HiRISE

HiRISE.HiReport.sql
Class Constraint

java.lang.Object
  extended by HiRISE.HiReport.sql.Constraint
Direct Known Subclasses:
SubqueryConstraint

public class Constraint
extends Object

Author:
guymac

Field Summary
protected  LinkedHashMap<Constraint,Column> constraints
          map of multiple constraints, will be created if needed
 
Constructor Summary
Constraint(String operator)
          Create a new constraint with the given operator
 
Method Summary
 Constraint and(Column c, Constraint constraint)
          Add a subordinate 'AND' constraint to a column
 HashMap<Constraint,Column> getConstraints()
          Get a map of subordinate constraints
 Object getValue()
          Get the constrained value or null if the constraint has no value (it is on a column)
protected  void goMultiple()
          Change this constraint so that it can contain subordinate constraints
 boolean isMultiple()
          Return true if this constraint contains subordinate constraints
 Constraint or(Column c, Constraint constraint)
          Add a subordinate 'OR' constraint to a column
 Constraint setValue(Object value)
          Set the value being constrained
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

constraints

protected LinkedHashMap<Constraint,Column> constraints
map of multiple constraints, will be created if needed

Constructor Detail

Constraint

public Constraint(String operator)
Create a new constraint with the given operator

Parameters:
operator - or SQL keyword
Method Detail

setValue

public Constraint setValue(Object value)
Set the value being constrained

Parameters:
value - The value
Returns:
This constraint

toString

public String toString()
Overrides:
toString in class Object

getValue

public Object getValue()
Get the constrained value or null if the constraint has no value (it is on a column)

Returns:
value or null if the constraint is on a column

getConstraints

public HashMap<Constraint,Column> getConstraints()
Get a map of subordinate constraints

Returns:
map from constraint to column being constrained

and

public Constraint and(Column c,
                      Constraint constraint)
Add a subordinate 'AND' constraint to a column

Parameters:
c - the column
constraint - the constraint
Returns:
the parent constraint (this)

or

public Constraint or(Column c,
                     Constraint constraint)
Add a subordinate 'OR' constraint to a column

Parameters:
c - the column
constraint - the constraint
Returns:
the parent constraint (this)

goMultiple

protected void goMultiple()
Change this constraint so that it can contain subordinate constraints


isMultiple

public boolean isMultiple()
Return true if this constraint contains subordinate constraints

Returns:
true if multiple

HiRISE

Copyright (C) Arizona Board of Regents on behalf of the Planetary Image Research Laboratory, Lunar and Planetary Laboratory at the University of Arizona