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 }); }
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)) }); }
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); } }
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); } }
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); } }
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); } }
public IValuable <G> Not(IValueProvider <G> valueProvider) { dynamic thisValue = Data; return(EvaluateOrThrow(() => valueProvider.GetAsValue(!thisValue), "Invalid value for negation")); }