Class AbstractLocation
- java.lang.Object
 - 
- org.biojava.bio.symbol.AbstractLocation
 
 
- 
- All Implemented Interfaces:
 Serializable,Location
- Direct Known Subclasses:
 AbstractRangeLocation,FuzzyPointLocation
public abstract class AbstractLocation extends Object implements Location, Serializable
An abstract implementation ofLocation. This provides implementations of the binary operators which delegate to theLocationToolsclass.- Author:
 - Matthew Pocock
 - See Also:
 - Serialized Form
 
 
- 
- 
Field Summary
- 
Fields inherited from interface org.biojava.bio.symbol.Location
empty, full, naturalOrder 
 - 
 
- 
Constructor Summary
Constructors Constructor Description AbstractLocation() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Location l)Checks if this location contains the other.booleanequals(Object o)Checks if this location is equivalent to the other.LocationgetDecorator(Class decoratorClass)Checks the decorator chain for an instance ofdecoratorClass and return it if found.inthashCode()Locationintersection(Location loc)Returns a Location that contains all points common to both ranges.LocationnewInstance(Location loc)Create a new instance of Location with all of the same decorators as this instance but with the data stored inloc.booleanoverlaps(Location l)Checks if these two locations overlap, using this location's concept of overlapping.Locationunion(Location loc)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 Detail
- 
AbstractLocation
public AbstractLocation()
 
 - 
 
- 
Method Detail
- 
getDecorator
public Location getDecorator(Class decoratorClass)
Description copied from interface:LocationChecks 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:
 getDecoratorin 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
public Location newInstance(Location loc)
Description copied from interface:LocationCreate 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:
 newInstancein 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
public boolean contains(Location l)
Description copied from interface:LocationChecks if this location contains the other.Abstractly, a location contains another if every point in the other location is contained within this one.
 
- 
overlaps
public boolean overlaps(Location l)
Description copied from interface:LocationChecks if these two locations overlap, using this location's concept of overlapping.Abstractly, two locations overlap if they both contain any point.
 
- 
union
public Location union(Location loc)
Description copied from interface:LocationReturn a Location containing all points in either ranges. 
- 
intersection
public Location intersection(Location loc)
Description copied from interface:LocationReturns a Location that contains all points common to both ranges.- Specified by:
 intersectionin 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
public boolean equals(Object o)
Description copied from interface:LocationChecks 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) && b.contains(a). You should call LocationTools.areEqual after casting l to Location.
 
 - 
 
 -