de.uni_paderborn.robots.logic
Class Robot

java.lang.Object
  |
  +--de.uni_paderborn.robots.items.Item
        |
        +--de.uni_paderborn.robots.logic.Robot
Direct Known Subclasses:
LAR

public class Robot
extends Item

the class for the robot especially all its features


Field Summary
private  Arena arena
          the arena of the robot
only one arena for the robot possible!
private  int direction
          direction of the robot
private  boolean disqualified
           
static int EAST
          direction: EAST : Integer = 4
private  int energy
          energy of the robot
static int NORTH
          direction: NORTH : Integer = 1
private  java.util.HashSet portable
          HashSet of the cards
note: every robot may only have five cards!
private  ArenaImages.RobotImages robotImages
          Imageset of this robot to be used by the GUI.
private  RobotTimer robotTimer
          The RobotTimer that controls the needed time of this robot.
static int SOUTH
          direction: SOUTH : Integer = 3
static int WEST
          direction: WEST : Integer = 2
 
Fields inherited from class de.uni_paderborn.robots.items.Item
field, name
 
Constructor Summary
Robot()
           
 
Method Summary
 void addToPortable(Card elem)
          adds a new card to the hashSet
also creates a new hashSet when first card is added
 boolean exchangeOK(Card myCard, Card otherCard)
          checks whether both robots want to exchange
should be implemented seriously in the special robot classes
 Card exchangeProposal()
          for card exchange should be implemented seriously in the special robot classes
 Arena getArena()
          access to the arena
 AbstractAction getCommand()
          getCommand of the robot
should be implemented seriously in the special robot classes
 int getDirection()
          Read access method for attribute direction
 int getEnergy()
          Read access method for attribute energy
 ArenaImages.RobotImages getImages()
          Returns the image set of this robot
 RobotTimer getRobotTimer()
          access to the robotTimer
 boolean hasInPortable(Card elem)
          checks the hashSet of cards if there is this card in yet
 boolean isDisqualified()
           
 java.util.Iterator iteratorOfPortable()
          access to the iteratorOfPortabel
also creates a new one if necessary
 void removeAllFromPortable()
          removes all cards in portable
 void removeFromPortable(Card elem)
          removes a Card out of the iterator
 void removeYou()
          removes robot from the arena
 void setArena(Arena elem)
          to set the arena
 int setDirection(int direction)
          Write access method for attribute direction
 void setDisqualified(boolean d)
           
 int setEnergy(int energy)
          Write access method for attribute energy
checks the energy not to be below 0 and above max energy
 void setImages(ArenaImages.RobotImages robotImages)
          Sets the image set of this robot
 int sizeOfPortable()
          access to the number of cards in portable
 
Methods inherited from class de.uni_paderborn.robots.items.Item
getField, getIcon, getName, setField, setName
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

energy

private int energy
energy of the robot

direction

private int direction
direction of the robot

NORTH

public static final int NORTH
direction: NORTH : Integer = 1

WEST

public static final int WEST
direction: WEST : Integer = 2

EAST

public static final int EAST
direction: EAST : Integer = 4

SOUTH

public static final int SOUTH
direction: SOUTH : Integer = 3

robotTimer

private RobotTimer robotTimer
The RobotTimer that controls the needed time of this robot.

disqualified

private boolean disqualified

portable

private java.util.HashSet portable
HashSet of the cards
note: every robot may only have five cards!

arena

private Arena arena
the arena of the robot
only one arena for the robot possible!

robotImages

private ArenaImages.RobotImages robotImages
Imageset of this robot to be used by the GUI. This set contains images of all visual states used by the robot
Constructor Detail

Robot

public Robot()
Method Detail

getCommand

public AbstractAction getCommand()
getCommand of the robot
should be implemented seriously in the special robot classes
Returns:
null because of wrong call

exchangeProposal

public Card exchangeProposal()
for card exchange should be implemented seriously in the special robot classes
Returns:
null

getDirection

public final int getDirection()
Read access method for attribute direction
Returns:
direction the direction the robot looks to

setDirection

public final int setDirection(int direction)
Write access method for attribute direction
Parameters:
direction - the direction the robot should look to

getEnergy

public final int getEnergy()
Read access method for attribute energy
Parameters:
energy - the current energy of the robot

setEnergy

public final int setEnergy(int energy)
Write access method for attribute energy
checks the energy not to be below 0 and above max energy
Parameters:
energy - the energy the robot shall have
Returns:
energy the final energy of the robot

setDisqualified

public void setDisqualified(boolean d)

isDisqualified

public boolean isDisqualified()

exchangeOK

public boolean exchangeOK(Card myCard,
                          Card otherCard)
checks whether both robots want to exchange
should be implemented seriously in the special robot classes
Parameters:
myCard - the proposed card of the robot
otherCard - the proposal card of the other robot
whether - ok to cahnge or not

addToPortable

public final void addToPortable(Card elem)
adds a new card to the hashSet
also creates a new hashSet when first card is added
Parameters:
elem - the card which wants to be added

hasInPortable

public final boolean hasInPortable(Card elem)
checks the hashSet of cards if there is this card in yet
Parameters:
elem - the Card to check
Returns:
bool whether in or not

iteratorOfPortable

public final java.util.Iterator iteratorOfPortable()
access to the iteratorOfPortabel
also creates a new one if necessary
Returns:
iterator of cards

removeFromPortable

public final void removeFromPortable(Card elem)
removes a Card out of the iterator
Parameters:
elem - the Card which shall be removed

sizeOfPortable

public final int sizeOfPortable()
access to the number of cards in portable
Returns:
int the number of cards in portable

removeAllFromPortable

public final void removeAllFromPortable()
removes all cards in portable

removeYou

public final void removeYou()
removes robot from the arena
Overrides:
removeYou in class Item

setArena

public final void setArena(Arena elem)
to set the arena
Parameters:
elem - the arena

getArena

public final Arena getArena()
access to the arena
Returns:
arena

setImages

public final void setImages(ArenaImages.RobotImages robotImages)
Sets the image set of this robot
Parameters:
robotImages - Image set to be used for this robot

getImages

public final ArenaImages.RobotImages getImages()
Returns the image set of this robot
Returns:
Image set of this robot

getRobotTimer

public RobotTimer getRobotTimer()
access to the robotTimer
Returns:
robotTimer the timer of teh robot