ProtocolLearner
Class MessageTrace

java.lang.Object
  extended by ProtocolLearner.MessageTrace
All Implemented Interfaces:
java.lang.Iterable<java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>>>, java.util.Iterator<java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>>>

public class MessageTrace
extends java.lang.Object
implements java.lang.Iterable<java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>>>, java.util.Iterator<java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>>>

An abstract class for a message trace. Message trace is defined as a sequence of input/output messages.

Author:
Serge Gorbunov

Constructor Summary
MessageTrace(int id)
          Constructor.
 
Method Summary
 boolean addIOPair(java.lang.String input, java.util.ArrayList<java.lang.String> output)
          Adds a pair of input/output messages to the message trace
 void addLoop(PassiveLearner.Loop l)
          Identify a new loop in the trace
 java.util.ArrayList<PassiveLearner.Loop> getLoops()
           
 java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>> getMsg(int index)
           
 java.util.ArrayList<java.lang.Integer> getSkipMsgs()
           
 java.util.ArrayList<java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>>> getTrace()
          Returns the whole message trace
 int getTraceId()
          Returns the trace identifier
 int getTraceSize()
          Returns the number of IO pais in the trace
 boolean hasNext()
          Checks if there is a next IO pair in the trace
 java.util.Iterator<java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>>> iterator()
          Iterator method
 java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>> next()
          Returns the next IO pair from the trace
 void remove()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageTrace

public MessageTrace(int id)
Constructor.

Parameters:
id - Message trace identifier
Method Detail

getTraceId

public int getTraceId()
Returns the trace identifier

Returns:
Trace identifier

addIOPair

public boolean addIOPair(java.lang.String input,
                         java.util.ArrayList<java.lang.String> output)
Adds a pair of input/output messages to the message trace

Parameters:
input - Input message
output - Output message
Returns:
True if the IO pair is successfully added

getTrace

public java.util.ArrayList<java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>>> getTrace()
Returns the whole message trace

Returns:
The message trace

iterator

public java.util.Iterator<java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>>> iterator()
Iterator method

Specified by:
iterator in interface java.lang.Iterable<java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>>>

hasNext

public boolean hasNext()
Checks if there is a next IO pair in the trace

Specified by:
hasNext in interface java.util.Iterator<java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>>>
Returns:
True if there is one, false otherwise

next

public java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>> next()
Returns the next IO pair from the trace

Specified by:
next in interface java.util.Iterator<java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>>>
Returns:
IO pair

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>>>

addLoop

public void addLoop(PassiveLearner.Loop l)
Identify a new loop in the trace


getLoops

public java.util.ArrayList<PassiveLearner.Loop> getLoops()

getTraceSize

public int getTraceSize()
Returns the number of IO pais in the trace


getMsg

public java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>> getMsg(int index)
Returns:
A IO message at the specified index

getSkipMsgs

public java.util.ArrayList<java.lang.Integer> getSkipMsgs()
Returns:
An arraylist of messsageIds that should be skipped while constructing a FSA due to those traces being a part of a loop