public override bool CompareForEquality(Values.IValue left, Values.IValue right)  // left == right
        {
            bool retVal = base.CompareForEquality(left, right);

            if (!retVal)
            {
                if (left.Type == right.Type)
                {
                    Values.StructureValue leftValue  = left as Values.StructureValue;
                    Values.StructureValue rightValue = right as Values.StructureValue;

                    if (left != null && right != null)
                    {
                        retVal = true;

                        foreach (KeyValuePair <string, Variables.IVariable> pair in leftValue.SubVariables)
                        {
                            Variables.IVariable leftVar  = pair.Value;
                            Variables.IVariable rightVar = rightValue.getVariable(pair.Key);

                            if (leftVar.Type != null)
                            {
                                retVal = leftVar.Type.CompareForEquality(leftVar.Value, rightVar.Value);
                                if (!retVal)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            return(retVal);
        }
Esempio n. 2
0
        /// <summary>
        /// Appends the INamable which match the name provided in retVal
        /// </summary>
        /// <param name="name"></param>
        /// <param name="retVal"></param>
        public void Find(string name, List <Utils.INamable> retVal)
        {
            if (!BuildingDeclaredElements)
            {
                try
                {
                    BuildingDeclaredElements = true;

                    Values.StructureValue structureValue = Value as Values.StructureValue;
                    if (structureValue != null)
                    {
                        structureValue.Find(name, retVal);
                    }

                    // Dereference of an empty value holds the empty value
                    Values.EmptyValue emptyValue = Value as Values.EmptyValue;
                    if (emptyValue != null)
                    {
                        retVal.Add(emptyValue);
                    }
                }
                finally
                {
                    BuildingDeclaredElements = false;
                }
            }
        }
        /// <summary>
        /// Provides the value associated to this Expression
        /// </summary>
        /// <param name="instance">The instance on which the value is computed</param>
        /// <param name="localScope">The local scope used to compute the value of this expression</param>
        /// <param name="globalFind">Indicates that the search should be performed globally</param>
        /// <returns></returns>
        public override Values.IValue GetValue(InterpretationContext context)
        {
            Values.StructureValue retVal = null;

            Types.Structure structureType = Structure.GetExpressionType() as Types.Structure;
            if (structureType != null)
            {
                retVal = new Values.StructureValue(structureType, Root);

                foreach (KeyValuePair <string, Expression> pair in Associations)
                {
                    Values.IValue      val = pair.Value.GetValue(new InterpretationContext(context));
                    Variables.Variable var = (Variables.Variable)Generated.acceptor.getFactory().createVariable();
                    var.Name      = pair.Key;
                    var.Value     = val;
                    var.Enclosing = retVal;
                    retVal.set(var);
                }
            }
            else
            {
                AddError("Cannot determine structure type for " + ToString());
            }

            return(retVal);
        }
Esempio n. 4
0
        /// <summary>
        /// Coputes targets from the function and adds them to the collection
        /// </summary>
        /// <param name="function">Function containing targets</param>
        /// <param name="collection">Collection to be filled with targets</param>
        private void ComputeTargets(Function function, Values.ListValue collection)
        {
            if (function != null)
            {
                Graph graph = function.Graph;
                if (graph != null && graph.Segments.Count > 1)
                {
                    double prevSpeed = Double.MaxValue;
                    for (int i = 1; i < graph.Segments.Count; i++)
                    {
                        Graph.Segment         s             = graph.Segments[i];
                        Types.Structure       structureType = (Types.Structure)EFSSystem.findType(OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0], "Kernel.SpeedAndDistanceMonitoring.TargetSupervision"), "Kernel.SpeedAndDistanceMonitoring.TargetSupervision.Target");
                        Values.StructureValue value         = new Values.StructureValue(structureType, structureType.NameSpace);

                        Variables.Variable speed = (Variables.Variable)DataDictionary.Generated.acceptor.getFactory().createVariable();
                        speed.Type      = EFSSystem.findType(OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0], "Default.BaseTypes"), "Default.BaseTypes.Speed");
                        speed.Name      = "Speed";
                        speed.Mode      = Generated.acceptor.VariableModeEnumType.aInternal;
                        speed.Default   = "0.0";
                        speed.Enclosing = value;
                        speed.Value     = new Values.DoubleValue(EFSSystem.DoubleType, s.Val(s.Start));
                        value.set(speed);

                        Variables.Variable location = (Variables.Variable)DataDictionary.Generated.acceptor.getFactory().createVariable();
                        location.Type      = EFSSystem.findType(OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0], "Default.BaseTypes"), "Default.BaseTypes.Distance");
                        location.Name      = "Location";
                        location.Mode      = Generated.acceptor.VariableModeEnumType.aInternal;
                        location.Default   = "0.0";
                        location.Enclosing = value;
                        location.Value     = new Values.DoubleValue(EFSSystem.DoubleType, s.Start);
                        value.set(location);

                        Variables.Variable length = (Variables.Variable)DataDictionary.Generated.acceptor.getFactory().createVariable();
                        length.Type      = EFSSystem.findType(OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0], "Default.BaseTypes"), "Default.BaseTypes.Length");
                        length.Name      = "Length";
                        length.Mode      = Generated.acceptor.VariableModeEnumType.aInternal;
                        length.Default   = "0.0";
                        length.Enclosing = value;
                        length.Value     = new Values.DoubleValue(EFSSystem.DoubleType, s.End);
                        value.set(length);

                        if (s.Val(s.Start) < prevSpeed)
                        {
                            collection.Val.Add(value);
                        }
                        prevSpeed = s.Val(s.Start);
                    }
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Finds the type of the structure corresponding to the provided NID_PACKET
        /// </summary>
        /// <param name="nameSpace">The namespace where the type has to be found</param>
        /// <param name="nidPacket">The id of the packet</param>
        /// <returns></returns>
        private Values.StructureValue FindStructure(int nidPacket)
        {
            Types.Structure structure = null;
            DataDictionary.Types.NameSpace nameSpace;

            if (nidPacket != 44)
            {
                nameSpace = OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0], "Messages.PACKET.TRACK_TO_TRAIN");
                foreach (DataDictionary.Types.NameSpace subNameSpace in nameSpace.SubNameSpaces)
                {
                    Types.Structure       structureType  = (Types.Structure)EFSSystem.findType(subNameSpace, subNameSpace.FullName + ".Message");
                    Values.StructureValue structureValue = new Values.StructureValue(structureType, nameSpace);

                    foreach (KeyValuePair <string, Variables.IVariable> pair in structureValue.SubVariables)
                    {
                        string variableName = pair.Key;
                        if (variableName.Equals("NID_PACKET"))
                        {
                            Values.IntValue value = pair.Value.Value as Values.IntValue;
                            if (value.Val == nidPacket)
                            {
                                structure = structureType;
                            }
                        }
                        if (structure != null)
                        {
                            break;
                        }
                    }
                }
            }
            else
            {
                nameSpace = OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0], "Messages.PACKET.DATA_USED_BY_APPLICATIONS_OUTSIDE_THE_ERTMS_ETCS_SYSTEM");
                structure = (Types.Structure)EFSSystem.findType(nameSpace, nameSpace.FullName + ".Message");
            }

            Values.StructureValue retVal = null;
            if (structure != null)
            {
                retVal = new Values.StructureValue(structure, nameSpace);
            }

            return(retVal);
        }
