public override IEnumerator <VHDLEnumValue <T> > GetEnumerator() { foreach (T i in EnumBaseType <T> .GetBaseValuesInRange(left.TypedValue, right.TypedValue, direction)) { yield return(new VHDLEnumValue <T>(i)); } }
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]); } }
public override VHDLEnumValue <T> RIGHTOF(VHDLEnumValue <T> X) { return(new VHDLEnumValue <T>(EnumBaseType <T> .SUCC(X.TypedValue))); }
public override VHDLEnumValue <T> LEFTOF(VHDLEnumValue <T> X) { return(new VHDLEnumValue <T>(EnumBaseType <T> .PRED(X.TypedValue))); }
public override VHDLIntegerValue POS(VHDLEnumValue <T> X) { return(new VHDLIntegerValue(EnumBaseType <T> .IndexOf(X.TypedValue))); }
public EnumRange() : base(new VHDLEnumValue <T>(EnumBaseType <T> .GetFirstValue()), new VHDLEnumValue <T>(EnumBaseType <T> .GetLastValue()), RangeDirection.To) { }