KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > db4o > query > Constraint


1 /* Copyright (C) 2004 - 2006 db4objects Inc. http://www.db4o.com
2
3 This file is part of the db4o open source object database.
4
5 db4o is free software; you can redistribute it and/or modify it under
6 the terms of version 2 of the GNU General Public License as published
7 by the Free Software Foundation and as clarified by db4objects' GPL
8 interpretation policy, available at
9 http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
10 Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
11 Suite 350, San Mateo, CA 94403, USA.
12
13 db4o is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */

21 package com.db4o.query;
22
23 /**
24  * constraint to limit the objects returned upon
25  * {@link Query#execute() query execution}.
26  * <br><br>
27  * Constraints are constructed by calling
28  * {@link Query#constrain Query.constrain()}.
29  * <br><br>
30  * Constraints can be joined with the methods {@link #and}
31  * and {@link #or}.
32  * <br><br>
33  * The methods to modify the constraint evaluation algorithm may
34  * be merged, to construct combined evaluation rules.
35  * Examples:
36  * <ul>
37  * <li> <code>Constraint#smaller().equal()</code> for "smaller or equal" </li>
38  * <li> <code>Constraint#not().like()</code> for "not like" </li>
39  * <li> <code>Constraint#not().greater().equal()</code> for "not greater or equal" </li>
40  * </ul>
41  */

42 public interface Constraint {
43
44     /**
45      * links two Constraints for AND evaluation.
46      * @param with the other {@link Constraint}
47      * @return a new {@link Constraint}, that can be used for further calls
48      * to {@link #and and()} and {@link #or or()}
49      */

50     public Constraint and (Constraint with);
51
52
53     /**
54      * links two Constraints for OR evaluation.
55      * @param with the other {@link Constraint}
56      * @return a new {@link Constraint}, that can be used for further calls
57      * to {@link #and and()} and {@link #or or()}
58      */

59     public Constraint or (Constraint with);
60
61
62     /**
63      * sets the evaluation mode to <code>==</code>.
64      * @return this {@link Constraint} to allow the chaining of method calls.
65      */

66     public Constraint equal ();
67
68
69     /**
70      * sets the evaluation mode to <code>&gt;</code>.
71      * @return this {@link Constraint} to allow the chaining of method calls.
72      */

73     public Constraint greater ();
74
75     /**
76      * sets the evaluation mode to <code>&lt;</code>.
77      * @return this {@link Constraint} to allow the chaining of method calls.
78      */

79     public Constraint smaller ();
80
81
82     /**
83      * sets the evaluation mode to identity comparison.
84      * @return this {@link Constraint} to allow the chaining of method calls.
85      */

86     public Constraint identity ();
87     
88     
89     /**
90      * sets the evaluation mode to "like" comparison.
91      * <br><br>Constraints are compared to the first characters of a field.<br><br>
92      * @return this {@link Constraint} to allow the chaining of method calls.
93      */

94     public Constraint like ();
95     
96     
97     /**
98      * sets the evaluation mode to containment comparison.
99      * @return this {@link Constraint} to allow the chaining of method calls.
100      */

101     public Constraint contains ();
102
103     /**
104      * sets the evaluation mode to string startsWith comparison.
105      * @param caseSensitive comparison will be case sensitive if true, case insensitive otherwise
106      * @return this {@link Constraint} to allow the chaining of method calls.
107      */

108     public Constraint startsWith(boolean caseSensitive);
109
110     /**
111      * sets the evaluation mode to string endsWith comparison.
112      * @param caseSensitive comparison will be case sensitive if true, case insensitive otherwise
113      * @return this {@link Constraint} to allow the chaining of method calls.
114      */

115     public Constraint endsWith(boolean caseSensitive);
116
117
118     /**
119      * turns on not() comparison.
120      * @return this {@link Constraint} to allow the chaining of method calls.
121      */

122     public Constraint not ();
123     
124     
125     /**
126      * returns the Object the query graph was constrained with to
127      * create this {@link Constraint}.
128      * @return Object the constraining object.
129      */

130     public Object JavaDoc getObject();
131
132 }
133
Popular Tags