public class CompoundRichLocation extends SimpleRichLocation implements RichLocation
RichLocation.Strand, RichLocation.Tools
Annotatable.AnnotationForwarder
Modifier and Type | Field and Description |
---|---|
protected List |
members |
protected int |
size |
circularLength, term
CIRCULAR, EMPTY_LOCATION, FEATURE, NOTE, RANK, TERM
empty, full, naturalOrder
ANNOTATION
Modifier | Constructor and Description |
---|---|
protected |
CompoundRichLocation() |
|
CompoundRichLocation(Collection members)
Constructs a CompoundRichLocation from the given set of members, with
the default term of "join".
|
|
CompoundRichLocation(ComparableTerm term,
Collection members)
Constructs a CompoundRichLocation from the given set of members.
|
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.
|
Location |
getDecorator(Class decoratorClass)
Checks the decorator chain for an instance of
|
static ComparableTerm |
getJoinTerm()
Getter for the "join" term
|
Set |
getNoteSet()
Returns the set of notes associated with this object.
|
static ComparableTerm |
getOrderTerm()
Getter for the "order" term
|
RichAnnotation |
getRichAnnotation()
Return the associated annotation object.
|
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.
|
void |
setCircularLength(int sourceSeqLength)
Sets the circular length of this location.
|
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 |
setNoteSet(Set notes)
Clears the notes associated with this object and replaces them with
the contents of this set.
|
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.
|
getCircularLength, getCrossRef, getFeature, getId, getMax, getMaxPosition, getMin, getMinPosition, getRank, getStrand, getTerm, posmax, posmin, setCrossRef, setId, setMaxPosition, setMinPosition, setPositionResolver, setRank, setStrand
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getCircularLength, getCrossRef, getFeature, getMaxPosition, getMinPosition, getRank, getStrand, getTerm, setPositionResolver, setRank
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
public CompoundRichLocation(Collection members)
members
- the members to put into the compound location.RichLocation.Tools
public CompoundRichLocation(ComparableTerm term, Collection members)
term
- the term to use when describing the group of members.members
- the members to put into the compound location.RichLocation.Tools
protected CompoundRichLocation()
public static ComparableTerm getJoinTerm()
public static ComparableTerm getOrderTerm()
public void sort()
sort
in interface RichLocation
sort
in class SimpleRichLocation
public void setFeature(RichFeature feature) throws ChangeVetoException
setFeature
in interface RichLocation
setFeature
in class SimpleRichLocation
feature
- the feature.ChangeVetoException
public Annotation getAnnotation()
getAnnotation
in interface Annotatable
getAnnotation
in class SimpleRichLocation
public RichAnnotation getRichAnnotation()
getRichAnnotation
in interface RichAnnotatable
getRichAnnotation
in class SimpleRichLocation
public Set getNoteSet()
getNoteSet
in interface RichAnnotatable
getNoteSet
in class SimpleRichLocation
Note
public void setNoteSet(Set notes) throws ChangeVetoException
setNoteSet
in interface RichAnnotatable
setNoteSet
in class SimpleRichLocation
notes
- the set of Note objects to replace the existing ones with.ChangeVetoException
- ALWAYSNote
public void setCircularLength(int sourceSeqLength) throws ChangeVetoException
setCircularLength
in interface RichLocation
setCircularLength
in class SimpleRichLocation
sourceSeqLength
- the circular length of this locationChangeVetoException
- if it doesn't want to change.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
blockIterator
in class SimpleRichLocation
public boolean isContiguous()
isContiguous
in interface Location
isContiguous
in class SimpleRichLocation
true
if and only if this Location
contains every point from min
to
max
inclusive.public boolean contains(int p)
contains
in interface Location
contains
in class SimpleRichLocation
p
- the point to checkpublic 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
getDecorator
in class SimpleRichLocation
decoratorClass
- the Class to checkpublic Location newInstance(Location loc)
loc
.
The default behavior is to return loc
.
ALWAYS RETURNS SELF
newInstance
in interface Location
newInstance
in class SimpleRichLocation
loc
- the Location to use as templatepublic Location translate(int dist)
translate
in interface Location
translate
in class SimpleRichLocation
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. Recursively applies this call to all members. If passed a Location which is not a RichLocation, it converts it first using RichLocation.Tools.enrich().
contains
in interface Location
contains
in class SimpleRichLocation
l
- the Location to checkLocation
wholey contains l
.RichLocation.Tools
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. Recursively applies this call to all members.
overlaps
in interface Location
overlaps
in class SimpleRichLocation
l
- the Location to checkl
public Location union(Location l)
union
in interface Location
union
in class SimpleRichLocation
l
- the Location to union withCompoundLocation
if the components of the union
cannot be merged else a SimpleRichLocation
RichLocation.Tools
public Location intersection(Location l)
intersection
in interface Location
intersection
in class SimpleRichLocation
l
- the Location to intersect withCompoundLocation
if there is more than one region
of intersection that cannot be merged. Else a SimpleRichLocation
.public void setCrossRefResolver(CrossReferenceResolver r)
setCrossRefResolver
in interface RichLocation
setCrossRefResolver
in class SimpleRichLocation
r
- the resolver to use.public SymbolList symbols(SymbolList seq)
The most obvious application of this method to a CompoundRichLocation
is the contatenation of the components of a gene with multiple exons.
symbols
in interface Location
symbols
in class SimpleRichLocation
seq
- the SymbolList to processpublic void setTerm(ComparableTerm term) throws ChangeVetoException
setTerm
in interface RichLocation
setTerm
in class SimpleRichLocation
term
- the term this location should adopt.ChangeVetoException
- in case of error.public int hashCode()
hashCode
in class SimpleRichLocation
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. Compound locations are only equal to other Locations if all their components are equal.
equals
in interface Location
equals
in class SimpleRichLocation
o
- the Object to checkpublic int compareTo(Object o)
compareTo
in interface Comparable
compareTo
in class SimpleRichLocation
public String toString()
toString
in class SimpleRichLocation
Copyright © 2014 BioJava. All rights reserved.