Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.biojava.bio.symbol
Class AbstractLocationDecorator

    java.lang.Object
      org.biojava.bio.symbol.AbstractLocationDecorator

All Implemented Interfaces:
  Location

Direct Known Subclasses:
  BetweenLocation, CircularLocation

    public abstract class AbstractLocationDecorator

extends Object
implements Location

Abstract `Location` decorator (wrapper).

These wrap up a normal `Location` object, and act as markers to indicate that the location has some kind of special semantics.

When implementing a new Location decorator.

Author:
  Matthew Pocock

Field Summary

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

Constructor Summary
`protected` | `AbstractLocationDecorator(Location wrapped)` Construct a new decorator wrapping the specified Location.

Method Summary
`Iterator` | `blockIterator()` Return an Iterator over the set of maximal contiguous sub-locations.
`boolean` | `contains(int p)` Checks if this location contains a point.
`boolean` | `contains(Location l)` Checks if this location contains the other.
`protected abstract Location` | `decorate(Location loc)`
`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 decoratorClass and return it if found.
`int` | `getMax()` The maximum position contained.
`int` | `getMin()` The minimum position contained.
`protected Location` | `getWrapped()`
`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.
`SymbolList` | `symbols(SymbolList seq)` Return the symbols in a sequence that fall within this range.
`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.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractLocationDecorator

    protected AbstractLocationDecorator(Location wrapped)

  Construct a new decorator wrapping the specified Location.

Method Detail

### getWrapped

    protected final Location getWrapped()

### decorate

    protected abstract Location decorate(Location loc)

### 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 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

### getDecorator

    public Location getDecorator(Class decoratorClass)

  Description copied from interface: `Location`
  Checks the decorator chain for an instance of decoratorClass 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 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.

### getMin

    public int getMin()

  Description copied from interface: `Location`
  The minimum position contained.

  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`

  Specified by:
    `getMin` in interface `Location`
  Returns:
    the minimum position contained

### getMax

    public int getMax()

  Description copied from interface: `Location`
  The maximum position contained.

  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`

  Specified by:
    `getMax` in interface `Location`
  Returns:
    the maximum position contained

### 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

### 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

### contains

    public boolean contains(int p)

  Description copied from interface: `Location`
  Checks if this location contains a point.

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

### 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

### intersection

    public Location intersection(Location l)

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

  Specified by:
    `intersection` in interface `Location`
  Parameters:
    `l` - the Location to intersect with
  Returns:
    a Location containing all points common to both, or the empty range if there are no such points

### union

    public Location union(Location l)

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

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

### symbols

    public SymbolList symbols(SymbolList seq)

  Description copied from interface: `Location`
  Return the symbols in a sequence that fall within this range.

  Specified by:
    `symbols` in interface `Location`
  Parameters:
    `seq` - the SymbolList to process
  Returns:
    the SymbolList containing the symbols in seq in this range

### translate

    public Location translate(int dist)

  Description copied from interface: `Location`
  Create a location that is a translation of this location.

  Specified by:
    `translate` in interface `Location`
  Parameters:
    `dist` - the distance to translate (to the right)

### isContiguous

    public boolean isContiguous()

  Description copied from interface: `Location`
  Determine if a Location is contiguous.

  Specified by:
    `isContiguous` in interface `Location`
  Returns:
    `true` if and only if this Location contains every point from `min` to `max` inclusive.

### blockIterator

    public Iterator blockIterator()

  Description copied from interface: `Location`
  Return an Iterator over the set of maximal contiguous sub-locations.

  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.

  Specified by:
    `blockIterator` in interface `Location`
  Returns:
    an Iterator over Location objects that are the maximally contiguous set of locations contained within this location

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD