jeops.examples.monkeys
Class Monkey

java.lang.Object
  |
  +--jeops.examples.monkeys.PhysicalObject
        |
        +--jeops.examples.monkeys.Monkey

public class Monkey
extends PhysicalObject

An agent in the monkey and bananas world.

Version:
0.01 19 Jul 2000
Author:
Carlos Figueira Filho (csff@cin.ufpe.br)

Field Summary
private  PhysicalObject objectHeld
          The object this monkey holds.
 
Fields inherited from class jeops.examples.monkeys.PhysicalObject
at, description, on, weight
 
Constructor Summary
Monkey()
          Class constructor.
Monkey(java.awt.Point at)
          Class constructor.
Monkey(java.lang.String name, java.awt.Point at)
          Class constructor.
 
Method Summary
 void bring(PhysicalObject obj, java.awt.Point position)
          Brings an object to somewhere.
 void climbOn(PhysicalObject obj)
          Climbs on some object.
 void drop()
          Drops the object this monkey is holding.
 PhysicalObject getObjectHeld()
          Returns the object this monkey holds.
 void goTo(java.awt.Point position)
          Go somewhere.
 boolean holdsNothing()
          Checks whether this monkey holds something.
 boolean holdsSomething()
          Checks whether this monkey holds something.
 boolean isHolding(PhysicalObject obj)
          Checks whether this monkey holds a given object.
 void jumpOn(PhysicalObject obj)
          Jumps on some object.
 void setObjectHeld(PhysicalObject value)
          Defines the object this monkey holds.
 void take(PhysicalObject obj)
          Takes an object.
 
Methods inherited from class jeops.examples.monkeys.PhysicalObject
getAt, getDescription, getOn, getWeight, isAt, isOn, setAt, setOn, toString
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

objectHeld

private PhysicalObject objectHeld
The object this monkey holds.
Constructor Detail

Monkey

public Monkey()
Class constructor.

Monkey

public Monkey(java.awt.Point at)
Class constructor.
Parameters:
at - the position of this object

Monkey

public Monkey(java.lang.String name,
              java.awt.Point at)
Class constructor.
Parameters:
name - the name of this monkey
at - the position of this object
Method Detail

bring

public void bring(PhysicalObject obj,
                  java.awt.Point position)
Brings an object to somewhere.
Parameters:
obj - the object to be brought.
position - the new position of this monkey and the given object.

climbOn

public void climbOn(PhysicalObject obj)
Climbs on some object.
Parameters:
obj - the object this monkey is climbing on.

drop

public void drop()
Drops the object this monkey is holding.

getObjectHeld

public PhysicalObject getObjectHeld()
Returns the object this monkey holds.
Returns:
the object this monkey holds.

goTo

public void goTo(java.awt.Point position)
Go somewhere.
Parameters:
position - the new position of this monkey.

holdsNothing

public boolean holdsNothing()
Checks whether this monkey holds something.
Returns:
true if this monkey holds nothing; false otherwise.

holdsSomething

public boolean holdsSomething()
Checks whether this monkey holds something.
Returns:
true if this monkey holds something; false otherwise.

isHolding

public boolean isHolding(PhysicalObject obj)
Checks whether this monkey holds a given object.
Parameters:
obj - the object to be checked.
Returns:
true if this monkey holds the given object; false otherwise.

jumpOn

public void jumpOn(PhysicalObject obj)
Jumps on some object.
Parameters:
obj - the object this monkey is jumping on.

setObjectHeld

public void setObjectHeld(PhysicalObject value)
Defines the object this monkey holds.
Parameters:
value - the object this monkey holds.

take

public void take(PhysicalObject obj)
Takes an object.
Parameters:
obj - the object this monkey is taking.