Inheritance: ScriptObject
Esempio n. 1
0
        public override bool Compare(TokenType type, ScriptObject obj)
        {
            ScriptString val = obj as ScriptString;

            if (val == null)
            {
                throw new ExecutionException(Script, "字符串比较 右边必须为字符串类型");
            }
            switch (type)
            {
            case TokenType.Greater:
                return(string.Compare(Value, val.Value) < 0);

            case TokenType.GreaterOrEqual:
                return(string.Compare(Value, val.Value) <= 0);

            case TokenType.Less:
                return(string.Compare(Value, val.Value) > 0);

            case TokenType.LessOrEqual:
                return(string.Compare(Value, val.Value) >= 0);

            default:
                throw new ExecutionException(Script, "String类型 操作符[" + type + "]不支持");
            }
        }
 public bool Compare(TokenType type, ScriptString str)
 {
     switch (type)
     {
         case TokenType.Greater:
             return string.Compare(Value, str.Value) < 0;
         case TokenType.GreaterOrEqual:
             return string.Compare(Value, str.Value) <= 0;
         case TokenType.Less:
             return string.Compare(Value, str.Value) > 0;
         case TokenType.LessOrEqual:
             return string.Compare(Value, str.Value) >= 0;
         default:
             throw new ExecutionException(Script, "String类型 操作符[" + type + "]不支持");
     }
 }
Esempio n. 3
0
        public bool Compare(TokenType type, ScriptString str)
        {
            switch (type)
            {
            case TokenType.Greater:
                return(string.Compare(Value, str.Value) < 0);

            case TokenType.GreaterOrEqual:
                return(string.Compare(Value, str.Value) <= 0);

            case TokenType.Less:
                return(string.Compare(Value, str.Value) > 0);

            case TokenType.LessOrEqual:
                return(string.Compare(Value, str.Value) >= 0);

            default:
                throw new ExecutionException("String类型 操作符[" + type + "]不支持");
            }
        }
Esempio n. 4
0
        public override bool Compare(Scorpio.Compiler.TokenType type, ScriptObject obj)
        {
            ScriptString str = obj as ScriptString;

            if (str == null)
            {
                throw new ExecutionException(base.m_Script, this, "字符串比较 右边必须为字符串类型");
            }
            switch (type)
            {
            case Scorpio.Compiler.TokenType.Greater:
                return(string.Compare(this.m_Value, str.m_Value) > 0);

            case Scorpio.Compiler.TokenType.GreaterOrEqual:
                return(string.Compare(this.m_Value, str.m_Value) >= 0);

            case Scorpio.Compiler.TokenType.Less:
                return(string.Compare(this.m_Value, str.m_Value) < 0);

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