## org.biojava.bio.symbol
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 of `Location`. This provides implementations of the binary operators which delegate to the `LocationTools` class.

Author:
  Matthew Pocock
See Also:
  Serialized Form

Field Summary

Fields inherited from interface org.biojava.bio.symbol.Location
`empty, full, naturalOrder`

Constructor Summary
`AbstractLocation()`

Method Summary
`boolean` `contains(Location l)` Checks if this location contains the other.
`boolean` `equals(Object o)` Checks if this location is equivalent to the other.
`Location` `getDecorator(Class decoratorClass)` Checks the decorator chain for an instance of <class>decoratorClass</class> and return it if found.
`int` `hashCode()`
`Location` `intersection(Location loc)` Returns a Location that contains all points common to both ranges.
`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.
`Location` `union(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: `Location`
  Checks the decorator chain for an instance of <class>decoratorClass</class> and return it if found.

  The default behavior is to return null. If the current object is a decorator and is an instance of <class>decoratorClass</class> it should return itself. Otherwise, the decorator should chain this method onto the instance it wraps.

  Specified by:
    `getDecorator` in interface `Location`
  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: `Location`
  Create a new instance of Location with all of the same decorators as this instance but with the data stored in `loc`.

  The default behavior is to return <loc>loc</loc> unchanged. If the class is a location decorator then it should instantiate an instance of the same type that decorates `loc`.

  Specified by:
    `newInstance` in interface `Location`
  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: `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.

  Specified by:
    `contains` in interface `Location`
  Parameters:
    `l` - the Location to check
  Returns:
    true if this contains l, otherwise false

### overlaps

    public boolean overlaps(Location l)

  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.

  Specified by:
    `overlaps` in interface `Location`
  Parameters:
    `l` - the Location to check
  Returns:
    true if they overlap, otherwise false

### union

    public Location union(Location loc)

  Description copied from interface: `Location`
  Return a Location containing all points in either ranges.

  Specified by:
    `union` in interface `Location`
  Parameters:
    `loc` - the Location to union with
  Returns:
    a Location representing the union

### intersection

    public Location intersection(Location loc)

  Description copied from interface: `Location`
  Returns a Location that contains all points common to both ranges.

  Specified by:
    `intersection` in interface `Location`
  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: `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) && b.contains(a). You should call LocationTools.areEqual after casting l to Location.

  Specified by:
    `equals` in interface `Location`
  Overrides:
    `equals` in class `Object`
  Parameters:
    `o` - the Object to check
  Returns:
    true if this equals l, otherwise false

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`