Package org.biojava.bio
Class PropertyConstraint.Enumeration
java.lang.Object
org.biojava.bio.PropertyConstraint.Enumeration
- All Implemented Interfaces:
PropertyConstraint
- Enclosing interface:
- PropertyConstraint
Enumeration accepts a property if it is present
in the specified set of values.
If you want to declare that a property must be within a range
of values, for example PRIMARY_COLOR is one of "RED, YELLOW, BLUE"
Use with FilterUtils.byAnnotation() to search for features
with properties set to a range of values- Since:
- 1.3
- Author:
- Matthew Pocock
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.biojava.bio.PropertyConstraint
PropertyConstraint.And, PropertyConstraint.ByAnnotationType, PropertyConstraint.ByClass, PropertyConstraint.Enumeration, PropertyConstraint.ExactValue, PropertyConstraint.Or -
Field Summary
Fields inherited from interface org.biojava.bio.PropertyConstraint
ANY, NONE -
Constructor Summary
ConstructorsConstructorDescriptionEnumeration(Object[] values) Creates a newEnumerationusing the elements of the specified array as a constraint.Enumeration(Set values) Creates a newEnumerationusing the members of the specified set as a constraint. -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptreturns true if the value fulfills the constraint.getValuesreturns the set of values which constrain the property.booleansubConstraintOf(PropertyConstraint subConstraint) subConstraintOfreturns true if the constraint is a sub-constraint.toString()
-
Constructor Details
-
Enumeration
Creates a newEnumerationusing the members of the specified set as a constraint.- Parameters:
values- aSetof all possible values
-
Enumeration
Creates a newEnumerationusing the elements of the specified array as a constraint.- Parameters:
values- anArrayof all possible values
-
-
Method Details
-
getValues
getValuesreturns the set of values which constrain the property.- Returns:
- a
Set.
-
accept
Description copied from interface:PropertyConstraintacceptreturns true if the value fulfills the constraint. Manually compare items with the PropertyConstraint. Node: this will ususaly be done for you in an AnnotationType instance Use for implementing accept() on AnnotatoinType- Specified by:
acceptin interfacePropertyConstraint- Parameters:
value- anObjectto check.- Returns:
- a
boolean.
-
subConstraintOf
Description copied from interface:PropertyConstraintsubConstraintOfreturns true if the constraint is a sub-constraint.A pair of constraints super and sub are in a superConstraint/subConstraint relationship if every object accepted by sub is also accepted by super. To put it another way, if instanceOf was used as a set-membership indicator function over some set of objects, then the set produced by super would be a superset of that produced by sub.
It is not expected that constraints will neccesarily maintain references to super/sub types. It will be more usual to infer this relationship by introspecting the constraints themselves. For example,
Useful when attempting to compare two constraints to see if it is necisary to retain both. You may want to check the more general or the more specific constraint only.PropertyConstraint.ByClasswill infer subConstraintOf by looking at the possible class of all items matching subConstraint.- Specified by:
subConstraintOfin interfacePropertyConstraint- Parameters:
subConstraint- aPropertyConstraintto check.- Returns:
- a
boolean.
-
toString
-