Inheritance: Scorpio.ScriptNumber
        public override bool Compare(TokenType type, ScriptObject obj)
        {
            ScriptNumberDouble val = obj as ScriptNumberDouble;

            if (val == null)
            {
                throw new ExecutionException(Script, "数字比较 两边的数字类型不一致 请先转换再比较 ");
            }
            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(Script, "Double类型 操作符[" + type + "]不支持");
            }
        }
        public override bool Compare(TokenType type, CodeOperator oper, ScriptNumber num)
        {
            ScriptNumberDouble val = num as ScriptNumberDouble;

            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);
        }
示例#3
0
        public override bool Compare(Scorpio.Compiler.TokenType type, ScriptObject obj)
        {
            ScriptNumberDouble num = obj as ScriptNumberDouble;

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

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

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

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