SSF.OS.BGP4.Players
Class AbstractPlayer

java.lang.Object
  |
  +--SSF.Util.Streams.BasicPlayer
        |
        +--SSF.OS.BGP4.Players.AbstractPlayer
All Implemented Interfaces:
StreamInterface
Direct Known Subclasses:
BinPlayer, DataPlayer, TrafficPlayer, VerbosePlayer

public class AbstractPlayer
extends BasicPlayer

Converts encoded simulation records into instances of Java constructs (Objects or fundamental types). For each record, a method specific to that record type is called which handles how that record will be "played back".


Field Summary
protected  BasicPlayer[] handlers
          An array of handlers for each type of record.
 
Constructor Summary
AbstractPlayer(java.lang.String streamID)
          Constructs an abstract player using the given stream ID.
 
Method Summary
 int receive(int typeid, int srcid, double time, byte[] buf, int bindex, int length)
          Converts an encoded simulation record into Java constructs.
 
Methods inherited from class SSF.Util.Streams.BasicPlayer
connectRead, connectWrite, disconnect, getRecordCount, getRecordSourceCode, getRecordSourceString, getRecordTypeCode, getRecordTypeString, isConnected, main, send, send
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handlers

protected BasicPlayer[] handlers
An array of handlers for each type of record.

Constructor Detail

AbstractPlayer

public AbstractPlayer(java.lang.String streamID)
Constructs an abstract player using the given stream ID.

Method Detail

receive

public int receive(int typeid,
                   int srcid,
                   double time,
                   byte[] buf,
                   int bindex,
                   int length)
Converts an encoded simulation record into Java constructs.

Specified by:
receive in interface StreamInterface
Overrides:
receive in class BasicPlayer
Parameters:
typeid - A code indicating the type of the record.
srcid - A code indicating the source of the record.
time - The simulation time at which the record was created.
buf - A byte array which contains the record (as well as additional bytes, maybe).
bindex - The index into the byte array at which the record begins.
length - The number of bytes in the record.
Returns:
an integer indicating whether or not the method completed successfully