manager
Class Advancer13

java.lang.Object
  extended by manager.Advancer
      extended by manager.Advancer13
All Implemented Interfaces:
LogicalTimeListener

public class Advancer13
extends Advancer

An implementation of the Advancer class specific to the RTI-NG 1.3 DMSO RTI implementation.


Constructor Summary
Advancer13()
           
 
Method Summary
protected  void advanceTo(byte[] serTime)
           
 void advanceTo(double time, boolean block)
          Request this advancer to advance to the given time.
 void constrain(double time)
           
 double getTime()
          Gives the current local time.
 void grantTo(double newTime)
          Although Advancers do implement the LogicalTimeListener interface they cannot be used like normal listeners of this type.
 void initialise()
          Perform any setup steps (eg.
 void regulating(double time)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Advancer13

public Advancer13()
           throws hla.rti13.java1.RTIexception
Throws:
hla.rti13.java1.RTIexception
Method Detail

initialise

public void initialise()
                throws hla.rti13.java1.RTIexception
Description copied from class: Advancer
Perform any setup steps (eg. registering as time-regulating of time-constrained). The purpose of placing this in a separate method as opposed to assuming it will be done in the constructor is to allow calls to RTIambassador.tick() which may re-enter the local federate code and (potentially) re-enter this Advancer object itself (eg. to notifying time-regulating). If such a re-entrant call were placed in a constructor, the thread would attempt to use a null variable.

Specified by:
initialise in class Advancer
Throws:
hla.rti13.java1.RTIexception

advanceTo

public void advanceTo(double time,
                      boolean block)
               throws hla.rti13.java1.RTIexception
Description copied from class: Advancer
Request this advancer to advance to the given time. The call can be blocking or non-blocking. A non-blocking call will request the RTI to advance to the given time and hand the thread to the RTI briefly. This *may* result in advance to the requested time being completed or may not (a call to Advancer.getTime() will clear this up). A blocking call will request the RTI to advance to the given time and will repeatedly make the call and give the RTI time on the thread until it is succesfully granted to the requested time. This will result in receipt of all external events with earlier timestamps than the requested time and may take a large amount of real time if other federates are doing considerable processing

Specified by:
advanceTo in class Advancer
Parameters:
time - the time to which the federate wants to advance
block - if true, the method will return only once the local time is equal to 'time', if false, the method will return immediately after requesting advance with the RTI, the requested time may have been reached or not.
Throws:
hla.rti13.java1.RTIexception - barring catastrophic RTI failure, the most likely cause would be a request to advance to a time < the current local time

advanceTo

protected void advanceTo(byte[] serTime)
                  throws hla.rti13.java1.RTIexception
Throws:
hla.rti13.java1.RTIexception

getTime

public double getTime()
Description copied from class: Advancer
Gives the current local time. This is strictly the time to which the advancer has been granted by the RTI, not the time that it is currently advancing to (not that this method is not explicitly synchronised with the methods performing time advance requests and time advance grants, due to this the result may be incorrect even as it returns.

Specified by:
getTime in class Advancer
Returns:
the current local time, as granted by the RTI.

grantTo

public void grantTo(double newTime)
Although Advancers do implement the LogicalTimeListener interface they cannot be used like normal listeners of this type. The invocation of the Advancer's grantTo may cause it to immediately issue another advance request. If the grant events are fired to other LogicalTimeListeners after this has occured then they may attempt to perform actions only valid in the time_granted phase causing RTIexceptions.

Advancers should then occupy a special place in the federate ambassador code, either always shuffling to the end of the listener list, or occupying a separate variable which is always accessed last during any event firing.

Specified by:
grantTo in interface LogicalTimeListener
Specified by:
grantTo in class Advancer

constrain

public void constrain(double time)

regulating

public void regulating(double time)