Ejemplo n.º 1
0
 private Event InitiateValue(Event context)
 {
     if (InitialValue != null)
     {
         this.marking.value = InitialValue.Eval(context);
         InitialValue       = null;
     }
     return(this);
 }
Ejemplo n.º 2
0
 public DataSet ValidInputs()
 {
     if (type == null)
     {
         return(null);
     }
     else
     {
         return((DataSet)type.Eval(this));
     }
 }
Ejemplo n.º 3
0
        //public override string Symbol => "!";

        public override DataType Eval(Event context)
        {
            var c = child.Eval(context);

            var ct = c.GetType();

            if (ct == typeof(BoolType))
            {
                var cc = (BoolType)c;
                return(new BoolType(!cc.value));
            }
            else
            {
                throw new NotImplementedException("NegOp on non-boolean.");
            }
        }
Ejemplo n.º 4
0
        public override DataType Eval(Event context)
        {
            var c = child.Eval(context);

            if (!(c.GetType() == typeof(EventSet)))
            {
                throw new Exception("Value of not an event set.");
            }
            EventSet s = (EventSet)c;

            if (s.value.Count < 1)
            {
                throw new Exception("Value of non-existent event.");
            }

            if (s.value.Count > 1)
            {
                var result = new HashSet <DataType>();
                foreach (Event e in s.value)
                {
                    if (e.marking.value == null)
                    {
                        result.Add(new Unit());
                    }
                    else
                    {
                        result.Add(e.marking.value);
                    }
                }
                return(new DataSet(result));
            }
            else
            {
                if (s.value.ElementAt(0).marking.value == null)
                {
                    return(new Unit());
                }
                else
                {
                    return(s.value.ElementAt(0).marking.value);
                }
            }
        }
Ejemplo n.º 5
0
        public override DataType Eval(Event context)
        {
            var c = child.Eval(context);

            if (!(c.GetType() == typeof(EventSet)))
            {
                throw new Exception("IsPending of not an event set.");
            }
            EventSet s = (EventSet)c;

            if (s.value.Count > 1)
            {
                throw new Exception("IsPending of multiple events.");
            }

            if (s.value.ElementAt(0).marking == null)
            {
                return(new Unit());
            }
            else
            {
                return(new BoolType(s.value.ElementAt(0).marking.pending));
            }
        }