Package uk.ac.starlink.ttools.moc
Class BagMocBuilder
java.lang.Object
uk.ac.starlink.ttools.moc.BagMocBuilder
- All Implemented Interfaces:
MocBuilder
MocBuilder implementation based on IndexBags.
- Since:
- 28 Jan 2025
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsConstructorDescriptionBagMocBuilder
(int maxOrder) Constructor with default IndexBag creation policy.BagMocBuilder
(int maxOrder, LongFunction<IndexBag> bagFactory) Constructor with custom IndexBag creation policy. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTile
(int order, long ipix) Add a numbered tile at a given order.void
Following a call to this method, the MOC is in normal form; no sets of 4 tiles in the same quad, no part of the sphere represented by more than one tile at different orders.Returns an iterator over the UNIQ values represented by this MOC in sequence.void
endTiles()
Signal that no further tiles will be added.long[]
Returns an array of the number of tiles present at each order of the normalised MOC.static long
uniq
(int order, long lindex) Encodes an order and a tile index to a UNIQ value.
-
Constructor Details
-
BagMocBuilder
public BagMocBuilder(int maxOrder) Constructor with default IndexBag creation policy.- Parameters:
maxOrder
- maximum order stored by this MOC
-
BagMocBuilder
Constructor with custom IndexBag creation policy.- Parameters:
maxOrder
- maximum order stored by this MOCbagFactory
- creates an IndexBag capable of storing non-negative integers less than the supplied long value
-
-
Method Details
-
addTile
public void addTile(int order, long ipix) Description copied from interface:MocBuilder
Add a numbered tile at a given order. Adding a tile that has already been added has no effect.- Specified by:
addTile
in interfaceMocBuilder
- Parameters:
order
- HEALPix order, in the range 0..29ipix
- tile index within the given order, in the range 0..12*4^order
-
endTiles
public void endTiles()Description copied from interface:MocBuilder
Signal that no further tiles will be added.- Specified by:
endTiles
in interfaceMocBuilder
-
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 interfaceMocBuilder
-
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 byMocBuilder.createOrderedUniqIterator()
.Should only be called after
MocBuilder.endTiles()
has been called.- Specified by:
getOrderCounts
in interfaceMocBuilder
-
consolidate
public void consolidate()Following a call to this method, the MOC is in normal form; no sets of 4 tiles in the same quad, no part of the sphere represented by more than one tile at different orders. There is no change in the semantic content.Calling this method during a run of tile additions may result in a smaller memory footprint or better performance. Or it may not.
-
uniq
public static long uniq(int order, long lindex) Encodes an order and a tile index to a UNIQ value. Input values are assumed to be legal.- Parameters:
order
- orderlindex
- tile index within order- Returns:
- uniq value
-