예제 #1
0
    public bool Compare(string val, Condition.TYPE comp)
    {
        switch (this.m_Type)
        {
        case CJVariable.TYPE.String:
            if (comp == Condition.TYPE.Equal)
            {
                return(this.SValue == val);
            }
            DebugUtils.Assert("Improper conditiotn for String", true, DebugUtils.AssertType.Info);
            return(false);

        case CJVariable.TYPE.Int:
            switch (comp)
            {
            case Condition.TYPE.Equal:
                return(this.IValue == int.Parse(val));

            case Condition.TYPE.Less:
                return(this.IValue < int.Parse(val));

            case Condition.TYPE.Greater:
                return(this.IValue > int.Parse(val));

            default:
                DebugUtils.Assert("Improper conditiotn for Int", true, DebugUtils.AssertType.Info);
                return(false);
            }
            break;

        case CJVariable.TYPE.Float:
            switch (comp)
            {
            case Condition.TYPE.Equal:
                return(this.FValue == float.Parse(val));

            case Condition.TYPE.Less:
                return(this.FValue < float.Parse(val));

            case Condition.TYPE.Greater:
                return(this.FValue > float.Parse(val));

            default:
                DebugUtils.Assert("Improper conditiotn for Float", true, DebugUtils.AssertType.Info);
                return(false);
            }
            break;

        case CJVariable.TYPE.Bool:
            if (comp == Condition.TYPE.Equal)
            {
                return(this.BValue == bool.Parse(val));
            }
            DebugUtils.Assert("Improper conditiotn for Bool", true, DebugUtils.AssertType.Info);
            return(false);
        }
        DebugUtils.Assert("Improper conditiotn", true, DebugUtils.AssertType.Info);
        return(false);
    }
예제 #2
0
    public static string ToString(Condition.TYPE type)
    {
        switch (type)
        {
        case Condition.TYPE.Equal:
            return("Equal");

        case Condition.TYPE.Less:
            return("Less");

        case Condition.TYPE.Greater:
            return("Greater");

        default:
            return("Unknown");
        }
    }
예제 #3
0
 public Condition(CJVariable var, Condition.TYPE type)
 {
     this.m_Variable = var;
     this.m_Type     = type;
 }
예제 #4
0
 public void SetConditionType(Condition.TYPE type)
 {
     this.m_Type = type;
 }