Exemple #1
0
 public override IEnumerator <VHDLEnumValue <T> > GetEnumerator()
 {
     foreach (T i in EnumBaseType <T> .GetBaseValuesInRange(left.TypedValue, right.TypedValue, direction))
     {
         yield return(new VHDLEnumValue <T>(i));
     }
 }
Exemple #2
0
        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            ReadOnlyCollection <T> enumValues = EnumBaseType <T> .GetBaseValues();

            int leftIndex  = enumValues.IndexOf(left);
            int rightIndex = enumValues.IndexOf(right);

            if (direction == RangeDirection.To)
            {
                int iterator = leftIndex;
                do
                {
                    yield return(enumValues[iterator]);

                    iterator++;
                    if (iterator >= enumValues.Count)
                    {
                        iterator = 0;
                    }
                }while (iterator != rightIndex);
                yield return(enumValues[rightIndex]);
            }
            else
            {
                int iterator = rightIndex;
                do
                {
                    yield return(enumValues[iterator]);

                    iterator--;
                    if (iterator < 0)
                    {
                        iterator = enumValues.Count - 1;
                    }
                }while (iterator != leftIndex);
                yield return(enumValues[leftIndex]);
            }
        }
Exemple #3
0
 public override VHDLEnumValue <T> RIGHTOF(VHDLEnumValue <T> X)
 {
     return(new VHDLEnumValue <T>(EnumBaseType <T> .SUCC(X.TypedValue)));
 }
Exemple #4
0
 public override VHDLEnumValue <T> LEFTOF(VHDLEnumValue <T> X)
 {
     return(new VHDLEnumValue <T>(EnumBaseType <T> .PRED(X.TypedValue)));
 }
Exemple #5
0
 public override VHDLIntegerValue POS(VHDLEnumValue <T> X)
 {
     return(new VHDLIntegerValue(EnumBaseType <T> .IndexOf(X.TypedValue)));
 }
Exemple #6
0
 public EnumRange()
     : base(new VHDLEnumValue <T>(EnumBaseType <T> .GetFirstValue()), new VHDLEnumValue <T>(EnumBaseType <T> .GetLastValue()), RangeDirection.To)
 {
 }