Esempio n. 1
0
        /// <summary>
        /// Sets the array for specified index.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="arrayValue">The array value.</param>
        internal void SetArray(MemoryIndex index, AssociativeArray arrayValue)
        {
            lockedTest();

            IndexData data;

            if (!IndexData.TryGetValue(index, out data))
            {
                data = new IndexData(null, null, null);
            }

            IndexDataBuilder builder = data.Builder();

            builder.Array = arrayValue;

            IndexData[index] = builder.Build();

            ArrayDescriptor descriptor;

            if (TryGetDescriptor(arrayValue, out descriptor))
            {
                if (descriptor.ParentVariable != null)
                {
                    Arrays[descriptor.ParentVariable.CallLevel].Remove(arrayValue);
                }
            }
            Arrays[index.CallLevel].Add(arrayValue);
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the data of specified index.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <returns>Data of specified index.</returns>
        /// <exception cref="System.Exception">Missing alias value for given index</exception>
        internal IndexData GetIndexData(MemoryIndex index)
        {
            IndexData data;

            if (IndexData.TryGetValue(index, out data))
            {
                return(data);
            }
            throw new Exception("Missing alias value for " + index);
        }
Esempio n. 3
0
        /// <summary>
        /// Determines whether the specified index has array.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <returns>True whether the specified index has array.</returns>
        internal bool HasArray(MemoryIndex index)
        {
            IndexData data;

            if (IndexData.TryGetValue(index, out data))
            {
                return(data.Array != null);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Gets the aliases for specified index.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <returns>Aliases for the specified index.</returns>
        /// <exception cref="System.Exception">Missing alias value for  + index</exception>
        internal MemoryAlias GetAliases(MemoryIndex index)
        {
            IndexData data;

            if (IndexData.TryGetValue(index, out data))
            {
                if (data.Aliases != null)
                {
                    return(data.Aliases);
                }
            }
            throw new Exception("Missing alias value for " + index);
        }
Esempio n. 5
0
        /// <summary>
        /// Gets the array descriptor which contains information about defined indexes in the specified array.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <returns>Array descriptor which contains information about defined indexes in the specified array.</returns>
        /// <exception cref="System.Exception">Missing array for index  + index</exception>
        internal AssociativeArray GetArray(MemoryIndex index)
        {
            IndexData data;

            if (IndexData.TryGetValue(index, out data))
            {
                if (data.Array != null)
                {
                    return(data.Array);
                }
            }

            throw new Exception("Missing array for index " + index);
        }
Esempio n. 6
0
        /// <summary>
        /// Gets the objects for given index.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <returns>Collection of objects for given index.</returns>
        public ObjectValueContainer GetObjects(MemoryIndex index)
        {
            IndexData data;

            if (IndexData.TryGetValue(index, out data))
            {
                if (data.Objects != null)
                {
                    return(data.Objects);
                }
            }

            return(new ObjectValueContainer());
        }
Esempio n. 7
0
        /// <summary>
        /// Sets the memory entry to actual index data collection.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="memoryEntry">The memory entry.</param>
        internal void SetMemoryEntry(MemoryIndex index, MemoryEntry memoryEntry)
        {
            IndexData data;

            if (IndexData.TryGetValue(index, out data))
            {
                Data.SetMemoryEntry(index, memoryEntry);
            }
            else if (!Locked)
            {
                IndexData[index] = new IndexData(null, null, null);
                Data.SetMemoryEntry(index, memoryEntry);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Tries to get array for specified index.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="arrayValue">The array value.</param>
        /// <returns>True whether the specified index has array.</returns>
        internal bool TryGetArray(MemoryIndex index, out AssociativeArray arrayValue)
        {
            IndexData data;

            if (IndexData.TryGetValue(index, out data))
            {
                arrayValue = data.Array;
                return(data.Array != null);
            }
            else
            {
                arrayValue = null;
                return(false);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Tries the get aliases for specified index.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="aliases">The aliases.</param>
        /// <returns>True whether specified index has aliases.</returns>
        internal bool TryGetAliases(MemoryIndex index, out MemoryAlias aliases)
        {
            IndexData data;

            if (IndexData.TryGetValue(index, out data))
            {
                aliases = data.Aliases;
                return(data.Aliases != null);
            }
            else
            {
                aliases = null;
                return(false);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Sets objects for given index.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="objects">The objects.</param>
        internal void SetObjects(MemoryIndex index, ObjectValueContainer objects)
        {
            lockedTest();

            IndexData data;

            if (!IndexData.TryGetValue(index, out data))
            {
                data = new IndexData(null, null, null);
            }

            IndexDataBuilder builder = data.Builder();

            builder.Objects = objects;

            IndexData[index] = builder.Build();
        }
Esempio n. 11
0
        /// <summary>
        /// Removes the alias from specified index.
        /// </summary>
        /// <param name="index">The index.</param>
        internal void RemoveAlias(MemoryIndex index)
        {
            lockedTest();

            IndexData data;

            if (!IndexData.TryGetValue(index, out data))
            {
                data = new IndexData(null, null, null);
            }

            IndexDataBuilder builder = data.Builder();

            builder.Aliases = null;

            IndexData[index] = builder.Build();
        }
Esempio n. 12
0
        /// <summary>
        /// Removes the array from specified index.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="arrayValue">The array value.</param>
        internal void RemoveArray(MemoryIndex index, AssociativeArray arrayValue)
        {
            lockedTest();

            ArrayDescriptors.Remove(arrayValue);

            IndexData data;

            if (!IndexData.TryGetValue(index, out data))
            {
                data = new IndexData(null, null, null);
            }

            IndexDataBuilder builder = data.Builder();

            builder.Array = null;

            IndexData[index] = builder.Build();
            Arrays[index.CallLevel].Remove(arrayValue);
        }
Esempio n. 13
0
 /// <summary>
 /// Tries to get data of given index.
 /// </summary>
 /// <param name="index">The index.</param>
 /// <param name="data">The data.</param>
 /// <returns><c>true</c> if the data are same; otherwise, <c>false</c>.</returns>
 internal bool TryGetIndexData(MemoryIndex index, out IndexData data)
 {
     return(IndexData.TryGetValue(index, out data));
 }