EDU.gatech.cc.is.simulation
Class BinSim

java.lang.Object
  |
  +--EDU.gatech.cc.is.simulation.AttractorSim
        |
        +--EDU.gatech.cc.is.simulation.BinSim

public class BinSim
extends AttractorSim
implements SimulatedObject

A simple bin for depositing attractors.

Copyright (c)2000 by Tucker Balch


Field Summary
protected  java.awt.Color background
           
static boolean DEBUG
           
 
Fields inherited from class EDU.gatech.cc.is.simulation.AttractorSim
all_objects, background, bottom, DEBUG, deposited, foreground, left, picked_up, position, RADIUS, rando, right, seed, top, unique_id, visionclass
 
Constructor Summary
BinSim()
          Instantiate a BinSin object.
 
Method Summary
 void draw(java.awt.Graphics g, int w, int h, double t, double b, double l, double r)
          Draw the bin.
 void draw(Vec2 pos, java.awt.Graphics g, int w, int h, double t, double b, double l, double r)
          Draw the object in a specific spot.
 Vec2 getCenter(Vec2 from)
          Find the center point of the object from a particular location.
 Vec2 getClosestPoint(Vec2 from)
          Find the closest point on the object from a particular location.
 void init(double xp, double yp, double t, double r, java.awt.Color f, java.awt.Color b, int v, int i, long s)
          Initialize an BinSim object.
 boolean isPickupable()
          true if the object can be picked up, false otherwise.
 boolean isPushable()
          true if the object is pushable false otherwise.
 void push(Vec2 d, Vec2 v)
          Try to push the object.
 void quit()
          Clean up.
 
Methods inherited from class EDU.gatech.cc.is.simulation.AttractorSim
checkCollision, checkCollision, clearTrail, drawIcon, drawID, drawState, drawTrail, getID, getPosition, getVisionClass, isObstacle, pickUp, putDown, receive, setID, setTrailLength, setVisionClass, takeStep
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

background

protected java.awt.Color background

DEBUG

public static final boolean DEBUG
Constructor Detail

BinSim

public BinSim()
Instantiate a BinSin object. Be sure to also call init with proper values.
See Also:
init(double, double, double, double, java.awt.Color, java.awt.Color, int, int, long)
Method Detail

init

public void init(double xp,
                 double yp,
                 double t,
                 double r,
                 java.awt.Color f,
                 java.awt.Color b,
                 int v,
                 int i,
                 long s)
Initialize an BinSim object. Called automatically by JavaBotSim.
Specified by:
init in interface SimulatedObject
Overrides:
init in class AttractorSim
Parameters:
xp - the x coordinate.
yp - the y coordinate.
t - ingored.
r - the radius.
f - the foreground color.
b - ignored.
v - the vision class.
i - the unique id.
s - random number seed.

isPushable

public boolean isPushable()
Description copied from interface: SimulatedObject
true if the object is pushable false otherwise.
Specified by:
isPushable in interface SimulatedObject
Overrides:
isPushable in class AttractorSim
Tags copied from interface: SimulatedObject
Returns:
true if the object is pushable, false otherwise.

isPickupable

public boolean isPickupable()
Description copied from interface: SimulatedObject
true if the object can be picked up, false otherwise.
Specified by:
isPickupable in interface SimulatedObject
Overrides:
isPickupable in class AttractorSim
Tags copied from interface: SimulatedObject
Returns:
true if the object can be picked up, false otherwise.

getClosestPoint

public Vec2 getClosestPoint(Vec2 from)
Description copied from interface: SimulatedObject
Find the closest point on the object from a particular location. This is useful for obstacle avoidance and so on.
Specified by:
getClosestPoint in interface SimulatedObject
Overrides:
getClosestPoint in class AttractorSim
Tags copied from interface: SimulatedObject
Parameters:
from - the place from which the point is determined.
Returns:
the closest point.

getCenter

public Vec2 getCenter(Vec2 from)
Description copied from interface: SimulatedObject
Find the center point of the object from a particular location.
Specified by:
getCenter in interface SimulatedObject
Overrides:
getCenter in class AttractorSim
Tags copied from interface: SimulatedObject
Parameters:
from - the place from which the point is determined.
Returns:
the center point.

push

public void push(Vec2 d,
                 Vec2 v)
Description copied from interface: SimulatedObject
Try to push the object.
Specified by:
push in interface SimulatedObject
Overrides:
push in class AttractorSim
Tags copied from interface: SimulatedObject
Parameters:
d - the direction and distance of the push.
v - the velocity of the push.

quit

public void quit()
Description copied from interface: SimulatedObject
Clean up.
Specified by:
quit in interface SimulatedObject
Overrides:
quit in class AttractorSim

draw

public void draw(java.awt.Graphics g,
                 int w,
                 int h,
                 double t,
                 double b,
                 double l,
                 double r)
Draw the bin.
Specified by:
draw in interface SimulatedObject
Overrides:
draw in class AttractorSim
Tags copied from interface: SimulatedObject
Parameters:
g - graphics area to draw the object.
w - the width in pixels of g.
h - the height in pixels of g.
t - the y coordinate represented by the top boundary of the drawing area.
b - the y coordinate represented by the bottom boundary of the drawing area.
l - the x coordinate represented by the left boundary of the drawing area.
r - the x coordinate represented by the right boundary of the drawing area.

draw

public void draw(Vec2 pos,
                 java.awt.Graphics g,
                 int w,
                 int h,
                 double t,
                 double b,
                 double l,
                 double r)
Draw the object in a specific spot.
Specified by:
draw in interface SimulatedObject
Overrides:
draw in class AttractorSim
Tags copied from interface: SimulatedObject
Parameters:
p - location to draw it at.
g - graphics area to draw the object.
w - the width in pixels of g.
h - the height in pixels of g.
t - the y coordinate represented by the top boundary of the drawing area.
b - the y coordinate represented by the bottom boundary of the drawing area.
l - the x coordinate represented by the left boundary of the drawing area.
r - the x coordinate represented by the right boundary of the drawing area.