com.speckled.specksim.state
Class BroadcastDetails

java.lang.Object
  extended by com.speckled.specksim.state.BroadcastDetails
All Implemented Interfaces:
SerializableState

public class BroadcastDetails
extends java.lang.Object
implements SerializableState

Holds details of a broadcast

Author:
ryanm

Field Summary
 int broadcastChannel
          The channel ID of the broadcast
 float broadcastEndTime
          The time at which the broadcast ended
 int broadcastingSpeckID
          The id of the sending speck
 float broadcastStartTime
          The time at which the broadcast started
 int[] interferedSpeckIDs
          An array of the IDs of the specks that are interfered by the broadcast
 int messageSize
          The size of the message
 int possibleRecipients
          The number of specks that would be able to receive the broadcast under perfect conditions ie: no movement or interference
 int[] receivingSpeckIDs
          An array of the IDs of the specks that are receiving the broadcast
 
Constructor Summary
BroadcastDetails()
          Constructs a dummy BroadcastDetails that can be used to constructs others with the decode method
BroadcastDetails(int broadcastingSpeckID, int broadcastChannel, int possibleRecipients, int[] receivingSpeckIDs, int[] interferedSpeckIDs, float broadcastStartTime, float broadcastEndTime, int messageSize)
          Constructs a new BroadcastDetails
 
Method Summary
 BroadcastDetails decode(byte[] data)
          Decode the supplied data and construct a new state object from it.
 byte[] encode()
          Encode the data of this state object to a byte array, such that it may be decoded by decode( data )
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

broadcastingSpeckID

public final int broadcastingSpeckID
The id of the sending speck


broadcastChannel

public final int broadcastChannel
The channel ID of the broadcast


possibleRecipients

public final int possibleRecipients
The number of specks that would be able to receive the broadcast under perfect conditions ie: no movement or interference


receivingSpeckIDs

public final int[] receivingSpeckIDs
An array of the IDs of the specks that are receiving the broadcast


interferedSpeckIDs

public final int[] interferedSpeckIDs
An array of the IDs of the specks that are interfered by the broadcast


broadcastStartTime

public final float broadcastStartTime
The time at which the broadcast started


broadcastEndTime

public final float broadcastEndTime
The time at which the broadcast ended


messageSize

public final int messageSize
The size of the message

Constructor Detail

BroadcastDetails

public BroadcastDetails()
Constructs a dummy BroadcastDetails that can be used to constructs others with the decode method


BroadcastDetails

public BroadcastDetails(int broadcastingSpeckID,
                        int broadcastChannel,
                        int possibleRecipients,
                        int[] receivingSpeckIDs,
                        int[] interferedSpeckIDs,
                        float broadcastStartTime,
                        float broadcastEndTime,
                        int messageSize)
Constructs a new BroadcastDetails

Parameters:
broadcastingSpeckID -
broadcastChannel -
possibleRecipients -
receivingSpeckIDs -
interferedSpeckIDs -
broadcastStartTime -
broadcastEndTime -
messageSize -
Method Detail

decode

public BroadcastDetails decode(byte[] data)
                        throws java.io.IOException
Description copied from interface: SerializableState
Decode the supplied data and construct a new state object from it.

Specified by:
decode in interface SerializableState
Parameters:
data - The data to decode. It was produced by the encode() method
Returns:
A new state object that contains the supplied data
Throws:
java.io.IOException

encode

public byte[] encode()
Description copied from interface: SerializableState
Encode the data of this state object to a byte array, such that it may be decoded by decode( data )

Specified by:
encode in interface SerializableState
Returns:
The encoded data