public class WayPointProbe extends OutputProbe implements java.lang.Iterable<WayPoint>
Probe.ExportProps, Probe.ImportExportFileInfo
ModelComponent.NavpanelVisibility
Modifier and Type | Field and Description |
---|---|
static int |
WRITE_ALL_STATES |
static int |
WRITE_FIRST_STATE |
myProps, useOldSaveMethod, writeStartStopTimeInSeconds
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
Constructor and Description |
---|
WayPointProbe() |
WayPointProbe(RootModel model) |
Modifier and Type | Method and Description |
---|---|
WayPoint |
add(WayPoint newWay)
Adds a waypoint to this probe, and returns any waypoint that previously
occupied the same time slot.
|
void |
apply(double t)
Called at time
t to apply this probe |
void |
clear()
Clears all waypoints in this probe, except for the waypoint at time 0.
|
WayPoint |
get(double t)
Returns the waypoint at time
t , or null if none exists. |
WayPoint |
getAfter(double t)
Returns the next waypoint immediately after time
t , or null if none exists. |
WayPoint |
getBreakPointAfter(double t)
Returns the next breakpoint immediately after time
t ,
or null if none exists. |
WayPoint |
getByIndex(int idx)
Returns the waypoint at a specified positional index.
|
boolean |
getCheckState() |
WayPoint |
getLastValid()
Returns the last valid waypoint
|
java.util.Collection<WayPoint> |
getPoints()
Returns a
Collection view of the waypoints in this probe. |
RootModel |
getRootModel()
Returns the RootModel associated with this probe.
|
WayPoint |
getValidAfter(double t)
Returns the next valid waypoint immediately after time
t ,
or null if none exists. |
WayPoint |
getValidBefore(double t)
Returns the previous valid waypoint immediately before time
t , or null if none exists. |
WayPoint |
getValidOnOrBefore(double t)
Returns the valid waypoint immediately at or before time
t , or null if none exists. |
int |
getWriteFlags() |
void |
invalidateAfterTime(double t)
Invalidates all waypoints after a specified time.
|
void |
invalidateInitialState() |
boolean |
isEventTime(double t)
Queries whether time
t is an event time for this probe. |
java.util.Iterator<WayPoint> |
iterator()
Returns an interator for the waypoints in this probe
|
java.util.ListIterator<WayPoint> |
listIterator()
Returns a list interator for the waypoints in this probe
|
void |
load()
Loads waypoints and state from binary data in the attached file.
|
void |
loadfrom(java.lang.String fileName)
Loads waypoint data from the specified file.
|
double |
maxEventTime()
Queries the maximum event time in this probe.
|
double |
nextEventTime(double t)
Returns the time of the next probe event after time
t . |
int |
numValid()
Queries the number of currently valid waypoints in this probe.
|
void |
postscan(java.util.Deque<ScanToken> tokens,
CompositeComponent ancestor)
Performs any required post-scanning for this component.
|
WayPoint |
remove(double t)
Removes and returns the waypoint at time
t in this probe. |
boolean |
remove(WayPoint way)
Removes a specified waypoint from this probe, if it exists.
|
void |
resetInitialState() |
void |
save()
Writes all waypoints and their state as binary data to the attached
file if it exists.
|
void |
saveas(java.lang.String fileName) |
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer.
|
boolean |
scanItem(ReaderTokenizer rtok,
java.util.Deque<ScanToken> tokens) |
void |
setCheckState(boolean enable) |
void |
setWriteFlags(int flags) |
int |
size()
Queries the number of waypoints in this probe.
|
void |
updateInitialStateIfNecessary() |
void |
writeItems(java.io.PrintWriter pw,
NumberFormat fmt,
CompositeComponent ancestor)
Write probe attributes to a PrintWriter
|
createState, export, getAllPropertyInfo, getAttachedFile, getAttachedFileName, getChildren, getClippedVirtualTime, getDefaultScale, getDefaultStartTime, getDefaultStopTime, getDefaultUpdateInterval, getDuration, getExportFile, getExportFileInfo, getExportFileName, getExportProps, getFileFromPath, getImportFile, getImportFileInfo, getImportFileName, getInitialState, getPathFromFile, getProperty, getScale, getStartTime, getState, getStopTime, getTimelineTime, getTrack, getUpdateInterval, getVirtualTime, hasAttachedFile, hasChildren, hasState, importData, isAttachedFileRelative, isCloneable, isInput, isPrintable, isScalable, isSettable, print, setAttachedFileName, setData, setExportFileName, setImportFileName, setInterval, setName, setScalable, setScale, setStartStopTimes, setStartTime, setState, setStopTime, setTrack, setUpdateInterval
dispose, finalize, getModel, initialize, isActive, setActive, setModel, setModelFromComponent, write
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, copy, createTempFlag, disconnectFromHierarchy, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getSoftReferences, isFixed, isMarked, isScanning, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, setFixed, setFlag, setMarked, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setScanning, setSelected, setWritable, updateReferences
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, isFixed, isMarked, isSelected, notifyParentOfChange, setFixed, setMarked, setNumber, setParent, setSelected, setWritable, updateReferences
isWritable
public static final int WRITE_FIRST_STATE
public static final int WRITE_ALL_STATES
public WayPointProbe()
public WayPointProbe(RootModel model)
public void setCheckState(boolean enable)
public boolean getCheckState()
public void resetInitialState()
public void invalidateInitialState()
public void updateInitialStateIfNecessary()
public WayPoint add(WayPoint newWay)
newWay
- new waypoint to addpublic WayPoint remove(double t)
t
in this probe. If the
waypoint does not exist, or if t <= 0
, null
is returned.t
- time of the waypoint that should be removednull
public boolean remove(WayPoint way)
way
- waypoint to removetrue
if the waypoint exists and was removedpublic void clear()
public double nextEventTime(double t)
t
.nextEventTime
in class Probe
t
- reference time for the next eventpublic boolean isEventTime(double t)
t
is an event time for this probe.isEventTime
in class Probe
t
- time to querytrue
if t
is an event timepublic int size()
public int numValid()
public double maxEventTime()
public java.util.Iterator<WayPoint> iterator()
iterator
in interface java.lang.Iterable<WayPoint>
public java.util.ListIterator<WayPoint> listIterator()
public java.util.Collection<WayPoint> getPoints()
Collection
view of the waypoints in this probe.public WayPoint getAfter(double t)
t
, or null
if none exists.t
- time after which next waypoint is soughtt
, or null
public WayPoint getValidAfter(double t)
t
,
or null
if none exists.t
- time after which next valid waypoint is soughtt
, or null
public WayPoint getLastValid()
public WayPoint getBreakPointAfter(double t)
t
,
or null
if none exists.t
- time after which next breakpoint is soughtt
, or null
public WayPoint getValidOnOrBefore(double t)
t
, or null
if none exists.t
- time at or before which valid waypoint is soughtt
, or null
public WayPoint getValidBefore(double t)
t
, or null
if none exists.t
- time before which previous valid waypoint is soughtt
, or null
public WayPoint get(double t)
t
, or null
if none exists.t
- time at which waypoint is soughtt
, or null
public WayPoint getByIndex(int idx)
idx
- index of the requested waypointix
java.lang.IndexOutOfBoundsException
- if the index is out of boundspublic void apply(double t)
t
to apply this probeapply
in class OutputProbe
t
- time at which probe is being appliedpublic void invalidateAfterTime(double t)
t
- time after which waypoints will be invalidatedpublic void save() throws java.io.IOException
public void saveas(java.lang.String fileName)
public void load() throws java.io.IOException
public void loadfrom(java.lang.String fileName)
fileName
- file to waypoints frompublic void scan(ReaderTokenizer rtok, java.lang.Object ref) throws java.io.IOException
ModelComponentBase
write
.scan
in interface ModelComponent
scan
in interface Scannable
scan
in class Probe
rtok
- Tokenizer from which to scan the elementref
- optional reference object which can be used for resolving references to
other objectsjava.io.IOException
- if an I/O or formatting error occuredpublic void postscan(java.util.Deque<ScanToken> tokens, CompositeComponent ancestor) throws java.io.IOException
PostScannable
scan()
method and stored in the token queue.
The most common use of this method is to resolve the paths
of component references, which may not have been created
at the time of the initial scan()
call.postscan
in interface PostScannable
postscan
in class ModelComponentBase
tokens
- token information that was stored during
scan()
.ancestor
- ancestor component with respect to which
reference component paths are defined.java.io.IOException
- if an error is encountered (such as a reference to a
non-existent component)public boolean scanItem(ReaderTokenizer rtok, java.util.Deque<ScanToken> tokens) throws java.io.IOException
java.io.IOException
public int getWriteFlags()
public void setWriteFlags(int flags)
public void writeItems(java.io.PrintWriter pw, NumberFormat fmt, CompositeComponent ancestor) throws java.io.IOException
Probe
pw
- writer to which components are writtenfmt
- format for floating point numbersancestor
- ancestor component which respect to which references are
expressedjava.io.IOException
- if an I/O error occurredpublic RootModel getRootModel()