Ejemplo n.º 1
0
        internal IntervalIntSet(IntSetType setType, Int first, Int last)
            : this(setType)
        {
            Add(new IntInterval(first, last));

            UpdateHashAndBounds();
        }
Ejemplo n.º 2
0
        internal IntervalIntSet(IntSetType setType, IEnumerable <Int> enumerated) : this(setType)
        {
            foreach (var item in enumerated)
            {
                Add(item);
            }

            UpdateHashAndBounds();
        }
Ejemplo n.º 3
0
        internal IntervalIntSet(IntSetType setType, IEnumerable<Int> enumerated)
            : this(setType)
        {
            foreach (var item in enumerated)
            {
                Add(item);
            }

            UpdateHashAndBounds();
        }
Ejemplo n.º 4
0
        public static TokenProducerInfo Combine(IntSetType tokenSetType, IEnumerable<TokenProducerInfo> items)
        {
            switch (items.Count())
            {
                case 0: return
                        new TokenProducerInfo
                        {
                            Disambiguation = Disambiguation.Exclusive,
                            RealActions = SparseIntSetType.Instance.Empty,
                            PossibleTokens = tokenSetType.Empty,
                            MainTokenId = -1,
                        };
                case 1: return items.First();
            }

            TokenProducerInfo result = null;

            foreach (var item in items)
            {
                if (item.Disambiguation == Disambiguation.Exclusive)
                {
                    if (result == null)
                    {
                        result = item;
                    }
                }
            }

            if (result == null)
            {
                result = new TokenProducerInfo { Disambiguation = Disambiguation.Exclusive };
                int mainToken = PredefinedTokens.NoToken;
                var allPossible = tokenSetType.Mutable();
                var allActions = SparseIntSetType.Instance.Mutable();

                foreach (var item in items)
                {
                    if (mainToken != PredefinedTokens.NoToken && item.MainTokenId != PredefinedTokens.NoToken)
                    {
                        mainToken = item.MainTokenId;
                    }

                    allPossible.AddAll(item.PossibleTokens);
                    allActions.AddAll(item.RealActions);
                }

                result.MainTokenId = mainToken;
                result.RealActions = allActions.CompleteAndDestroy();
                result.PossibleTokens = allPossible.CompleteAndDestroy();
            }

            return result;
        }
Ejemplo n.º 5
0
 internal BitSetBase(IntSetType setType, int bitCount, bool defaultBit)
     : base(setType)
 {
     words = new uint[(bitCount - 1) / BitsInWord + 1];
     if (defaultBit)
     {
         int len = words.Length;
         for (int i = 0; i != len; ++i)
         {
             words[i] = ~0u;
         }
     }
 }
Ejemplo n.º 6
0
        internal IntervalIntSet(IntSetType setType, IEnumerable <IntInterval> intervals) : this(setType)
        {
            if (intervals == null)
            {
                throw new ArgumentNullException("intervals");
            }

            foreach (var interval in intervals)
            {
                Add(interval);
            }

            UpdateHashAndBounds();
        }
Ejemplo n.º 7
0
        internal IntervalIntSet(IntSetType setType, IEnumerable<IntInterval> intervals)
            : this(setType)
        {
            if (intervals == null)
            {
                throw new ArgumentNullException("intervals");
            }

            foreach (var interval in intervals)
            {
                Add(interval);
            }

            UpdateHashAndBounds();
        }
 public ScanAmbiguityResolver(IntSetType tokenSetType, int actionCount)
 {
     this.actionToTokenProducer = new TokenProducerInfo[actionCount];
     this.stateToTokenProducer = new Dictionary<object, TokenProducerInfo>();
     this.tokenSetType = tokenSetType;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Create empty set
 /// </summary>
 /// <param name="setType"></param>
 internal IntervalIntSet(IntSetType setType)
     : base(setType)
 {
 }
 public MutableIntervalIntSet(IntSetType setType)
     : base(setType)
 {
 }
Ejemplo n.º 11
0
        internal IntervalIntSet(IntSetType setType, Int first, Int last) : this(setType)
        {
            Add(new IntInterval(first, last));

            UpdateHashAndBounds();
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Create empty set
 /// </summary>
 /// <param name="setType"></param>
 internal IntervalIntSet(IntSetType setType) : base(setType)
 {
 }
Ejemplo n.º 13
0
 protected MutableIntSet(IntSetType setType)
     : base(setType)
 {
 }
Ejemplo n.º 14
0
 protected IntSet(IntSetType setType)
 {
     this.setType = setType;
 }
Ejemplo n.º 15
0
 public MutableIntervalIntSet(IntSetType setType) : base(setType)
 {
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Unsafe constructor for constructing from the ready intervals list
 /// </summary>
 /// <param name="setType"></param>
 /// <param name="intervals">sorted intervals list or <c>null</c></param>
 protected IntervalIntSetBase(IntSetType setType)
     : base(setType)
 {
     this.intervals = new List <IntInterval>();
     UpdateHashAndBounds();
 }
Ejemplo n.º 17
0
 internal BitSetBase(IntSetType setType, uint[] words)
     : base(setType)
 {
     this.words = words;
 }
Ejemplo n.º 18
0
 protected MutableIntSet(IntSetType setType) : base(setType)
 {
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Unsafe constructor for constructing from the ready intervals list
 /// </summary>
 /// <param name="setType"></param>
 /// <param name="intervals">sorted intervals list or <c>null</c></param>
 protected IntervalIntSetBase(IntSetType setType)
     : base(setType)
 {
     this.intervals = new List<IntInterval>();
     UpdateHashAndBounds();
 }