java.lang.Object
org.josql.expressions.Expression
org.josql.expressions.BinaryExpression
org.josql.expressions.InExpression
- public class InExpression
- extends BinaryExpression
This class represents in [ NOT ] IN [ LIKE ] [ ALL ] expression.
If any of the values listed are Maps or Collections then they are iterated over to see if a match
is found. For Maps only the key values are checked. If you pass a list then it is iterated over
using a for construct rather than an Iterator since it's much faster.
Note: due to the way that the expression is designed it is POSSIBLE to have a binary expression
in the in list, however at this time that is not supported since it can lead to an ambiguous result,
for example: true IN (true, false) has no sensible meaning.
Last Modified By: $Author: barrygently $
Last Modified On: $Date: 2005/04/28 05:48:59 $
Current Revision: $Revision: 1.3 $
| Fields inherited from class org.josql.expressions.Expression |
|
|
Method Summary |
void |
addItem(Expression e)
|
private boolean |
compareCollection(java.lang.Object o,
java.util.Collection c,
java.lang.String v,
java.lang.String wc)
|
private boolean |
compareItem(java.lang.Object o,
java.lang.Object n,
java.lang.String v,
java.lang.String wc)
|
private boolean |
compareList(java.lang.Object o,
java.util.List l,
java.lang.String v,
java.lang.String wc)
|
private boolean |
compareMap(java.lang.Object o,
java.util.Map m,
java.lang.String v,
java.lang.String wc)
|
java.util.List |
getItems()
|
void |
init(org.josql.Query q)
Initialise the IN expression. |
boolean |
isAll()
|
boolean |
isDoLike()
|
boolean |
isIgnoreCase()
|
boolean |
isNot()
|
boolean |
isTrue(java.lang.Object o,
org.josql.Query q)
Return whether this expression evaulates to true. |
void |
setAll(boolean v)
|
void |
setDoLike(boolean d)
|
void |
setIgnoreCase(boolean v)
|
void |
setItems(java.util.List items)
|
void |
setNot(boolean v)
|
java.lang.String |
toString()
Return a string representation of this expression. |
items
private java.util.List items
not
private boolean not
doLike
private boolean doLike
all
private boolean all
lPats
private java.util.Map lPats
ignoreCase
private boolean ignoreCase
InExpression
public InExpression()
init
public void init(org.josql.Query q)
throws org.josql.QueryParseException
- Initialise the IN expression. Init the LHS and then all of the values in the brackets.
- Overrides:
init in class BinaryExpression
setIgnoreCase
public void setIgnoreCase(boolean v)
isIgnoreCase
public boolean isIgnoreCase()
isAll
public boolean isAll()
setAll
public void setAll(boolean v)
isDoLike
public boolean isDoLike()
setDoLike
public void setDoLike(boolean d)
setItems
public void setItems(java.util.List items)
getItems
public java.util.List getItems()
addItem
public void addItem(Expression e)
isNot
public boolean isNot()
setNot
public void setNot(boolean v)
isTrue
public boolean isTrue(java.lang.Object o,
org.josql.Query q)
throws org.josql.QueryExecutionException
- Return whether this expression evaulates to
true. If any of the values on RHS are Maps (keys
only) or Collections then they are iterated over and checked against the LHS.
- Specified by:
isTrue in class Expression
compareCollection
private boolean compareCollection(java.lang.Object o,
java.util.Collection c,
java.lang.String v,
java.lang.String wc)
compareList
private boolean compareList(java.lang.Object o,
java.util.List l,
java.lang.String v,
java.lang.String wc)
compareItem
private boolean compareItem(java.lang.Object o,
java.lang.Object n,
java.lang.String v,
java.lang.String wc)
compareMap
private boolean compareMap(java.lang.Object o,
java.util.Map m,
java.lang.String v,
java.lang.String wc)
toString
public java.lang.String toString()
- Return a string representation of this expression.
In the form: Expression 55 [ NOT ] [$]IN [ LIKE ] [ ALL ]
( Expression 55 [ , Expression 55 * ] )
- Specified by:
toString in class Expression