baobab.trace
Class TraceCoder

java.lang.Object
  extended by baobab.trace.TraceCoder
All Implemented Interfaces:
Coder<Trace>
Direct Known Subclasses:
SubTraceCoder

public class TraceCoder
extends java.lang.Object
implements Coder<Trace>

The TraceCoder class codifies a trace as a bidimensional array of bytes.

Author:
Marilia Dias Vieira Braga

Method Summary
 byte[][] code(Trace decoded)
           
 int[] code(Trace decoded, byte[][] coded, int pos1, int pos2)
           
 byte[][] code(java.util.Vector<Trace> rules)
          Codes a vector of objects as a bidimensional array of bytes.
 Trace decode(byte[][] coded)
           
 java.util.Vector<Trace> decode(byte[][] codedElement, int numberOfCodedTraces)
          Decodes a bidimensional array of bytes as a vector of objects.
 Trace decode(byte[][] coded, int pos1, int len1, int pos2, int len2)
           
 int getCodedArrayLength()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

code

public byte[][] code(Trace decoded)

decode

public Trace decode(byte[][] coded)

code

public int[] code(Trace decoded,
                  byte[][] coded,
                  int pos1,
                  int pos2)

decode

public Trace decode(byte[][] coded,
                    int pos1,
                    int len1,
                    int pos2,
                    int len2)

code

public byte[][] code(java.util.Vector<Trace> rules)
Description copied from interface: Coder
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.

Specified by:
code in interface Coder<Trace>
Parameters:
rules - A vector of objects
Returns:
the coded objects as an array of bytes

decode

public java.util.Vector<Trace> decode(byte[][] codedElement,
                                      int numberOfCodedTraces)
Description copied from interface: Coder
Decodes a bidimensional array of bytes as a vector of objects.

Specified by:
decode in interface Coder<Trace>
Parameters:
codedElement - the coded objects as a bidimensional array of bytes
numberOfCodedTraces - the number of objects that are coded
Returns:
a vector with the decoded objects

getCodedArrayLength

public int getCodedArrayLength()
Specified by:
getCodedArrayLength in interface Coder<Trace>