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 longBinary utilitiesprotected Moc1Dprotected Moc1Dstatic longFields 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 TypeMethodDescriptionvoidadd(int order1, long val1, int order2, long val2) Add one cell to the Moc2D.voidadd(int order1, long firstVal1, long lastVal1, int order2, long firstVal2, long lastVal2) Add a list of consecutive Moc cells.voidprotected voidInternal usage: Add one token element according to the format "[s|t]order/npix[-npixn]".charcDim1()Return the Moc signature character for the first dimension (ex: 't' for TMoc)charcDim2()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)voidclear()Clear the MOC - data only (not the properties, nor the mocOrder)protected voidDeep copy.protected abstract longcodeDim1(long a) protected longcodeTime(long a) protected voidRecalculates the metrics associated with the MOC hierarchical view: the number of hierarchical cells, the deepest order used...protected abstract longdecodeDim1(long a) protected longdecodeTime(long a) booleanReturn true in case of equality (only check data - no properties, nor MocOrder)voidflush()ASCII invalid input: '&' JSON parserdoubleReturn the coverage pourcentage of the MoclonggetEnd1(int order, long val) Returns the value of the end of the interval (excluded) expressed at the maximum order (first dimension)longgetEnd2(int order, long val) Returns the value of the end of the interval (excluded) expressed at the maximum order (second dimension)longgetMem()Return approximatively the amount of memory used for storing this MOC in RAM (in bytes)intReturn the Moc order of the first dimensionintReturn the Moc order of the second dimensionintReturn the number of values to write in FITS serializationintReturn the number of ranges - first dimensionlonggetStart1(int order, long val) Returns the value of the beginning of the interval expressed at the maximum order (first dimension)longgetStart2(int order, long val) Returns the value of the beginning of the interval expressed at the maximum order (second dimension)inthashCode()protected abstract booleanisCodedDim1(long a) protected booleanisCodedTime(long a) booleanisCompatible(Moc moc) Return true if the moc is compatible for operation (same sys)booleanisEmpty()Return true if the Moc is empty (no coverage)booleanisFull()Return true if the Moc is full (full coverage)protected StringlowAscii(int n) Display the n first ranges at the max orderintReturn the deepest possible order for the first dimension (ex: 61 for TMoc)intReturn the deepest possible order for the second dimension (ex: 29 for SMoc)protected Moc2DGeneric operations: 0-union, 1-intersection, 2-subtractionvoidreadSpecificDataRange(int nval, byte[] t, int mode) Create Moc2D from the list of fits valuesbooleanreduction(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).booleanDegrades 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)voidsetMocOrder(int order1, int order2) Set Moc orders of the first and the second dimension simultaneously (fastest than in two steps)voidsetMocOrder1(int order1) Set Moc order of the first dimensionvoidsetMocOrder2(int order2) Set Moc order of the second dimensionvoidsetRangeList(Range range) Set the list of ranges - Warning: no copyintReturn the number of bit shifting between two consecutive orders for the first dimension (ex: 1 for TMoc)intReturn the number of bit shifting between two consecutive orders for the second dimension (ex: 2 for SMoc)intReturn the number of bytes used for coding each FITS value (=> always long)toDebug()voidwriteASCII(OutputStream out) Write MOC to an output stream in ASCII serializationvoidwriteJSON(OutputStream out) Write MOC to an output stream in JSON serialization (non IVOA standard)intwriteSpecificDataRange(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, 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
-
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:
seeRangeListin classMoc
-
setRangeList
Set the list of ranges - Warning: no copy- Specified by:
setRangeListin 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:
clone1in 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:
getCoveragein 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:
computeHierarchyin classMoc
-
getNbRanges
public int getNbRanges()Return the number of ranges - first dimension- Specified by:
getNbRangesin 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:
isCompatiblein classMoc
-
operation
Generic operations: 0-union, 1-intersection, 2-subtraction -
writeASCII
Write MOC to an output stream in ASCII serialization- Specified by:
writeASCIIin 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:
sizeOfCodingin classMoc
-
getNbCoding
public int getNbCoding()Return the number of values to write in FITS serialization- Specified by:
getNbCodingin classMoc
-
cellIterator
Provide an Iterator on the MOC cell List (range highest order architecture for Moc2D)- Specified by:
cellIteratorin 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:
writeSpecificDataRangein 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:
readSpecificDataRangein classMoc- Throws:
Exception
-
flush
public void flush()ASCII invalid input: '&' JSON parser -
addToken
Description copied from class:MocInternal 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
-