baobab.bio.permutation.counter
Class PermutationCounterCoder

java.lang.Object
  extended by baobab.bio.permutation.counter.PermutationCounterCoder
All Implemented Interfaces:
Coder<PermutationCounter>

public class PermutationCounterCoder
extends java.lang.Object
implements Coder<PermutationCounter>

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

Author:
Marilia Dias Vieira Braga

Constructor Summary
PermutationCounterCoder(int permutationSize)
          Constructs a TraceCoder
 
Method Summary
 int[] code(PermutationCounter decoded, byte[][] coded, int pos1, int pos2)
           
 byte[][] code(java.util.Vector<PermutationCounter> rules)
          Codes a vector of objects as a bidimensional array of bytes.
 java.util.Vector<PermutationCounter> decode(byte[][] codedElement, int numberOfCodedPermutations)
          Decodes a bidimensional array of bytes as a vector of objects.
 PermutationCounter 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
 

Constructor Detail

PermutationCounterCoder

public PermutationCounterCoder(int permutationSize)
Constructs a TraceCoder

Method Detail

code

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

decode

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

code

public byte[][] code(java.util.Vector<PermutationCounter> 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<PermutationCounter>
Parameters:
rules - A vector of objects
Returns:
the coded objects as an array of bytes

decode

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

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

getCodedArrayLength

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