Inheritance: Scorpio.ScriptNumber
コード例 #1
0
        public override bool Compare(TokenType type, ScriptObject num)
        {
            ScriptNumberInt val = num as ScriptNumberInt;

            if (val == null)
            {
                throw new ExecutionException(m_Script, this, "数字比较 两边的数字类型不一致 请先转换再比较 ");
            }
            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(m_Script, this, "Int类型 操作符[" + type + "]不支持");
            }
        }
コード例 #2
0
        public override bool Compare(Scorpio.Compiler.TokenType type, ScriptObject num)
        {
            ScriptNumberInt num2 = num as ScriptNumberInt;

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

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

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

            case Scorpio.Compiler.TokenType.LessOrEqual:
                return(this.m_Value <= num2.m_Value);
            }
            throw new ExecutionException(base.m_Script, this, "Int类型 操作符[" + type + "]不支持");
        }