jeops.examples.monkeys
Class PhysicalObject

java.lang.Object
  |
  +--jeops.examples.monkeys.PhysicalObject
Direct Known Subclasses:
Banana, Blanket, Couch, Ladder, Monkey

public class PhysicalObject
extends java.lang.Object
implements Constants

An object in the monkey and bananas world.

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

Field Summary
private  java.awt.Point at
          The position of this object.
private  java.lang.String description
          A description of this object.
private  PhysicalObject on
          The object over which this one is on.
private  int weight
          The weight of this object.
 
Fields inherited from interface jeops.examples.monkeys.Constants
ACTIVE, AT, CEILING, FLOOR, HEAVY, HOLD, LIGHT, ON, SATISFIED
 
Constructor Summary
PhysicalObject(java.lang.String description, int weight)
          Class constructor.
PhysicalObject(java.lang.String description, java.awt.Point at, int weight)
          Class constructor.
 
Method Summary
 java.awt.Point getAt()
          Returns the position of this object.
 java.lang.String getDescription()
          Returns a description of this object.
 PhysicalObject getOn()
          Returns the object over which this one is on.
 int getWeight()
          Returns the weight of this object.
 boolean isAt(java.awt.Point p)
          Checks whether this object is at a given position.
 boolean isOn(java.lang.Object o)
          Checks whether this object is on a given object.
 void setAt(java.awt.Point newAt)
          Defines the position of this object.
 void setOn(PhysicalObject value)
          Defines the object over which this one is on.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

at

private java.awt.Point at
The position of this object.

on

private PhysicalObject on
The object over which this one is on.

description

private java.lang.String description
A description of this object.

weight

private int weight
The weight of this object.
Constructor Detail

PhysicalObject

public PhysicalObject(java.lang.String description,
                      int weight)
Class constructor.
Parameters:
description - a description of this object.
weight - the weight of this object.

PhysicalObject

public PhysicalObject(java.lang.String description,
                      java.awt.Point at,
                      int weight)
Class constructor.
Parameters:
description - a description of this object.
at - the position of this object
weight - the weight of this object.
Method Detail

getAt

public java.awt.Point getAt()
Returns the position of this object.
Returns:
the position of this object.

getDescription

public java.lang.String getDescription()
Returns a description of this object.
Returns:
a description of this object.

getOn

public PhysicalObject getOn()
Returns the object over which this one is on.
Returns:
the object over which this one is on.

getWeight

public int getWeight()
Returns the weight of this object.
Returns:
the weight of this object.

isAt

public boolean isAt(java.awt.Point p)
Checks whether this object is at a given position.
Parameters:
p - the position being checked.
Returns:
true if the object is at the given position; false otherwise.

isOn

public boolean isOn(java.lang.Object o)
Checks whether this object is on a given object.
Parameters:
o - the object being checked.
Returns:
true if the object is on the given object; false otherwise.

setAt

public void setAt(java.awt.Point newAt)
Defines the position of this object.
Parameters:
newAt - the new position of this object.

setOn

public void setOn(PhysicalObject value)
Defines the object over which this one is on.
Parameters:
value - the object over which this one is on.

toString

public java.lang.String toString()
Returns a string representation of this object. Useful for debugging.
Overrides:
toString in class java.lang.Object
Returns:
a string representation of this object.