de.cau.cs.kieler.krep.evalbench.trace
Class Trace

java.lang.Object
  extended by de.cau.cs.kieler.krep.evalbench.trace.Trace
All Implemented Interfaces:
Iterator<Tick>

public class Trace
extends Object
implements Iterator<Tick>

A trace is a set of ticks, which contains input and output valuations.

Rating proposed yellow
(2010-01-28) ctr

Constructor Summary
Trace(IAssembler asm)
          read trace from a file.
Trace(LinkedList<Tick> ts)
          Generate new Trace from a list of ticks.
 
Method Summary
 void add(IO io, Signal s)
          add signal to the last tick of the trace.
 void add(Tick t)
          add an additional tick to the end of the trace.
 HashMap<String,Integer> getIndex()
           
 int getPos()
           
 Tick getTick()
           
 ArrayList<Tick> getTicks()
           
 String getWCRT()
           
 boolean hasNext()
           
 boolean isValid()
           
 Tick next()
          activate the next tick.
 LinkedList<String[]> printTicks()
           
 void remove()
          
 void reset()
          Reset the trace counter to the start of the tick.
 void setIndex(HashMap<String,Integer> idx)
           
 void setOutput(Tick output)
          set the value of the output signal in the current tick.
 void setTicks(ArrayList<Tick> ts)
           
 int size()
           
 void snapshot()
          save the current value of all outputs as a reference.
 void startTick()
          generate new Tick from scratch.
 String toString()
           
 void validate()
          check for the whole trace, that the outputs match the reference outputs.
 boolean validateCurrent()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Trace

public Trace(IAssembler asm)
read trace from a file.

Parameters:
asm - the assembler program that is tested by this trace

Trace

public Trace(LinkedList<Tick> ts)
Generate new Trace from a list of ticks.

Parameters:
ts - ticks of the trace
Method Detail

getIndex

public HashMap<String,Integer> getIndex()
Returns:
mapping for all signals in the trace to their index.

setIndex

public void setIndex(HashMap<String,Integer> idx)
Parameters:
idx - mapping for all signals in the trace to their index.

setTicks

public void setTicks(ArrayList<Tick> ts)
Parameters:
ts - all ticks of the current trace.

getTicks

public ArrayList<Tick> getTicks()
Returns:
all ticks of the current trace.

add

public void add(IO io,
                Signal s)
add signal to the last tick of the trace.

Parameters:
io - indicate whether this is an input or output
s - the additional signal

startTick

public void startTick()
generate new Tick from scratch.


reset

public void reset()
Reset the trace counter to the start of the tick.


getPos

public int getPos()
Returns:
current number of steps

size

public int size()
Returns:
number of steps

remove

public void remove()

Specified by:
remove in interface Iterator<Tick>

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<Tick>
Returns:
true if the trace contains more ticks

printTicks

public LinkedList<String[]> printTicks()
Returns:
String representation of the trace for table in Trace view

setOutput

public void setOutput(Tick output)
set the value of the output signal in the current tick.

Parameters:
output - tick which outputs are read

getTick

public Tick getTick()
Returns:
the current tick

next

public final Tick next()
activate the next tick.

Specified by:
next in interface Iterator<Tick>
Returns:
the next tick

validateCurrent

public boolean validateCurrent()
Returns:
true when the outputs of the current tick match the reference outputs

validate

public void validate()
check for the whole trace, that the outputs match the reference outputs.


isValid

public boolean isValid()
Returns:
true, if the outputs match the reference output in all ticks

toString

public String toString()
Overrides:
toString in class Object

getWCRT

public String getWCRT()
Returns:
String to indicate minimal, average and maximal execution times

snapshot

public void snapshot()
save the current value of all outputs as a reference.


add

public void add(Tick t)
add an additional tick to the end of the trace.

Parameters:
t - the additional tick