Class SelfOrThis
java.lang.Object
org.biopax.paxtools.pattern.constraint.ConstraintAdapter
org.biopax.paxtools.pattern.constraint.SelfOrThis
- All Implemented Interfaces:
Constraint
When a constraint excludes the origin element, but it is needed to be among them, use this
constraint. The wrapped constraint must have size 2.
- Author:
- Ozgun Babur
-
Field Summary
Fields inherited from class org.biopax.paxtools.pattern.constraint.ConstraintAdapter
blacklist, size -
Constructor Summary
ConstructorsConstructorDescriptionSelfOrThis(Constraint con) Constructor with the wrapped constraint.SelfOrThis(Constraint con, int selfIndex) Constructor with the wrapped constraint and index of self. -
Method Summary
Modifier and TypeMethodDescriptionbooleanThis is a generative constraint.Gets the first mapped element along with the generated elements of wrapped constraint.intReturns size of the wrapped constraint.booleanChecks if the last index is either generated or equal to the first element.Methods inherited from class org.biopax.paxtools.pattern.constraint.ConstraintAdapter
assertIndLength, convertStepDirection, findDirectionInCatalysis, findDirectionInPathways, getCatalysisDirection, getControlChain, getConvParticipants, getDirection, getDirection, getDirection, getDirection, setSize
-
Constructor Details
-
SelfOrThis
Constructor with the wrapped constraint. Index of self is 0 by default.- Parameters:
con- wrapped constraint
-
SelfOrThis
Constructor with the wrapped constraint and index of self. This index cannot map to the last element, but has to map one of the previous ones.- Parameters:
con- wrapped constraintselfIndex- index of self
-
-
Method Details
-
getVariableSize
public int getVariableSize()Returns size of the wrapped constraint.- Specified by:
getVariableSizein interfaceConstraint- Overrides:
getVariableSizein classConstraintAdapter- Returns:
- size of the wrapped constraint
-
canGenerate
public boolean canGenerate()This is a generative constraint.- Specified by:
canGeneratein interfaceConstraint- Overrides:
canGeneratein classConstraintAdapter- Returns:
- true
-
generate
Gets the first mapped element along with the generated elements of wrapped constraint.- Specified by:
generatein interfaceConstraint- Overrides:
generatein classConstraintAdapter- Parameters:
match- current pattern matchind- mapped indices- Returns:
- first mapped element along with the generated elements of wrapped constraint
-
satisfies
Checks if the last index is either generated or equal to the first element.- Specified by:
satisfiesin interfaceConstraint- Overrides:
satisfiesin classConstraintAdapter- Parameters:
match- current pattern matchind- mapped indices- Returns:
- true if the last index is either generated or equal to the first element
-