components
Class Absorber

java.lang.Object
  extended by java.awt.event.KeyAdapter
      extended by components.GameObject
          extended by components.Absorber
All Implemented Interfaces:
ActionListener, KeyListener, EventListener

public class Absorber
extends GameObject

Absorber is a mutable object that can take in a ball and shoot it out.

Specification Fields

Field Summary
 
Fields inherited from class components.GameObject
center, coRef, delay, depth, frozen, g, height, name, orientAngle, orientVect, selected, shape, targets, velocity, visible, width
 
Constructor Summary
Absorber(Map<String,String> p, GameSpace g)
          Construct an absorber in GameSpace g with the given properties
 
Method Summary
 void actionPerformed(ActionEvent e)
          This is overriden in objects where something actually occurs when triggered, for example, Flippers
 void clearObject()
          remove the object from the absorber
 void getBasicPropertyMap(Map<String,String> m)
          changes the map to represent the values of this GameObject required by the xml spec
 Vect3 getBRB()
          the bottom-right-back corner of this absorber
 GameObjectClassification getGOClassification()
          Requires that all obejects return their own classification
 GameObject getObject()
          the object held by the absorber
 Set<Vect3> getOccupiedPositions()
           
 void hold(GameObject projectile)
          hold on to the given projectile
 boolean isFull()
          true if the absorber is already holding something
 void onCollision(GameObject projectile)
           
protected  Shape shape()
          the Shape of the object
 
Methods inherited from class components.GameObject
action, addTarget, clearTargets, defaults, equals, getBounds, getCenter, getCoRef, getDelay, getDepth, getDiff, getGameSpace, getHeight, getName, getNonRoundedTLF, getOrientAngle, getOrientVector, getRoundedTLF, getShape, getTargets, getTLF, getVelocity, getWidth, hashCode, isFrozen, isSelected, isVisible, putInVect3, putInVect3, removeTarget, setCenter, setCoRef, setDelay, setDepth, setFrozen, setHeight, setOrientAngle, setOrientVect, setProperty, setSelected, setTLF, setVelocity, setVisible, setWidth, stepFrame, toString
 
Methods inherited from class java.awt.event.KeyAdapter
keyPressed, keyReleased, keyTyped
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Absorber

public Absorber(Map<String,String> p,
                GameSpace g)
Construct an absorber in GameSpace g with the given properties

Requires:
p of the form { "property" => "setting", ... }
Method Detail

onCollision

public void onCollision(GameObject projectile)
Overrides:
onCollision in class GameObject

getBRB

public Vect3 getBRB()
the bottom-right-back corner of this absorber


hold

public void hold(GameObject projectile)
hold on to the given projectile

Throws:
IllegalArgumentException - if projectile is null or projectil is not a ball
Requires:
projectile is a ball

actionPerformed

public void actionPerformed(ActionEvent e)
Description copied from class: GameObject
This is overriden in objects where something actually occurs when triggered, for example, Flippers

Specified by:
actionPerformed in interface ActionListener
Overrides:
actionPerformed in class GameObject
Effects:
the Absorber shoots out the ball if there is one inside

getGOClassification

public GameObjectClassification getGOClassification()
Description copied from class: GameObject
Requires that all obejects return their own classification

Specified by:
getGOClassification in class GameObject
Returns:
the GameObjectClassification of this object

getBasicPropertyMap

public void getBasicPropertyMap(Map<String,String> m)
Description copied from class: GameObject
changes the map to represent the values of this GameObject required by the xml spec

Overrides:
getBasicPropertyMap in class GameObject

shape

protected Shape shape()
Description copied from class: GameObject
the Shape of the object

Specified by:
shape in class GameObject

getOccupiedPositions

public Set<Vect3> getOccupiedPositions()
Specified by:
getOccupiedPositions in class GameObject
Returns:
the set of top left front points of grid positions occupied by this where the x grid positions go from 0-20, y from 0-20, and z from 0-10

getObject

public GameObject getObject()
the object held by the absorber

Returns:
the object inside the absorber. null if nothing there.

clearObject

public void clearObject()
remove the object from the absorber


isFull

public boolean isFull()
true if the absorber is already holding something

Returns:
true if something is inside the absorber