baobab.trace
Class Trace

java.lang.Object
  extended by baobab.trace.Trace
All Implemented Interfaces:
Joinable<Trace>
Direct Known Subclasses:
DecomposedTrace, SubTrace

public class Trace
extends java.lang.Object
implements Joinable<Trace>

The Trace class represents a trace.

Author:
Marilia Dias Vieira Braga

Constructor Summary
Trace(int[] element, int elementSize)
          Constructs a Trace
Trace(Trace rule)
          Constructs a Trace, as a clone of a given trace
 
Method Summary
 void addElement(int[] element, int elementSize, int prevNumberOfElements)
          Adds a new element to this trace
 byte[] getBytes(int elementSize, int numberOfElements)
          Produces a string representation of a trace
 int[] getDebugElementData()
           
 java.util.Vector<int[]> getElements(int elementSize, int numberOfElements)
          Decode the trace as a Vector of elements (represented as arrays of ints)
 java.util.Vector<BitList> getElementsAsBitLists(int elementSize, int numberOfElements)
          Decode the trace as a Vector of elements (represented as arrays of bytes)
 int getHeightOf(BitList element, int elementSize, int numberOfElements)
           
 long getNumberOfOccurrences()
          Gets the number of occurrences of this trace
 int height(int elementSize, int numberOfElements)
           
 void incrementDebugNumberOfElements()
           
 void incrementOccurrences(long add)
          Increments the number of this trace
 boolean isEmpty()
          Tests whether this joinable object is empty
 void join(Trace trace)
          Join (merge) the object joinable to this object
 java.lang.String normalFormString(int elementSize, int numberOfElements)
          Produces a string representation of a trace
 java.lang.String normalFormString(int elementSize, int numberOfElements, java.lang.String[] mapIntToName, boolean condenseNames)
          Produces a string representation of a trace
static Trace parse(java.lang.String description, int elementSize, int numberOfElements)
           
static Trace parse(java.lang.String description, int elementSize, int numberOfElements, java.util.Hashtable<java.lang.String,java.lang.Integer> mapNamesToInt)
           
static Trace parseBitList(byte[] list, int elementSize, int numberOfElements)
           
 Trace reverse(int elementSize, int numberOfElements)
           
 void setDebugElementData(int[] debugData)
           
 void split(Trace trace)
          Split the object joinable from this object
 java.lang.String toString()
           
 java.lang.String toString(int elementSize, int numberOfElements)
          Produces a string representation of a trace
 java.lang.String toString(int elementSize, int numberOfElements, java.lang.String[] mapIntToName, boolean condenseNames)
          Produces a string representation of a trace
 java.lang.String toString(int elementSize, int numberOfElements, java.lang.String[] mapIntToName, java.util.Hashtable<java.lang.String,java.util.TreeSet<java.lang.String>> mapNamesToDescriptions, boolean condenseNames)
          Produces a string representation of a trace
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Trace

public Trace(int[] element,
             int elementSize)
Constructs a Trace

Parameters:
element - the first element represented as an array of ints
elementSize - the maximum value for all elements

Trace

public Trace(Trace rule)
Constructs a Trace, as a clone of a given trace

Parameters:
rule - the give trace
Method Detail

parse

public static Trace parse(java.lang.String description,
                          int elementSize,
                          int numberOfElements,
                          java.util.Hashtable<java.lang.String,java.lang.Integer> mapNamesToInt)

parse

public static Trace parse(java.lang.String description,
                          int elementSize,
                          int numberOfElements)

parseBitList

public static Trace parseBitList(byte[] list,
                                 int elementSize,
                                 int numberOfElements)

setDebugElementData

public void setDebugElementData(int[] debugData)

getDebugElementData

public int[] getDebugElementData()

incrementDebugNumberOfElements

public void incrementDebugNumberOfElements()

incrementOccurrences

public void incrementOccurrences(long add)
Increments the number of this trace

Parameters:
add - the number of occurrences to add

getHeightOf

public int getHeightOf(BitList element,
                       int elementSize,
                       int numberOfElements)

getNumberOfOccurrences

public long getNumberOfOccurrences()
Gets the number of occurrences of this trace

Returns:
the number of occurrences

getElements

public java.util.Vector<int[]> getElements(int elementSize,
                                           int numberOfElements)
Decode the trace as a Vector of elements (represented as arrays of ints)

Parameters:
elementSize - the maximum value for all elements
numberOfElements - the number of elements on this trace
Returns:
the resulting Vector

getElementsAsBitLists

public java.util.Vector<BitList> getElementsAsBitLists(int elementSize,
                                                       int numberOfElements)
Decode the trace as a Vector of elements (represented as arrays of bytes)

Parameters:
elementSize - the maximum value for all elements
numberOfElements - the number of elements on this trace
Returns:
the resulting Vector

addElement

public void addElement(int[] element,
                       int elementSize,
                       int prevNumberOfElements)
Adds a new element to this trace

Parameters:
element - the element to be added, represented as an array of ints
elementSize - the maximum value for all elements of this trace
prevNumberOfElements - the previous number of elements on this trace

height

public int height(int elementSize,
                  int numberOfElements)

reverse

public Trace reverse(int elementSize,
                     int numberOfElements)

normalFormString

public java.lang.String normalFormString(int elementSize,
                                         int numberOfElements)
Produces a string representation of a trace

Parameters:
elementSize - the maximum value for all elements of this trace
numberOfElements - the number of elements on this trace
Returns:
a string

normalFormString

public java.lang.String normalFormString(int elementSize,
                                         int numberOfElements,
                                         java.lang.String[] mapIntToName,
                                         boolean condenseNames)
Produces a string representation of a trace

Parameters:
elementSize - the maximum value for all elements of this trace
numberOfElements - the number of elements on this trace
Returns:
a string

toString

public java.lang.String toString(int elementSize,
                                 int numberOfElements)
Produces a string representation of a trace

Parameters:
elementSize - the maximum value for all elements of this trace
numberOfElements - the number of elements on this trace
Returns:
a string

getBytes

public byte[] getBytes(int elementSize,
                       int numberOfElements)
Produces a string representation of a trace

Parameters:
elementSize - the maximum value for all elements of this trace
numberOfElements - the number of elements on this trace
Returns:
a string

toString

public java.lang.String toString(int elementSize,
                                 int numberOfElements,
                                 java.lang.String[] mapIntToName,
                                 boolean condenseNames)
Produces a string representation of a trace

Parameters:
elementSize - the maximum value for all elements of this trace
numberOfElements - the number of elements on this trace
Returns:
a string

toString

public java.lang.String toString(int elementSize,
                                 int numberOfElements,
                                 java.lang.String[] mapIntToName,
                                 java.util.Hashtable<java.lang.String,java.util.TreeSet<java.lang.String>> mapNamesToDescriptions,
                                 boolean condenseNames)
Produces a string representation of a trace

Parameters:
elementSize - the maximum value for all elements of this trace
numberOfElements - the number of elements on this trace
Returns:
a string

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

join

public void join(Trace trace)
Description copied from interface: Joinable
Join (merge) the object joinable to this object

Specified by:
join in interface Joinable<Trace>
Parameters:
trace - the object to be joined

split

public void split(Trace trace)
Description copied from interface: Joinable
Split the object joinable from this object

Specified by:
split in interface Joinable<Trace>
Parameters:
trace - the object to be splitted

isEmpty

public boolean isEmpty()
Description copied from interface: Joinable
Tests whether this joinable object is empty

Specified by:
isEmpty in interface Joinable<Trace>
Returns:
true/false