|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmanager.Coupler
public class Coupler
The coupler class transparently couples the federate to the federation in a controlled manner. The general use for a Coupler is:
| Constructor Summary | |
|---|---|
Coupler(boolean isLeader,
int numFederates)
Creates a Coupler with the given details |
|
| Method Summary | |
|---|---|
boolean |
delegatedDiscover(int id,
int classID)
Delegates a discoverObjectInstance callback to the coupler. |
boolean |
delegatedReflect(int instID,
hla.rti13.java1.ReflectedAttributes attrs)
Delegates a reflectAttributeValues callback to the coupler. |
boolean |
delegatedReflect(int instID,
ReflectedAttributes13 attrs)
|
java.sql.Timestamp |
finalise(double time)
Finalise the coupling procedure, once this method returns the federate will be coupled to exactly n other federates in a single federation all of whom will share the given fedexid. |
void |
grantTo(double newTime)
|
void |
initialise()
Sets up the master/slave relationship by ensuring exactly 1 federate has the job of waiting for all federates to join, then sending the fedexid (for logging/debugging) whilst n-1 federates have the job of joining, then listening for the fedexid. |
boolean |
isCoupled()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Coupler(boolean isLeader,
int numFederates)
throws hla.rti13.java1.RTIexception
isLeader - if the parent federate created the fedexnumFederates - the number of federates which should be coupled to
hla.rti13.java1.RTIexception - usually if the .fed file does not contain the correct
classes.| Method Detail |
|---|
public void initialise()
throws hla.rti13.java1.RTIexception
RTIException - usually if the RTI doesn't support
publication/subscription management services, or if the .fed file
is not correctly configured with the HLA_RePast admin types:
hla.rti13.java1.RTIexception
public java.sql.Timestamp finalise(double time)
throws hla.rti13.java1.RTIexception
time - the time the federate is currently at (usually 0.0)
java.lang.Exception
hla.rti13.java1.RTIexception
public boolean delegatedDiscover(int id,
int classID)
id - the instanceID obtained through the callbackclassID - the classID obtained through the callback
public boolean delegatedReflect(int instID,
hla.rti13.java1.ReflectedAttributes attrs)
throws java.lang.Exception
instID - the instanceHandle from the callbackattrs - the values from the callback
java.lang.Exception - usually during de-serialisation or if the attrs object is bad
public boolean delegatedReflect(int instID,
ReflectedAttributes13 attrs)
throws java.lang.Exception
java.lang.Exceptionpublic void grantTo(double newTime)
grantTo in interface LogicalTimeListenerpublic boolean isCoupled()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||