Пример #1
0
        public CrunchedWord3Grid Crunch(Word3Grid input)
        {
            SortedTable <Word3> .Index r1 = this.table.Find(input.Row1);
            SortedTable <Word3> .Index r2 = this.table.Find(input.Row2);
            SortedTable <Word3> .Index r3 = this.table.Find(input.Row3);
            SortedTable <Word3> .Index c1 = this.table.Find(input.Column1);
            SortedTable <Word3> .Index c2 = this.table.Find(input.Column2);
            SortedTable <Word3> .Index c3 = this.table.Find(input.Column3);

            CrunchedWord3Grid crunchedGrid;
            int c = r1.CompareTo(c1);

            if (c == 0)
            {
                c = r2.CompareTo(c2);
            }

            if (c > 0)
            {
                crunchedGrid = new CrunchedWord3Grid(c1, c2, c3, r1, r2, r3);
            }
            else
            {
                crunchedGrid = new CrunchedWord3Grid(r1, r2, r3, c1, c2, c3);
            }

            return(crunchedGrid);
        }
Пример #2
0
 private void DoColumn2(Word3 column2, Word3Grid grid, Action <Word3Grid> onFound)
 {
     if (this.allowDuplicateWords || (!grid.Row1.Equals(column2) && !grid.Column1.Equals(column2) && !grid.Row2.Equals(column2)))
     {
         grid = new Word3Grid(grid.Row1, grid.Row2, new Word3(grid.A20, column2.L3, '\0'));
         this.trie.Match2(grid.A20, grid.A21, w => this.DoRow3(w, grid, onFound));
     }
 }
Пример #3
0
 private void DoColumn1(Word3 column1, Word3Grid grid, Action <Word3Grid> onFound)
 {
     if (this.allowDuplicateWords || !grid.Row1.Equals(column1))
     {
         grid = new Word3Grid(grid.Row1, new Word3(column1.L2, '\0', '\0'), new Word3(column1.L3, '\0', '\0'));
         this.trie.Match1(grid.A10, w => this.DoRow2(w, grid, onFound));
     }
 }
Пример #4
0
 private void DoRow3(Word3 row3, Word3Grid grid, Action <Word3Grid> onFound)
 {
     grid = new Word3Grid(grid.Row1, grid.Row2, row3);
     if (this.allowDuplicateWords || (!grid.Row1.Equals(row3) && !grid.Column1.Equals(row3) && !grid.Row2.Equals(row3) && !grid.Column2.Equals(row3) && !grid.Column3.Equals(row3)))
     {
         if (this.trie.Contains(grid.Column3))
         {
             onFound(grid);
         }
     }
 }
Пример #5
0
        public void Find(Word3 input, Action <Word3Grid> onFound)
        {
            Word3Grid grid = new Word3Grid(input, new Word3(), new Word3());

            this.trie.Match1(grid.A00, w => this.DoColumn1(w, grid, onFound));
        }