de.mguennewig.pobjects
Class LiteralSet

java.lang.Object
  extended by de.mguennewig.pobjects.LiteralSet
All Implemented Interfaces:
Term

public class LiteralSet
extends java.lang.Object
implements Term

A set of literal values (a, b, c, ...), where the elements are for example strings, numbers or an object.

Author:
Michael Günnewig

Constructor Summary
LiteralSet(java.lang.Object... values)
          Create a set of literal values.
 
Method Summary
 java.lang.Boolean contains(java.lang.Object value)
          Tests whether value is part of the set.
 boolean containsNull()
          Tests whether this set contains the null value.
 boolean equals(java.lang.Object obj)
          Tests whether this literal set is equal to another object.
 java.lang.String getSqlValue(EvalContext eval)
          Returns the SQL representation for this term.
 java.lang.Object getValue(int n)
          Returns the value at position n.
 int hashCode()
          
 boolean isConstant()
          Tests whether the expression can be evaluated without an object.
 boolean isJoin()
          Tests whether this expression enforces any kind of join.
 boolean isSelection()
          Tests whether this expression is a selection.
 int size()
          Returns the number of values in this literal set.
 java.lang.String toString()
          Returns a textual representation for this literal set.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LiteralSet

public LiteralSet(java.lang.Object... values)
Create a set of literal values.

Throws:
java.lang.IllegalArgumentException - if no values are given.
Method Detail

equals

public boolean equals(java.lang.Object obj)
Tests whether this literal set is equal to another object.

Overrides:
equals in class java.lang.Object
Returns:
true if the other object is an existing literal set with equal value list. Two value lists are equal, if they have the same length and every value is equal and in the same order as in the other list.

contains

public final java.lang.Boolean contains(java.lang.Object value)
Tests whether value is part of the set.

Returns:
true if value is part of the set, null if the set contains null, otherwise false

containsNull

public final boolean containsNull()
Tests whether this set contains the null value.


getSqlValue

public java.lang.String getSqlValue(EvalContext eval)
Returns the SQL representation for this term.

Specified by:
getSqlValue in interface Term
Parameters:
eval - An unused evaluation context.
See Also:
toString()

getValue

public final java.lang.Object getValue(int n)
Returns the value at position n.


hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

isConstant

public final boolean isConstant()
Description copied from interface: Term
Tests whether the expression can be evaluated without an object.

Specified by:
isConstant in interface Term

isJoin

public final boolean isJoin()
Description copied from interface: Term
Tests whether this expression enforces any kind of join.

Specified by:
isJoin in interface Term

isSelection

public final boolean isSelection()
Description copied from interface: Term
Tests whether this expression is a selection.

With selection is an expression meant that binds a Member to one Literal.

Specified by:
isSelection in interface Term

size

public final int size()
Returns the number of values in this literal set.


toString

public java.lang.String toString()
Returns a textual representation for this literal set.

Overrides:
toString in class java.lang.Object
Returns:
The textual representation as used in SQL.
See Also:
Literal.toString()