# Class CdsMocBuilder

java.lang.Object
uk.ac.starlink.ttools.moc.CdsMocBuilder

All Implemented Interfaces:
  `MocBuilder`

public abstract class CdsMocBuilder extends Object implements MocBuilder
MocBuilder implementation based on the CDS SMoc class.

Since:
  28 Jan 2025
Author:
  Mark Taylor

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`CdsMocBuilder(int maxOrder)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`static MocBuilder`
`createCdsMocBuilder(int maxOrder, int batchSize)`
Returns an instance of this class that may or may not use tile batching to affect performance.
`PrimitiveIterator.OfLong`
`createOrderedUniqIterator()`
Returns an iterator over the UNIQ values represented by this MOC in sequence.
`long[]`
`getOrderCounts()`
Returns an array of the number of tiles present at each order of the normalised MOC.

### Methods inherited from class Object

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

### Methods inherited from interface MocBuilder

`addTile, endTiles`

## Constructor Details

### CdsMocBuilder

protected CdsMocBuilder(int maxOrder)
Constructor.

Parameters:
  `maxOrder` - maximum order stored by this MOC

## Method Details

### createOrderedUniqIterator

public PrimitiveIterator.OfLong createOrderedUniqIterator()
Description copied from interface: `MocBuilder`
Returns an iterator over the UNIQ values represented by this MOC in sequence. That means that the lower-order ones come first.

Should only be called after `MocBuilder.endTiles()` has been called.

Specified by:
  `createOrderedUniqIterator` in interface `MocBuilder`

### getOrderCounts

public long[] getOrderCounts()
Description copied from interface: `MocBuilder`
Returns an array of the number of tiles present at each order of the normalised MOC. The length of the array gives the number of orders present (the last element may not be zero, unless only one element is returned). The sum of the elements of this array gives the number of values that will be returned by `MocBuilder.createOrderedUniqIterator()`.

Should only be called after `MocBuilder.endTiles()` has been called.

Specified by:
  `getOrderCounts` in interface `MocBuilder`

### createCdsMocBuilder

public static MocBuilder createCdsMocBuilder(int maxOrder, int batchSize)
Returns an instance of this class that may or may not use tile batching to affect performance.

Parameters:
  `maxOrder` - maximum HEALPix order of the MOC
  `batchSize` - if >1, pixels are added in batches per order, which may result in improved performance