All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gerken.vehicles.Receptor

java.lang.Object
   |
   +----gerken.vehicles.NetworkNode
           |
           +----gerken.vehicles.Receptor

public class Receptor
extends NetworkNode

A Receptor is like a NetworkNode in that it sums its inputs, it fires and it can therefore affect other nodes in a VehicleNetwork. It differs, though, in the way that it gathers inputs. While a NetworkNode sums inputs from connections with other nodes, a Receptor gets its input from the light given off by other simulation participants. In order for a participant to be seen by a Receptor, the participant must have the exact color that the Receptor is programmed to see. In addition, the participant must lie in the Receptor's field of vision.

This software is provided on an as-is basis and is copyright Chris Gerken. The only rights granted to you are to enjoy and learn from this software.


Constructor Index

 o Receptor(double, double, Color, int, String)

Return a receptor whose field of vision lies between angle l to the left and angle r to the right.

Method Index

 o addToLightInput(double)
Increment the receptor's light input sum by value.

 o compute()

All of the receiver's inputs have been summed.

 o getInput()

Return the light input to the receptor as an integer value.

 o getLeftAngle()

Get the counterclockwise-most boundary angle of the receptor's field of vision.

 o getLightInput()

Return the amount of light received by the receptor.

 o getRightAngle()

Get the clockwise-most boundary angle of the receptor's field of vision.

 o getSaturated()

Return whether this receptor has total light inputs that exceed its threshhold.

 o getSeesColor()

Return the color seen by the receptor.

 o seesAngle(double)

Determine whether angle lies between the receiver's leftAngle and rightAngle.

 o setLeftAngle(double)

Set the counterclockwise-most boundary angle of the receptor's field of vision.

 o setRightAngle(double)

Set the clockwise-most boundary angle of the receptor's field of vision.

Constructors

 o Receptor
 public Receptor(double l,
                 double r,
                 Color c,
                 int t,
                 String n)

Return a receptor whose field of vision lies between angle l to the left and angle r to the right. The receptor will see other participants of color c and will fire whenever the sum of its light inputs exceeds threshhold t. Once registered to a scenario, the receptor can be retrieved using name n.

Although angles are represented internally in radians, the values in this constructor are assumed to be double values in degrees. An angle of 0.0 represents the direction in which he vehicle is moving. The angle value increases (to 180.0 directly behind the vehicle) to the left or counterclockwise. Angle values decrease to the right or clockwise.

Parameters:
l - double
r - double
c - java.awt.Color
t - int
n - java.lang.String

Methods

 o addToLightInput
 public void addToLightInput(double value)
Increment the receptor's light input sum by value.

Parameters:
value - double
 o compute
 public void compute()

All of the receiver's inputs have been summed. If the sum of the inputs is greater than the threshhold then the receiver will fire.

Overrides:
compute in class NetworkNode
 o getInput
 public int getInput()

Return the light input to the receptor as an integer value.

Returns:
int
Overrides:
getInput in class NetworkNode
 o getLeftAngle
 public double getLeftAngle()

Get the counterclockwise-most boundary angle of the receptor's field of vision.

Returns:
double
 o getLightInput
 public double getLightInput()

Return the amount of light received by the receptor.

Returns:
double
 o getRightAngle
 public double getRightAngle()

Get the clockwise-most boundary angle of the receptor's field of vision.

Returns:
double
 o getSaturated
 public boolean getSaturated()

Return whether this receptor has total light inputs that exceed its threshhold.

Returns:
boolean
 o getSeesColor
 public Color getSeesColor()

Return the color seen by the receptor.

Returns:
java.awt.Color
 o seesAngle
 public boolean seesAngle(double angle)

Determine whether angle lies between the receiver's leftAngle and rightAngle. It is assumed that angle has already been normalized.

Parameters:
angle - double
Returns:
boolean
 o setLeftAngle
 public void setLeftAngle(double value)

Set the counterclockwise-most boundary angle of the receptor's field of vision.

Parameters:
value - double
 o setRightAngle
 public void setRightAngle(double value)

Set the clockwise-most boundary angle of the receptor's field of vision.

Parameters:
value - double

All Packages  Class Hierarchy  This Package  Previous  Next  Index