public class CookieCutterSensor extends SimEntityBase implements Sensor
Modifier and Type | Field and Description |
---|---|
protected java.util.Set<Moveable> |
contacts
The Contacts currently being tracked by this Sensor.
|
protected java.awt.geom.Ellipse2D |
footprint
The circular coverage area for this Sensor.
|
protected java.awt.geom.AffineTransform |
locationTransform |
protected double |
maxRange
The range of this Sensor.
|
protected Mover |
mover
The Mover on which this Sensor resides.
|
eventList, property
DEFAULT_ENTITY_NAME, DEFAULT_EVENT_NAME, DEFAULT_PRIORITY, EVENT_METHOD_PREFIX, NL
Constructor and Description |
---|
CookieCutterSensor(double maxRange)
Creates a new CookieCutterSensor not associated with a Mover.
|
CookieCutterSensor(double maxRange,
Mover mover)
Creates a new CookieCutterSensor.
|
CookieCutterSensor(Mover mover,
double maxRange)
Creates a new CookieCutterSensor.
|
Modifier and Type | Method and Description |
---|---|
void |
doDetection(Moveable contact)
Adds the contact to the list of currently sensed contacts.
|
void |
doEndMove(Mover mover)
Schedules EndMove for this Sensor.
|
void |
doStartMove(Mover mover)
Schedules StartMove for this sensor
|
void |
doUndetection(Moveable contact)
Removes the given contact from the contacts list.
|
java.awt.geom.Point2D |
getAcceleration()
Returns the acceleration vector for this Sensor.
|
java.util.Set<Moveable> |
getContacts()
Returns this Set of contacts currently held by this Sensor.
|
java.awt.Shape |
getFootprint()
Returns the detection area for this Sensor.
|
java.awt.geom.Point2D |
getLocation()
The current location of this Sensor.
|
double |
getMaxRange()
Returns the radius of detection for this Sensor.
|
Mover |
getMover()
The Mover on which this Sensor is located.
|
java.awt.geom.Point2D |
getVelocity()
Returns the velocity of this Sensor.
|
boolean |
isInRangeOf(java.awt.geom.Point2D point)
Determine if the given point is inside the detection area for
this Sensor.
|
void |
propertyChange(java.beans.PropertyChangeEvent e)
If from this Sensor's mover, re-broadcast the event.
|
void |
reset()
Clears all pending events for this Sensor and clears the contact list.
|
void |
setMaxRange(double r) |
void |
setMover(Mover mover)
Places this Sensor on the given Mover.
|
java.lang.String |
toString()
Returns a String containing the range of this Sensor and the information on the Mover
for this Sensor.
|
coldReset, dumpDoMethods, dumpDoMethodsStr, dumpNamesAndSignatures, dumpNamesAndSignaturesStr, getFullMethodName, getSignatureString, handleSimEvent, isAssignableFrom, isDebug, processSimEvent, setDebug, stopAtTime, stopOnTime
addPropertyChangeListener, addPropertyChangeListener, attemptSchedule, clearAddedProperty, compareTo, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAddedProperties, getEventList, getEventListID, getName, getPriority, getPropertiesString, getProperty, getProperty, getPropertyChangeListeners, getSerial, interrupt, interrupt, interruptAll, interruptAll, interruptAll, interruptAllWithArgs, interruptAllWithArgs, isClearAddedPropertiesOnReset, isJustDefinedProperties, isPersistant, isReRunnable, isVerbose, parametersMatch, removePropertyChangeListener, removePropertyChangeListener, resetNextSerial, setClearAddedPropertiesOnReset, setEventList, setEventListID, setJustDefinedProperties, setName, setPersistant, setPriority, setProperty, setVerbose, waitDelay, waitDelay, waitDelay, waitDelay
addSimEventListener, getSimEventListeners, notifyListeners, removeSimEventListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEventListID, setEventListID
addSimEventListener, getSimEventListeners, notifyListeners, removeSimEventListener
processSimEvent
isPersistant, isReRunnable, setPersistant
getEventList, getPriority, getSerial, handleSimEvent, interrupt, interrupt, interruptAll, interruptAll, interruptAll, interruptAllWithArgs, interruptAllWithArgs, setPriority, waitDelay, waitDelay
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, getAddedProperties, getProperty, getProperty, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener, setProperty
protected Mover mover
protected java.awt.geom.Ellipse2D footprint
protected java.awt.geom.AffineTransform locationTransform
protected java.util.Set<Moveable> contacts
protected double maxRange
public CookieCutterSensor(double maxRange)
maxRange
- Radius of "cookie"public CookieCutterSensor(double maxRange, Mover mover)
maxRange
- Radius of "cookie"mover
- The Mover this sensor delegates its position topublic CookieCutterSensor(Mover mover, double maxRange)
maxRange
- Radius of "cookie"mover
- The Mover this sensor delegates its position topublic void doDetection(Moveable contact)
doDetection
in interface Sensor
contact
- Mover that is passed by the Mediatorpublic void doUndetection(Moveable contact)
doUndetection
in interface Sensor
contact
- The contact that was lostpublic java.awt.geom.Point2D getVelocity()
getVelocity
in interface Moveable
public double getMaxRange()
getMaxRange
in interface Sensor
public java.awt.Shape getFootprint()
getFootprint
in interface Sensor
public java.awt.geom.Point2D getAcceleration()
getAcceleration
in interface Moveable
public void doEndMove(Mover mover)
public void doStartMove(Mover mover)
doStartMove
in interface Sensor
mover
- Mover this Sensor is onpublic java.awt.geom.Point2D getLocation()
getLocation
in interface Moveable
public Mover getMover()
public void setMover(Mover mover)
public void reset()
reset
in interface ReRunnable
reset
in class BasicSimEntity
public boolean isInRangeOf(java.awt.geom.Point2D point)
isInRangeOf
in interface Sensor
point
- Point to testpublic java.lang.String toString()
toString
in class BasicSimEntity
public void propertyChange(java.beans.PropertyChangeEvent e)
propertyChange
in interface java.beans.PropertyChangeListener
e
- Heard PropertyChangeEventpublic java.util.Set<Moveable> getContacts()
getContacts
in interface Sensor
public void setMaxRange(double r)
setMaxRange
in interface Sensor