Beispiel #1
0
 internal ReverseEnumerator(OrderedHashSet <T> set, int startIndex)
 {
     m_set     = set;
     m_index   = startIndex;
     m_version = set.m_version;
     m_current = default(T);
 }
Beispiel #2
0
        internal ICollection <DominoTileEntity> Create(short engineValue)
        {
            var    tiles            = new OrderedHashSet <DominoTileEntity>();
            ushort secondValueStart = 0;

            for (ushort firstIndex = 0; firstIndex <= 12; firstIndex++)
            {
                for (ushort secondIndex = secondValueStart; secondIndex <= 12; secondIndex++)
                {
                    tiles.Add(new DominoTileEntity(firstIndex, secondIndex, firstIndex == secondIndex && firstIndex == engineValue));
                }
                secondValueStart++;
            }

            Random randomizer      = new Random();
            var    randomizedTiles = new DominoTileEntity[tiles.Count()];

            tiles.CopyTo(randomizedTiles);
            var n = randomizedTiles.Count();

            while (n > 1)
            {
                n--;
                var k     = randomizer.Next(n + 1);
                var value = randomizedTiles[k];
                randomizedTiles[k] = randomizedTiles[n];
                randomizedTiles[n] = value;
            }
            return(new OrderedHashSet <DominoTileEntity>(randomizedTiles));
        }
Beispiel #3
0
 internal ReverseEnumerator(OrderedHashSet <T> set)
     : this(set, set.m_lastOrderIndex)
 {
 }
Beispiel #4
0
 internal Enumerator(OrderedHashSet <T> set)
     : this(set, set.m_firstOrderIndex)
 {
 }
Beispiel #5
0
 public ReverseRange(OrderedHashSet <T> set, T startingItem)
 {
     m_set          = set;
     m_startingItem = startingItem;
 }
Beispiel #6
0
 public ReverseReader(OrderedHashSet <T> set)
 {
     this.m_set = set;
 }