protected static class FormationMoverManager.SurrogateTarget extends java.lang.Object implements Mover
Modifier and Type | Field and Description |
---|---|
protected java.awt.geom.Point2D |
initialLocation
The initial location.
|
protected double |
initialTime
The time this surrogate was constructed.
|
static java.lang.String |
MESSAGE |
protected java.awt.geom.Point2D |
velocity
The velocity of the leader and therefore the station point.
|
DEFAULT_ENTITY_NAME, DEFAULT_EVENT_NAME, DEFAULT_PRIORITY, EVENT_METHOD_PREFIX, NL
Modifier | Constructor and Description |
---|---|
protected |
SurrogateTarget(java.awt.geom.Point2D point,
Mover leader)
Creates a new surrogate based on the given initial location and the
velocity of the given Mover.
|
Modifier and Type | Method and Description |
---|---|
void |
accelerate(java.awt.geom.Point2D p)
Accelerate with the given acceleration vector.
|
void |
accelerate(java.awt.geom.Point2D a,
double speed)
Accelerate in the direction of the given acceleration vector
to the given speed.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this PropertyChangeSource.
|
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this PropertyChangeSource for a specific property.
|
void |
addSimEventListener(SimEventListener l)
Registers a listener.
|
int |
compareTo(SimEntity other) |
void |
doEndMove(Moveable mover)
Event that signals that this Mover has reached its desired location.
|
void |
doStartMove(Moveable mover)
Event that signals the start of a move to a previously set destination.
|
void |
firePropertyChange(java.beans.PropertyChangeEvent event)
Notify all PropertyChangeListeners of the PropertyChangeEvent.
|
java.awt.geom.Point2D |
getAcceleration() |
java.lang.String[] |
getAddedProperties() |
EventList |
getEventList() |
int |
getEventListID() |
java.awt.geom.Point2D |
getLocation()
The current location of the point.
|
double |
getMaxSpeed() |
MovementState |
getMovementState() |
java.lang.String |
getName() |
Priority |
getPriority()
If two events occur at the same time with the same event priority,
the one with the highest entity priority will be processed first.
|
java.lang.Object |
getProperty(java.lang.String name)
Get the value of a property
|
java.lang.Object |
getProperty(java.lang.String name,
java.lang.Object defaultValue)
Get the value of a property if able; if not able return the
provided default value.
|
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners()
Get an Array containing all of the PropertyChangeListeners.
|
int |
getSerial() |
SimEventListener[] |
getSimEventListeners()
Get an array containing all registered listeners.
|
java.awt.geom.Point2D |
getVelocity()
The current velocity of the point.
|
void |
handleSimEvent(SimEvent e)
Typically an Event is handled (as opposed to processed, as in SimEventListener)
by actually executing a method.
|
void |
interrupt(java.lang.String eventName)
Cancels the next event for this entity that matches the event name.
|
void |
interrupt(java.lang.String n,
java.lang.Object... o)
Interrupt (cancel) the next pending event with name eventName
and interruption parameter array "parameters"
belonging to this object.
|
void |
interruptAll()
Interrupt (cancel) all pending events for this entity.
|
void |
interruptAll(java.lang.String eventName)
Cancels all events for this entity that match the event name.
|
void |
interruptAll(java.lang.String n,
java.lang.Object... o)
Interrupt (cancel) all pending events with name eventName
and interruption parameter array "parameters"
belonging to this object.
|
void |
interruptAllWithArgs(java.lang.Object parameter)
Interrupt (cancel) all events scheduled by this component having
the given eventName and an argument matching the parameter.
|
void |
interruptAllWithArgs(java.lang.String eventName,
java.lang.Object parameter)
Interrupt (cancel) all events scheduled by this component having
the given eventName and an argument matching the parameter.
|
boolean |
isClearAddedPropertiesOnReset() |
boolean |
isMoving() |
boolean |
isPersistant() |
boolean |
isReRunnable() |
void |
magicMove(java.awt.geom.Point2D loc)
Instantly move to the given location.
|
void |
move(java.awt.geom.Point2D vel)
Move with the given velocity.
|
void |
moveTo(java.awt.geom.Point2D d)
Causes this Mover to move to the given destination at
its maximum speed.
|
void |
moveTo(java.awt.geom.Point2D d,
double t)
Causes this Mover to move to the given destination at the
given speed.
|
void |
notifyListeners(SimEvent e)
Notify registered listeners by calling their processSimEvent method.
|
java.lang.String |
paramString() |
void |
pause()
Pause at the current location.
|
void |
processSimEvent(SimEvent event)
Process the fired SimEvent.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Causes the PropertyChangeListener to stop listening.
|
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Causes the PropertyChangeListener to stop listening.
|
void |
removeSimEventListener(SimEventListener l)
Unregister a listener.
|
void |
reset()
Implementing classes with state variables should initialize them in
their overridden reset() method.
|
void |
setClearAddedPropertiesOnReset(boolean b) |
void |
setEventListID(int id) |
void |
setLocation(java.awt.geom.Point2D location)
Added to support zero argument constructors and the ObjectMaker system.
|
void |
setMaxSpeed(double max)
Added to support zero argument constructors and the ObjectMaker system.
|
void |
setName(java.lang.String n) |
void |
setPersistant(boolean p) |
void |
setPriority(Priority d)
If two events occur at the same time with the same event priority,
the one with the highest entity priority will be processed first.
|
void |
setProperty(java.lang.String name,
java.lang.Object value)
Set the given property to the given value.
|
void |
stop()
Stops at the current location.
|
SimEvent |
waitDelay(java.lang.String n,
double d) |
SimEvent |
waitDelay(java.lang.String n,
double d,
java.lang.Object... o)
Schedule an event with (optional) given parameters and a default priority after a delay from
the current simulation time.
|
SimEvent |
waitDelay(java.lang.String n,
double d,
Priority p,
java.lang.Object... o)
Schedule an event after a delay from the current
simulation time.
|
protected double initialTime
protected java.awt.geom.Point2D initialLocation
protected java.awt.geom.Point2D velocity
public static final java.lang.String MESSAGE
protected SurrogateTarget(java.awt.geom.Point2D point, Mover leader)
point
- Given initial locationleader
- Given Mover representing the leaderpublic java.awt.geom.Point2D getLocation()
getLocation
in interface Moveable
public java.awt.geom.Point2D getVelocity()
getVelocity
in interface Moveable
public void accelerate(java.awt.geom.Point2D p)
Mover
accelerate
in interface Mover
p
- given acceleration vectorpublic void accelerate(java.awt.geom.Point2D a, double speed)
Mover
accelerate
in interface Mover
a
- given accelerationspeed
- given speedpublic void doEndMove(Moveable mover)
Mover
public void doStartMove(Moveable mover)
Mover
doStartMove
in interface Mover
mover
- Should be reference to this Mover.public double getMaxSpeed()
getMaxSpeed
in interface Mover
public MovementState getMovementState()
getMovementState
in interface Mover
public boolean isMoving()
public void magicMove(java.awt.geom.Point2D loc)
Mover
public void move(java.awt.geom.Point2D vel)
Mover
public void moveTo(java.awt.geom.Point2D d)
Mover
public void moveTo(java.awt.geom.Point2D d, double t)
Mover
public java.lang.String paramString()
paramString
in interface Mover
public void pause()
Mover
public void stop()
Mover
public java.awt.geom.Point2D getAcceleration()
getAcceleration
in interface Moveable
public EventList getEventList()
getEventList
in interface SimEventScheduler
EventList
on which this scheduler will
schedule its events (and receive handleSimEvent()
calls from).public int getEventListID()
getEventListID
in interface SimEntity
public Priority getPriority()
SimEventScheduler
getPriority
in interface SimEventScheduler
public int getSerial()
getSerial
in interface SimEventScheduler
public void handleSimEvent(SimEvent e)
SimEventScheduler
handleSimEvent
in interface SimEventScheduler
e
- The SimEvent to be handled.public void interrupt(java.lang.String n, java.lang.Object... o)
SimEventScheduler
interrupt
in interface SimEventScheduler
n
- Name of event to cancelo
- Parameters of the event to cancel (must be matched)public void interruptAll()
SimEventScheduler
interruptAll
in interface SimEventScheduler
public void interruptAll(java.lang.String n, java.lang.Object... o)
SimEventScheduler
interruptAll
in interface SimEventScheduler
n
- Given event nameo
- Given parameters to be matchedpublic boolean isPersistant()
isPersistant
in interface ReRunnable
public boolean isReRunnable()
isReRunnable
in interface ReRunnable
public void reset()
ReRunnable
reset
in interface ReRunnable
public void setEventListID(int id)
setEventListID
in interface SimEntity
public void setPersistant(boolean p)
setPersistant
in interface ReRunnable
p
- Given new value of persistentpublic void setPriority(Priority d)
SimEventScheduler
setPriority
in interface SimEventScheduler
d
- Priority of this objectpublic SimEvent waitDelay(java.lang.String n, double d)
public SimEvent waitDelay(java.lang.String n, double d, java.lang.Object... o)
SimEventScheduler
waitDelay
in interface SimEventScheduler
n
- The name of the scheduled event (prefixed by "do" for method name).d
- The amount of time before the event is scheduledo
- parameters, possibly emptypublic SimEvent waitDelay(java.lang.String n, double d, Priority p, java.lang.Object... o)
SimEventScheduler
waitDelay
in interface SimEventScheduler
n
- The name of the scheduled event (prefixed by "do" for method name).d
- The amount of time before the event is scheduledp
- The priority of this event (higher is better).o
- The parameters passed to the scheduled event.SimEvent
public java.lang.String getName()
public void setName(java.lang.String n)
public void addSimEventListener(SimEventListener l)
SimEventSource
addSimEventListener
in interface SimEventSource
l
- SimEventListener to addpublic SimEventListener[] getSimEventListeners()
SimEventSource
getSimEventListeners
in interface SimEventSource
public void notifyListeners(SimEvent e)
SimEventSource
TODO: should be eliminated or moved: This is not really part of the public contract for the listener pattern, but rather one way to implement that contract. It should be the object's responsibility to figure out when and how to notify its listeners, so no externally invokable trigger should be provided. NOTE: Un-deprecating this method.
notifyListeners
in interface SimEventSource
e
- the event to notify listeners of.public void removeSimEventListener(SimEventListener l)
SimEventSource
removeSimEventListener
in interface SimEventSource
l
- SimEventListener to remove as listenerpublic void processSimEvent(SimEvent event)
SimEventListener
processSimEvent
in interface SimEventListener
event
- The SimEvent to process.public void setProperty(java.lang.String name, java.lang.Object value)
PropertyChangeSource
setProperty
in interface PropertyChangeSource
name
- The name of the property to be setvalue
- The new value of the propertypublic java.lang.Object getProperty(java.lang.String name)
PropertyChangeSource
getProperty
in interface PropertyChangeSource
name
- The name of the property to be retrievedpublic java.lang.Object getProperty(java.lang.String name, java.lang.Object defaultValue)
PropertyChangeSource
getProperty
in interface PropertyChangeSource
name
- The name of the property to be retrieved.defaultValue
- The default value -- returned if property's value cannot
be returned or is null.public void firePropertyChange(java.beans.PropertyChangeEvent event)
PropertyChangeSource
firePropertyChange
in interface PropertyChangeSource
event
- The event with all the information about what property has changed
and to what value.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeSource
addPropertyChangeListener
in interface PropertyChangeSource
listener
- The new listener to all my property changes.public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
PropertyChangeSource
addPropertyChangeListener
in interface PropertyChangeSource
propertyName
- The name of the property the listener is interested in.listener
- The new listener to all my property changes.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeSource
removePropertyChangeListener
in interface PropertyChangeSource
listener
- The listener that will stop listening to my property changes.public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
PropertyChangeSource
removePropertyChangeListener
in interface PropertyChangeSource
propertyName
- The name of the property to stop listening to.listener
- The listener that will stop listening to my property changes.public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
PropertyChangeSource
getPropertyChangeListeners
in interface PropertyChangeSource
public java.lang.String[] getAddedProperties()
getAddedProperties
in interface PropertyChangeSource
public int compareTo(SimEntity other)
compareTo
in interface java.lang.Comparable<SimEntity>
public boolean isClearAddedPropertiesOnReset()
public void setClearAddedPropertiesOnReset(boolean b)
public void interrupt(java.lang.String eventName)
SimEventScheduler
interrupt
in interface SimEventScheduler
eventName
- Given event namepublic void interruptAll(java.lang.String eventName)
SimEventScheduler
interruptAll
in interface SimEventScheduler
eventName
- Given event namepublic void setMaxSpeed(double max) throws MagicMoveException
Mover
setMaxSpeed
in interface Mover
max
- speed that this Mover should never exceed.MagicMoveException
- if this Mover doesn't support "magic movespublic void setLocation(java.awt.geom.Point2D location) throws MagicMoveException
Mover
setLocation
in interface Mover
location
- Given locationMagicMoveException
- if Mover doesn't support magic movespublic void interruptAllWithArgs(java.lang.String eventName, java.lang.Object parameter)
SimEventScheduler
interruptAllWithArgs
in interface SimEventScheduler
eventName
- name of eventparameter
- parameter to matchpublic void interruptAllWithArgs(java.lang.Object parameter)
SimEventScheduler
interruptAllWithArgs
in interface SimEventScheduler
parameter
- parameter to match