Package org.biojavax.bio.seq
Class SimplePosition
java.lang.Object
org.biojavax.bio.seq.SimplePosition
- All Implemented Interfaces:
Position
A simple implementation of the Position interface.
- Since:
- 1.5
- Author:
- Richard Holland
-
Field Summary
Fields inherited from interface org.biojavax.bio.seq.Position
BETWEEN_BASES, EMPTY_POSITION, IN_RANGE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SimplePosition
(boolean fs, boolean fe, int p) Constructs a point position, with optionally fuzzy start and end.SimplePosition
(boolean fs, boolean fe, int s, int e, String t) Constructs a range position, with optionally fuzzy start and end.SimplePosition
(int p) Constructs a point position, with no fuzzy start or end.SimplePosition
(int s, int e) Constructs a range position, with no fuzzy start or end. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Two positions are equal if they share all parameters in common, eg. fuzzy start+end, start, end, type.int
getEnd()
Returns the end of the range of bases this base could lie in.boolean
Returns true if the position has a fuzzy end.boolean
Returns true if the position has a fuzzy start.getId()
Gets the Hibernate ID.int
getStart()
Returns the beginning of the range of bases this base could lie in.getType()
Returns the type of this position if it is not a point/single position.void
Sets the Hibernate ID.toString()
translate
(int distance) Takes this position and returns a copy translated by 'distance' bases.
-
Constructor Details
-
SimplePosition
Constructs a point position, with no fuzzy start or end. (eg. 1, 2, or 3).- Parameters:
p
- the point position
-
SimplePosition
Constructs a range position, with no fuzzy start or end. (eg. 1..2, 2..5, or 3..8).- Parameters:
s
- the start positione
- the end position
-
SimplePosition
Constructs a point position, with optionally fuzzy start and end. (eg. invalid input: '<'1 or 3> or 2 or even invalid input: '<'5>).- Parameters:
fs
- fuzzy start?fe
- fuzzy end?p
- the point position
-
SimplePosition
Constructs a range position, with optionally fuzzy start and end. (eg. invalid input: '<'1.2 or 1^3> or 2.2 or even invalid input: '<'5^6>). The type of the range is given, it should normally be one of the two defined in the Position interface, but its up to you.- Parameters:
fs
- fuzzy start?fe
- fuzzy end?s
- the start of the positione
- the end of the positiont
- the type of the position
-
SimplePosition
protected SimplePosition()
-
-
Method Details
-
getFuzzyStart
Returns true if the position has a fuzzy start.- Specified by:
getFuzzyStart
in interfacePosition
- Returns:
- the fuzziness of the start.
-
getFuzzyEnd
Returns true if the position has a fuzzy end.- Specified by:
getFuzzyEnd
in interfacePosition
- Returns:
- the fuzziness of the end.
-
getStart
Returns the beginning of the range of bases this base could lie in. If this position is a single position, then start=end. -
getEnd
Returns the end of the range of bases this base could lie in. If this position is a single position, then start=end. -
getType
Returns the type of this position if it is not a point/single position. Types are usually BETWEEN_BASES or IN_RANGE but could be any string value. -
translate
Takes this position and returns a copy translated by 'distance' bases. -
equals
Two positions are equal if they share all parameters in common, eg. fuzzy start+end, start, end, type. -
toString
-
getId
Gets the Hibernate ID. Should be used with caution.- Returns:
- the Hibernate ID, if using Hibernate.
-
setId
Sets the Hibernate ID. Should be used with caution.- Parameters:
id
- the Hibernate ID, if using Hibernate.
-