public class ValueSet extends java.lang.Object implements ReferenceSaveable, java.lang.Iterable<java.util.Map.Entry<java.lang.String,Value>>, com.tameif.tame.struct.Sizable
Constructor and Description |
---|
ValueSet()
Creates a new ValueHash.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears this hash.
|
boolean |
containsKey(java.lang.String variableName)
Checks if a variable is defined on this hash.
|
void |
copyFrom(ValueSet hash)
Copies values from one value hash to this one.
|
static ValueSet |
create(java.util.Map<java.lang.Long,Value> referenceMap,
java.io.InputStream in)
Creates this object from an input stream, expecting its byte representation.
|
Value |
get(java.lang.String variableName)
Gets a value on this hash.
|
boolean |
isEmpty()
Returns if this object contains no objects.
|
java.util.Iterator<java.util.Map.Entry<java.lang.String,Value>> |
iterator() |
java.util.List<java.lang.String> |
names() |
void |
put(java.lang.String variableName,
Value value)
Sets a value on this hash.
|
void |
readReferentialBytes(java.util.Map<java.lang.Long,Value> referenceMap,
java.io.InputStream in)
Imports this object from bytes, looking up value references in a map.
|
void |
remove(java.lang.String variableName)
Clears a variable from the hash.
|
int |
size() |
void |
writeReferentialBytes(java.util.concurrent.atomic.AtomicLong referenceCounter,
java.util.Map<java.lang.Object,java.lang.Long> referenceSet,
java.io.OutputStream out)
Exports this object to bytes, preserving up value references from a map.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fromReferentialBytes, toReferentialBytes
public static ValueSet create(java.util.Map<java.lang.Long,Value> referenceMap, java.io.InputStream in) throws java.io.IOException
referenceMap
- the reference map to use for "seen" value references.in
- the input stream to read from.java.io.IOException
- if a read error occurs.public void copyFrom(ValueSet hash)
hash
- the source hash to copy values from.public void clear()
public Value get(java.lang.String variableName)
variableName
- the variable name.public void put(java.lang.String variableName, Value value)
variableName
- the variable name.value
- the value.public void remove(java.lang.String variableName)
variableName
- the name of the variable.public boolean containsKey(java.lang.String variableName)
variableName
- the name of the variable.public java.util.List<java.lang.String> names()
public java.util.Iterator<java.util.Map.Entry<java.lang.String,Value>> iterator()
iterator
in interface java.lang.Iterable<java.util.Map.Entry<java.lang.String,Value>>
public void writeReferentialBytes(java.util.concurrent.atomic.AtomicLong referenceCounter, java.util.Map<java.lang.Object,java.lang.Long> referenceSet, java.io.OutputStream out) throws java.io.IOException
ReferenceSaveable
writeReferentialBytes
in interface ReferenceSaveable
referenceCounter
- the reference counter to use for when unique values are seen.referenceSet
- the reference set to use for "seen" value references - maps object reference to counter value.out
- the output stream to write to.java.io.IOException
- if a write problem occurs.public void readReferentialBytes(java.util.Map<java.lang.Long,Value> referenceMap, java.io.InputStream in) throws java.io.IOException
ReferenceSaveable
readReferentialBytes
in interface ReferenceSaveable
referenceMap
- the reference map to use for "seen" value references.in
- the input stream to read from.java.io.IOException
- if a read problem occurs.public int size()
size
in interface com.tameif.tame.struct.Sizable
public boolean isEmpty()
com.tameif.tame.struct.Sizable
Sizable.size()
returns 0.isEmpty
in interface com.tameif.tame.struct.Sizable