1 package org.odbms; 2 3 /* Copyright 2002-2005 The Apache Software Foundation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /** 19 * constraint for a single query node. 20 * <br><br>A Constraint is associated with one single <code>Query</code> node 21 * - a single member of a class.<br><br> 22 * Constraints are constructed by calling 23 * <a href="Query.html#constrain(java.lang.object)"> 24 * <code>Query.constrain()</code></a>. 25 * <br><br> 26 * Constraints can be joined with the methods and() and or().<br><br> 27 * The following mutual exclusive functions set the evaluation mode. 28 * The subsequent call prevails:<br> 29 * identity(), equal(), greater(), greaterOrEqual(), smaller(), 30 * smallerOrEqual(), like(), contains()<br><br> 31 * is(), and not() are also mutually exclusive.<br><br> 32 */ 33 public interface Constraint { 34 35 /** 36 * links two Constraints for AND evaluation 37 * @param andWith the other Constraint 38 * @return a new Constraint, that can be used for further calls to and() and or() 39 */ 40 public Constraint and (Constraint andWith); 41 42 43 44 /** 45 * links two Constraints for OR evaluation 46 * @param orWith the other Constraint 47 * @return a new Constraint, that can be used for further calls to and() and or() 48 */ 49 public Constraint or (Constraint orWith); 50 51 52 53 /** 54 * sets the evaluation mode to "==" 55 * @return this Constraint to allow the chaining of method calls 56 */ 57 public Constraint equal (); 58 59 60 61 /** 62 * sets the evaluation mode to ">" 63 * @return this Constraint to allow the chaining of method calls 64 */ 65 public Constraint greater (); 66 67 68 69 /** 70 * sets the evaluation mode to ">=" 71 * @return this Constraint to allow the chaining of method calls 72 */ 73 public Constraint greaterOrEqual (); 74 75 76 77 /** 78 * sets the evaluation mode to "<" 79 * @return this Constraint to allow the chaining of method calls 80 */ 81 public Constraint smaller (); 82 83 84 85 /** 86 * sets the evaluation mode to "<=" 87 * @return this Constraint to allow the chaining of method calls 88 */ 89 public Constraint smallerOrEqual (); 90 91 92 /** 93 * sets the evaluation mode to identity comparison 94 * @return this Constraint to allow the chaining of method calls 95 */ 96 public Constraint identity (); 97 98 99 /** 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