js.tinyvm
Class RecordTable<T extends WritableData>

java.lang.Object
  extended by js.tinyvm.WritableDataWithOffset
      extended by js.tinyvm.RecordTable<T>
All Implemented Interfaces:
WritableData

public class RecordTable<T extends WritableData>
extends WritableDataWithOffset

Record table.


Constructor Summary
RecordTable(java.lang.String name, boolean allowDuplicates, boolean align)
          Constructor.
 
Method Summary
 void add(T element)
          Add a writable element.
 void dump(IByteWriter writer)
          Dump all elements.
 T get(int index)
          Get writable element by its index.
 int getLength()
          Length.
 int indexOf(T element)
          Get index of writable element.
 void initOffset(int startOffset)
          Init offset of record table and all of its elements.
 java.util.Iterator<T> iterator()
          Iterator.
 int size()
          Number of entries.
 
Methods inherited from class js.tinyvm.WritableDataWithOffset
getOffset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecordTable

public RecordTable(java.lang.String name,
                   boolean allowDuplicates,
                   boolean align)
Constructor.

Parameters:
name - description of this record table
allowDuplicates - allow duplicates?
align - align output?
Method Detail

add

public void add(T element)
Add a writable element.

Parameters:
element -

get

public T get(int index)
Get writable element by its index.

Parameters:
index - index

indexOf

public int indexOf(T element)
Get index of writable element.

Parameters:
element -
Returns:
index or -1 if not found

iterator

public java.util.Iterator<T> iterator()
Iterator.


size

public int size()
Number of entries.


dump

public void dump(IByteWriter writer)
          throws TinyVMException
Dump all elements.

Parameters:
writer - writer to write binary to
Throws:
TinyVMException

getLength

public int getLength()
              throws TinyVMException
Length.

Throws:
TinyVMException

initOffset

public void initOffset(int startOffset)
                throws TinyVMException
Init offset of record table and all of its elements.

Overrides:
initOffset in class WritableDataWithOffset
Parameters:
startOffset - start offset
Throws:
TinyVMException - if offset is not correct