alice.kareltherobot
Class Beeper

java.lang.Object
  extended by Cone
      extended by alice.kareltherobot.Beeper
Direct Known Subclasses:
InfiniteBeepers

public class Beeper
extends Cone

Represents a beeper in the world. If you click on a beeper in the world, it will tell you how many beepers are on that corner. Normally create these with methods of the KarelWorld.

Version:
1.0 (Karel-Alice) February 2010
Author:
Joseph Bergin

Constructor Summary
Beeper(int street, int avenue)
          Constructs a single beeper at a given grid location.
 
Method Summary
 int avenue()
          Gets the avenue location of the center of this beeper.
 KarelWorld getWorld()
          Get the world to which this object has been added (but only after you add it).
 int howMany()
          How many beeers are on the corner that this one occupies
 int street()
          Gets the street location of the center of this beeper.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Beeper

public Beeper(int street,
              int avenue)
Constructs a single beeper at a given grid location. Normally, these are created with the placeBeepers method of KarelWorld.

Parameters:
street - the street number of the beeper
avenue - the avenue number of the beeper
Method Detail

getWorld

public KarelWorld getWorld()
Get the world to which this object has been added (but only after you add it).


howMany

public int howMany()
How many beeers are on the corner that this one occupies

Returns:
the number of beepers on the same corner as this object.

street

public int street()
Gets the street location of the center of this beeper.

Returns:
the street number

avenue

public int avenue()
Gets the avenue location of the center of this beeper.

Returns:
the avenue number