Package cds.moc
Class Moc1D
java.lang.Object
cds.moc.Moc
cds.moc.Moc1D
- All Implemented Interfaces:
Cloneable,Comparable<Moc>,Iterable<MocCell>
The Moc1D class implements the methods specific to one-dimensional MOCs (e.g. SPACE or TIME).
-
Field Summary
FieldsFields inherited from class cds.moc.Moc
ASCII, cacheDeepestOrder, cacheHashCode, cacheNbCells, comment, COMPRESS_SINGLETON, CR, FITS, JSON, LOGIC_MAX, LOGIC_MIN, MASK_COMP, MAXSIZE, MAXWORD, property, RAW, unites, UNMASK_COMP, VERSION -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMoc1D()Generic Moc 1D creatorprotectedMoc1D(int mocOrder) Generic Moc 1D creatorprotectedGeneric Moc 1D generator from another Moc 1DprotectedMoc1D(InputStream in) Generic Moc 1D generator from input streamprotectedGeneric Moc 1D generator from ASCII Moc String -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int order, long val) Add one cell to the Moc.voidadd(int order, long firstVal, long lastVal) Add a list of consecutive Moc cells.voidadd(long[] valList, int size) Fast addition of a list of ranges expressed at the maximum order (2 consecutive longq per range): start..end (end excluded).voidAdd directly a Mocprotected voidInternal usage: Add one token element according to the format "[s|t]order/npix[-npixn]".voidStops the buffering and frees the memory required for it.voidbufferOn()Activation of the buffererization.voidbufferOn(int size) Activation of the buffererization.intbuffer size, not yet proceedabstract charcDim()Return the Moc signature character (ex: 's' for SMoc, 't' for TMoc)cellIterator(boolean flagRange) Provide an Iterator on the MOC cell List (hierarchical view)voidclear()Clear the MOC - data only (not the properties, nor the mocOrder)protected voidDeep copy.Return the complementprotected voidRecalculates the metrics associated with the MOC hierarchical view: the number of hierarchical cells, the deepest order used...protected voidcreateMocByUniq(int nval, int nbyte, byte[] t) protected voidcreateMocByUniqUnsorted(int nval, int nbyte, byte[] t, boolean protoTMoc) booleanReturn true in case of equality (only check data - no properties, nor MocOrder)voidflush()Inserts in the MOC all the elements being inserted in the buffer.doubleReturn the coverage pourcentage of the MoclonggetEnd(int order, long val) Returns the value of the end of the interval (excluded) expressed at the maximum orderlonggetMem()Return approximatively the amount of memory used for storing this MOC in RAM (in bytes)intget min Moc min Order.intReturn the Moc order.intReturn the number of rangeslongReturn the number of used cells at the Moc order: (ex: s2/1 3/5-6 => 6longgetStart(int order, long val) Returns the value of the beginning of the interval expressed at the maximum ordergetSys()Get the reference system.inthashCode()booleanisCompatible(Moc moc) Return true if the moc is compatible for operation (same class and sys)booleanisEmpty()Return true if the Moc is empty (no coverage)booleanisFull()Return true if the Moc is full (full coverage)booleanisIncluding(int order, long val) booleanisIntersecting(int order, long val) protected StringlowAscii(int n) Display the n first ranges at the max orderabstract intmaxOrder()Return the deepest possible order (ex: 29 for SMoc, 61 for TMoc)abstract longmaxVal()Return the number of values at the deepest order (ex: 2x2^29x2^29 for SMoc, 2^61 for TMoc)protected Moc1DGeneric operations: 0-union, 1-intersection, 2-subtractionvoidreadSpecificDataRange(int nval, byte[] t, int mode) protected voidreadSpecificDataRange(InputStream in, int naxis1, int naxis2, int nbyte) protected voidreadSpecificDataUniq(InputStream in, int naxis1, int naxis2, int nbyte) Readersbooleanreduction(long maxSize) Degrades the resolution(s) of the MOC until the RAM size of the MOC is reduced under the specified maximum (expressed in bytes).Acces to the list of ranges (no copy)voidsetMinOrder(int minOrder) Set min Moc min Order.voidsetMocOrder(int mocOrder) Set Moc order.voidsetRangeList(Range range) Set the list of ranges - Warning: no copyvoidSet alternative reference System.abstract intReturn the number of bit shifting between two consecutive orders (ex: 2 for SMoc, 1 for TMoc)abstract Stringsys()Return the default reference systemtoDebug()Return an Iterator providing the list of values at the Moc order.voidwriteASCII(OutputStream out) Write MOC to an output stream IN ASCII encoded formatvoidwriteJSON(OutputStream out) Write MOC to an output stream IN JSON encoded formatprotected intwriteJSON(OutputStream out, boolean flagNL) Write HEALPix MOC to an output stream IN JSON encoded formatintwriteSpecificDataRange(OutputStream out, int mode) Write Moc1D data in RangesMethods inherited from class cds.moc.Moc
accretion, add, clone, codeComp, compareTo, compressRange, createMoc, createMoc, decodeComp, difference, dup, getBourrage, getComment, getDeepestOrder, getFitsLine, getFitsLine, getMocOrder4op, getMocOrderLogic, getNbCells, getNbCoding, getProperty, getPropertyKeys, getSpaceMoc, getSpaceOrder, getSpaceSys, getSpaceTimeMoc, getTimeMoc, getTimeOrder, getTimeSys, getUnitDisk, getUnitDisk, hpix2uniq, intersection, isCodedComp, isIncluding, isIntersecting, isSpace, isTime, iterator, json2ASCII, log2, pow2, read, read, read, readASCII, readFITS, readFully, readFully, readJSON, readLong, readSpecificData, resetCache, setMocOrderLogic, setProperty, setProperty, setSpaceOrder, setSpaceSys, setTimeOrder, setTimeSys, sizeOfCoding, subtraction, toASCII, toJSON, toString, uncompressRange, uncompressRange, union, uniq2hpix, uniq2hpix, write, write, write, write, writeASCII, writeASCII, writeASCIIFlush, writeData, writeFITS, writeFITS, writeJSON, writeSpecificData, writeSpecificFitsProp, writeValMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
range
-
mocOrder
protected int mocOrder -
sys
-
biggestOrder
protected int biggestOrder
-
-
Constructor Details
-
Moc1D
protected Moc1D()Generic Moc 1D creator -
Moc1D
protected Moc1D(int mocOrder) Generic Moc 1D creator- Parameters:
mocOrder- Moc Order (-1 => not defined)
-
Moc1D
Generic Moc 1D generator from ASCII Moc String- Parameters:
s- ASCII Moc (regular ASCII or JSON)- Throws:
Exception
-
Moc1D
Generic Moc 1D generator from input stream- Parameters:
in- input stream- Throws:
Exception
-
Moc1D
Generic Moc 1D generator from another Moc 1D- Parameters:
moc- moc to be dumped- Throws:
Exception
-
-
Method Details
-
toDebug
-
lowAscii
Display the n first ranges at the max order -
clear
public void clear()Clear the MOC - data only (not the properties, nor the mocOrder) -
clone1
Deep copy. The source is this, the target is the Moc in parameter- Overrides:
clone1in classMoc- Throws:
CloneNotSupportedException
-
reduction
Degrades the resolution(s) of the MOC until the RAM size of the MOC is reduced under the specified maximum (expressed in bytes). -
maxOrder
public abstract int maxOrder()Return the deepest possible order (ex: 29 for SMoc, 61 for TMoc) -
shiftOrder
public abstract int shiftOrder()Return the number of bit shifting between two consecutive orders (ex: 2 for SMoc, 1 for TMoc) -
cDim
public abstract char cDim()Return the Moc signature character (ex: 's' for SMoc, 't' for TMoc) -
maxVal
public abstract long maxVal()Return the number of values at the deepest order (ex: 2x2^29x2^29 for SMoc, 2^61 for TMoc) -
sys
Return the default reference system -
computeHierarchy
protected void computeHierarchy()Recalculates the metrics associated with the MOC hierarchical view: the number of hierarchical cells, the deepest order used...- Specified by:
computeHierarchyin classMoc
-
getNbValues
public long getNbValues()Return the number of used cells at the Moc order: (ex: s2/1 3/5-6 => 6 -
setRangeList
Set the list of ranges - Warning: no copy- Specified by:
setRangeListin classMoc
-
isEmpty
public boolean isEmpty()Return true if the Moc is empty (no coverage) -
isFull
public boolean isFull()Return true if the Moc is full (full coverage) -
getCoverage
public double getCoverage()Return the coverage pourcentage of the Moc- Specified by:
getCoveragein classMoc
-
getNbRanges
public int getNbRanges()Return the number of ranges- Specified by:
getNbRangesin classMoc
-
getMem
public long getMem()Return approximatively the amount of memory used for storing this MOC in RAM (in bytes) -
isCompatible
Return true if the moc is compatible for operation (same class and sys)- Specified by:
isCompatiblein classMoc
-
operation
Generic operations: 0-union, 1-intersection, 2-subtraction -
complement
Return the complement- Specified by:
complementin classMoc- Throws:
Exception
-
equals
Return true in case of equality (only check data - no properties, nor MocOrder) -
hashCode
public int hashCode() -
isIncluding
public boolean isIncluding(int order, long val) -
isIntersecting
public boolean isIntersecting(int order, long val) -
setMocOrder
Set Moc order. Will impact the precision (and the number) of the values. -1 for internal reset- Throws:
Exception
-
getMocOrder
public int getMocOrder()Return the Moc order. Either specically set by setOrder(). If not definied, return the biggest used order during the addition, And if not defined return the hierarchycal deespest order -
setSys
Set alternative reference System.- Parameters:
sys- alternative reference frame keyword (not standardized in IVOA document)
-
getSys
Get the reference system. See setSys() -
setMinOrder
Set min Moc min Order. The hierarchical view will be start at this order. 0 by default- Throws:
Exception
-
getMinOrder
public int getMinOrder()get min Moc min Order. The hierarchical view will be start at this order. 0 by default -
add
Add one cell to the Moc.- Parameters:
order- Order of the cellval- Value of the cell- Throws:
Exception
-
add
Add a list of consecutive Moc cells.- Parameters:
order- Order of the cellsfirstVal- First valuelastVal- Last value (included)- Throws:
Exception
-
getStart
public long getStart(int order, long val) Returns the value of the beginning of the interval expressed at the maximum order -
getEnd
public long getEnd(int order, long val) Returns the value of the end of the interval (excluded) expressed at the maximum order -
bufferOn
public void bufferOn()Activation of the buffererization. Significantly speeds up random multiple additions. -
bufferOn
public void bufferOn(int size) Activation of the buffererization. Significantly speeds up random multiple additions Required additionnal memory for the buffer (see bufferOff()) Note: Any read access or operation on the MOC will automatically be preceded by a flush() if necessary.- Parameters:
size- : size of the buffer (required even value)
-
bufferOff
public void bufferOff()Stops the buffering and frees the memory required for it. -
flush
public void flush()Inserts in the MOC all the elements being inserted in the buffer. The buffering remains active for future insertions (unlike bufferOff()) -
bufferSize
public int bufferSize()buffer size, not yet proceed- Overrides:
bufferSizein classMoc
-
add
public void add(long[] valList, int size) Fast addition of a list of ranges expressed at the maximum order (2 consecutive longq per range): start..end (end excluded). These ranges do not need to be sorted, nor to be disjoint.- Parameters:
valList- list of range indexsize- Number of values (= 2x number of ranges)
-
add
Add directly a Moc- Throws:
Exception
-
seeRangeList
Acces to the list of ranges (no copy)- Specified by:
seeRangeListin classMoc
-
cellIterator
Provide an Iterator on the MOC cell List (hierarchical view)- Specified by:
cellIteratorin classMoc- Parameters:
flagRange- true for getting range rather than all individual values- Returns:
- mocCell => dim,order,startVal,endVal
-
valIterator
Return an Iterator providing the list of values at the Moc order. => values provided in ascending order -
addToken
Internal usage: Add one token element according to the format "[s|t]order/npix[-npixn]". If the order is not mentioned, use the last used order (currentOrder) Note: Also support JSON non standard IVOA syntax -
readSpecificDataUniq
protected void readSpecificDataUniq(InputStream in, int naxis1, int naxis2, int nbyte) throws Exception Readers- Throws:
Exception
-
createMocByUniqUnsorted
protected void createMocByUniqUnsorted(int nval, int nbyte, byte[] t, boolean protoTMoc) throws Exception - Throws:
Exception
-
createMocByUniq
- Throws:
Exception
-
readSpecificDataRange
protected void readSpecificDataRange(InputStream in, int naxis1, int naxis2, int nbyte) throws Exception - Throws:
Exception
-
readSpecificDataRange
- Specified by:
readSpecificDataRangein classMoc- Throws:
Exception
-
writeSpecificDataRange
Write Moc1D data in Ranges- Specified by:
writeSpecificDataRangein classMoc- Parameters:
out- output streammode- RAW or COMP_SINGLETON- Returns:
- number of bytes written
- Throws:
Exception
-
writeASCII
Write MOC to an output stream IN ASCII encoded format- Specified by:
writeASCIIin classMoc- Parameters:
out- output stream- Throws:
Exception
-
writeJSON
Write MOC to an output stream IN JSON encoded format -
writeJSON
Write HEALPix MOC to an output stream IN JSON encoded format- Parameters:
out- output stream- Throws:
Exception
-