T
- a TElement type.public abstract class TElementContext<T extends TElement> extends java.lang.Object implements StateSaveable
TElement
.Modifier and Type | Field and Description |
---|---|
protected T |
element
Reference to source element.
|
protected ValueSet |
variables
Variable bank.
|
Modifier | Constructor and Description |
---|---|
protected |
TElementContext(T element)
Creates an element context.
|
Modifier and Type | Method and Description |
---|---|
void |
clearValue(java.lang.String variableName)
Clears a variable's value on this context.
|
T |
getElement()
Gets the element associated with this context.
|
Value |
getValue(java.lang.String variableName)
Gets a variable's value on this context.
|
void |
readStateBytes(TAMEModule module,
java.util.Map<java.lang.Long,Value> referenceMap,
java.io.InputStream in)
Imports this object's state from bytes.
|
void |
setValue(java.lang.String variableName,
Value value)
Sets a variable's value on this context.
|
java.lang.String |
toString() |
java.util.Iterator<java.lang.String> |
values()
Returns an iterator of this context's value names.
|
void |
writeStateBytes(TAMEModule module,
java.util.concurrent.atomic.AtomicLong referenceCounter,
java.util.Map<java.lang.Object,java.lang.Long> referenceSet,
java.io.OutputStream out)
Exports this object's state to bytes.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
fromStateBytes, toStateBytes
protected ValueSet variables
protected TElementContext(T element)
element
- the element reference.public T getElement()
public void setValue(java.lang.String variableName, Value value)
variableName
- the variable name.value
- the variable value.public Value getValue(java.lang.String variableName)
variableName
- the variable name.public java.util.Iterator<java.lang.String> values()
public void clearValue(java.lang.String variableName)
variableName
- the variable name.public java.lang.String toString()
toString
in class java.lang.Object
public void writeStateBytes(TAMEModule module, java.util.concurrent.atomic.AtomicLong referenceCounter, java.util.Map<java.lang.Object,java.lang.Long> referenceSet, java.io.OutputStream out) throws java.io.IOException
StateSaveable
writeStateBytes
in interface StateSaveable
module
- the source module for reference.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 readStateBytes(TAMEModule module, java.util.Map<java.lang.Long,Value> referenceMap, java.io.InputStream in) throws java.io.IOException
StateSaveable
readStateBytes
in interface StateSaveable
module
- the source module for reference.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.