|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava.utils.AbstractChangeable
org.biojavax.bio.seq.SimpleRichLocation
public class SimpleRichLocation
A simple implementation of RichLocation.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.biojavax.bio.seq.RichLocation |
---|
RichLocation.Strand, RichLocation.Tools |
Nested classes/interfaces inherited from interface org.biojava.bio.Annotatable |
---|
Annotatable.AnnotationForwarder |
Field Summary | |
---|---|
protected int |
circularLength
|
protected ComparableTerm |
term
|
Fields inherited from interface org.biojavax.bio.seq.RichLocation |
---|
CIRCULAR, EMPTY_LOCATION, FEATURE, NOTE, RANK, TERM |
Fields inherited from interface org.biojava.bio.symbol.Location |
---|
empty, full, naturalOrder |
Fields inherited from interface org.biojava.bio.Annotatable |
---|
ANNOTATION |
Constructor Summary | |
---|---|
protected |
SimpleRichLocation()
|
|
SimpleRichLocation(Position pos,
int rank)
Creates a new instance of SimpleRichSequenceLocation that points to a single position on the positive strand. |
|
SimpleRichLocation(Position pos,
int rank,
RichLocation.Strand strand)
Creates a new instance of SimpleRichSequenceLocation that points to a single position. |
|
SimpleRichLocation(Position pos,
int rank,
RichLocation.Strand strand,
CrossRef crossRef)
Creates a new instance of SimpleRichSequenceLocation that points to a single position on another sequence. |
|
SimpleRichLocation(Position min,
Position max,
int rank)
Creates a new instance of SimpleRichSequenceLocation that points to a range position on the positive strand. |
|
SimpleRichLocation(Position min,
Position max,
int rank,
RichLocation.Strand strand)
Creates a new instance of SimpleRichSequenceLocation that points to a range position. |
|
SimpleRichLocation(Position min,
Position max,
int rank,
RichLocation.Strand strand,
CrossRef crossRef)
Creates a new instance of SimpleRichSequenceLocation that points to a range position on another sequence. |
Method Summary | |
---|---|
Iterator |
blockIterator()
Return an Iterator over the set of maximal contiguous sub-locations. |
int |
compareTo(Object o)
Locations are sorted first by rank, then crossref, then strand, then term, then min, then max. |
boolean |
contains(int p)
Checks if this location contains a point. |
boolean |
contains(Location l)
Checks if this location contains the other. A location contains another location if it overlaps it, and the coordinates enclose those of the other location at both ends, and they fall on the same strand. |
boolean |
equals(Object o)
Checks if this location is equivalent to the other. Locations are equal if their term, min, max, strand, and crossref are the same, and if their rank is the same too. |
Annotation |
getAnnotation()
Should return the associated annotation object. |
int |
getCircularLength()
Retrieves the circular length of this location. |
CrossRef |
getCrossRef()
Retrieves the crossref associated with this location. |
Location |
getDecorator(Class decoratorClass)
Checks the decorator chain for an instance of |
RichFeature |
getFeature()
Retrieves the feature this location is associated with. |
Integer |
getId()
Gets the Hibernate ID. |
int |
getMax()
The maximum position contained. |
Position |
getMaxPosition()
Retrieves the end position of this location. |
int |
getMin()
The minimum position contained. |
Position |
getMinPosition()
Retrieves the start position of this location. |
Set |
getNoteSet()
Returns the set of notes associated with this object. Warning this method gives access to the original Collection not a copy. |
int |
getRank()
Retrieves the rank associated with this location. |
RichAnnotation |
getRichAnnotation()
Return the associated annotation object. |
RichLocation.Strand |
getStrand()
Retrieves the strand associated with this location. |
ComparableTerm |
getTerm()
Retrieves the term associated with this location. |
int |
hashCode()
|
Location |
intersection(Location l)
Returns a Location that contains all points common to both ranges. If the locations overlap and are on the same strand, the intersection is returned. |
boolean |
isContiguous()
Determine if a Location is contiguous. |
Location |
newInstance(Location loc)
Create a new instance of Location with all of the same decorators as this instance but with the data stored in loc . |
boolean |
overlaps(Location l)
Checks if these two locations overlap, using this location's concept of overlapping. A location overlaps another location if it is on the same sequence, and the coordinates overlap, and both are of the same circularity. |
protected Position |
posmax(Position a,
Position b)
|
protected Position |
posmin(Position a,
Position b)
|
void |
setCircularLength(int circularLength)
Sets the circular length of this location. |
protected void |
setCrossRef(CrossRef crossRef)
|
void |
setCrossRefResolver(CrossReferenceResolver r)
Sets the cross ref resolver to use when retrieving remote symbols. |
void |
setFeature(RichFeature feature)
Sets the feature this location is associated with. |
void |
setId(Integer id)
Sets the Hibernate ID. |
protected void |
setMaxPosition(Position max)
|
protected void |
setMinPosition(Position min)
|
void |
setNoteSet(Set notes)
Clears the notes associated with this object and replaces them with the contents of this set. Warning this method gives access to the original Collection not a copy. |
void |
setPositionResolver(PositionResolver p)
Sets the resolver to use when working out actual base coordinates from fuzzy positions. |
void |
setRank(int rank)
Sets the rank for this location. |
protected void |
setStrand(RichLocation.Strand strand)
|
void |
setTerm(ComparableTerm term)
Sets the term for this location. |
void |
sort()
Sorts the member locations of a compound location. |
SymbolList |
symbols(SymbolList seq)
Return the symbols in a sequence that fall within this range. If the location is circular but the sequence is not, or they are both circular but of different circular lengths, an exception is thrown. |
String |
toString()
Form: "start..end" or just "point" for point locations |
Location |
translate(int dist)
Create a location that is a translation of this location. |
Location |
union(Location l)
Return a Location containing all points in either ranges. A merged SimpleRichLocation is returned if the two locations overlap and are on the same strand. |
Methods inherited from class org.biojava.utils.AbstractChangeable |
---|
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.biojava.utils.Changeable |
---|
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener |
Field Detail |
---|
protected ComparableTerm term
protected int circularLength
Constructor Detail |
---|
public SimpleRichLocation(Position pos, int rank)
pos
- the location position (a point).rank
- Rank of location.public SimpleRichLocation(Position pos, int rank, RichLocation.Strand strand)
pos
- the location position (a point).rank
- Rank of location.strand
- The strand of the locationpublic SimpleRichLocation(Position pos, int rank, RichLocation.Strand strand, CrossRef crossRef)
pos
- the location position (a point).rank
- Rank of location.strand
- the strand of the locationcrossRef
- a cross reference to another object (null for parent sequence)public SimpleRichLocation(Position min, Position max, int rank)
min
- the minimum bound of the locationmax
- the maximum bound of the locationrank
- Rank of location.public SimpleRichLocation(Position min, Position max, int rank, RichLocation.Strand strand)
min
- the minimum bound of the locationmax
- the maximum bound of the locationrank
- Rank of location.strand
- the strand of the locationpublic SimpleRichLocation(Position min, Position max, int rank, RichLocation.Strand strand, CrossRef crossRef)
min
- the minimum bound of the locationmax
- the maximum bound of the locationrank
- Rank of location.strand
- the strand of the locationcrossRef
- a cross reference to another object (null for parent sequence)protected SimpleRichLocation()
Method Detail |
---|
public void sort()
sort
in interface RichLocation
public RichFeature getFeature()
getFeature
in interface RichLocation
public void setFeature(RichFeature feature) throws ChangeVetoException
setFeature
in interface RichLocation
feature
- the feature.
ChangeVetoException
public CrossRef getCrossRef()
getCrossRef
in interface RichLocation
protected void setCrossRef(CrossRef crossRef)
public Annotation getAnnotation()
getAnnotation
in interface Annotatable
public RichAnnotation getRichAnnotation()
getRichAnnotation
in interface RichAnnotatable
public Set getNoteSet()
getNoteSet
in interface RichAnnotatable
Note
public void setNoteSet(Set notes) throws ChangeVetoException
setNoteSet
in interface RichAnnotatable
notes
- the set of Note objects to replace the existing ones with.
ChangeVetoException
- if the set is null or contains any objects
that are not Note objects.Note
public ComparableTerm getTerm()
getTerm
in interface RichLocation
public void setTerm(ComparableTerm term) throws ChangeVetoException
setTerm
in interface RichLocation
term
- the term this location should adopt.
ChangeVetoException
- in case of error.public int getCircularLength()
getCircularLength
in interface RichLocation
public void setCircularLength(int circularLength) throws ChangeVetoException
setCircularLength
in interface RichLocation
circularLength
- the circular length of this location
ChangeVetoException
- if it doesn't want to change.public RichLocation.Strand getStrand()
getStrand
in interface RichLocation
protected void setStrand(RichLocation.Strand strand)
public int getRank()
getRank
in interface RichLocation
public void setRank(int rank) throws ChangeVetoException
setRank
in interface RichLocation
rank
- the rank this location should adopt.
ChangeVetoException
- in case of error.public int getMax()
WARNING: The location will not contain every point between getMin()
and getMax()
if isContiguous()
is false. If isContiguous()
does return false you should use the Iterator
returned by blockIterator()
to iterate over the minimum set of contiguous blocks that make up this Location
getMax
in interface Location
public int getMin()
WARNING: The location will not contain every point between getMin()
and getMax()
if isContiguous()
is false. If isContiguous()
does return false you should use the Iterator
returned by blockIterator()
to iterate over the minimum set of contiguous blocks that make up this Location
getMin
in interface Location
public Position getMinPosition()
getMinPosition
in interface RichLocation
protected void setMinPosition(Position min)
public Position getMaxPosition()
getMaxPosition
in interface RichLocation
protected void setMaxPosition(Position max)
public void setPositionResolver(PositionResolver p)
setPositionResolver
in interface RichLocation
p
- the position resolver to use.public Iterator blockIterator()
Given any location, it can be considered to contain zero or more maximal contiguous blocks of width 1 or greater. The empty location is composed from nothing. A contiguous location is composed from itself. A non-contiguous location is composed from contiguous blocks seperated by gaps.
This method should return an Iterator over these maximally contiguous blocks starting with the left-most block, and finishing at the right-most block.
blockIterator
in interface Location
public boolean isContiguous()
isContiguous
in interface Location
true
if and only if this Location
contains every point from min
to
max
inclusive.public boolean contains(int p)
contains
in interface Location
p
- the point to check
public Location getDecorator(Class decoratorClass)
The default behavior is to return null. If the current object is a
decorator and is an instance of
getDecorator
in interface Location
decoratorClass
- the Class to check
public Location newInstance(Location loc)
loc
.
The default behavior is to return loc
.
newInstance
in interface Location
loc
- the Location to use as template
public Location translate(int dist)
translate
in interface Location
dist
- the distance to translate (to the right)public boolean contains(Location l)
Abstractly, a location contains another if every point in the other location is contained within this one. A location contains another location if it overlaps it, and the coordinates enclose those of the other location at both ends, and they fall on the same strand.
contains
in interface Location
l
- the Location to check
public boolean overlaps(Location l)
Abstractly, two locations overlap if they both contain any point. A location overlaps another location if it is on the same sequence, and the coordinates overlap, and both are of the same circularity.
overlaps
in interface Location
l
- the Location to check
public Location union(Location l)
union
in interface Location
l
- the Location to union with
public Location intersection(Location l)
intersection
in interface Location
l
- the Location to intersect with
protected Position posmin(Position a, Position b)
protected Position posmax(Position a, Position b)
public void setCrossRefResolver(CrossReferenceResolver r)
setCrossRefResolver
in interface RichLocation
r
- the resolver to use.public SymbolList symbols(SymbolList seq)
symbols
in interface Location
seq
- the SymbolList to process
public int hashCode()
hashCode
in class Object
public boolean equals(Object o)
Abstractly, a location is equal to another if for every point in one it is also in the other. This is equivalent to a.contains(b) && b.contains(a). You should call LocationTools.areEqual after casting l to Location. Locations are equal if their term, min, max, strand, and crossref are the same, and if their rank is the same too.
equals
in interface Location
equals
in class Object
o
- the Object to check
public int compareTo(Object o)
compareTo
in interface Comparable
public String toString()
toString
in class Object
public Integer getId()
public void setId(Integer id)
id
- the Hibernate ID, if using Hibernate.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |