# Class MocCoverage

java.lang.Object
uk.ac.starlink.ttools.cone.MocCoverage

All Implemented Interfaces:
  `Coverage`

Direct Known Subclasses:
  `AsciiMocCoverage, ConeQueryCoverage, UrlMocCoverage`

public abstract class MocCoverage extends Object implements Coverage
Abstract superclass for Coverage implementations based on MOC (HEALPix Multi-Order Coverage) objects.

Since:
  9 Jan 2012
Author:
  Mark Taylor

## Nested Class Summary

### Nested classes/interfaces inherited from interface Coverage

`Coverage.Amount`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final cds.moc.HealpixImpl`
`DFLT_HPI`
Default Healpix implementation.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`MocCoverage()`
Constructs a MocCoverage with default HEALPix implementation.
`protected`
`MocCoverage(cds.moc.HealpixImpl hpi)`
Constructs a MocCoverage with specified HEALPix implementation.

## Method Summary

Modifier and Type
Method
Description
`protected abstract cds.moc.SMoc`
`createMoc()`
Constructs the MOC which will define this object's coverage.
`boolean`
`discOverlaps(double alphaDeg, double deltaDeg, double radiusDeg)`
Indicates whether a given disc on the sphere overlaps, or may overlap with this coverage.
`Coverage.Amount`
`getAmount()`
Returns the amount category for coverage.
`cds.moc.SMoc`
`getMoc()`
Returns the MOC object associated with this footprint.
`void`
`initCoverage()`
Must be called before any of the query methods are used.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DFLT_HPI

public static final cds.moc.HealpixImpl DFLT_HPI
Default Healpix implementation.

## Constructor Details

### MocCoverage

protected MocCoverage()
Constructs a MocCoverage with default HEALPix implementation.

### MocCoverage

protected MocCoverage(cds.moc.HealpixImpl hpi)
Constructs a MocCoverage with specified HEALPix implementation.

Parameters:
  `hpi` - HEALPix implementation to use for calculations

## Method Details

### createMoc

protected abstract cds.moc.SMoc createMoc() throws IOException
Constructs the MOC which will define this object's coverage. This method, which may be time-consuming, will be called a maximum of once by the `initCoverage()` method of `MocCoverage`, and should not be called by anyone else.

Returns:
  new MOC defining footprint, or null
Throws:
  `IOException`

### initCoverage

public void initCoverage() throws IOException
Description copied from interface: `Coverage`
Must be called before any of the query methods are used. May be time consuming (it may contact an external service). It is legal to call this method multiple times from the same or different threads. If `Coverage.getAmount()` returns non-null, this method will return directly. Following a successful or error return of this method, `Coverage.getAmount()` will return non-null.

Specified by:
  `initCoverage` in interface `Coverage`
Throws:
  `IOException`

### getAmount

public Coverage.Amount getAmount()
Description copied from interface: `Coverage`
Returns the amount category for coverage. If the footprint is not ready for use, null is returned. In that case, `Coverage.initCoverage()` must be called before use.

Specified by:
  `getAmount` in interface `Coverage`
Returns:
  coverage amount category

### discOverlaps

public boolean discOverlaps(double alphaDeg, double deltaDeg, double radiusDeg)
Description copied from interface: `Coverage`
Indicates whether a given disc on the sphere overlaps, or may overlap with this coverage. False positives are permitted.

Specified by:
  `discOverlaps` in interface `Coverage`
Parameters:
  `alphaDeg` - central longitude in degrees
  `deltaDeg` - central latitude in degrees
  `radiusDeg` - radius in degrees
Returns:
  false if the given disc definitely does not overlap this footprint; otherwise true

### getMoc

public cds.moc.SMoc getMoc()
Returns the MOC object associated with this footprint.

Returns:
  moc