baobab.trace
Class Trace

java.lang.Object
  extended by baobab.trace.Trace
All Implemented Interfaces:
baobab.util.Joinable<Trace>

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

The Trace class represents a trace on 1..elementSize. A trace is a precedence defined set of sets, which are sorted sets of elements. An element is a sorted set of integers on 1..elementSize. A set is a collection of compatible elements (two elements are compatibles when they do not intersect or when one contains the other).

Version:
1.0, August 2006
Author:
Marilia Dias Vieira Braga

Constructor Summary
Trace(byte[] element, int elementSize)
          Constructs a Trace
Trace(Trace rule)
          Constructs a Trace, as a clone of a given trace
 
Method Summary
 void addElement(byte[] element, int elementSize, int prevNumberOfElements)
          Adds a new element to this trace
 int[] getDebugElementData()
           
 java.util.Vector<byte[]> getElements(int elementSize, int numberOfElements)
          Decode the trace as a Vector of elements (represented as arrays of bytes)
 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()
           
 void join(Trace trace)
           
static Trace parse(java.lang.String description, int elementSize, int numberOfElements)
           
 void setDebugElementData(int[] debugData)
           
 void split(Trace trace)
           
 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)
          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(byte[] element,
             int elementSize)
Constructs a Trace

Parameters:
element - the first element represented as an array of bytes
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)

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

getNumberOfOccurrences

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

Returns:
the number of occurrences

getElements

public java.util.Vector<byte[]> getElements(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(byte[] element,
                       int elementSize,
                       int prevNumberOfElements)
Adds a new element to this trace

Parameters:
element - the element to be added, represented as an array of bytes
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)

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

toString

public java.lang.String toString(int elementSize,
                                 int numberOfElements,
                                 java.lang.String[] mapIntToName)
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)
Specified by:
join in interface baobab.util.Joinable<Trace>

split

public void split(Trace trace)
Specified by:
split in interface baobab.util.Joinable<Trace>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface baobab.util.Joinable<Trace>