Class BeastInfo

java.lang.Object
  extended by BeastInfo

public class BeastInfo
extends java.lang.Object

A full description of the state of a Beast. Why have this separate class rather than looking directly at the Beast? Well, any method that gets a reference to a Beast can actually CHANGE its state, which a beast brain should be able to do. So, instead, we give the beast brains this info which is immutable (just as a String is immutable).

Author:
CPSC 111 instructors

Constructor Summary
BeastInfo(Beast beast)
          Create a new BeastInfo from the given Beast.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int getAge()
          Get the beast's age in steps since creation.
 IBeastBrain getBrain()
          Get the beast's brain.
 Direction getDirection()
          Get the beast's direction
 int getId()
          Get the beast's unique ID (or -1 if no unique ID could be found for the beast).
 BeastMood getMood()
          Get the beast's mood.
 double getX()
          Get the beast's x location in the simulation.
 double getY()
          Get the beast's y location in the simulation.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeastInfo

public BeastInfo(Beast beast)
Create a new BeastInfo from the given Beast.

Parameters:
beast - the beast to "scrape" info from, non-null
Method Detail

getId

public int getId()
Get the beast's unique ID (or -1 if no unique ID could be found for the beast).

Returns:
an ID

getAge

public int getAge()
Get the beast's age in steps since creation.

Returns:
the beast's age

getBrain

public IBeastBrain getBrain()
Get the beast's brain.

Returns:
the beast's brain

getDirection

public Direction getDirection()
Get the beast's direction

Returns:
the beast's direction

getMood

public BeastMood getMood()
Get the beast's mood.

Returns:
the beast's mood

getX

public double getX()
Get the beast's x location in the simulation.

Returns:
the beast's x location

getY

public double getY()
Get the beast's y location in the simulation.

Returns:
the beast's y location

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object