de.cau.cs.kieler.krep.evalbench.comm
Class CommunicationProtocol

java.lang.Object
  extended by de.cau.cs.kieler.krep.evalbench.comm.CommunicationProtocol
All Implemented Interfaces:
ICommunicationProtocol
Direct Known Subclasses:
KepProtocol, KlpProtocol

public abstract class CommunicationProtocol
extends Object
implements ICommunicationProtocol

Abstract class, implements common protocol features.

Rating yellow
(2010-02-05) review by cmot, msp, tam

Field Summary
 
Fields inherited from interface de.cau.cs.kieler.krep.evalbench.comm.ICommunicationProtocol
P_KEP, P_KREP
 
Constructor Summary
protected CommunicationProtocol(IConnection connectionProtocol)
          Constructs a new instance of the KEP protocol.
 
Method Summary
 void addCommunicationListener(ICommunicationListener listener)
          Adds a communication listener that is notified of all transferred data.
protected  LinkedList<ICommunicationListener> getCommunicationListeners()
           
protected  IConnection getConnection()
           
protected  void notifyComment(String comment)
          Notifies all registered communication listeners about a comment.
protected  void notifyReceive(String data)
          Notifies all registered communication listeners about received data.
protected  void notifySend(String data)
          Notifies all registered communication listeners about sent data.
 void removeCommunicationListener(ICommunicationListener listener)
          Removes a communication listener from the list.
protected  void setCommunicationListeners(LinkedList<ICommunicationListener> theCommunicationListeners)
           
protected  void setConnection(IConnection theConnection)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.cau.cs.kieler.krep.evalbench.comm.ICommunicationProtocol
continuousRun, getExecutionTrace, getTargetInfo, loadProgram, reset, stopContinuous, tick, verifyCommunication
 

Constructor Detail

CommunicationProtocol

protected CommunicationProtocol(IConnection connectionProtocol)
Constructs a new instance of the KEP protocol.

Parameters:
connectionProtocol - underlying connection protocol to be used; this protocol instance is expected to be already initialized
Method Detail

notifySend

protected void notifySend(String data)
Notifies all registered communication listeners about sent data.

Parameters:
data - data that was sent

notifyReceive

protected void notifyReceive(String data)
Notifies all registered communication listeners about received data.

Parameters:
data - data that was received

notifyComment

protected void notifyComment(String comment)
Notifies all registered communication listeners about a comment.

Parameters:
comment - comment about the next transaction

addCommunicationListener

public void addCommunicationListener(ICommunicationListener listener)
Adds a communication listener that is notified of all transferred data.

Specified by:
addCommunicationListener in interface ICommunicationProtocol
Parameters:
listener - listener to be added

removeCommunicationListener

public void removeCommunicationListener(ICommunicationListener listener)
Removes a communication listener from the list.

Specified by:
removeCommunicationListener in interface ICommunicationProtocol
Parameters:
listener - listener to be removed

setCommunicationListeners

protected void setCommunicationListeners(LinkedList<ICommunicationListener> theCommunicationListeners)
Parameters:
theCommunicationListeners - the communicationListeners to set

getCommunicationListeners

protected LinkedList<ICommunicationListener> getCommunicationListeners()
Returns:
the communicationListeners

setConnection

protected void setConnection(IConnection theConnection)
Parameters:
theConnection - the connection to set

getConnection

protected IConnection getConnection()
Returns:
the connection