KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > types > BooleanDataValue


1 /*
2
3    Derby - Class org.apache.derby.iapi.types.BooleanDataValue
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.iapi.types;
23
24 import org.apache.derby.iapi.error.StandardException;
25
26 public interface BooleanDataValue extends DataValueDescriptor
27 {
28     public boolean getBoolean();
29
30     /**
31      * The SQL AND operator. This provides SQL semantics for AND with unknown
32      * truth values - consult any standard SQL reference for an explanation.
33      *
34      * @param otherValue The other BooleanDataValue to AND with this one
35      *
36      * @return this AND otherValue
37      *
38      */

39     public BooleanDataValue and(BooleanDataValue otherValue);
40
41     /**
42      * The SQL OR operator. This provides SQL semantics for OR with unknown
43      * truth values - consult any standard SQL reference for an explanation.
44      *
45      * @param otherValue The other BooleanDataValue to OR with this one
46      *
47      * @return this OR otherValue
48      *
49      */

50     public BooleanDataValue or(BooleanDataValue otherValue);
51
52     /**
53      * The SQL IS operator - consult any standard SQL reference for an explanation.
54      *
55      * Implements the following truth table:
56      *
57      * otherValue
58      * | TRUE | FALSE | UNKNOWN
59      * this |----------------------------
60      * |
61      * TRUE | TRUE | FALSE | FALSE
62      * FALSE | FALSE | TRUE | FALSE
63      * UNKNOWN | FALSE | FALSE | TRUE
64      *
65      *
66      * @param otherValue BooleanDataValue to compare to. May be TRUE, FALSE, or UNKNOWN.
67      *
68      * @return whether this IS otherValue
69      *
70      */

71     public BooleanDataValue is(BooleanDataValue otherValue);
72
73     /**
74      * Implements NOT IS. This reverses the sense of the is() call.
75      *
76      *
77      * @param otherValue BooleanDataValue to compare to. May be TRUE, FALSE, or UNKNOWN.
78      *
79      * @return NOT( this IS otherValue )
80      *
81      */

82     public BooleanDataValue isNot(BooleanDataValue otherValue);
83
84     /**
85      * Throw an exception with the given SQLState if this BooleanDataValue
86      * is false. This method is useful for evaluating constraints.
87      *
88      * @param SQLState The SQLState of the exception to throw if
89      * this SQLBoolean is false.
90      * @param tableName The name of the table to include in the exception
91      * message.
92      * @param constraintName The name of the failed constraint to include
93      * in the exception message.
94      *
95      * @return this
96      *
97      * @exception StandardException Thrown if this BooleanDataValue
98      * is false.
99      */

100     public BooleanDataValue throwExceptionIfFalse(
101                                     String JavaDoc SQLState,
102                                     String JavaDoc tableName,
103                                     String JavaDoc constraintName)
104                             throws StandardException;
105
106     /*
107     ** NOTE: The NOT operator is translated to "= FALSE", which does the same
108     ** thing.
109     */

110
111     /**
112      * Set the value of this BooleanDataValue.
113      *
114      * @param theValue Contains the boolean value to set this BooleanDataValue
115      * to. Null means set this BooleanDataValue to null.
116      */

117     public void setValue(Boolean JavaDoc theValue);
118
119     /**
120      * Tell whether a BooleanDataValue has the given value. This is useful
121      * for short-circuiting.
122      *
123      * @param value The value to look for
124      *
125      * @return true if the BooleanDataValue contains the given value.
126      */

127     public boolean equals(boolean value);
128     
129     /**
130      * Return an immutable BooleanDataValue with the same value as this.
131      * @return An immutable BooleanDataValue with the same value as this.
132      */

133     public BooleanDataValue getImmutable();
134 }
135
Popular Tags