Esempio n. 6
0
        /// <summary>
        /// Fills the given structure with the values provided from the database
        /// </summary>
        /// <param name="aNameSpace">Namespace of the structure</param>
        /// <param name="fields">Fields to be copied into the structure</param>
        /// <param name="index">Index (of fields list) from which we have to start copying</param>
        /// <param name="aStructure">The structure to be filled</param>
        private void FillStructure(Types.NameSpace aNameSpace, ArrayList fields, ref int index, Values.StructureValue aStructure)
        {
            int j = 0;

            for (int i = index; i < fields.Count; i++)
            {
                Tests.DBElements.DBField field = fields[i] as Tests.DBElements.DBField;

                KeyValuePair <string, Variables.IVariable> pair = aStructure.SubVariables.ElementAt(j);
                Variables.IVariable variable = pair.Value;

                if (variable.Name.StartsWith(field.Variable))  // we use StartsWith and not Equals because we can have N_ITER_1 and N_ITER
                {
                    if (variable.Type is Types.Enum)
                    {
                        Types.Enum type = variable.Type as Types.Enum;
                        foreach (DataDictionary.Constants.EnumValue enumValue in type.Values)
                        {
                            int value = Int32.Parse(enumValue.getValue());
                            if (value == field.Value)
                            {
                                variable.Value = enumValue;
                                j++;
                                break;
                            }
                        }
                    }
                    else if (variable.Type is Types.Range)
                    {
                        Types.Range type = variable.Type as Types.Range;
                        variable.Value = new Values.IntValue(type, (decimal)field.Value);
                        j++;
                    }
                    else
                    {
                        throw new Exception("Unhandled variable type");
                    }
                    if (field.Variable.Equals("N_ITER")) // we have to create a sequence
                    {
                        KeyValuePair <string, Variables.IVariable> sequencePair = aStructure.SubVariables.ElementAt(j);
                        Variables.IVariable sequenceVariable = sequencePair.Value;
                        Types.Collection    collectionType   = (Types.Collection)EFSSystem.findType(aNameSpace, sequenceVariable.TypeName);
                        Values.ListValue    sequence         = new Values.ListValue(collectionType, new List <Values.IValue>());

                        for (int k = 0; k < field.Value; k++)
                        {
                            Types.Structure       structureType  = (Types.Structure)EFSSystem.findType(aNameSpace, sequence.CollectionType.Type.FullName);
                            Values.StructureValue structureValue = new Values.StructureValue(structureType, structureType.NameSpace);
                            FillStructure(aNameSpace, fields, ref index, structureValue);
                            sequence.Val.Add(structureValue);
                        }
                        sequenceVariable.Value = sequence;
                        j++;
                    }
                }

                // if all the fields of the structue are filled, we terminated
                if (j == aStructure.SubVariables.Count)
                {
                    index = i;
                    break;
                }
            }
        }
