Esempio n. 1
0
 public override ValueSpecification clone()
 {
     LiteralReal vs = new LiteralReal(0.0);
     vs.CLASSTYPE = CLASSTYPE;
     vs.Type = Type;
     vs.rValue = rValue;
     return ((ValueSpecification)vs);
 }
Esempio n. 2
0
        public override ValueSpecification clone()
        {
            LiteralReal vs = new LiteralReal(0.0);

            vs.CLASSTYPE = CLASSTYPE;
            vs.Type      = Type;
            vs.rValue    = rValue;
            return((ValueSpecification)vs);
        }
 public void addTime(double time)
 {
     Trigger trigger = new Trigger("time");
     TimeEvent te = new TimeEvent("time");
     LiteralReal lValue = new LiteralReal(time);
     te.When = lValue;
     trigger.MEvent = te;
     eventQueue.Add(trigger);
     restart();
 }
        public void addTime(double time)
        {
            Trigger     trigger = new Trigger("time");
            TimeEvent   te      = new TimeEvent("time");
            LiteralReal lValue  = new LiteralReal(time);

            te.When        = lValue;
            trigger.MEvent = te;
            eventQueue.Add(trigger);
            restart();
        }
Esempio n. 5
0
        public override ValueSpecification createValueFromString(string str)
        {
            ValueSpecification valueSpec = null;

            if (type == "real" || type == "double")
            {
                valueSpec = new LiteralReal(str);
            }
            else if (type == "integer")
            {
                valueSpec = new LiteralInteger(str);
            }
            else if (type == "string")
            {
                valueSpec = new LiteralString(str);
            }
            else if (type == "boolean")
            {
                valueSpec = new LiteralBoolean(str);
            }

            /*else if (type =="color")
             *  valueSpec = new Color(str);
             * else if (type =="Vector3")
             *  valueSpec = new Vector3(str);*/
            else if (type == "rotation")
            {
                valueSpec = new RotationVector(str);
            }
            else if (type == "shape")
            {
                //valueSpec = (UnityShapeSpecification)ScriptableObject.CreateInstance("UnityShapeSpecification");
                //((UnityShapeSpecification)valueSpec).instantiate(str);
            }
            else if (type == "point")
            {
                //valueSpec = (UnityPointSpecification)ScriptableObject.CreateInstance("UnityPointSpecification");
                //((UnityPointSpecification)valueSpec).instantiate(str);
            }

            /*else if (type =="path")
             *  valueSpec = new PathSpecification(str);
             * else if (type =="sound")
             *  valueSpec = new UnitySoundSpecification(str);
             * else if (type =="animation")
             *  valueSpec = new UnityAnimationSpecification(str);*/
            else
            {
                Console.WriteLine("Default : value is string");
                valueSpec = new LiteralString(str);
            }
            return(valueSpec);
        }
Esempio n. 6
0
        public bool equals(Trigger trigger)
        {
            if (mEvent.Type != trigger.mEvent.Type)
            {
                return(false);
            }
            if (mEvent.Type == "SignalEvent")
            {
                // StreamWriter file = MascaretApplication.Instance.logfile;
                if (mEvent as SignalEvent != null && ((SignalEvent)mEvent).name == ((SignalEvent)trigger.mEvent).Signal.Classifier.name)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else if (mEvent.Type == "ChangeEvent")
            {
                Expression exp1 = ((Expression)((ChangeEvent)mEvent).ChangeExpression);
                Expression exp2 = ((Expression)((ChangeEvent)trigger.MEvent).ChangeExpression);
                if (exp1.ExpressionValue == exp2.ExpressionValue)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else if (mEvent.Type == "TimeEvent")
            {
                LiteralReal value1 = (LiteralReal)((TimeEvent)mEvent).When;
                LiteralReal value2 = (LiteralReal)((TimeEvent)trigger.MEvent).When;

                if (value1.RValue == value2.RValue)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
 public override ValueSpecification createValueFromString(string str)
 {
     ValueSpecification valueSpec = null;
     if (type == "real" || type == "double" || type == "float")
     {
         valueSpec = new LiteralReal(str);
     }
     else if (type == "integer")
     {
         valueSpec = new LiteralInteger(str);
     }
     else if (type == "string")
     {
         valueSpec = new LiteralString(str);
     }
     else if (type == "boolean")
     {
         valueSpec = new LiteralBoolean(str);
     }
     /*else if (type =="color")
         valueSpec = new Color(str);
     else if (type =="Vector3")
         valueSpec = new Vector3(str);*/
     else if (type == "rotation")
     {
         valueSpec = new RotationVector(str);
     }
     else if (type == "shape")
     {
         //valueSpec = (UnityShapeSpecification)ScriptableObject.CreateInstance("UnityShapeSpecification");
         //((UnityShapeSpecification)valueSpec).instantiate(str);
     }
     else if (type == "point")
     {
         //valueSpec = (UnityPointSpecification)ScriptableObject.CreateInstance("UnityPointSpecification");
         //((UnityPointSpecification)valueSpec).instantiate(str);
     }
     /*else if (type =="path")
         valueSpec = new PathSpecification(str);
     else if (type =="sound")
         valueSpec = new UnitySoundSpecification(str);
     else if (type =="animation")
         valueSpec = new UnityAnimationSpecification(str);*/
     else
     {
         Console.WriteLine("Default : value is string");
         valueSpec = new LiteralString(str);
     }
     return valueSpec;
 }
Esempio n. 8
0
        public override ValueSpecification createValueFromString(string str)
        {
            string type = unit.Classifier.name;
            ValueSpecification valueSpec = null;
            if (type == "real" || type == "double")
            {
                valueSpec = new LiteralReal(str);
            }
            else if (type == "integer")
            {
                valueSpec = new LiteralInteger(str);
            }
            else if (type == "string")
            {
                valueSpec = new LiteralString(str);
            }
            else if (type == "boolean")
            {
                valueSpec = new LiteralBoolean(str);
            }

            return valueSpec;
        }
Esempio n. 9
0
        public override ValueSpecification createValueFromString(string str)
        {
            string             type      = unit.Classifier.name;
            ValueSpecification valueSpec = null;

            if (type == "real" || type == "double")
            {
                valueSpec = new LiteralReal(str);
            }
            else if (type == "integer")
            {
                valueSpec = new LiteralInteger(str);
            }
            else if (type == "string")
            {
                valueSpec = new LiteralString(str);
            }
            else if (type == "boolean")
            {
                valueSpec = new LiteralBoolean(str);
            }

            return(valueSpec);
        }
Esempio n. 10
0
        public void addTimeEvent(XElement timeNode, Package pkg)
        {
            string type;

            type = timeNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}type").Value;
            if (type == null) type = timeNode.Attribute("{http://www.omg.org/spec/XMI/20131001}type").Value;

            if (type != "uml:TimeEvent")
            {
                return;
            }

            string id = timeNode.Attribute("id").Value;

            TimeEvent timeEvent = new TimeEvent(id);

            XElement when = timeNode.Element("when");
            if (when != null && when.Element("expr") != null)
            {
                string timeExp = when.Element("expr").Attribute("value").Value;
                LiteralReal time = new LiteralReal(timeExp);
                timeEvent.When = time;
            }
            /* add in package*/
            _events.Add(id, timeEvent);
        }