baobab.util
Interface Coder<T>

Type Parameters:
T - the type of objects that this object may code
All Known Implementing Classes:
PermutationCounterCoder, SubTraceCoder, TraceCoder

public interface Coder<T>

The Coder interface represents a coder of an object as a bidimensional array of bytes

Author:
Marilia D. V. Braga

Method Summary
 byte[][] code(java.util.Vector<T> objects)
          Codes a vector of objects as a bidimensional array of bytes.
 java.util.Vector<T> decode(byte[][] codedObjects, int numberOfCodedObjects)
          Decodes a bidimensional array of bytes as a vector of objects.
 int getCodedArrayLength()
           
 

Method Detail

code

byte[][] code(java.util.Vector<T> objects)
Codes a vector of objects as a bidimensional array of bytes. If this coder is used by a CompressibleSortedSet, it is better to code the objects as few long chains (arrays) of bytes instead of many short chains (arrays). Also, it is important to code objects in the order they appear in the Vector, so that they can be decoded in the same order.

Parameters:
objects - A vector of objects
Returns:
the coded objects as an array of bytes

decode

java.util.Vector<T> decode(byte[][] codedObjects,
                           int numberOfCodedObjects)
Decodes a bidimensional array of bytes as a vector of objects.

Parameters:
codedObjects - the coded objects as a bidimensional array of bytes
numberOfCodedObjects - the number of objects that are coded
Returns:
a vector with the decoded objects

getCodedArrayLength

int getCodedArrayLength()