Antlr4.Runtime.Misc.Interval.Of C# (CSharp) Метод

Of() публичный статический Метод

Interval objects are used readonly so share all with the same single value a==b up to some max size.
Interval objects are used readonly so share all with the same single value a==b up to some max size. Use an array as a perfect hash. Return shared object for 0..INTERVAL_POOL_MAX_VALUE or a new Interval object with a..a in it. On Java.g4, 218623 IntervalSets have a..a (set with 1 element).
public static Of ( int a, int b ) : Antlr4.Runtime.Misc.Interval
a int
b int
Результат Antlr4.Runtime.Misc.Interval
        public static Antlr4.Runtime.Misc.Interval Of(int a, int b)
        {
            return new Antlr4.Runtime.Misc.Interval(a, b);
        }

Usage Example

Пример #1
0
        public virtual void Remove(int el)
        {
            if (@readonly)
            {
                throw new InvalidOperationException("can't alter readonly IntervalSet");
            }
            int n = intervals.Count;

            for (int i = 0; i < n; i++)
            {
                Interval I = intervals[i];
                int      a = I.a;
                int      b = I.b;
                if (el < a)
                {
                    break;
                }
                // list is sorted and el is before this interval; not here
                // if whole interval x..x, rm
                if (el == a && el == b)
                {
                    intervals.RemoveAt(i);
                    break;
                }
                // if on left edge x..b, adjust left
                if (el == a)
                {
                    intervals[i] = Interval.Of(I.a + 1, I.b);
                    break;
                }
                // if on right edge a..x, adjust right
                if (el == b)
                {
                    intervals[i] = Interval.Of(I.a, I.b - 1);
                    break;
                }
                // if in middle a..x..b, split interval
                if (el > a && el < b)
                {
                    // found in this interval
                    int oldb = I.b;
                    intervals[i] = Interval.Of(I.a, el - 1);
                    // [a..x-1]
                    Add(el + 1, oldb);
                }
            }
        }
All Usage Examples Of Antlr4.Runtime.Misc.Interval::Of