Class DirectedObject2D

All Implemented Interfaces:
Graph.Graphic, NamedObjectOps
Direct Known Subclasses:
GraphView

public abstract class DirectedObject2D extends PlacedAnimationObject2D
Animation object that follows a path. This class is provided primarily so that factories can be used to configure paths.
  • Constructor Details

  • Method Details

    • hasPath

      public boolean hasPath()
      Determine if this object has a path to follow.
      Returns:
      true if this object has a path to follow; false otherwise
    • getUpdatedTime

      protected double getUpdatedTime()
      Get the time used by the last call to update.
      Returns:
      the time;
      See Also:
    • getU

      protected double getU()
      Get the path parameter at the time specified in the last call to update.
      Returns:
      the value of the path parameter u; Double.NaN if no path set
      See Also:
    • getInitialS

      protected double getInitialS()
      Get the distance along the path at the start of a path traversal at the time specified in the last call to update. The value is initialized when a setPath method is called.
      Returns:
      the initial distance along the path; Double.NaN if the path is null
    • getInitialU

      protected double getInitialU()
      Get the path parameter for the start of a path traversal.
      Returns:
      the initial value of the path parameter; ( Double.NaN if the path is null
    • getS

      protected double getS()
      Get the current distance along the path at the time specified in the last call to update. The distance will be the one corresponding to the time returned by getUpdatedTime().
      Returns:
      the distance along the path
      See Also:
    • getU

      public double getU(double s)
      Get the path parameter for a specific distance along the path
      Parameters:
      s - the distance along the path from its start (negative distances or distances larger than the length of the path are allowed only for cyclic paths)
      Returns:
      the value of the path parameter u; Double.NaN if no path set
    • getS

      public double getS(double u)
      Get the current distance along the path from its start.
      Parameters:
      u - the path parameter
      Returns:
      the distance; Double.NaN if there is no path
    • getPathInversionLimit

      public double getPathInversionLimit()
      Get the inversion limit that will be used for splines that are created by paths in order to determine the path distance given the path parameter and vice versa. The limit is used when a spline is created.
      Returns:
      the path inversion limit; -1.0 if the default will be used.
    • setPathInversionLimit

      public void setPathInversionLimit(double limit)
      Set the inversion limit for a path. This method calls the method BasicSplinePath2D.setInversionLimit(double) thus modifying the behavior of the path.
      Parameters:
      limit - the inversion limit; negative values if no limit is to be set
    • defaultAngleRelative

      protected boolean defaultAngleRelative()
      Return the default value of the angle-relative flag. This method returns true unless overridden.
      Returns:
      the default value for setPath methods
      See Also:
    • setPath

      public final void setPath(AnimationPath2D objectPath, double time0)
      Set the path, specified by an instance of AnimationPath2D. This method calls setPath(AnimationPath2D,double,double,boolean,double) with appropriate arguments: an initial value of the path parameter u of 0.0, an angle of 0.0, and the angle-relative flag set to its default value (provided by the method defaultAngleRelative()). The path angle function will be set to null unless this behavior is overridden by a subclass, as will the corresponding simulation function. If one is desired, it should be reset.

      To override the behavior that this class provides, one should override setPathImplementation(org.bzdev.geom.BasicSplinePath2D,double,double,boolean,double).

      Parameters:
      objectPath - the path to set
      time0 - the increment from the current time at which the path should be set.
    • setPath

      public final void setPath(BasicSplinePath2D path, double time0)
      Set the path. This method calls setPath(BasicSplinePath2D,double,double,boolean,double) with appropriate arguments: an initial value of the path parameter u of 0.0, an angle of 0.0, and the angle-relative flag set to its default value (provided by the method defaultAngleRelative()). The path angle function will be set to null unless this behavior is overridden by a subclass, as will the corresponding simulation function. If one is desired, it should be reset.

      To override the behavior that this class provides, one should override setPathImplementation(org.bzdev.geom.BasicSplinePath2D,double,double,boolean,double).

      Parameters:
      path - the path the object will follow
      time0 - the increment from the current time at which the path should be set.
    • setPath

      public final void setPath(AnimationPath2D objectPath, boolean angleRelative, double time0)
      Set the path, using an AnimationPath2D object to specify the path and specifying the angle-relative flag. This method calls setPath(BasicSplinePath2D,double,double,boolean,double) with appropriate arguments: an initial value of the path parameter u of 0.0, and an angle of 0.0. The path angle function will be set to null unless this behavior is overridden by a subclass, as will the corresponding simulation function. If one is desired, it should be reset.

      To override the behavior that this class provides, one should override setPathImplementation(org.bzdev.geom.BasicSplinePath2D,double,double,boolean,double).

      Parameters:
      objectPath - the object providing the path this object will follow
      angleRelative - true if the angle (0.0) is measured relative to the path's tangent; false if the angle is measured from the positive X axis in graph coordinate space
      time0 - the increment from the current time at which the object starts moving along the path
    • setPath

      public final void setPath(BasicSplinePath2D path, boolean angleRelative, double time0)
      Set the path, specifying the angle-relative flag. This method calls setPath(BasicSplinePath2D,double,double,boolean,double) with appropriate arguments: an initial value of the path parameter u of 0.0 and an angle of 0.0. The path angle function will be set to null unless this behavior is overridden by a subclass, as will the corresponding simulation function. If one is desired, it should be reset.

      To override the behavior that this class provides, one should override setPathImplementation(org.bzdev.geom.BasicSplinePath2D,double,double,boolean,double).

      Parameters:
      path - the path the object will follow
      angleRelative - true if the angle (0.0)is measured relative to the path's tangent; false if the angle is measured from the positive X axis in graph coordinate space
      time0 - the increment from the current time at which the object starts moving along the path
    • setPath

      public final void setPath(AnimationPath2D objectPath, double angle, boolean angleRelative, double time0)
      Set the path, using an AnimationPath2D object to specify the path and specifying both the angle and the angle-relative flag. This method calls setPath(BasicSplinePath2D,double,double,boolean,double) with appropriate arguments: an initial value of the path parameter u of 0.0, and an angle of 0.0. The path angle function will be set to null unless this behavior is overridden by a subclass, as will the corresponding simulation function. If one is desired, it should be reset.

      To override the behavior that this class provides, one should override setPathImplementation(org.bzdev.geom.BasicSplinePath2D,double,double,boolean,double).

      As a use case for this method, suppose an animation contains an image for a large map and a path that represents a route, and the map is too large to fit in a window. One can use this method to make a GraphView follow the route (one will set the path velocity as well). By setting the angle-relative field to true and the angle to -π/2, the Y axis will always appear to be tangent to the path and the map will seem to rotate as the animation runs, mimicking a GPS display in a vehicle.

      Parameters:
      objectPath - the object providing the path this object will follow
      angle - the initial angle
      angleRelative - true if the angle (0.0) is measured relative to the path's tangent; false if the angle is measured from the positive X axis in graph coordinate space
      time0 - the increment from the current time at which the object starts moving along the path
    • setPath

      public final void setPath(BasicSplinePath2D path, double angle, boolean angleRelative, double time0)
      Set the path, specifying both the initial angle and the angle-relative flag. This method calls setPath(BasicSplinePath2D,double,double,boolean,double) with appropriate arguments: an initial value of the path parameter u of 0.0 and an angle of 0.0. The path angle function will be set to null, as will the corresponding simulation function. If one of these functions is desired, it should be set after this method is called..

      To override the behavior that this class provides, one should override setPathImplementation(org.bzdev.geom.BasicSplinePath2D,double,double,boolean,double).

      As a use case for this method, suppose an animation contains an image for a large map and a path that represents a route, and the map is too large to fit in a window. One can use this method to make a GraphView follow the route (one will set the path velocity as well). By setting the angle-relative field to true and the angle to -π/2, the Y axis will always appear to be tangent to the path and the map will seem to rotate as the animation runs, mimicking a GPS display in a vehicle.

      Parameters:
      path - the path the object will follow
      angle - the initial angle
      angleRelative - true if the angle (0.0)is measured relative to the path's tangent; false if the angle is measured from the positive X axis in graph coordinate space
      time0 - the increment from the current time at which the object starts moving along the path
    • setPath

      public final void setPath(AnimationPath2D objectPath, double u0, double angle, boolean angleRelative, double time0)
      Set a path, specified by an instance of AnimationPath2D and specifying an initial path parameter and angle for the object to follow. The object's position will held at the start of the path until the object's time passes time0. The object's initial angle will match that of a tangent to the path at the object's reference point's current location. The path angle function will be set to null unless this behavior is overridden by a subclass, as will the corresponding simulation function. If one of these functions is desired, it should be set after this method is called.

      To override the behavior that this class provides, one should override setPathImplementation(org.bzdev.geom.BasicSplinePath2D,double,double,boolean,double).

      As a use case for this method, suppose an animation contains an image for a large map and a path that represents a route, and the map is too large to fit in a window. One can use this method to make a GraphView follow the route (one will set the path velocity as well). By setting the angle-relative field to true and the angle to -π/2, the Y axis will always appear to be tangent to the path and the map will seem to rotate as the animation runs, mimicking a GPS display in a vehicle.

      Parameters:
      objectPath - the object providing the path
      u0 - the path's parameter at a time equal to time0
      angle - the initial angle
      angleRelative - true if the angle is measured relative to path's tangent; false if the angle is absolute
      time0 - the increment from the current time at which the object starts moving along the path
    • setPath

      public final void setPath(BasicSplinePath2D path, double u0, double angle, boolean angleRelative, double time0)
      Set a path for this object to follow, specifying an initial path parameter and angle. The object's position will held at the start of the path until the object's time passes time0. The object's angle will match that of a tangent to the path at the object's reference point's current location. The path angle function will be set to null unless this behavior is overridden by a subclass, as will the corresponding simulation function. If one of these functions is desired, it should be set after this method is called.
      Parameters:
      path - the path the object will follow
      u0 - the path's parameter at a time equal to time0
      angle - the initial angle
      angleRelative - true if the angle is measured relative to path's tangent; false if the angle is absolute
      time0 - the increment from the current time at which the object starts moving along the path
    • setPathImplementation

      protected void setPathImplementation(BasicSplinePath2D path, double u0, double angle, boolean angleRelative, double time0)
      Set a path for this object to follow, specifying an initial path parameter and angle. The object's position will held at the start of the path until the object's time passes time0. The object's angle will match that of a tangent to the path at the object's reference point's current location. The path angle function will be set to null, as will the corresponding simulation function. If one is desired, it should be reset after setPath is called. Subclasses that modify how paths are processed should override this method and in most cases call super.setPathImplementation and, of course, document any changes in behavior.
      Parameters:
      path - the path the object will follow
      u0 - the path's parameter at a time equal to time0
      angle - the initial angle
      angleRelative - true if the angle is measured relative to path's tangent; false if the angle is absolute
      time0 - the increment from the current time at which the object starts moving along the path
    • angleIsRelative

      public boolean angleIsRelative()
      Test if the angleRelative flag was set when the current path was set. When angleRelative flag the angle function, angular velocity, and angular acceleration are assumed to be computed relative to the tangent of the path. If the angular velocity is zero, the actual angle (the one returned by getAngle()) will be equal to the angle of the tangent to the path.
      Returns:
      true if the angleRelative flag was set; false if it was not or if there is no path
    • setAngleRelative

      public void setAngleRelative(boolean relative)
      Set whether or not the angle is relative to the current path. The setPath methods will also set whether or not the angle is relative to the current path. This method allows that to be changed. When the angle-relative flag's value changes, the path angle will be adjusted so that the object does not immediately rotate.
      Parameters:
      relative - true if the angle is relative to the current path; false otherwise
      Throws:
      IllegalStateException - no path has been defined
    • setPosition

      public void setPosition(double x, double y, double angle)
      Description copied from class: PlacedAnimationObject2D
      Set an object's position and orientation. Angles increase in the counterclockwise direction in graph coordinate space with an angle of zero corresponding to a subclass-specified direction, which will typically be one in which the object 'points' towards the positive x axis from position (0.0,0.0); The coordinates (x,y) are the coordinates of a subclass-specific reference point that is in a fixed location relative to the object.
      Overrides:
      setPosition in class PlacedAnimationObject2D
      Parameters:
      x - the x coordinate in graph coordinate space
      y - the y coordinate in graph coordinate space
      angle - the angle giving the object's orientation in radians
    • setAngle

      public void setAngle(double angle)
      Description copied from class: PlacedAnimationObject2D
      Set an object's angle. Angles increase in the counterclockwise direction in graph coordinate space with an angle of zero corresponding to a subclass-specified direction, which will typically be one in which the object 'points' towards the positive x axis from position (0.0,0.0).
      Overrides:
      setAngle in class PlacedAnimationObject2D
      Parameters:
      angle - the angle giving the object's orientation in radians
    • setPathAngle

      public void setPathAngle(double angle)
      Set angle to use when traversing the current path. The path angle is relative to the path if the angleRelative flag was set to true when the path was constructed or during a subsequent call to setAngleRelative(boolean); otherwise the angle is an absolute angle measured counterclockwise from the positive x axis.
      Parameters:
      angle - the angle in radians
      Throws:
      IllegalStateException - a path does not exist
    • setAngularVelocity

      public void setAngularVelocity(double angularVelocity)
      Set the angular velocity. Traversing a path will set this value to the current path angular velocity. The changes begin when path traversal starts.
      Parameters:
      angularVelocity - the angular velocity in radians per unit time (unit time is typically a second)
      See Also:
    • setAngularAcceleration

      public void setAngularAcceleration(double angularAcceleration)
      Set the angular acceleration. Traversing a path will set this value to the current path angular acceleration. The changes begin when path traversal starts.
      Parameters:
      angularAcceleration - the angular acceleration in radians per unit time per unit time (unit time is typically a second)
      See Also:
    • getAngularVelocity

      public double getAngularVelocity()
      Get the current angular velocity. This is the value provided in the last call to setAngularVelocity(double), possibly updated to the current path angular velocity if a path is being traversed.
      Returns:
      the angular velocity in radians per unit time (unit time is typically one second)
    • clearPath

      public void clearPath()
      Clear the path. This will also clear the distance function (if any), the path angle function (if any), and set both the path velocity and path acceleration to zero.

      This method calls SimObject.update().

    • setDistanceByF

      public void setDistanceByF(RealValuedFunctOps f)
      Set the function giving the distance along the path as a function of time, setting the function at a specific simulation time. The distance along the path will change when the object's time is updated. When a distance function is provided, the path velocity and acceleration is ignored.

      This method calls SimObject.update().

      Parameters:
      f - the function providing the distance along the path
    • setDistanceBySF

      public void setDistanceBySF(SimFunction f)
      Set the simulation function giving the distance along the path as a function of time, setting the function at a specific simulation time. The distance along the path will change when the object's time is updated. When a distance function is provided, the path velocity and acceleration is ignored.

      This method calls SimObject.update().

      Parameters:
      f - the function providing the distance along the path
    • setAngleByF

      public void setAngleByF(RealValuedFunctOps f)
      Set the function giving the angle of an object as a function of simulation time. When a path is being traversed, this angle function will be ignored if a function provided by setPathAngleByF(RealValuedFunctOps) or setPathAngleBySF(SimFunction) exists at the current time. Similarly, when an angle function is provided, the path angular velocity and angular acceleration are not used. The angle will change as the object's time is updated.

      This method calls SimObject.update(). The function provided must return an angle in units of radians.

      Parameters:
      f - the function providing the angle as a function of time
    • setAngleBySF

      public void setAngleBySF(SimFunction f)
      Set the simulation function giving the angle of an object as a simulation function of simulation time. When a path is being traversed, this angle function will be ignored if a function provided by setPathAngleByF(RealValuedFunctOps) or setPathAngleBySF(SimFunction) exists at the current time. Similarly, when an angle function is provided, the path angular velocity and angular acceleration are not used. The angle will change as the object's time is updated.

      This method calls SimObject.update(). The function provided must return an angle in units of radians.

      Parameters:
      f - the function providing the angle as a function of time
    • setPathAngleByF

      public void setPathAngleByF(RealValuedFunctOps f)
      Set the function giving the angle of an object as a function of time measured from the point at which the traversal of a path begins. When angleIsRelative() returns true, the angle function refers to the change in angle relative to the tangent at the current location along a path. When an angle function is provided, the path angular velocity and angular acceleration is not used. The angle will change as the object's time is updated. This function has no effect before a path's traversal starts. If the path traversal has started and a path is configured, this function will be used instead of a function provided by setAngleByF(RealValuedFunctOps).

      This method calls SimObject.update(). The function provided must return an angle in units of radians.

      Parameters:
      f - the function providing the angle as a function of time
    • setPathAngleBySF

      public void setPathAngleBySF(SimFunction f)
      Set the simulation function giving the angle of an object as a function of time measured from the point at which the traversal of a path begins. When angleIsRelative() returns true, the angle function refers to the change in angle relative to the tangent at the current location along a path. When an angle function is provided, the path angular velocity and angular acceleration is not used. The angle will change as the object's time is updated. This function has no effect before a path's traversal starts. If the path traversal has started and a path is configured, this function will be used instead of a function provided by setAngleByF(RealValuedFunctOps).

      This method calls SimObject.update(). The function provided must return an angle in units of radians.

      Parameters:
      f - the function providing the angle as a function of time
    • setPathVelocity

      public void setPathVelocity(double pathVelocity)
      Set the velocity along the path. The value will change as the object's time is updated. When a distance function is provided, the path velocity and acceleration is ignored.

      This method calls SimObject.update().

      Parameters:
      pathVelocity - the velocity of the object along the path.
    • setPathAcceleration

      public void setPathAcceleration(double pathAccel)
      Set the acceleration along the path. The value will change as the object's time is updated. When a distance function is provided, the path velocity and acceleration is ignored.

      This method calls SimObject.update().

      Parameters:
      pathAccel - the object's acceleration along the path
    • setPathAngularVelocity

      public void setPathAngularVelocity(double pathAngularVelocity)
      Set the angular velocity along the path. When angleIsRelative() returns true, the angular velocity refers to the change in angle relative to the tangent at the current location along a path. The angle will change as the object's time is updated. When an angle function is provided, the path angular velocity and angular acceleration is not used.

      This method calls SimObject.update().

      Parameters:
      pathAngularVelocity - the angular velocity of the object while traversing the path
    • setPathAngularAcceleration

      public void setPathAngularAcceleration(double pathAngularAccel)
      Set the angular acceleration along the path When angleIsRelative() returns true, the angular acceleration refers to the change in angle relative to the tangent at the current location along a path. The angle will change as the object's time is updated. When an angle function is provided, the path angular velocity and angular acceleration is not used.

      This method calls SimObject.update().

      Parameters:
      pathAngularAccel - the object's angular acceleration while traversing the path
    • getPathX

      protected double getPathX(double u)
      Get the x coordinate for a point along a path.
      Parameters:
      u - the path parameter
      Returns:
      the x coordinate; 0.0 if there is no path
    • getPathY

      public double getPathY(double u)
      Get the y coordinate for a point along a path.
      Parameters:
      u - the path parameter
      Returns:
      the y coordinate; 0.0 if there is no path
    • getPathDxDu

      public double getPathDxDu(double u)
      Get the derivative of the x coordinate for a point along a path with respect to the path parameter.
      Parameters:
      u - the path parameter
      Returns:
      the derivative of the x coordinate; 0.0 if there is no path
    • getPathDyDu

      public double getPathDyDu(double u)
      Get the derivative of the y coordinate for a point along a path with respect to the path parameter.
      Parameters:
      u - the path parameter
      Returns:
      the derivative of the y coordinate; 0.0 if there is no path
    • getMaxPathParameter

      public double getMaxPathParameter()
      Get the maximum value of the path parameter. For a closed path, this is the first positive value of the path parameter at which the path repeats itself.
      Returns:
      the maximum value of the path parameter; 0.0 if there is no path
    • getPathLength

      public double getPathLength()
      Get the length of the path.
      Returns:
      the length of the path; 0.0 if there is no path
    • getPathLength

      public double getPathLength(double u1, double u2)
      Get the length of the path parameter between an initial and final value of the path parameter. The returned value is the same if u1 and u2 are exchanged: lengths are non-negative.
      Parameters:
      u1 - the initial path parameter
      u2 - the final path parameter
      Returns:
      the length of the path; 0.0 if there is no path
    • getDistance

      public double getDistance(double u1, double u2) throws IllegalStateException, IllegalArgumentException
      Get the distance traversed on a subpath. If u2 < u1, the value returned is negative.

      This is intended for cases where direction is important.

      Parameters:
      u1 - the parameter at the first end point of a subpath
      u2 - the parameter at the second end point of a subpath
      Returns:
      the distance
      Throws:
      IllegalStateException - the path is not a simple path
      IllegalArgumentException - the parameter is out of bounds
    • isClosedPath

      public boolean isClosedPath()
      Determine if the path is closed.
      Returns:
      true if the path exists and is closed; false otherwise
    • pathExists

      public boolean pathExists()
      Determine if the path exists.
      Returns:
      true if the path exists; false otherwise.
    • getPathAngle

      public double getPathAngle()
      Get the path angle. When angleIsRelative() returns true, the path angle is measured relative to the path's tangent in the direction of increasing distance. Otherwise the path angle is measured from the positive x axis. The path angle is used by this class only when a path is set, and the path angle is set when a path is set.
      Returns:
      the path angle
      See Also:
    • getPathVelocity

      public double getPathVelocity()
      Get the path velocity.
      Returns:
      the speed along the path at the current time
    • getPathAcceleration

      public double getPathAcceleration()
      Get the path acceleration.
      Returns:
      the current value of the acceleration.
    • getInitialPathTime

      public double getInitialPathTime()
      Get the initial time at which a path traversal will start. When finite, this is the argument named time0 that was used when the last setPath method was called added to the simulation time when that setPath method was called.
      Returns:
      the time at which a path traversal will start; Double.POSITIVE_INFINITY if there is no path
    • update

      protected void update(double t, long simtime)
      Update the object's state to that at a specified time. The values of t passed to this method should form an increasing sequence. The default implementation's behavior depends on whether functions are provided. A distance function, path velocity, path acceleration, or angle function is not used when there is no path, although the angular acceleration and angular velocity will be used if these are nonzero.
      1. If a distance function is provided, that function is used to determine the new value of s (the distance along the path from its start) at time τ, with the path velocity and acceleration determined by that function's first and second derivatives (if not implemented, the path velocity and/or acceleration is set to Double.NaN). The time τ is the difference between the current time t and the time time0 at which the path traversal starts.
      2. If a distance function is not provided, the path velocity and path acceleration are used to determine the new value of s, and the path velocity is updated as well.
      3. If an angle function is provided, that function is used to determine the new angle, and its derivatives, if implemented provide the angular velocity and angular acceleration. The time argument $tau; is the difference between the current time t and the time time0 at which the path traversal starts. If the path was set with the flag angleRelative set to true, the angle is added to the tangent at the object's new position along the path; otherwise the angle is measured counterclockwise from the direction of the positive X axis.
      4. If an angle function is not provided the path angular velocity and path angular acceleration are used to compute the change in angle from the last time update was called. If the path was set with the flag angleRelative set to true, the angle is added to the angle of the tangent to the path at its new location; otherwise the angle is measured counterclockwise from the direction of the positive X axis.
      The angleRelative flag is the boolean argument to setPath(org.bzdev.geom.BasicSplinePath2D,double,double,boolean,double) or setPath(AnimationPath2D,double,double,boolean,double), but may be subsequently changed by calling setAngleRelative(boolean).

      If a velocity or acceleration has the value Double.NaN, it is treated as if its value were 0.0. In cases where one needs to obtain the previous value of s, one can override this method and obtain the previous value by calling getS() before calling super.update.

      Overrides:
      update in class SimObject
      Parameters:
      t - the time for which the object should be calculated.
      simtime - the simulation time
    • printConfiguration

      public void printConfiguration(String iPrefix, String prefix, boolean printName, PrintWriter out)
      Print this simulation object's configuration. Documentation for the use of this method is provided by the documentation for the SimObject method SimObject.printConfiguration(String,String,boolean,PrintWriter).

      When the second argument has a value of true, the object name and class name will be printed in a standard format with its indentation provided by the iPrefix argument. In addition, the configuration that is printed includes the following items.

      Defined in AnimationObject2D:

      • the Z-order.
      • whether or not this object is visible.
      Defined in PlacedAnimationObject2D:
      • the reference-point name (if any).
      • the reference point location.
      • the reference point bounds (minimum and maximum X and Y values for the rectangle to which the reference point names refer).
      Defined in DirectedObject2D:
      • the path this object will follow: either the name of an instance of AnimationPath2D or the configuration of a BasicSplinePath2D as provided by its method BasicSplinePath2D.printTable(String,Appendable).
      • the distance along a path for its starting point (the initial distance).
      • the initial value of the path's parameter.
      • the time at which a path traversal should start.
      • the initial value for whether or not the angle for the object is relative to the path's tangent or absolute.
      • the distance function.
      • a flag indicating if the distance function is set.
      • the path velocity.
      • the path acceleration.
      • the path inversion limit (described in the documentation for getPathInversionLimit().
      Overrides:
      printConfiguration in class PlacedAnimationObject2D
      Parameters:
      iPrefix - the prefix to use for an initial line when printName is true with null treated as an empty string
      prefix - a prefix string (typically whitespace) to put at the start of each line other than the initial line that is printed when printName is true
      printName - requests printing the name of an object
      out - the output print writer
    • printState

      public void printState(String iPrefix, String prefix, boolean printName, PrintWriter out)
      Print this simulation object's state. Documentation for the use of this method is provided by the documentation for the SimObject method SimObject.printState(String,String,boolean,PrintWriter).

      When the third argument has a value of true, the object name and class name will be printed in a standard format with its indentation provided by the iPrefix argument. In addition, the state that is printed includes the following items.

      Defined in PlacedAnimationObject2D:

      • the X coordinate of this object.
      • the Y coordinate of this object.
      • the angle for this object, measured counterclockwise.
      Defined in DirectedObject2D:
      • the name of the path (if any) this object can follow.
      • the path parameter.
      • the path distance.
      • the angle-relative flag.
      • the velocity along the path (NaN if undefined). When a distance function is used, its derivative, if implemented, determines this value.
      • the acceleration along the path (NaN if undefined). When a distance function is used, its second derivative, if implemented, determines this value.
      • the path angle. The angle is measured relative to the path's tangent in the direction of an increasing path parameter when the angle-relative flag is true; otherwise it is measured relative to the X axis. Angles are measured counterclockwise.
      • the angular velocity. When a path-angle function is used, its derivative, if implemented, determines this value.
      • the angular acceleration. When a path-angle function is used, its derivative, if implemented, determines this value.
      • the angular acceleration. When a path-angle function is used, its derivative, if implemented, determines this value.
      • the time at which this data was last updated.
      Overrides:
      printState in class PlacedAnimationObject2D
      Parameters:
      iPrefix - the prefix to use for an initial line when printName is true with null treated as an empty string
      prefix - a prefix string (typically whitespace) to put at the start of each line other than the initial line that is printed when printName is true
      printName - requests printing the name of an object
      out - the output print writer
    • clone

      protected Object clone() throws CloneNotSupportedException
      Creates and returns a copy of this object. This method will throw the exception CloneNotSupportedException if the object is interned.
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException - a clone could not be created
      See Also:
    • isInterned

      public boolean isInterned()
      Determine if an object is interned in a object namer's tables.
      Specified by:
      isInterned in interface NamedObjectOps
      Returns:
      true if the object is interned; false if not
    • getObjectNamer

      protected Simulation getObjectNamer()
      Get the object namer for a named object.
      Returns:
      the object namer for this named object
    • getName

      public final String getName()
      Get an object's name.
      Specified by:
      getName in interface NamedObjectOps
      Returns:
      the name of the object
    • canDelete

      public boolean canDelete()
      Determine if this named object can be deleted. A named object can be deleted if the method delete has not been called and if the object is not in a state that prevents the object from being deleted. Subclasses that override this method must call canDelete() for their superclasses and return false if the superclass' canDelete method returns false. The default method returns true if delete() has not been called and returned true.
      Specified by:
      canDelete in interface NamedObjectOps
      Returns:
      true if this object can be deleted; false otherwise
    • delete

      public final boolean delete()
      Delete an object. An object can only be deleted once. If this method returns true, the object (if interned) will have been removed from the object namer tables.

      The implementations provided by DefaultNamedObect and generated because of a @NamedObject annotation provide a protected method named onDelete. A subclass that overrides onDelete() must call the onDelete method of its superclass after it's onDelete method has been called and any cleanup actions performed. In some cases, this may happen at a later time (e.g., if a thread is used for some of the cleanup operations or if it is otherwise necessary to wait).

      Specified by:
      delete in interface NamedObjectOps
      Returns:
      true if the deletion request was accepted; false otherwise
    • isDeleted

      public final boolean isDeleted()
      Determine if an object has been deleted. An object is deleted if the method delete() has been called and returned true.
      Specified by:
      isDeleted in interface NamedObjectOps
      Returns:
      true if deleted; false otherwise
    • deletePending

      public final boolean deletePending()
      Determine if an object is being deleted. An deletion is pending if the method delete() has been called and returned true but the deletion has not been completed.
      Specified by:
      deletePending in interface NamedObjectOps
      Returns:
      true if deletion is pending; false otherwise