Exemplo n.º 1
0
        /// <summary>
        /// Resolve a constraint that has been recognized by applying any
        /// pending operators and returning the resulting Constraint.
        /// </summary>
        /// <returns>A constraint that incorporates all pending operators</returns>
        private Constraint Resolve(Constraint constraint)
        {
            while (_ops.Count > 0)
            {
                switch (_ops.Pop())
                {
                case Op.Not:
                    constraint = new NotConstraint(constraint);
                    break;

                case Op.All:
                    constraint = new AllItemsConstraint(constraint);
                    break;

                case Op.Some:
                    constraint = new SomeItemsConstraint(constraint);
                    break;

                case Op.None:
                    constraint = new NoItemConstraint(constraint);
                    break;

                case Op.Prop:
                    constraint = new PropertyConstraint(_opnds.Pop(), constraint);
                    break;
                }
            }

            return(constraint);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Resolve a constraint that has been recognized by applying any
        /// pending operators and returning the resulting Constraint.
        /// </summary>
        /// <returns>A constraint that incorporates all pending operators</returns>
        private Constraint Resolve( Constraint constraint )
        {
            while ( _ops.Count > 0 )
            {
                switch ( _ops.Pop() )
                {
                    case Op.Not:
                        constraint = new NotConstraint( constraint );
                        break;
                    case Op.All:
                        constraint = new AllItemsConstraint( constraint );
                        break;
                    case Op.Some:
                        constraint = new SomeItemsConstraint( constraint );
                        break;
                    case Op.None:
                        constraint = new NoItemConstraint( constraint );
                        break;
                    case Op.Prop:
                        constraint = new PropertyConstraint( _opnds.Pop(), constraint );
                        break;
                }
            }

            return constraint;
        }