Example #1
0
 public bool TryGetInstance(string instancePath, out ISymbol symbol)
 {
     symbol = null;
     if (instancePath.StartsWith(this._arrayInstance.InstancePath, StringComparison.OrdinalIgnoreCase))
     {
         SymbolParser.ArrayIndexType type;
         IList <int[]> jaggedIndices = null;
         if (SymbolParser.TryParseIndices(instancePath.Substring(this._arrayInstance.InstancePath.Length), out jaggedIndices, out type))
         {
             if (this.IsOversampled && ArrayIndexConverter.IsOversamplingIndex(jaggedIndices[0], this._arrayType))
             {
                 symbol = ((ISymbolFactoryOversampled)this._symbolFactory).CreateOversamplingElement(this._arrayInstance);
             }
             else
             {
                 ISymbol    parent    = this._arrayInstance;
                 IArrayType arrayType = this._arrayType;
                 for (int i = 0; i < jaggedIndices.Count; i++)
                 {
                     symbol    = this._symbolFactory.CreateArrayElement(jaggedIndices[i], parent, arrayType);
                     parent    = symbol;
                     arrayType = symbol.DataType as IArrayType;
                 }
             }
             return(true);
         }
     }
     return(false);
 }
Example #2
0
        public int IndexOf(ISymbol item)
        {
            string instancePath = item.InstancePath;

            if (instancePath.StartsWith(this._arrayInstance.InstancePath, StringComparison.OrdinalIgnoreCase))
            {
                SymbolParser.ArrayIndexType type;
                IList <int[]> jaggedIndices = null;
                if (SymbolParser.TryParseIndices(instancePath.Substring(this._arrayInstance.InstancePath.Length), out jaggedIndices, out type))
                {
                    return(ArrayIndexConverter.IndicesToSubIndex(jaggedIndices[0], this._arrayType));
                }
            }
            throw new ArgumentOutOfRangeException("item");
        }
Example #3
0
 public ISymbol this[int index]
 {
     get
     {
         if (this.IsOversampled && ArrayIndexConverter.IsOversamplingElement(index, this._arrayType.Dimensions.LowerBounds, this._arrayType.Dimensions.UpperBounds))
         {
             return(((ISymbolFactoryOversampled)this._symbolFactory).CreateOversamplingElement(this._arrayInstance));
         }
         int[] currentIndex = ArrayIndexConverter.SubIndexToIndices(index, this._arrayType);
         return(this._symbolFactory.CreateArrayElement(currentIndex, this._arrayInstance, this._arrayType));
     }
     set
     {
         throw new NotImplementedException();
     }
 }
Example #4
0
        public bool ContainsName(string instanceNameWithIndices)
        {
            string str;

            SymbolParser.ArrayIndexType type;
            IList <int[]> list;
            string        indicesStr = null;

            return(SymbolParser.TryParseArrayElement(instanceNameWithIndices, out str, out indicesStr, out list, out type) && ((StringComparer.OrdinalIgnoreCase.Compare(str, this._arrayInstance.InstanceName) == 0) && ArrayIndexConverter.TryCheckIndices(list, this._arrayType)));
        }
Example #5
0
        public bool Contains(string instancePath)
        {
            SymbolParser.ArrayIndexType type;
            if (!instancePath.StartsWith(this._arrayInstance.InstancePath, StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }
            IList <int[]> jaggedIndices = null;

            return(SymbolParser.TryParseIndices(instancePath.Substring(this._arrayInstance.InstancePath.Length), out jaggedIndices, out type) && ArrayIndexConverter.TryCheckIndices(jaggedIndices, this._arrayType));
        }