Package org.intermine.objectstore.query
Class ConstraintSet
- java.lang.Object
-
- org.intermine.objectstore.query.Constraint
-
- org.intermine.objectstore.query.ConstraintSet
-
public class ConstraintSet extends Constraint
Groups a series of Constraints together. Specify whether in the query the relationship between them should be AND or OR- Author:
- Richard Smith, Mark Woodbridge, Matthew Wakeling
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.LinkedHashSet<Constraint>
constraints
protected static java.util.List<ConstraintOp>
VALID_OPS
-
Fields inherited from class org.intermine.objectstore.query.Constraint
op
-
-
Constructor Summary
Constructors Constructor Description ConstraintSet(ConstraintOp op)
Construct empty ConstraintSet
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConstraintSet
addConstraint(Constraint constraint)
Add a Constraint to the setboolean
equals(java.lang.Object obj)
Test whether two ConstraintSets are equal, overrides Object.equals().java.util.Set<Constraint>
getConstraints()
Returns the Set of constraints.int
hashCode()
Get the hashCode for this object overrides Object.hashCode().ConstraintSet
removeConstraint(Constraint constraint)
Remove specified constraintjava.lang.String
toString()
-
Methods inherited from class org.intermine.objectstore.query.Constraint
getOp, negate
-
-
-
-
Field Detail
-
constraints
protected java.util.LinkedHashSet<Constraint> constraints
-
VALID_OPS
protected static final java.util.List<ConstraintOp> VALID_OPS
-
-
Constructor Detail
-
ConstraintSet
public ConstraintSet(ConstraintOp op)
Construct empty ConstraintSet- Parameters:
op
- relationship between constraints
-
-
Method Detail
-
addConstraint
public ConstraintSet addConstraint(Constraint constraint)
Add a Constraint to the set- Parameters:
constraint
- Constraint to be added to set- Returns:
- this ConstraintSet
-
removeConstraint
public ConstraintSet removeConstraint(Constraint constraint)
Remove specified constraint- Parameters:
constraint
- Constraint to be removed from set- Returns:
- this ConstraintSet
-
getConstraints
public java.util.Set<Constraint> getConstraints()
Returns the Set of constraints.- Returns:
- Set of Constraint objects
-
equals
public boolean equals(java.lang.Object obj)
Test whether two ConstraintSets are equal, overrides Object.equals(). constraints are held in LinkedHashSet, it uses the Set.equals() method which should check for equality regardless of the element ordering imposed in LinkedHashSet.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the object to compare with- Returns:
- true if objects are equal
-
hashCode
public int hashCode()
Get the hashCode for this object overrides Object.hashCode().- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the hashCode
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-