Package cds.moc
Class Moc2D
java.lang.Object
cds.moc.Moc
cds.moc.Moc2D
- All Implemented Interfaces:
Cloneable
,Comparable<Moc>
,Iterable<MocCell>
- Direct Known Subclasses:
STMoc
The Moc2D class implements the methods specific to two-dimensional MOCs (e.g. TIME.SPACE).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic long
Binary utilitiesprotected Moc1D
protected Moc1D
static long
Fields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(int order1, long val1, int order2, long val2) Add one cell to the Moc2D.void
add
(int order1, long firstVal1, long lastVal1, int order2, long firstVal2, long lastVal2) Add a list of consecutive Moc cells.void
protected void
Internal usage: Add one token element according to the format "[s|t]order/npix[-npixn]".char
cDim1()
Return the Moc signature character for the first dimension (ex: 't' for TMoc)char
cDim2()
Return the Moc signature character for the second dimension (ex: 's' for SMoccellIterator
(boolean flagRange) Provide an Iterator on the MOC cell List (range highest order architecture for Moc2D)void
clear()
Clear the MOC - data only (not the properties, nor the mocOrder)protected void
Deep copy.protected abstract long
codeDim1
(long a) protected long
codeTime
(long a) protected void
Recalculates the metrics associated with the MOC hierarchical view: the number of hierarchical cells, the deepest order used...protected abstract long
decodeDim1
(long a) protected long
decodeTime
(long a) boolean
Return true in case of equality (only check data - no properties, nor MocOrder)void
flush()
ASCII & JSON parserdouble
Return the coverage pourcentage of the Moclong
getEnd1
(int order, long val) Returns the value of the end of the interval (excluded) expressed at the maximum order (first dimension)long
getEnd2
(int order, long val) Returns the value of the end of the interval (excluded) expressed at the maximum order (second dimension)long
getMem()
Return approximatively the amount of memory used for storing this MOC in RAM (in bytes)int
Return the Moc order of the first dimensionint
Return the Moc order of the second dimensionint
Return the number of values to write in FITS serializationint
Return the number of ranges - first dimensionlong
getStart1
(int order, long val) Returns the value of the beginning of the interval expressed at the maximum order (first dimension)long
getStart2
(int order, long val) Returns the value of the beginning of the interval expressed at the maximum order (second dimension)int
hashCode()
protected abstract boolean
isCodedDim1
(long a) protected boolean
isCodedTime
(long a) boolean
isCompatible
(Moc moc) Return true if the moc is compatible for operation (same sys)boolean
isEmpty()
Return true if the Moc is empty (no coverage)boolean
isFull()
Return true if the Moc is full (full coverage)protected String
lowAscii
(int n) Display the n first ranges at the max orderint
Return the deepest possible order for the first dimension (ex: 61 for TMoc)int
Return the deepest possible order for the second dimension (ex: 29 for SMoc)protected Moc2D
Generic operations: 0-union, 1-intersection, 2-subtractionvoid
readSpecificDataRange
(int nval, byte[] t, int mode) Create Moc2D from the list of fits valuesboolean
reduction
(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).boolean
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)void
setMocOrder
(int order1, int order2) Set Moc orders of the first and the second dimension simultaneously (fastest than in two steps)void
setMocOrder1
(int order1) Set Moc order of the first dimensionvoid
setMocOrder2
(int order2) Set Moc order of the second dimensionvoid
setRangeList
(Range range) Set the list of ranges - Warning: no copyint
Return the number of bit shifting between two consecutive orders for the first dimension (ex: 1 for TMoc)int
Return the number of bit shifting between two consecutive orders for the second dimension (ex: 2 for SMoc)int
Return the number of bytes used for coding each FITS value (=> always long)toDebug()
void
writeASCII
(OutputStream out) Write MOC to an output stream in ASCII serializationvoid
writeJSON
(OutputStream out) Write MOC to an output stream in JSON serialization (non IVOA standard)int
writeSpecificDataRange
(OutputStream out, int mode) Write Moc2D data in RangesMethods inherited from class cds.moc.Moc
accretion, add, bufferSize, clone, codeComp, compareTo, complement, compressRange, createMoc, createMoc, decodeComp, difference, dup, getBourrage, getComment, getDeepestOrder, getFitsLine, getFitsLine, getMocOrder4op, getMocOrderLogic, getNbCells, 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, subtraction, toASCII, toJSON, toString, uncompressRange, uncompressRange, union, uniq2hpix, uniq2hpix, write, write, write, write, writeASCII, writeASCII, writeASCIIFlush, writeData, writeFITS, writeFITS, writeJSON, writeSpecificData, writeSpecificFitsProp, writeVal
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
range
-
protoDim1
-
protoDim2
-
MASK_T
public static long MASK_TBinary utilities -
UNMASK_T
public static long UNMASK_T
-
-
Constructor Details
-
Moc2D
Generic Moc 2D creator
-
-
Method Details
-
toDebug
-
lowAscii
Display the n first ranges at the max order -
maxOrder1
public int maxOrder1()Return the deepest possible order for the first dimension (ex: 61 for TMoc) -
maxOrder2
public int maxOrder2()Return the deepest possible order for the second dimension (ex: 29 for SMoc) -
shiftOrder1
public int shiftOrder1()Return the number of bit shifting between two consecutive orders for the first dimension (ex: 1 for TMoc) -
shiftOrder2
public int shiftOrder2()Return the number of bit shifting between two consecutive orders for the second dimension (ex: 2 for SMoc) -
cDim1
public char cDim1()Return the Moc signature character for the first dimension (ex: 't' for TMoc) -
cDim2
public char cDim2()Return the Moc signature character for the second dimension (ex: 's' for SMoc -
seeRangeList
Acces to the list of ranges (no copy)- Specified by:
seeRangeList
in classMoc
-
setRangeList
Set the list of ranges - Warning: no copy- Specified by:
setRangeList
in classMoc
-
getMocOrder1
public int getMocOrder1()Return the Moc order of the first dimension -
getMocOrder2
public int getMocOrder2()Return the Moc order of the second dimension -
setMocOrder
Set Moc orders of the first and the second dimension simultaneously (fastest than in two steps)- Throws:
Exception
-
setMocOrder1
Set Moc order of the first dimension- Throws:
Exception
-
setMocOrder2
Set Moc order of the second dimension- Throws:
Exception
-
getStart1
public long getStart1(int order, long val) Returns the value of the beginning of the interval expressed at the maximum order (first dimension) -
getEnd1
public long getEnd1(int order, long val) Returns the value of the end of the interval (excluded) expressed at the maximum order (first dimension) -
getStart2
public long getStart2(int order, long val) Returns the value of the beginning of the interval expressed at the maximum order (second dimension) -
getEnd2
public long getEnd2(int order, long val) Returns the value of the end of the interval (excluded) expressed at the maximum order (second dimension) -
add
-
add
Add one cell to the Moc2D.- Parameters:
order1
- Order of the cell (first dimension)val1
- Value of the cell (first dimension)order2
- Order of the cell (second dimension)val2
- Value of the cell (second dimension)- Throws:
Exception
-
add
public void add(int order1, long firstVal1, long lastVal1, int order2, long firstVal2, long lastVal2) throws Exception Add a list of consecutive Moc cells.- Parameters:
order1
- Order of the cells (first dimension)firstVal1
- First value (first dimension)lastVal1
- Last value (included) (first dimension)order2
- Order of the cells (second dimension)firstVal2
- First value (second dimension)lastVal2
- Last value (included) (second dimension)- Throws:
Exception
-
equals
Return true in case of equality (only check data - no properties, nor MocOrder) -
hashCode
public int hashCode() -
clone1
Deep copy. The source is this, the target is the Moc in parameter- Overrides:
clone1
in classMoc
- Throws:
CloneNotSupportedException
-
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:
getCoverage
in classMoc
-
computeHierarchy
protected void computeHierarchy()Recalculates the metrics associated with the MOC hierarchical view: the number of hierarchical cells, the deepest order used...- Specified by:
computeHierarchy
in classMoc
-
getNbRanges
public int getNbRanges()Return the number of ranges - first dimension- Specified by:
getNbRanges
in classMoc
-
getMem
public long getMem()Return approximatively the amount of memory used for storing this MOC in RAM (in bytes) -
clear
public void clear()Clear the MOC - data only (not the properties, nor the mocOrder) -
reduction
Degrades the resolution(s) of the MOC until the RAM size of the MOC is reduced under the specified maximum (expressed in bytes). -
reduction
Degrades the resolution(s) of the MOC until the RAM size of the MOC is reduced under the specified maximum (expressed in bytes).- Parameters:
maxMB
- size max in MBpriority
- Indicates the dimensions to be degraded as a priority in the form of a list of the dimension's signature characters ex: "t" for time only, "s" space only, "st"-both alternatively, space first (default), "ttts", ...- Throws:
Exception
-
isCompatible
Return true if the moc is compatible for operation (same sys)- Specified by:
isCompatible
in classMoc
-
operation
Generic operations: 0-union, 1-intersection, 2-subtraction -
writeASCII
Write MOC to an output stream in ASCII serialization- Specified by:
writeASCII
in classMoc
- Throws:
Exception
-
writeJSON
Write MOC to an output stream in JSON serialization (non IVOA standard) -
sizeOfCoding
public int sizeOfCoding()Return the number of bytes used for coding each FITS value (=> always long)- Specified by:
sizeOfCoding
in classMoc
-
getNbCoding
public int getNbCoding()Return the number of values to write in FITS serialization- Specified by:
getNbCoding
in classMoc
-
cellIterator
Provide an Iterator on the MOC cell List (range highest order architecture for Moc2D)- Specified by:
cellIterator
in classMoc
- Parameters:
flagRange
- not use for Moc2D- Returns:
- mocCell => dim,order,startVal,endVal,Moc1D
-
isCodedTime
protected boolean isCodedTime(long a) -
codeTime
protected long codeTime(long a) -
decodeTime
protected long decodeTime(long a) -
isCodedDim1
protected abstract boolean isCodedDim1(long a) -
codeDim1
protected abstract long codeDim1(long a) -
decodeDim1
protected abstract long decodeDim1(long a) -
writeSpecificDataRange
Write Moc2D data in Ranges- Specified by:
writeSpecificDataRange
in classMoc
- Parameters:
out
- output streammode
- RAW or COMP_SINGLETON- Returns:
- number of bytes written
- Throws:
Exception
-
readSpecificDataRange
Create Moc2D from the list of fits values- Specified by:
readSpecificDataRange
in classMoc
- Throws:
Exception
-
flush
public void flush()ASCII & JSON parser -
addToken
Description copied from class:Moc
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
-