RoboSim.SimGridAllyDeterminant Class Reference
Inheritance diagram for RoboSim.SimGridAllyDeterminant:
Collaboration diagram for RoboSim.SimGridAllyDeterminant:

Public Member Functions

 SimGridAllyDeterminant (Robot.GridCell origin_)
 
boolean validCell (Robot.GridCell potential_ally)
 

Private Attributes

Robot.GridCell origin
 

Detailed Description

FSPPredicate derivative making use of SimGridCell-specific information

Definition at line 38 of file RoboSim.java.

Constructor & Destructor Documentation

RoboSim.SimGridAllyDeterminant.SimGridAllyDeterminant ( Robot.GridCell  origin_)

Definition at line 40 of file RoboSim.java.

References RoboSim.SimGridAllyDeterminant.origin.

40 { origin = origin_; }

Member Function Documentation

boolean RoboSim.SimGridAllyDeterminant.validCell ( Robot.GridCell  potential_ally)
virtual

Implements Robot.RobotUtility.FSPPredicate.

Definition at line 42 of file RoboSim.java.

References RoboSim.SimGridCell.occupant_data, RoboSim.SimGridAllyDeterminant.origin, and RoboSim.RobotData.player.

43  {
44  if(potential_ally==origin)
45  return false;
46 
47  switch(potential_ally.contents)
48  {
49  case ALLY:
50  return true;
51  case SELF:
52  if(!(potential_ally instanceof SimGridCell) || !(origin instanceof SimGridCell))
53  return false;
54  SimGridCell origin_downcast = (SimGridCell)(origin);
55  SimGridCell potential_ally_downcast = (SimGridCell)(potential_ally);
56  if(potential_ally_downcast.occupant_data!=null &&
57  potential_ally_downcast.occupant_data.player.equals(origin_downcast.occupant_data.player))
58  return true;
59  default:
60  return false;
61  }
62  }

Member Data Documentation

Robot.GridCell RoboSim.SimGridAllyDeterminant.origin
private

The documentation for this class was generated from the following file: