Package org.intermine.api.query.range
Class AbstractHelper
- java.lang.Object
-
- org.intermine.api.query.range.AbstractHelper
-
- All Implemented Interfaces:
RangeHelper
public abstract class AbstractHelper extends java.lang.Object implements RangeHelper
A class that can be extended to easily create RangeHelpers for a particular type. To create a valid range helper any extending class need only provide a definition for what it means to be with a set of ranges, and a mechanism for parsing individual ranges.- Author:
- Alex Kalderimis
-
-
Constructor Summary
Constructors Constructor Description AbstractHelper()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Constraint
createConstraint(Queryable q, QueryNode node, PathConstraintRange con)
Extending classes may with to override this method if they need to adjust the main constraint set in some way, such as adding an extra constraint.protected ConstraintOptions
getContainsOptions()
By default the CONTAINS options are same as the WITHIN options with the left and right operators swapped.protected ConstraintOptions
getDoesntContainOptions()
By default the DOES NOT CONTAINS options are negation of the CONTAINS options.protected ConstraintOptions
getDoesntOverlapOptions()
By default the DOES NOT OVERLAP options are negation of the OVERLAPS options.protected ConstraintOptions
getOutsideOptions()
By default the OUTSIDE options are the negation of the WITHIN options, with the right and left fields swapped.protected ConstraintOptions
getOverlapsOptions()
By default the OVERLAPS options are the same as the WITHIN options with the right and left fields swapped.protected abstract ConstraintOptions
getWithinOptions()
protected Constraint
makeRangeConstraint(ConstraintOp op, Range range, ConstraintOptions options, QueryField left, QueryField right, QueryClass node)
Construct a constraint for an individual range, to be combined as per the ConstraintOptions.protected abstract Range
parseRange(java.lang.String range)
Construct a Range object from a string defining one of the ranges this constraint operates on.
-
-
-
Method Detail
-
createConstraint
public Constraint createConstraint(Queryable q, QueryNode node, PathConstraintRange con)
Extending classes may with to override this method if they need to adjust the main constraint set in some way, such as adding an extra constraint.- Specified by:
createConstraint
in interfaceRangeHelper
- Parameters:
q
- queryablenode
- query class to constraintcon
- range constraint- Returns:
- constraint
-
makeRangeConstraint
protected Constraint makeRangeConstraint(ConstraintOp op, Range range, ConstraintOptions options, QueryField left, QueryField right, QueryClass node)
Construct a constraint for an individual range, to be combined as per the ConstraintOptions. Override this method if you need finer grain control over the content of each constraint, in order, for example to add a further constraint to the constructed constraint set.- Parameters:
op
- The operator we are creating constraints for (eg. WITHIN, OUTSIDE, OVERLAPS...).range
- The parsed range we are constructing a constraint for.options
- The generated bundle of configured values.left
- The field to be constrained in the left side constraint.right
- The field to be constrained in the right side constraint.node
- query class to constrain- Returns:
- A constraint.
-
getWithinOptions
protected abstract ConstraintOptions getWithinOptions()
- Returns:
- The options that define what it means for the constrained object to be WITHIN a given set of ranges.
-
getOutsideOptions
protected ConstraintOptions getOutsideOptions()
By default the OUTSIDE options are the negation of the WITHIN options, with the right and left fields swapped.- Returns:
- The options that define what it means for the constrained object to be OUTSIDE a given set of ranges.
-
getOverlapsOptions
protected ConstraintOptions getOverlapsOptions()
By default the OVERLAPS options are the same as the WITHIN options with the right and left fields swapped.- Returns:
- The options that define what it means for the constrained object to OVERLAP a given set of ranges.
-
getDoesntOverlapOptions
protected ConstraintOptions getDoesntOverlapOptions()
By default the DOES NOT OVERLAP options are negation of the OVERLAPS options.- Returns:
- The options that define what it means for the constrained object to NOT OVERLAP a given set of ranges.
-
getContainsOptions
protected ConstraintOptions getContainsOptions()
By default the CONTAINS options are same as the WITHIN options with the left and right operators swapped.- Returns:
- The options that define what it means for the constrained object to CONTAIN a given set of ranges.
-
getDoesntContainOptions
protected ConstraintOptions getDoesntContainOptions()
By default the DOES NOT CONTAINS options are negation of the CONTAINS options.- Returns:
- The options that define what it means for the constrained object to NOT CONTAIN a given set of ranges.
-
parseRange
protected abstract Range parseRange(java.lang.String range)
Construct a Range object from a string defining one of the ranges this constraint operates on.- Parameters:
range
- A string describing a range (eg: "1 .. 10").- Returns:
- A parsed range object.
-
-