com.speckled.specksim.imp.shells
Class RealisticRadioShell

java.lang.Object
  extended by com.speckled.specksim.imp.shells.RealisticRadioShell
All Implemented Interfaces:
Configurable, MessageShell

public class RealisticRadioShell
extends java.lang.Object
implements MessageShell

This MessageShell uses a datafile that those clever people in Glasgow can generate to model the propagation of radio in a more realistic way. See the file radioShell.txt for an example

Author:
ryanm

Constructor Summary
RealisticRadioShell()
           
RealisticRadioShell(RealisticRadioShell shell)
          Constructs a new shell, identical to the argument
 
Method Summary
 MessageShell clone()
          Override this method to return a copy of this MessageShell.
 float getBitRate()
          Gets the data transmission speed, in kilobits per second.
 Vector3d[] getBoundingBox(SpeckPosition orientation)
          Works out an axis-aligned bounding box for this message shell.
 int getChannelID()
          Gets an identifier for the channel used by this shell.
 Configurator getConfigurator()
          Gets a Configurator object that describes and can manipulate the variables of this Configurable.
 float getMaxEnergy()
          Gets the current highest radiated energy data point
 SpeckPosition getOrientationOffset()
          Gets the offset that this shell has from the position and orientation of the owning speck
 float[] getPhiValues()
          Gets the values of phi for which there are radiated energy values
 float[][] getRadiatedEnergyValues()
          Gets the radiated energy values, indexed by (theta, phi)
 float getRange()
          Gets the current max range of the shell
 float[] getThetaValues()
          Gets the values of theta for which there are radiated energy values
 boolean hit(Speck sender, SpeckPosition senderOrientation, Speck target, SpeckPosition targetOrientation)
          Checks to see if the sender can reach the target.
 void setOrientationOffset(SpeckPosition offset)
          Sets the values of the offset that this shell will have with respect to the position and orientation of the owning speck
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RealisticRadioShell

public RealisticRadioShell()

RealisticRadioShell

public RealisticRadioShell(RealisticRadioShell shell)
Constructs a new shell, identical to the argument

Parameters:
shell - The shell to copy
Method Detail

hit

public boolean hit(Speck sender,
                   SpeckPosition senderOrientation,
                   Speck target,
                   SpeckPosition targetOrientation)
Description copied from interface: MessageShell
Checks to see if the sender can reach the target.

Specified by:
hit in interface MessageShell
Parameters:
sender - The sending speck
senderOrientation - The position of the sending speck at the time of transmission
target - The prospective receiving speck
targetOrientation - The position of the target speck at the time of transmission
Returns:
true if the sender can succesfully transmit to the target, false otherwise.

getThetaValues

public float[] getThetaValues()
Gets the values of theta for which there are radiated energy values

Returns:
the theta values, in degrees

getPhiValues

public float[] getPhiValues()
Gets the values of phi for which there are radiated energy values

Returns:
The phi values, in degrees

getRadiatedEnergyValues

public float[][] getRadiatedEnergyValues()
Gets the radiated energy values, indexed by (theta, phi)

Returns:
the radiated energy values

getMaxEnergy

public float getMaxEnergy()
Gets the current highest radiated energy data point

Returns:
The highest energy reading

getRange

public float getRange()
Gets the current max range of the shell

Returns:
The max range

getBoundingBox

public Vector3d[] getBoundingBox(SpeckPosition orientation)
Description copied from interface: MessageShell
Works out an axis-aligned bounding box for this message shell. This can be used as a quick rejection test when looking for broadcast recipients.

Specified by:
getBoundingBox in interface MessageShell
Parameters:
orientation - The orientation of the sending speck at the time of transmission
Returns:
A two-element array of Vector3Ds. The first element will be the position of the corner of the bounding box that is closest to the origin. The second element will be the corner furthest from the origin.

getBitRate

public float getBitRate()
Description copied from interface: MessageShell
Gets the data transmission speed, in kilobits per second. Return 0 for an effectively infinite bandwidth

Specified by:
getBitRate in interface MessageShell
Returns:
the bit rate of the transceiver, kbps, or 0 if you'd rather not bother will all of this messy low-level stuff

getChannelID

public int getChannelID()
Description copied from interface: MessageShell
Gets an identifier for the channel used by this shell. Shells operating on different channels will not interfer with each other. Radio devices should return a different value than laser devices, for example.

Specified by:
getChannelID in interface MessageShell
Returns:
An integer identifier for this channel.

getConfigurator

public Configurator getConfigurator()
Description copied from interface: Configurable
Gets a Configurator object that describes and can manipulate the variables of this Configurable. This method must only return null if the Configurable object is Annotated such that an AnnotatedConfigurator can be built from it.

Specified by:
getConfigurator in interface Configurable
Returns:
A configurator object, or null if annotated

clone

public MessageShell clone()
Description copied from interface: MessageShell
Override this method to return a copy of this MessageShell. This is so that changes can be made to the shell without affecting ongoing broadcasts.

Specified by:
clone in interface MessageShell
Overrides:
clone in class java.lang.Object
Returns:
A copy of this MessageShell, such that the clone will hit the same set of specks as the original

getOrientationOffset

public SpeckPosition getOrientationOffset()
Gets the offset that this shell has from the position and orientation of the owning speck

Returns:
The offset from the owning speck to the origin of the shell

setOrientationOffset

public void setOrientationOffset(SpeckPosition offset)
Sets the values of the offset that this shell will have with respect to the position and orientation of the owning speck

Parameters:
offset - The new offset values. Note that the values will be copied, so getOrientationOffset() will not return the supplied object in future.