public class DataBinsCacheManagement
extends java.lang.Object
addJPIPMessage(JPIPMessage)
.
getDataBin(int, long)
.
getCacheDescriptor(ViewWindowField, int, int)
.
Usage example:
constructor
setJPEG2KCodestream
[add methods] / [get methods]
Modifier and Type | Field and Description |
---|---|
protected JPEG2KCodestream |
codestream
Definition in
JPEG2KCodestream . |
static int |
EXPLICIT_FORM |
static int |
IMPLICIT_FORM |
static int |
INDEX_RANGE |
protected MainHeaderDataBin |
mainHeaderDataBin
Contains the main header codestream.
|
protected java.util.Map<java.lang.Long,MetaDataBin> |
metaDataBins |
private java.util.concurrent.locks.ReentrantLock |
mutex
Mutex used to lock the cache.
|
static int |
NO_CACHE
Allowed values for the form of the cache bin descriptor.
|
static int |
NUMBER_OF_BYTES |
static int |
NUMBER_OF_LAYERS |
protected java.util.Map<java.lang.Long,PrecinctDataBin> |
precinctsDataBins
Is a hashtable contains the received data for each precinct data-bin.
|
protected java.util.Map<java.lang.Long,TileHeaderDataBin> |
tileHeaderDataBins
Stores the tile header data received.
|
static int |
WILDCARD
Allowed values for the qualifier of the cache bin descriptor.
|
Constructor and Description |
---|
DataBinsCacheManagement()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addJPIPMessage(JPIPMessage jpipMessage)
Adds a segment of a data-bin given as a JPIP message.
|
protected java.util.ArrayList<ModelElement> |
explicitForm(java.util.ArrayList<java.lang.Long> relevantPrecincts,
int qualifier)
Gets the cache descriptor following the explicit form.
|
protected java.util.ArrayList<ModelElement> |
explicitForm(int qualifier)
Gets the cache descriptor following the explicit form.
|
java.util.ArrayList<ModelElement> |
getCacheDescriptor(ViewWindowField viewWindow,
int form,
int qualifier) |
DataBin |
getDataBin(int classIdentifier,
long inClassIdentifier)
Returns the byte array of the data-bin identified by
classIdentifier and the inClassIdentifier . |
long |
getDatabinLength(int classIdentifier,
long inClassIdentifier)
Returns the length of a data bin.
|
protected java.util.ArrayList<ModelElement> |
implicitForm(java.util.ArrayList<java.lang.Long> relevantPrecincts)
Gets the cache descriptor following the implicit form.
|
boolean |
isComplete(int classIdentifier,
long inClassIdentifier)
Check if a data bin is complete.
|
boolean |
isHeldByCurrentThread() |
boolean |
isInCache(ViewWindowField viewWindow)
This method is used to check if a requested window of interest can
be retrieved from the data stored in the cache.
|
boolean |
isLocked() |
java.util.Set<java.lang.Long> |
keySet(int classIdentifier) |
void |
list(java.io.PrintStream out)
Prints this cache out to the specified output stream.
|
void |
lock()
Locks all the cache's data bins.
|
private static void |
printByteStream(byte[] buffer)
Useful method for printing out a ByteStream.
|
void |
reset()
Sets the attributes to its initial values.
|
void |
setJPEG2KCodestream(JPEG2KCodestream codestream)
Sets the
codestream attribute. |
java.lang.String |
toString() |
void |
unlock()
Unlocks all the cache's data bins.
|
protected MainHeaderDataBin mainHeaderDataBin
protected java.util.Map<java.lang.Long,PrecinctDataBin> precinctsDataBins
The key of the hash is the unique precinct identifier (see
JPIPMessageHeader.inClassIdentifier
).
The hash's value is an object with the precinct data.
protected java.util.Map<java.lang.Long,TileHeaderDataBin> tileHeaderDataBins
The hash's key is the tile identifier. And the value is an object to save the tile header data-bin.
protected java.util.Map<java.lang.Long,MetaDataBin> metaDataBins
protected JPEG2KCodestream codestream
JPEG2KCodestream
.
This object can be only read and it cannot be modified or removed because it is a shared object used by other classes.
public static final int NO_CACHE
Further information, see ISO/IEC 15444-9 sections C.8.1.2 y C.8.1.3
public static final int EXPLICIT_FORM
public static final int IMPLICIT_FORM
public static final int WILDCARD
Further information, see ISO/IEC 15444-9 sections C.8.1.2 y C.8.1.3
public static final int INDEX_RANGE
public static final int NUMBER_OF_LAYERS
public static final int NUMBER_OF_BYTES
private java.util.concurrent.locks.ReentrantLock mutex
public final void setJPEG2KCodestream(JPEG2KCodestream codestream)
codestream
attribute.codestream
- definition in codestream
.public void addJPIPMessage(JPIPMessage jpipMessage)
jpipMessage
- definition in JPIPMessage
.public DataBin getDataBin(int classIdentifier, long inClassIdentifier)
classIdentifier
and the inClassIdentifier
.
If the data-bin is not in the cache, a null
pointer is
returned.classIdentifier
- definition in JPIPMessageHeader.classIdentifierinClassIdentifier
- definition in JPIPMessageHeader.inClassIdentifier null
pointer if
the data-bin is not in the cache.public final boolean isComplete(int classIdentifier, long inClassIdentifier)
classIdentifier
- definition in JPIPMessageHeader.classIdentifierinClassIdentifier
- definition in JPIPMessageHeader.inClassIdentifiertrue
if the data bin is complete. Otherwise, returns
false
.public final long getDatabinLength(int classIdentifier, long inClassIdentifier)
classIdentifierdefinition
- in JPIPMessageHeader.classIdentifierinClassIdentifier
- definition in JPIPMessageHeader.inClassIdentifierpublic final java.util.Set<java.lang.Long> keySet(int classIdentifier)
classIdentifier
- definition in JPIPMessageHeader.classIdentifierpublic void reset()
public boolean isInCache(ViewWindowField viewWindow)
viewWindow
- definition in ViewWindowField
.true
if the WOI can be recovered.
Otherwise, it will return false
.public java.util.ArrayList<ModelElement> getCacheDescriptor(ViewWindowField viewWindow, int form, int qualifier)
viewWindow
- type
- allowed values: NO_CACHE
, EXPLICIT_FORM
,
IMPLICIT_FORM
.subtype
- allowed values: WILDCARD
, INDEX_RANGE
,
NUMBER_OF_LAYERS
, or NUMBER_OF_BYTES
.public void lock()
Since all data bins are locked, it must be used carefully.
public void unlock()
public boolean isLocked()
public boolean isHeldByCurrentThread()
public java.lang.String toString()
toString
in class java.lang.Object
public void list(java.io.PrintStream out)
out
- an output stream.protected java.util.ArrayList<ModelElement> explicitForm(java.util.ArrayList<java.lang.Long> relevantPrecincts, int qualifier)
relevantPrecincts
- an array list with the relevant precincts which
will be included in the cache descriptor.subtype
- allowed values: WILDCARD
, INDEX_RANGE
,
NUMBER_OF_LAYERS
, or NUMBER_OF_BYTES
.protected java.util.ArrayList<ModelElement> explicitForm(int qualifier)
subtype
- allowed values: WILDCARD
, INDEX_RANGE
,
NUMBER_OF_LAYERS
, or NUMBER_OF_BYTES
.protected java.util.ArrayList<ModelElement> implicitForm(java.util.ArrayList<java.lang.Long> relevantPrecincts)
relevantPrecincts
- an array list with the relevant precincts which
will be included in the cache descriptor.private static void printByteStream(byte[] buffer)
buffer
- the byte array to be printed.
CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Group on Interactive Coding of Images (GICI) (contact)