|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.intermine.objectstore.query.ConstraintHelper
public final class ConstraintHelper
Static methods to create Lists of Constraint objects in a query and
Constraints in a query relating to a given QueryClass, plus helper methods
for dealing with Constraints.
'left' and 'right' arguments for each constraint type are defined as follows:
SimpleConstraint: left = arg1, right = arg2 (both QueryEvaluables)
ClassConstraint: left = QueryClass arg1, right = a QueryClass or example object arg2
ContainsConstraint: left = the QueryReference - i.e. field of containing class
right = the QueryClass this reference is constrained to
SubQueryConstraint: left = the QueryClass or QueryEvaluable constrained to be in
the subquery
right = the query
ConstraintSet: N/A
| Method Summary | |
|---|---|
static void |
addToList(java.util.List<Constraint> list,
Constraint constraint)
Adds all the constraints present in the argument into the given List. |
static java.util.List<Constraint> |
createList(Query query)
Converts a constraint from a query into a List of Constraint objects. |
static java.util.List<Constraint> |
createList(Query query,
FromElement fromElement)
Return a List of Constraint objects that relate to the given FromElement. |
static java.util.List<Constraint> |
filter(java.util.List<Constraint> list,
FromElement fromElement,
boolean related)
Return a subset of the given List that contains only Constraints that relate to the given FromElement or constraints associated with nothing if fromElement is null. |
static java.lang.Object |
getLeftArgument(Constraint constraint)
Get the left argument of the given constraint, will return null if passed a ConstraintSet or a MultipleInBagConstraint. |
protected static java.util.Set<QueryField> |
getQueryFields(QueryEvaluable qe)
Descends into QueryExpression and QueryFunction objects to find all instances of QueryField. |
static java.lang.Object |
getRightArgument(Constraint constraint)
Get the right argument of the given constraint, will return null if passed a ConstraintSet or a MultipleInBagConstraint. |
static boolean |
isAssociatedWith(Constraint constraint,
FromElement fromElement)
Returns true if the constraint is associated with the given FromElement. |
static boolean |
isAssociatedWithNothing(Constraint c)
Returns true if the given constraint is associated with no particular FromElement. |
static boolean |
isCrossReference(Constraint constraint)
Returns true if the Constraint is a cross-reference between two QueryClasses. |
static boolean |
isRelatedTo(Constraint constraint,
FromElement fromElement)
Returns true if the constraint is associated with the given FromElement. |
static boolean |
isRelatedToNothing(Constraint c)
Returns true if the given constraint is related to no FromElement. |
static java.util.List<Constraint> |
listRelatedConstraints(Query query,
FromElement fromElement)
Return a List of Constraint objects that relate to the given FromElement. |
static void |
traverseConstraints(Constraint c,
ConstraintTraverseAction ca)
Traverse the given Constraint tree (ie. recursively look for nested constraints if the argument is a ConstraintSet) and call ConstraintTraverseAction for each Constraint. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.util.List<Constraint> createList(Query query)
query - a Query object to list Constraints for
public static java.util.List<Constraint> createList(Query query,
FromElement fromElement)
query - a Query object to to list contraints forfromElement - a FromElement that returned constraints relate to
public static void traverseConstraints(Constraint c,
ConstraintTraverseAction ca)
c - the Constraint to traverse - could be a ConstraintSet (possibly with nested
ConstraintSets)ca - ConstraintTraverseAction.apply() is called for each Constraint found
public static java.util.List<Constraint> listRelatedConstraints(Query query,
FromElement fromElement)
query - a Query object to to list contraints forfromElement - a FromElement that returned constraints relate to
public static java.util.List<Constraint> filter(java.util.List<Constraint> list,
FromElement fromElement,
boolean related)
list - a list of Constraints to filterfromElement - a fromElement that returned constraints relate torelated - if tru list all releted constraints, otherwise just associated
public static void addToList(java.util.List<Constraint> list,
Constraint constraint)
list - a List of Constraints, to which to add more entriesconstraint - a Constraint to pick apart
public static boolean isAssociatedWith(Constraint constraint,
FromElement fromElement)
constraint - the constraint in questionfromElement - the FromElement to check
public static boolean isAssociatedWithNothing(Constraint c)
c - the constraint to examine
public static boolean isRelatedTo(Constraint constraint,
FromElement fromElement)
constraint - the constraint in questionfromElement - the FromElement to check
public static boolean isRelatedToNothing(Constraint c)
c - the constraint to examine
public static boolean isCrossReference(Constraint constraint)
constraint - the contraint to test
protected static java.util.Set<QueryField> getQueryFields(QueryEvaluable qe)
qe - a QueryEvalubale to find QueryFields for
public static java.lang.Object getLeftArgument(Constraint constraint)
constraint - a constraint
public static java.lang.Object getRightArgument(Constraint constraint)
constraint - a constraint
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||