public IJsmExpression Evaluate(IServices services) { IJsmExpression result = _value.Evaluate(services); if (result is IConstExpression number) { return(ValueExpression.Create(number.Value == 0 ? 1 : 0)); } return(result); }
public IJsmExpression Evaluate(IServices services) { var result = _value.Evaluate(services); if (result is IConstExpression number) { return(ValueExpression.Create((int)(-number.Value))); } return(result); }
public IJsmExpression Evaluate(IServices services) { IGlobalVariableService global = ServiceId.Global[services]; if (global.IsSupported) { var value = global.Get(_globalVariable); return(ValueExpression.Create(value)); } return(this); }
public IJsmExpression Evaluate(IServices services) { IJsmExpression first = _first.Evaluate(services); IJsmExpression last = _last.Evaluate(services); if (first is IConstExpression n1 && last is IConstExpression n2) { return(ValueExpression.Create((Int32)(n1.Value ^ n2.Value))); } return(new BitXor(first, last)); }
public IJsmExpression Evaluate(IServices services) { IJsmExpression first = _first.Evaluate(services); IJsmExpression last = _last.Evaluate(services); if (first is IConstExpression n1 && last is IConstExpression n2) { return(ValueExpression.Create(n1.Value != n2.Value ? 1 : 0)); } return(new NotEquals(first, last)); }
public IJsmExpression Evaluate(IServices services) { var first = _first.Evaluate(services); var last = _last.Evaluate(services); if (first is IConstExpression n1 && last is IConstExpression n2) { return(ValueExpression.Create((int)(n1.Value * n2.Value))); } return(new Mul(first, last)); }
public IJsmExpression Evaluate(IServices services) { var first = _first.Evaluate(services); var last = _last.Evaluate(services); if (first is IConstExpression n1 && last is IConstExpression n2) { return(ValueExpression.Create(n1.Value <= n2.Value ? 1 : 0)); } return(new LessOrEquals(first, last)); }
public IJsmExpression Evaluate(IServices services) { IInteractionService interaction = ServiceId.Interaction[services]; if (interaction.IsSupported) { Int32 value = interaction[_index]; return(ValueExpression.Create(value)); } return(this); }
public IJsmExpression Evaluate(IServices services) { ILogicalExpression first = _first.LogicalEvaluate(services); ILogicalExpression last = _last.LogicalEvaluate(services); if (first is IConstExpression n1) { if (n1.Value != 0) { // (true || ??) => true return(ValueExpression.Create(0)); } if (last is IConstExpression n2) { if (n2.Value != 0) { // (false || true) => true return(ValueExpression.Create(0)); } else { // (false || false) => false return(ValueExpression.Create(1)); } } else { // (false || ??) => ?? return(_last); } } else if (last is IConstExpression n2) { if (n2.Value != 0) { // (?? || true) => true return(ValueExpression.Create(0)); } // (?? || true) => ?? return(first); } // (?? || ??) return(new LogOr(first, last)); }
public IJsmExpression Evaluate(IServices services) { var first = _first.LogicalEvaluate(services); var last = _last.LogicalEvaluate(services); if (first is IConstExpression n1) { if (n1.Value == 0) { // (false && ??) => false return(ValueExpression.Create(1)); } if (last is IConstExpression n2) { if (n2.Value == 0) { // (true && false) => false return(ValueExpression.Create(1)); } else { // (true && true) => true return(ValueExpression.Create(0)); } } else { // (true && ??) => ?? return(_last); } } else if (last is IConstExpression n2) { if (n2.Value == 0) { // (?? && false) => false return(ValueExpression.Create(1)); } // (?? && true) => ?? return(first); } // (?? && ??) return(new LogAnd(first, last)); }
ILogicalExpression ILogicalExpression.LogicalInverse() { return(ValueExpression.Create(_fieldObjectId.Value == 0 ? 1 : 0)); }
public ILogicalExpression LogicalInverse() { return(ValueExpression.Create(Value == 0 ? 1 : 0)); }
ILogicalExpression ILogicalExpression.LogicalInverse() => ValueExpression.Create(_fieldObjectId.Value == 0 ? 1 : 0);
public ILogicalExpression LogicalInverse() => ValueExpression.Create(Value == 0 ? 1 : 0);