Package org.biojavax.bio.seq
Class SimplePosition
- java.lang.Object
-
- org.biojavax.bio.seq.SimplePosition
-
- All Implemented Interfaces:
Position
public class SimplePosition extends Object implements 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
Constructors Modifier Constructor Description protected
SimplePosition()
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
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
getFuzzyEnd()
Returns true if the position has a fuzzy end.boolean
getFuzzyStart()
Returns true if the position has a fuzzy start.Integer
getId()
Gets the Hibernate ID.int
getStart()
Returns the beginning of the range of bases this base could lie in.String
getType()
Returns the type of this position if it is not a point/single position.void
setId(Integer id)
Sets the Hibernate ID.String
toString()
Position
translate(int distance)
Takes this position and returns a copy translated by 'distance' bases.
-
-
-
Constructor Detail
-
SimplePosition
public SimplePosition(int p)
Constructs a point position, with no fuzzy start or end. (eg. 1, 2, or 3).- Parameters:
p
- the point position
-
SimplePosition
public SimplePosition(int s, int e)
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
public SimplePosition(boolean fs, boolean fe, int p)
Constructs a point position, with optionally fuzzy start and end. (eg. <1 or 3> or 2 or even <5>).- Parameters:
fs
- fuzzy start?fe
- fuzzy end?p
- the point position
-
SimplePosition
public SimplePosition(boolean fs, boolean fe, int s, int e, String t)
Constructs a range position, with optionally fuzzy start and end. (eg. <1.2 or 1^3> or 2.2 or even <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 Detail
-
getFuzzyStart
public boolean getFuzzyStart()
Returns true if the position has a fuzzy start.- Specified by:
getFuzzyStart
in interfacePosition
- Returns:
- the fuzziness of the start.
-
getFuzzyEnd
public boolean getFuzzyEnd()
Returns true if the position has a fuzzy end.- Specified by:
getFuzzyEnd
in interfacePosition
- Returns:
- the fuzziness of the end.
-
getStart
public int 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
public int 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
public String 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
public Position translate(int distance)
Takes this position and returns a copy translated by 'distance' bases.
-
equals
public boolean equals(Object o)
Two positions are equal if they share all parameters in common, eg. fuzzy start+end, start, end, type.
-
getId
public Integer getId()
Gets the Hibernate ID. Should be used with caution.- Returns:
- the Hibernate ID, if using Hibernate.
-
-