Class AbstractLocation
- All Implemented Interfaces:
Serializable
,Location
- Direct Known Subclasses:
AbstractRangeLocation
,FuzzyPointLocation
Location
.
This provides implementations of the binary operators which delegate to
the LocationTools
class.- Author:
- Matthew Pocock
- See Also:
-
Field Summary
Fields inherited from interface org.biojava.bio.symbol.Location
empty, full, naturalOrder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if this location contains the other.boolean
Checks if this location is equivalent to the other.getDecorator
(Class decoratorClass) Checks the decorator chain for an instance ofdecoratorClass and return it if found.int
hashCode()
intersection
(Location loc) Returns a Location that contains all points common to both ranges.newInstance
(Location loc) Create a new instance of Location with all of the same decorators as this instance but with the data stored inloc
.boolean
Checks if these two locations overlap, using this location's concept of overlapping.Return a Location containing all points in either ranges.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.biojava.bio.symbol.Location
blockIterator, contains, getMax, getMin, isContiguous, symbols, translate
-
Constructor Details
-
AbstractLocation
public AbstractLocation()
-
-
Method Details
-
getDecorator
Description copied from interface:Location
Checks the decorator chain for an instance ofdecoratorClass and return it if found.The default behavior is to return null. If the current object is a decorator and is an instance of
decoratorClass it should return itself. Otherwise, the decorator should chain this method onto the instance it wraps.- Specified by:
getDecorator
in interfaceLocation
- Parameters:
decoratorClass
- the Class to check- Returns:
- a Location if an instance of this class is present in the decorator chain and null otherwise.
-
newInstance
Description copied from interface:Location
Create a new instance of Location with all of the same decorators as this instance but with the data stored inloc
.The default behavior is to return
loc unchanged. If the class is a location decorator then it should instantiate an instance of the same type that decoratesloc
.- Specified by:
newInstance
in interfaceLocation
- Parameters:
loc
- the Location to use as template- Returns:
- a Location instance based on loc with the same decorators as the current instance
-
contains
Description copied from interface:Location
Checks if this location contains the other.Abstractly, a location contains another if every point in the other location is contained within this one.
-
overlaps
Description copied from interface:Location
Checks if these two locations overlap, using this location's concept of overlapping.Abstractly, two locations overlap if they both contain any point.
-
union
Description copied from interface:Location
Return a Location containing all points in either ranges. -
intersection
Description copied from interface:Location
Returns a Location that contains all points common to both ranges.- Specified by:
intersection
in interfaceLocation
- Parameters:
loc
- the Location to intersect with- Returns:
- a Location containing all points common to both, or the empty range if there are no such points
-
equals
Description copied from interface:Location
Checks if this location is equivalent to the other.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) invalid input: '&'invalid input: '&' b.contains(a). You should call LocationTools.areEqual after casting l to Location.
-
hashCode
-