Inheritance: DataDictionary.Types.Type
コード例 #1
0
        public override void visit(Function obj, bool visitSubNodes)
        {
            Functions.Function function = obj as Functions.Function;

            if (function != null)
            {
                function.ExecutionCount = 0;
                function.ExecutionTimeInMilli = 0L;
            }

            base.visit(obj, visitSubNodes);
        }
コード例 #2
0
        /// <summary>
        ///     Computes targets from the function and stores them in 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, ListValue collection)
        {
            if (function != null)
            {
                Graph graph = function.Graph;
                if (graph != null)
                {
                    for (int i = 0; i < graph.Segments.Count; i++)
                    {
                        Graph.Segment s = graph.Segments[i];
                        StructureValue value = CreateTarget(s.Start, s.End - s.Start, s.Evaluate(s.Start));

                        collection.Val.Add(value);
                    }
                }
            }
        }
コード例 #3
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, ListValue collection)
        {
            if (function != null)
            {
                Graph graph = function.Graph;
                if (graph != null && graph.Segments.Count > 1)
                {
                    NameSpace defaultNameSpace = OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0],
                        "Default");
                    Structure structureType = (Structure)
                        EFSSystem.FindType(
                            defaultNameSpace,
                            "TargetStruct"
                        );

                    double prevSpeed = graph.Segments[0].Evaluate(graph.Segments[0].Start);
                    for (int i = 1; i < graph.Segments.Count; i++)
                    {
                        Graph.Segment s = graph.Segments[i];
                        StructureValue value = new StructureValue(structureType);

                        Field speed = value.CreateField(value, "Speed", structureType);
                        speed.Value = new DoubleValue(EFSSystem.DoubleType, s.Evaluate(s.Start));

                        Field location = value.CreateField(value, "Location", structureType);
                        location.Value = new DoubleValue(EFSSystem.DoubleType, s.Start);

                        Field length = value.CreateField(value, "Length", structureType);
                        length.Value = SegmentLength(s.End);

                        Enum targetType = (Enum) EFSSystem.FindType(defaultNameSpace, "TargetTypeEnum");
                        Field type = value.CreateField(value, "Type", structureType);
                        type.Value = targetType.DefaultValue;

                        // Only add the target for the current segment to the collection if it brings a reduction in permitted speed
                        if (s.Evaluate(s.Start) < prevSpeed)
                        {
                            collection.Val.Add(value);
                        }
                        // But even if it is not added to the collection of targets, this segment is now the reference speed
                        prevSpeed = s.Evaluate(s.Start);
                    }
                }
            }
        }
コード例 #4
0
        public override void visit(Function obj, bool visitSubNodes)
        {
            obj.setCacheable(false);

            base.visit(obj, visitSubNodes);
        }
コード例 #5
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, ListValue collection)
        {
            if (function != null)
            {
                Graph graph = function.Graph;
                if (graph != null && graph.Segments.Count > 1)
                {
                    double prevSpeed = graph.Segments[0].Evaluate(graph.Segments[0].Start);
                    for (int i = 1; i < graph.Segments.Count; i++)
                    {
                        Graph.Segment s = graph.Segments[i];
                        Structure structureType =
                            (Structure)
                                EFSSystem.FindType(
                                    OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0],
                                        "Kernel.SpeedAndDistanceMonitoring.TargetSpeedMonitoring"),
                                    "Kernel.SpeedAndDistanceMonitoring.TargetSpeedMonitoring.Target");
                        StructureValue value = new StructureValue(structureType);

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

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

                        Variable length = (Variable) acceptor.getFactory().createVariable();
                        length.Type =
                            EFSSystem.FindType(
                                OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0],
                                    "Default.BaseTypes"), "Default.BaseTypes.Length");
                        length.Name = "Length";
                        length.Mode = acceptor.VariableModeEnumType.aInternal;
                        length.Default = "0.0";
                        length.Enclosing = value;
                        length.Value = SegmentLength(s.End);
                        value.set(length);

                        // Only add the target for the current segment to the collection if it brings a reduction in permitted speed
                        if (s.Evaluate(s.Start) < prevSpeed)
                        {
                            collection.Val.Add(value);
                        }
                        // But even if it is not added to the collection of targets, this segment is now the reference speed
                        prevSpeed = s.Evaluate(s.Start);
                    }
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// Provides the distance parameter of the function
        /// </summary>
        /// <param name="function"></param>
        /// <returns></returns>
        public Parameter GetDistanceParameter(Function function)
        {
            Parameter retVal = null;

            foreach (Parameter p in function.allParameters())
            {
                if (IsDouble(p))
                {
                    retVal = p;
                    break;
                }
            }

            return retVal;
        }
コード例 #7
0
 /// <summary>
 /// Checks for references of a specific function in the given dictionary
 /// </summary>
 /// <param name="function"></param>
 private void CheckReferences(Function function)
 {
     foreach (Usage usage in EfsSystem.Instance.FindReferences(function))
     {
         ModelElement user = usage.User;
         if (Dictionary == EnclosingFinder<Dictionary>.find(user, true))
         {
             // Only considers the users in the checked dictionary
             IExpressionable expressionable = user as IExpressionable;
             if (expressionable != null)
             {
                 FindCall findCall = new FindCall(function);
                 findCall.GatherReferences(expressionable.Tree);
                 foreach (Call call in findCall.References)
                 {
                     CheckCall(call, null, null);
                 }
             }
         }
     }
 }
コード例 #8
0
        /// <summary>
        /// Provides the speed parameter of the function
        /// </summary>
        /// <param name="function"></param>
        /// <returns></returns>
        public Parameter GetSpeedParameter(Function function)
        {
            Parameter retVal = null;

            Parameter distance = GetDistanceParameter(function);
            foreach (Parameter p in function.allParameters())
            {
                if (IsDouble(p) && p != distance)
                {
                    retVal = p;
                    break;
                }
            }

            return retVal;
        }