public class SimpleRichLocation extends AbstractChangeable implements RichLocation
RichLocation.Strand, RichLocation.Tools
Annotatable.AnnotationForwarder
Modifier and Type | Field and Description |
---|---|
protected int |
circularLength |
protected ComparableTerm |
term |
CIRCULAR, EMPTY_LOCATION, FEATURE, NOTE, RANK, TERM
empty, full, naturalOrder
ANNOTATION
Modifier | Constructor and Description |
---|---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
boolean |
equals(Object o)
Checks if this location is equivalent to the other.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
protected ComparableTerm term
protected int circularLength
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()
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 locationChangeVetoException
- 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
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
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)
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 checkpublic Location newInstance(Location loc)
loc
.
The default behavior is to return loc
.
newInstance
in interface Location
loc
- the Location to use as templatepublic Location translate(int dist)
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.
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.
public Location union(Location l)
public Location intersection(Location l)
intersection
in interface Location
l
- the Location to intersect withpublic void setCrossRefResolver(CrossReferenceResolver r)
setCrossRefResolver
in interface RichLocation
r
- the resolver to use.public SymbolList symbols(SymbolList seq)
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.
public int compareTo(Object o)
compareTo
in interface Comparable
public Integer getId()
Copyright © 2014 BioJava. All rights reserved.