Inheritance: Scorpio.ScriptNumber
Esempio n. 1
0
        public override bool Compare(TokenType type, ScriptNumber num)
        {
            ScriptNumberLong val = num as ScriptNumberLong;

            if (val == null)
            {
                throw new ExecutionException("数字比较 两边的数字类型不一致 请先转换再比较 ");
            }
            switch (type)
            {
            case TokenType.Greater:
                return(m_Value > val.m_Value);

            case TokenType.GreaterOrEqual:
                return(m_Value >= val.m_Value);

            case TokenType.Less:
                return(m_Value < val.m_Value);

            case TokenType.LessOrEqual:
                return(m_Value <= val.m_Value);

            default:
                throw new ExecutionException("Number类型 操作符[" + type + "]不支持");
            }
        }
Esempio n. 2
0
        public override bool Compare(Scorpio.Compiler.TokenType type, ScriptObject num)
        {
            ScriptNumberLong @long = num as ScriptNumberLong;

            if (@long == null)
            {
                throw new ExecutionException(base.m_Script, this, "数字比较 两边的数字类型不一致 请先转换再比较 ");
            }
            switch (type)
            {
            case Scorpio.Compiler.TokenType.Greater:
                return(this.m_Value > @long.m_Value);

            case Scorpio.Compiler.TokenType.GreaterOrEqual:
                return(this.m_Value >= @long.m_Value);

            case Scorpio.Compiler.TokenType.Less:
                return(this.m_Value < @long.m_Value);

            case Scorpio.Compiler.TokenType.LessOrEqual:
                return(this.m_Value <= @long.m_Value);
            }
            throw new ExecutionException(base.m_Script, this, "Long类型 操作符[" + type + "]不支持");
        }
        public override bool Compare(TokenType type, CodeOperator oper, ScriptNumber num)
        {
            ScriptNumberLong val = num as ScriptNumberLong;

            if (val == null)
            {
                throw new ExecutionException("数字比较 两边的数字类型不一致 请先转换再比较 ");
            }
            switch (type)
            {
            case TokenType.Greater:
                return(m_Value > val.m_Value);

            case TokenType.GreaterOrEqual:
                return(m_Value >= val.m_Value);

            case TokenType.Less:
                return(m_Value < val.m_Value);

            case TokenType.LessOrEqual:
                return(m_Value <= val.m_Value);
            }
            return(false);
        }