Esempio n. 7
0
        private string format_eurobalise_message(DBElements.DBMessage message)
        {
            DataDictionary.Types.NameSpace nameSpace = OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0], "Messages");
            Types.Structure       structureType      = (Types.Structure)EFSSystem.findType(nameSpace, "Messages.EUROBALISE.Message");
            Values.StructureValue structure          = new Values.StructureValue(structureType, nameSpace);

            int index = 0;

            FillStructure(nameSpace, message.Fields, ref index, structure); // fills the message fields


            // then we fill the packets
            KeyValuePair <string, Variables.IVariable> subSequencePair = structure.SubVariables.ElementAt(structure.SubVariables.Count - 1);

            Variables.IVariable subSequenceVariable = subSequencePair.Value;

            Types.Collection collectionType = (Types.Collection)EFSSystem.findType(nameSpace, "Messages.EUROBALISE.Collection1");
            Values.ListValue collection     = new Values.ListValue(collectionType, new List <Values.IValue>());

            Types.Structure       subStructure1Type = (Types.Structure)EFSSystem.findType(nameSpace, "Messages.EUROBALISE.SubStructure1");
            Values.StructureValue subStructure1     = new Values.StructureValue(subStructure1Type, nameSpace);

            Types.Structure       packetStructure = (Types.Structure)EFSSystem.findType(nameSpace, "Messages.PACKET.TRACK_TO_TRAIN.Message");
            Values.StructureValue packetValue     = new Values.StructureValue(packetStructure, nameSpace);

            // will contain the list of all packets of the message and then be added to the structure packetValue
            ArrayList subStructures = new ArrayList();

            foreach (DBElements.DBPacket packet in message.Packets)
            {
                Tests.DBElements.DBField nidPacketField = packet.Fields[0] as Tests.DBElements.DBField;

                if (nidPacketField.Value != 255)  // 255 means "end of information"
                {
                    Values.StructureValue subStructure = FindStructure(nidPacketField.Value);

                    index = 0;
                    FillStructure(nameSpace, packet.Fields, ref index, subStructure);

                    subStructures.Add(subStructure);
                }
            }

            // the collection of the message packets is copied to the structure packetValue
            int i = 0;

            foreach (KeyValuePair <string, Variables.IVariable> pair in packetValue.SubVariables)
            {
                if (i == subStructures.Count)
                {
                    break;
                }
                string variableName = pair.Key;
                Values.StructureValue structureValue = subStructures[i] as Values.StructureValue;
                if (structureValue.Structure.FullName.Contains(variableName))
                {
                    Variables.IVariable variable = pair.Value;
                    variable.Value = structureValue;
                    i++;
                }
            }

            subStructure1.SubVariables.ElementAt(0).Value.Value = packetValue;
            collection.Val.Add(subStructure1);
            subSequenceVariable.Value = collection;

            return(structure.Name);
        }
        /// <summary>
        /// Coputes targets from the function and adds them to the collection
        /// </summary>
        /// <param name="function">Function containing targets</param>
        /// <param name="collection">Collection to be filled with targets</param>
        private void ComputeTargets(Function function, Values.ListValue collection)
        {
            if (function != null)
            {
                Graph graph = function.Graph;
                if (graph != null && graph.Segments.Count > 1)
                {
                    double prevSpeed = Double.MaxValue;
                    for (int i = 1; i < graph.Segments.Count; i++)
                    {
                        Graph.Segment s = graph.Segments[i];
                        Types.Structure structureType = (Types.Structure)EFSSystem.findType(OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0], "Kernel.SpeedAndDistanceMonitoring.TargetSupervision"), "Kernel.SpeedAndDistanceMonitoring.TargetSupervision.Target");
                        Values.StructureValue value = new Values.StructureValue(structureType, structureType.NameSpace);

                        Variables.Variable speed = (Variables.Variable)DataDictionary.Generated.acceptor.getFactory().createVariable();
                        speed.Type = EFSSystem.findType(OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0], "Default.BaseTypes"), "Default.BaseTypes.Speed");
                        speed.Name = "Speed";
                        speed.Mode = Generated.acceptor.VariableModeEnumType.aInternal;
                        speed.Default = "0.0";
                        speed.Enclosing = value;
                        speed.Value = new Values.DoubleValue(EFSSystem.DoubleType, s.Val(s.Start));
                        value.set(speed);

                        Variables.Variable location = (Variables.Variable)DataDictionary.Generated.acceptor.getFactory().createVariable();
                        location.Type = EFSSystem.findType(OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0], "Default.BaseTypes"), "Default.BaseTypes.Distance");
                        location.Name = "Location";
                        location.Mode = Generated.acceptor.VariableModeEnumType.aInternal;
                        location.Default = "0.0";
                        location.Enclosing = value;
                        location.Value = new Values.DoubleValue(EFSSystem.DoubleType, s.Start);
                        value.set(location);

                        Variables.Variable length = (Variables.Variable)DataDictionary.Generated.acceptor.getFactory().createVariable();
                        length.Type = EFSSystem.findType(OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0], "Default.BaseTypes"), "Default.BaseTypes.Length");
                        length.Name = "Length";
                        length.Mode = Generated.acceptor.VariableModeEnumType.aInternal;
                        length.Default = "0.0";
                        length.Enclosing = value;
                        length.Value = new Values.DoubleValue(EFSSystem.DoubleType, s.End);
                        value.set(length);

                        if (s.Val(s.Start) < prevSpeed)
                        {
                            collection.Val.Add(value);
                        }
                        prevSpeed = s.Val(s.Start);
                    }
                }
            }
        }
        /// <summary>
        /// Provides the value associated to this Expression
        /// </summary>
        /// <param name="instance">The instance on which the value is computed</param>
        /// <param name="localScope">The local scope used to compute the value of this expression</param>
        /// <param name="globalFind">Indicates that the search should be performed globally</param>
        /// <returns></returns>
        public override Values.IValue GetValue(InterpretationContext context)
        {
            Values.StructureValue retVal = null;

            Types.Structure structureType = Structure.GetExpressionType() as Types.Structure;
            if (structureType != null)
            {
                retVal = new Values.StructureValue(structureType, Root);

                foreach (KeyValuePair<string, Expression> pair in Associations)
                {
                    Values.IValue val = pair.Value.GetValue(new InterpretationContext(context));
                    Variables.Variable var = (Variables.Variable)Generated.acceptor.getFactory().createVariable();
                    var.Name = pair.Key;
                    var.Value = val;
                    var.Enclosing = retVal;
                    retVal.set(var);
                }
            }
            else
            {
                AddError("Cannot determine structure type for " + ToString());
            }

            return retVal;
        }
        private string format_eurobalise_message(DBElements.DBMessage message)
        {
            DataDictionary.Types.NameSpace nameSpace = OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0], "Messages");
            Types.Structure structureType = (Types.Structure)EFSSystem.findType(nameSpace, "Messages.EUROBALISE.Message");
            Values.StructureValue structure = new Values.StructureValue(structureType, nameSpace);

            int index = 0;
            FillStructure(nameSpace, message.Fields, ref index, structure); // fills the message fields

            // then we fill the packets
            KeyValuePair<string, Variables.IVariable> subSequencePair = structure.SubVariables.ElementAt(structure.SubVariables.Count - 1);
            Variables.IVariable subSequenceVariable = subSequencePair.Value;

            Types.Collection collectionType = (Types.Collection)EFSSystem.findType(nameSpace, "Messages.EUROBALISE.Collection1");
            Values.ListValue collection = new Values.ListValue(collectionType, new List<Values.IValue>());

            Types.Structure subStructure1Type = (Types.Structure)EFSSystem.findType(nameSpace, "Messages.EUROBALISE.SubStructure1");
            Values.StructureValue subStructure1 = new Values.StructureValue(subStructure1Type, nameSpace);

            Types.Structure packetStructure = (Types.Structure)EFSSystem.findType(nameSpace, "Messages.PACKET.TRACK_TO_TRAIN.Message");
            Values.StructureValue packetValue = new Values.StructureValue(packetStructure, nameSpace);

            // will contain the list of all packets of the message and then be added to the structure packetValue
            ArrayList subStructures = new ArrayList();

            foreach (DBElements.DBPacket packet in message.Packets)
            {
                Tests.DBElements.DBField nidPacketField = packet.Fields[0] as Tests.DBElements.DBField;

                if (nidPacketField.Value != 255)  // 255 means "end of information"
                {
                    Values.StructureValue subStructure = FindStructure(nidPacketField.Value);

                    index = 0;
                    FillStructure(nameSpace, packet.Fields, ref index, subStructure);

                    subStructures.Add(subStructure);
                }
            }

            // the collection of the message packets is copied to the structure packetValue
            int i = 0;
            foreach (KeyValuePair<string, Variables.IVariable> pair in packetValue.SubVariables)
            {
                if (i == subStructures.Count)
                {
                    break;
                }
                string variableName = pair.Key;
                Values.StructureValue structureValue = subStructures[i] as Values.StructureValue;
                if (structureValue.Structure.FullName.Contains(variableName))
                {
                    Variables.IVariable variable = pair.Value;
                    variable.Value = structureValue;
                    i++;
                }
            }

            subStructure1.SubVariables.ElementAt(0).Value.Value = packetValue;
            collection.Val.Add(subStructure1);
            subSequenceVariable.Value = collection;

            return structure.Name;
        }
        /// <summary>
        /// Finds the type of the structure corresponding to the provided NID_PACKET
        /// </summary>
        /// <param name="nameSpace">The namespace where the type has to be found</param>
        /// <param name="nidPacket">The id of the packet</param>
        /// <returns></returns>
        private Values.StructureValue FindStructure(int nidPacket)
        {
            Types.Structure structure = null;
            DataDictionary.Types.NameSpace nameSpace;

            if (nidPacket != 44)
            {
                nameSpace = OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0], "Messages.PACKET.TRACK_TO_TRAIN");
                foreach (DataDictionary.Types.NameSpace subNameSpace in nameSpace.SubNameSpaces)
                {
                    Types.Structure structureType = (Types.Structure)EFSSystem.findType(subNameSpace, subNameSpace.FullName + ".Message");
                    Values.StructureValue structureValue = new Values.StructureValue(structureType, nameSpace);

                    foreach (KeyValuePair<string, Variables.IVariable> pair in structureValue.SubVariables)
                    {
                        string variableName = pair.Key;
                        if (variableName.Equals("NID_PACKET"))
                        {
                            Values.IntValue value = pair.Value.Value as Values.IntValue;
                            if (value.Val == nidPacket)
                            {
                                structure = structureType;
                            }
                        }
                        if (structure != null)
                        {
                            break;
                        }
                    }
                }
            }
            else
            {
                nameSpace = OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0], "Messages.PACKET.DATA_USED_BY_APPLICATIONS_OUTSIDE_THE_ERTMS_ETCS_SYSTEM");
                structure = (Types.Structure)EFSSystem.findType(nameSpace, nameSpace.FullName + ".Message");
            }

            Values.StructureValue retVal = null;
            if (structure != null)
            {
                retVal = new Values.StructureValue(structure, nameSpace);
            }

            return retVal;
        }
        /// <summary>
        /// Fills the given structure with the values provided from the database
        /// </summary>
        /// <param name="aNameSpace">Namespace of the structure</param>
        /// <param name="fields">Fields to be copied into the structure</param>
        /// <param name="index">Index (of fields list) from which we have to start copying</param>
        /// <param name="aStructure">The structure to be filled</param>
        private void FillStructure(Types.NameSpace aNameSpace, ArrayList fields, ref int index, Values.StructureValue aStructure)
        {
            int j = 0;
            for (int i = index; i < fields.Count; i++)
            {
                Tests.DBElements.DBField field = fields[i] as Tests.DBElements.DBField;

                KeyValuePair<string, Variables.IVariable> pair = aStructure.SubVariables.ElementAt(j);
                Variables.IVariable variable = pair.Value;

                if (variable.Name.StartsWith(field.Variable))  // we use StartsWith and not Equals because we can have N_ITER_1 and N_ITER
                {
                    if (variable.Type is Types.Enum)
                    {
                        Types.Enum type = variable.Type as Types.Enum;
                        foreach (DataDictionary.Constants.EnumValue enumValue in type.Values)
                        {
                            int value = Int32.Parse(enumValue.getValue());
                            if (value == field.Value)
                            {
                                variable.Value = enumValue;
                                j++;
                                break;
                            }
                        }
                    }
                    else if (variable.Type is Types.Range)
                    {
                        Types.Range type = variable.Type as Types.Range;
                        variable.Value = new Values.IntValue(type, (decimal)field.Value);
                        j++;
                    }
                    else
                    {
                        throw new Exception("Unhandled variable type");
                    }
                    if (field.Variable.Equals("N_ITER")) // we have to create a sequence
                    {
                        KeyValuePair<string, Variables.IVariable> sequencePair = aStructure.SubVariables.ElementAt(j);
                        Variables.IVariable sequenceVariable = sequencePair.Value;
                        Types.Collection collectionType = (Types.Collection)EFSSystem.findType(aNameSpace, sequenceVariable.TypeName);
                        Values.ListValue sequence = new Values.ListValue(collectionType, new List<Values.IValue>());

                        for (int k = 0; k < field.Value; k++)
                        {
                            Types.Structure structureType = (Types.Structure)EFSSystem.findType(aNameSpace, sequence.CollectionType.Type.FullName);
                            Values.StructureValue structureValue = new Values.StructureValue(structureType, structureType.NameSpace);
                            FillStructure(aNameSpace, fields, ref index, structureValue);
                            sequence.Val.Add(structureValue);
                        }
                        sequenceVariable.Value = sequence;
                        j++;
                    }
                }

                // if all the fields of the structue are filled, we terminated
                if (j == aStructure.SubVariables.Count)
                {
                    index = i;
                    break;
                }
            }
        }