private void DoColumn1(Word2 column1, Word2Grid grid, Action <Word2Grid> onFound) { if (this.allowDuplicateWords || !grid.Row1.Equals(column1)) { grid = new Word2Grid(grid.Row1, new Word2(column1.L2, '\0')); this.trie.Match1(grid.A10, w => this.DoRow2(w, grid, onFound)); } }
private void DoRow2(Word2 row2, Word2Grid grid, Action <Word2Grid> onFound) { grid = new Word2Grid(grid.Row1, row2); if (this.allowDuplicateWords || (!grid.Row1.Equals(row2) && !grid.Column1.Equals(row2) && !grid.Column2.Equals(grid.Row1))) { if (this.trie.Contains(grid.Column2)) { onFound(grid); } } }
public CrunchedWord2Grid Crunch(Word2Grid input) { SortedTable <Word2> .Index r1 = this.table.Find(input.Row1); SortedTable <Word2> .Index r2 = this.table.Find(input.Row2); SortedTable <Word2> .Index c1 = this.table.Find(input.Column1); SortedTable <Word2> .Index c2 = this.table.Find(input.Column2); CrunchedWord2Grid crunchedGrid; int c = r1.CompareTo(c1); if (c > 0) { crunchedGrid = new CrunchedWord2Grid(c1, c2, r1, r2); } else { crunchedGrid = new CrunchedWord2Grid(r1, r2, c1, c2); } return(crunchedGrid); }
public void Find(Word2 input, Action <Word2Grid> onFound) { Word2Grid grid = new Word2Grid(input, new Word2()); this.trie.Match1(grid.A00, w => this.DoColumn1(w, grid, onFound)); }