コード例 #1
0
                    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);
                    }
コード例 #2
0
                    public IJsmExpression Evaluate(IServices services)
                    {
                        var result = _value.Evaluate(services);

                        if (result is IConstExpression number)
                        {
                            return(ValueExpression.Create((int)(-number.Value)));
                        }
                        return(result);
                    }
コード例 #3
0
                public IJsmExpression Evaluate(IServices services)
                {
                    IGlobalVariableService global = ServiceId.Global[services];

                    if (global.IsSupported)
                    {
                        var value = global.Get(_globalVariable);
                        return(ValueExpression.Create(value));
                    }
                    return(this);
                }
コード例 #4
0
                    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));
                    }
コード例 #5
0
                    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));
                    }
コード例 #6
0
                    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));
                    }
コード例 #7
0
                    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));
                    }
コード例 #8
0
                public IJsmExpression Evaluate(IServices services)
                {
                    IInteractionService interaction = ServiceId.Interaction[services];

                    if (interaction.IsSupported)
                    {
                        Int32 value = interaction[_index];
                        return(ValueExpression.Create(value));
                    }

                    return(this);
                }
コード例 #9
0
                    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));
                    }
コード例 #10
0
                    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));
                    }
コード例 #11
0
 ILogicalExpression ILogicalExpression.LogicalInverse()
 {
     return(ValueExpression.Create(_fieldObjectId.Value == 0 ? 1 : 0));
 }
コード例 #12
0
 public ILogicalExpression LogicalInverse()
 {
     return(ValueExpression.Create(Value == 0 ? 1 : 0));
 }
コード例 #13
0
 ILogicalExpression ILogicalExpression.LogicalInverse() => ValueExpression.Create(_fieldObjectId.Value == 0 ? 1 : 0);
コード例 #14
0
 public ILogicalExpression LogicalInverse() => ValueExpression.Create(Value == 0 ? 1 : 0);