Exemple #1
0
        public bool Evaluate()
        {
            switch (_type)
            {
            case Type.TRIGGER:
                return(_parameter.Trigger());

            case Type.EQUALS:
                switch (_parameter.type)
                {
                case FsmParameter.Type.BOOLEAN:
                    return(_parameter.Equals(_boolValue));

                case FsmParameter.Type.INTEGER:
                    return(_parameter.Equals(_intValue));

                case FsmParameter.Type.FLOAT:
                    return(_parameter.Equals(_floatValue));

                default:
                    throw new NotSupportedException("Unknown parameter type " + _parameter.type);
                }

            case Type.GREATER_THAN:
                switch (_parameter.type)
                {
                case FsmParameter.Type.BOOLEAN:
                    throw new NotSupportedException("Cannot compare a boolean parameter");

                case FsmParameter.Type.INTEGER:
                    return(_parameter.GreaterThan(_intValue));

                case FsmParameter.Type.FLOAT:
                    return(_parameter.GreaterThan(_floatValue));

                default:
                    throw new NotSupportedException("Unknown parameter type " + _parameter.type);
                }

            case Type.SMALLER_THAN:
                switch (_parameter.type)
                {
                case FsmParameter.Type.BOOLEAN:
                    throw new NotSupportedException("Cannot compare a boolean parameter");

                case FsmParameter.Type.INTEGER:
                    return(_parameter.SmallerThan(_intValue));

                case FsmParameter.Type.FLOAT:
                    return(_parameter.SmallerThan(_floatValue));

                default:
                    throw new NotSupportedException("Unknown parameter type " + _parameter.type);
                }

            default:
                throw new InvalidOperationException("Unkown condition type " + _type);
            }
        }