001    package  org.odbms;
002    
003    /* Copyright 2002-2005 The Apache Software Foundation
004     *
005     * Licensed under the Apache License, Version 2.0 (the "License");
006     * you may not use this file except in compliance with the License.
007     * You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    
018    /**
019     * constraint for a single query node.  
020     * <br><br>A Constraint is associated with one single <code>Query</code> node 
021     * - a single member of a class.<br><br>
022     * Constraints are constructed by calling 
023     * <a href="Query.html#constrain(java.lang.object)">
024     * <code>Query.constrain()</code></a>.
025     * <br><br>
026     * Constraints can be joined with the methods and() and or().<br><br>
027     * The following mutual exclusive functions set the evaluation mode.
028     * The subsequent call prevails:<br>
029     * identity(), equal(), greater(), greaterOrEqual(), smaller(), 
030     * smallerOrEqual(), like(), contains()<br><br>
031     * is(), and not() are also mutually exclusive.<br><br>
032     */
033    public interface Constraint {
034    
035        /**
036             * links two Constraints for AND evaluation
037         * @param andWith the other Constraint
038         * @return a new Constraint, that can be used for further calls to and() and or()
039         */
040        public Constraint and (Constraint andWith);
041    
042    
043    
044        /**
045             * links two Constraints for OR evaluation
046         * @param orWith the other Constraint
047         * @return a new Constraint, that can be used for further calls to and() and or()
048         */
049        public Constraint or (Constraint orWith);
050    
051    
052    
053        /**
054         * sets the evaluation mode to "=="
055         * @return this Constraint to allow the chaining of method calls
056         */
057        public Constraint equal ();
058    
059    
060    
061        /**
062         * sets the evaluation mode to ">"
063         * @return this Constraint to allow the chaining of method calls
064         */
065        public Constraint greater ();
066    
067    
068    
069        /**
070         * sets the evaluation mode to ">="
071         * @return this Constraint to allow the chaining of method calls
072         */
073        public Constraint greaterOrEqual ();
074    
075    
076    
077        /**
078         * sets the evaluation mode to "<"
079         * @return this Constraint to allow the chaining of method calls
080         */
081        public Constraint smaller ();
082    
083    
084    
085        /**
086         * sets the evaluation mode to "<="
087         * @return this Constraint to allow the chaining of method calls
088         */
089        public Constraint smallerOrEqual ();
090    
091    
092        /**
093         * sets the evaluation mode to identity comparison
094         * @return this Constraint to allow the chaining of method calls
095         */
096        public Constraint identity ();
097            
098            
099        /**
100         * sets the evaluation mode to "like" comparison
101         * @return this Constraint to allow the chaining of method calls
102         */
103        public Constraint like ();
104            
105            
106        /**
107         * sets the evaluation mode to containment comparison
108         * @return this Constraint to allow the chaining of method calls
109         */
110        public Constraint contains ();
111    
112    
113        /**
114         * turns off not() comparison
115         * @return this Constraint to allow the chaining of method calls
116         */
117        public Constraint is ();
118    
119    
120    
121        /**
122         * turns on not() comparison
123         * @return this Constraint to allow the chaining of method calls
124         */
125        public Constraint not ();
126    }
127