Beispiel #1
0
 public void MoveNext()
 {
     if (Current.Parent == null)
     {
         Current = Current.ChildA;
     }
     else if (Current.Parent.ChildA == Current)
     {
         Current = Current.Parent.ChildB;
     }
     else
     {
         int levelsUp = 1;
         Current = Current.Parent;
         while (Current.Parent != null && Current == Current.Parent.ChildB)
         {
             Current = Current.Parent;
             levelsUp++;
         }
         if (Current.Parent != null)
         {
             Current = Current.Parent.ChildB;
         }
         else
         {
             levelsUp++;
         }
         for (int i = 0; i < levelsUp; i++)
         {
             Current = Current.ChildA;
         }
     }
 }
Beispiel #2
0
 public IntensityValue(IntensityValue parent, int value, int level)
 {
     if (level > 7)
     {
         throw new Exception("There are no more colours left");
     }
     Value  = value;
     Parent = parent;
     Level  = level;
 }
Beispiel #3
0
 public IntensityValueWalker()
 {
     Current = new IntensityValue(null, 1 << 7, 1);
 }