|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.umd.cloud9.util.map.HMapIF
edu.umd.cloud9.io.map.HMapIFW
public class HMapIFW
Writable representing a map where keys are ints and values are floats.
One notable feature of this class is the ability to support lazy decoding,
controlled by the setLazyDecodeFlag(boolean) method. In lazy
decoding mode, when an object of this type is deserialized, key-value pairs
are not inserted into the map, but rather held in arrays. The reduces memory
used in cases where random access to values is not required. In lazy decoding
mode, the raw keys and values may be fetched by the getKeys() and
getValues() methods, respectively. The map can be subsequently
populated with the decode() method.
| Constructor Summary | |
|---|---|
HMapIFW()
Creates a HMapIFW object. |
|
| Method Summary | |
|---|---|
static HMapIFW |
create(byte[] bytes)
Creates a HMapIFW object from a byte array. |
static HMapIFW |
create(DataInput in)
Creates a HMapIFW object from a DataInput. |
void |
decode()
In lazy decoding mode, populates the map with deserialized data. |
int[] |
getKeys()
In lazy decoding mode, returns an array of all the keys if the map hasn't been decoded yet. |
static boolean |
getLazyDecodeFlag()
Returns the value of the lazy decoding flag |
float[] |
getValues()
In lazy decoding mode, returns an array of all the values if the map hasn't been decoded yet. |
boolean |
isDecoded()
Returns whether or not this map has been decoded. |
void |
plus(HMapIFW m)
Adds values from keys of another map to this map. |
void |
readFields(DataInput in)
Deserializes the map. |
byte[] |
serialize()
Returns the serialized representation of this object as a byte array. |
static void |
setLazyDecodeFlag(boolean b)
Sets the lazy decoding flag. |
int |
size()
Returns the number of key-value mappings in this map. |
void |
write(DataOutput out)
Serializes the map. |
| Methods inherited from class edu.umd.cloud9.util.map.HMapIF |
|---|
clear, clone, containsKey, containsValue, dot, entrySet, get, getEntriesSortedByValue, getEntriesSortedByValue, isEmpty, keySet, length, normalize, plus, put, putAll, remove, toString, values |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface edu.umd.cloud9.util.map.MapIF |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public HMapIFW()
HMapIFW object.
| Method Detail |
|---|
public void readFields(DataInput in)
throws IOException
readFields in interface Writablein - source for raw byte representation
IOExceptionpublic void decode()
IOExceptionpublic boolean isDecoded()
public void write(DataOutput out)
throws IOException
write in interface Writableout - where to write the raw byte representation
IOException
public byte[] serialize()
throws IOException
IOException
public static HMapIFW create(DataInput in)
throws IOException
HMapIFW object from a DataInput.
in - source for reading the serialized representation
HMapIFW object
IOException
public static HMapIFW create(byte[] bytes)
throws IOException
HMapIFW object from a byte array.
bytes - raw serialized representation
HMapIFW object
IOExceptionpublic static void setLazyDecodeFlag(boolean b)
public static boolean getLazyDecodeFlag()
public int[] getKeys()
public float[] getValues()
public void plus(HMapIFW m)
m - the other mappublic int size()
MapIF
size in interface MapIFsize in class HMapIF
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||