Ejemplo n.º 1
0
 public static DeclaredValuePointer <G> GetNativePointer <G>(ExecutionState <G> executionState, G groupState, string location, string name, PointerOperation operation, IValueProvider <G> valueProvider) where G : IGroupState <G>, new()
 {
     return(new DeclaredValuePointer <G>(location, valueProvider.GetAsValue(GetNative <G>(location, name)))
     {
         Identifier = name
     });
 }
Ejemplo n.º 2
0
        public void Execute(ExecutionState <G> executionState, IValueProvider <G> valueProvider)
        {
            object[] parameters = executionState.ListRegister.Select(pointer => ((IValue <G>)pointer.Value).GetData()).ToArray();
            executionState.ListRegister.Clear();
            dynamic thisValue = Data;

            executionState.ListRegister.Add(new ValuePointer <G> {
                Value = valueProvider.GetAsValue(thisValue.DynamicInvoke(parameters))
            });
        }
Ejemplo n.º 3
0
        public IValuable <G> DivideBy(IValuable <G> value, IValueProvider <G> valueProvider)
        {
            string exceptionMessage = "Invalid values for division";

            switch (value)
            {
            case IValue <G> val:
                dynamic thisValue    = Data;
                dynamic dynamicValue = val.GetData();
                return(EvaluateOrThrow(() => valueProvider.GetAsValue(thisValue / dynamicValue), exceptionMessage));

            default:
                throw new EngineRuntimeException(exceptionMessage);
            }
        }
Ejemplo n.º 4
0
        public IValuable <G> IsLessThanOrEqualTo(IValuable <G> value, IValueProvider <G> valueProvider)
        {
            string exceptionMessage = "Invalid values for less than or equals";

            switch (value)
            {
            case IValue <G> val:
                dynamic thisValue    = Data;
                dynamic dynamicValue = val.GetData();
                return(EvaluateOrThrow(() => valueProvider.GetAsValue(thisValue <= dynamicValue), exceptionMessage));

            default:
                throw new EngineRuntimeException(exceptionMessage);
            }
        }
Ejemplo n.º 5
0
        public ValuePointer <G> Get(IValuable <G> value, bool createNonExistent, IValueProvider <G> valueProvider)
        {
            string exceptionMessage = "Value is not keyed";

            switch (value)
            {
            case IValue <G> val:
                dynamic thisValue    = Data;
                dynamic dynamicValue = val.GetData();
                return(EvaluateOrThrow(() => new ValuePointer <G> {
                    Value = valueProvider.GetAsValue(thisValue[dynamicValue])
                }, exceptionMessage));

            default:
                throw new EngineRuntimeException(exceptionMessage);
            }
        }
Ejemplo n.º 6
0
        public ValuePointer <G> GetAt(IValuable <G> value, IValueProvider <G> valueProvider)
        {
            string exceptionMessage = "Value is not indexed";

            switch (value)
            {
            case IValue <G> val:
                dynamic thisValue    = Data;
                dynamic dynamicValue = val.GetData();
                return(EvaluateOrThrow(() => new ValuePointer <G> {
                    Value = valueProvider.GetAsValue(Enumerable.ElementAt(thisValue, dynamicValue))
                }, exceptionMessage));

            default:
                throw new EngineRuntimeException(exceptionMessage);
            }
        }
Ejemplo n.º 7
0
        public IValuable <G> Not(IValueProvider <G> valueProvider)
        {
            dynamic thisValue = Data;

            return(EvaluateOrThrow(() => valueProvider.GetAsValue(!thisValue), "Invalid value for negation"));
        }