org.npsnet.xrti.utilities
Class ObjectInstanceProxy

java.lang.Object
  extended byorg.npsnet.xrti.utilities.ObjectInstanceProxy
Direct Known Subclasses:
HLAobjectRootProxy, HLAobjectRootProxy

public class ObjectInstanceProxy
extends java.lang.Object

The base class of all object instance proxies.

Author:
Andrzej Kapolka

Field Summary
protected  boolean autoFlushDisabled
          Whether or not automatic state flushing has been disabled.
protected  ObjectClassHandle classHandle
          The object class handle.
protected  boolean deleted
          Whether or not the object instance has been deleted.
protected  ObjectInstanceHandle instanceHandle
          The object instance handle.
protected  java.lang.String name
          The object name.
protected  RTIambassador rtiAmbassador
          The run-time infrastructure ambassador.
 
Constructor Summary
protected ObjectInstanceProxy(RTIambassador pRTIAmbassador, ObjectClassHandle pClassHandle)
          Constructor for object instance proxies created to represent new locally owned objects.
protected ObjectInstanceProxy(RTIambassador pRTIAmbassador, ObjectClassHandle pClassHandle, java.lang.String pName)
          Constructor for object instance proxies created to represent new locally owned objects.
protected ObjectInstanceProxy(RTIambassador pRTIAmbassador, ObjectInstanceHandle pInstanceHandle, ObjectClassHandle pClassHandle, java.lang.String pName)
          Constructor for object instance proxies created in response to discovered objects.
 
Method Summary
 void delete()
          Deletes the object instance that this proxy represents.
 boolean equals(java.lang.Object otherObjectInstanceProxy)
          Checks whether this proxy represents the same object instance as another proxy.
 void flushAttributeValues(byte[] userSuppliedTag)
          Flushes all modified attribute values.
 void flushAttributeValues(byte[] userSuppliedTag, boolean superFlush)
          Flushes all, or all modified attribute values.
protected  void getAttributeValuesToFlush(AttributeHandleValueMap ahvm, boolean superFlush)
          Places the attribute values to flush into the specified map.
 boolean getAutoFlushDisabled()
          Checks whether auto-flush behavior is disabled for this proxy.
 ObjectClassHandle getClassHandle()
          Returns the object class handle.
 ObjectInstanceHandle getInstanceHandle()
          Returns the object instance handle.
 java.lang.String getName()
          Return the object instance name.
 int hashCode()
          Computes and returns a hash code corresponding to the object instance that this proxy represents.
 boolean isDeleted()
          Checks whether the object instance that this proxy represents has been deleted.
 void provideAttributeValueUpdate(AttributeHandleSet theAttributes, byte[] userSuppliedTag)
          Notifies the proxy that it should provide an update regarding a set of object attributes.
 void reflectAttributeValues(AttributeHandleValueMap theAttributes, byte[] userSuppliedTag, OrderType sentOrdering, TransportationType theTransport)
          Notifies the proxy of changes to the state of an object instance.
 void reflectAttributeValues(AttributeHandleValueMap theAttributes, byte[] userSuppliedTag, OrderType sentOrdering, TransportationType theTransport, LogicalTime theTime, OrderType receivedOrdering)
          Notifies the proxy of changes to the state of an object instance.
 void reflectAttributeValues(AttributeHandleValueMap theAttributes, byte[] userSuppliedTag, OrderType sentOrdering, TransportationType theTransport, LogicalTime theTime, OrderType receivedOrdering, MessageRetractionHandle retractionHandle)
          Notifies the proxy of changes to the state of an object instance.
 void reflectAttributeValues(AttributeHandleValueMap theAttributes, byte[] userSuppliedTag, OrderType sentOrdering, TransportationType theTransport, LogicalTime theTime, OrderType receivedOrdering, MessageRetractionHandle retractionHandle, RegionHandleSet sentRegions)
          Notifies the proxy of changes to the state of an object instance.
 void reflectAttributeValues(AttributeHandleValueMap theAttributes, byte[] userSuppliedTag, OrderType sentOrdering, TransportationType theTransport, LogicalTime theTime, OrderType receivedOrdering, RegionHandleSet sentRegions)
          Notifies the proxy of changes to the state of an object instance.
 void reflectAttributeValues(AttributeHandleValueMap theAttributes, byte[] userSuppliedTag, OrderType sentOrdering, TransportationType theTransport, RegionHandleSet sentRegions)
          Notifies the proxy of changes to the state of an object instance.
 void setAutoFlushDisabled(boolean pAutoFlushDisabled)
          Disables or enables auto-flush behavior for this proxy.
protected  void setDeleted(boolean pDeleted)
          Sets whether the object instance that this proxy represents has been deleted.
 java.lang.String toString()
          Returns a string representation of this object instance proxy.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

rtiAmbassador

protected RTIambassador rtiAmbassador
The run-time infrastructure ambassador.


instanceHandle

protected ObjectInstanceHandle instanceHandle
The object instance handle.


classHandle

protected ObjectClassHandle classHandle
The object class handle.


name

protected java.lang.String name
The object name.


autoFlushDisabled

protected boolean autoFlushDisabled
Whether or not automatic state flushing has been disabled.


deleted

protected boolean deleted
Whether or not the object instance has been deleted.

Constructor Detail

ObjectInstanceProxy

protected ObjectInstanceProxy(RTIambassador pRTIAmbassador,
                              ObjectInstanceHandle pInstanceHandle,
                              ObjectClassHandle pClassHandle,
                              java.lang.String pName)
                       throws RTIinternalError
Constructor for object instance proxies created in response to discovered objects.

Parameters:
pRTIAmbassador - the run-time infrastructure ambassador
pInstanceHandle - the object instance handle
pClassHandle - the object class handle
pName - the object name
Throws:
RTIinternalError - if an internal error occurred in the run-time infrastructure

ObjectInstanceProxy

protected ObjectInstanceProxy(RTIambassador pRTIAmbassador,
                              ObjectClassHandle pClassHandle)
                       throws ObjectClassNotDefined,
                              ObjectClassNotPublished,
                              FederateNotExecutionMember,
                              SaveInProgress,
                              RestoreInProgress,
                              RTIinternalError
Constructor for object instance proxies created to represent new locally owned objects. Automatically notifies the run-time infrastructure.

Parameters:
pRTIAmbassador - the run-time infrastructure ambassador
pClassHandle - the object class handle
Throws:
ObjectClassNotDefined - if the specified object class is not defined
ObjectClassNotPublished - if the specified object class is not published
FederateNotExecutionMember - if the federate is not a member of an execution
SaveInProgress - if a save operation is in progress
RestoreInProgress - if a restore operation is in progress
RTIinternalError - if an internal error occurred in the run-time infrastructure

ObjectInstanceProxy

protected ObjectInstanceProxy(RTIambassador pRTIAmbassador,
                              ObjectClassHandle pClassHandle,
                              java.lang.String pName)
                       throws ObjectClassNotDefined,
                              ObjectClassNotPublished,
                              IllegalName,
                              ObjectInstanceNameInUse,
                              FederateNotExecutionMember,
                              SaveInProgress,
                              RestoreInProgress,
                              RTIinternalError
Constructor for object instance proxies created to represent new locally owned objects. Automatically notifies the run-time infrastructure.

Parameters:
pRTIAmbassador - the run-time infrastructure ambassador
pClassHandle - the object class handle
pName - the object name
Throws:
ObjectClassNotDefined - if the specified object class is not defined
ObjectClassNotPublished - if the specified object class is not published
IllegalName - if the instance name has is illegal
ObjectInstanceNameInUse - if the instance name is already in use
FederateNotExecutionMember - if the federate is not a member of an execution
SaveInProgress - if a save operation is in progress
RestoreInProgress - if a restore operation is in progress
RTIinternalError - if an internal error occurred in the run-time infrastructure
Method Detail

reflectAttributeValues

public void reflectAttributeValues(AttributeHandleValueMap theAttributes,
                                   byte[] userSuppliedTag,
                                   OrderType sentOrdering,
                                   TransportationType theTransport)
                            throws AttributeNotRecognized,
                                   AttributeNotSubscribed,
                                   FederateInternalError
Notifies the proxy of changes to the state of an object instance.

Parameters:
theAttributes - the map between attribute handles and the new values of the identified attributes
userSuppliedTag - a user-supplied tag associated with the state change
sentOrdering - the type of ordering with which the update was sent
theTransport - the type of transport associated with the update
Throws:
AttributeNotRecognized - if the attribute was not recognized
AttributeNotSubscribed - if the federate had not subscribed to the attribute
FederateInternalError - if an error occurs in the federate

reflectAttributeValues

public void reflectAttributeValues(AttributeHandleValueMap theAttributes,
                                   byte[] userSuppliedTag,
                                   OrderType sentOrdering,
                                   TransportationType theTransport,
                                   RegionHandleSet sentRegions)
                            throws AttributeNotRecognized,
                                   AttributeNotSubscribed,
                                   FederateInternalError
Notifies the proxy of changes to the state of an object instance.

Parameters:
theAttributes - the map between attribute handles and the new values of the identified attributes
userSuppliedTag - a user-supplied tag associated with the state change
sentOrdering - the type of ordering with which the update was sent
theTransport - the type of transport associated with the update
sentRegions - the set of region handles identifying the regions associated with the attribute update
Throws:
AttributeNotRecognized - if the attribute was not recognized
AttributeNotSubscribed - if the federate had not subscribed to the attribute
FederateInternalError - if an error occurs in the federate

reflectAttributeValues

public void reflectAttributeValues(AttributeHandleValueMap theAttributes,
                                   byte[] userSuppliedTag,
                                   OrderType sentOrdering,
                                   TransportationType theTransport,
                                   LogicalTime theTime,
                                   OrderType receivedOrdering)
                            throws AttributeNotRecognized,
                                   AttributeNotSubscribed,
                                   FederateInternalError
Notifies the proxy of changes to the state of an object instance.

Parameters:
theAttributes - the map between attribute handles and the new values of the identified attributes
userSuppliedTag - a user-supplied tag associated with the state change
sentOrdering - the type of ordering with which the update was sent
theTransport - the type of transport associated with the update
theTime - the logical time associated with the attribute update
receivedOrdering - the type of ordering with which the update was received
Throws:
AttributeNotRecognized - if the attribute was not recognized
AttributeNotSubscribed - if the federate had not subscribed to the attribute
FederateInternalError - if an error occurs in the federate

reflectAttributeValues

public void reflectAttributeValues(AttributeHandleValueMap theAttributes,
                                   byte[] userSuppliedTag,
                                   OrderType sentOrdering,
                                   TransportationType theTransport,
                                   LogicalTime theTime,
                                   OrderType receivedOrdering,
                                   RegionHandleSet sentRegions)
                            throws AttributeNotRecognized,
                                   AttributeNotSubscribed,
                                   FederateInternalError
Notifies the proxy of changes to the state of an object instance.

Parameters:
theAttributes - the map between attribute handles and the new values of the identified attributes
userSuppliedTag - a user-supplied tag associated with the state change
sentOrdering - the type of ordering with which the update was sent
theTransport - the type of transport associated with the update
theTime - the logical time associated with the attribute update
receivedOrdering - the type of ordering with which the update was received
sentRegions - the set of region handles identifying the regions associated with the attribute update
Throws:
AttributeNotRecognized - if the attribute was not recognized
AttributeNotSubscribed - if the federate had not subscribed to the attribute
FederateInternalError - if an error occurs in the federate

reflectAttributeValues

public void reflectAttributeValues(AttributeHandleValueMap theAttributes,
                                   byte[] userSuppliedTag,
                                   OrderType sentOrdering,
                                   TransportationType theTransport,
                                   LogicalTime theTime,
                                   OrderType receivedOrdering,
                                   MessageRetractionHandle retractionHandle)
                            throws AttributeNotRecognized,
                                   AttributeNotSubscribed,
                                   InvalidLogicalTime,
                                   FederateInternalError
Notifies the proxy of changes to the state of an object instance.

Parameters:
theAttributes - the map between attribute handles and the new values of the identified attributes
userSuppliedTag - a user-supplied tag associated with the state change
sentOrdering - the type of ordering with which the update was sent
theTransport - the type of transport associated with the update
theTime - the logical time associated with the attribute update
receivedOrdering - the type of ordering with which the update was received
retractionHandle - the message retraction handle
Throws:
AttributeNotRecognized - if the attribute was not recognized
AttributeNotSubscribed - if the federate had not subscribed to the attribute
InvalidLogicalTime - if the specified logical time was invalid
FederateInternalError - if an error occurs in the federate

reflectAttributeValues

public void reflectAttributeValues(AttributeHandleValueMap theAttributes,
                                   byte[] userSuppliedTag,
                                   OrderType sentOrdering,
                                   TransportationType theTransport,
                                   LogicalTime theTime,
                                   OrderType receivedOrdering,
                                   MessageRetractionHandle retractionHandle,
                                   RegionHandleSet sentRegions)
                            throws AttributeNotRecognized,
                                   AttributeNotSubscribed,
                                   InvalidLogicalTime,
                                   FederateInternalError
Notifies the proxy of changes to the state of an object instance.

Parameters:
theAttributes - the map between attribute handles and the new values of the identified attributes
userSuppliedTag - a user-supplied tag associated with the state change
sentOrdering - the type of ordering with which the update was sent
theTransport - the type of transport associated with the update
theTime - the logical time associated with the attribute update
receivedOrdering - the type of ordering with which the update was received
retractionHandle - the message retraction handle
sentRegions - the set of region handles identifying the regions associated with the attribute update
Throws:
AttributeNotRecognized - if the attribute was not recognized
AttributeNotSubscribed - if the federate had not subscribed to the attribute
InvalidLogicalTime - if the specified logical time was invalid
FederateInternalError - if an error occurs in the federate

provideAttributeValueUpdate

public void provideAttributeValueUpdate(AttributeHandleSet theAttributes,
                                        byte[] userSuppliedTag)
                                 throws AttributeNotRecognized,
                                        AttributeNotOwned,
                                        FederateInternalError
Notifies the proxy that it should provide an update regarding a set of object attributes.

Parameters:
theAttributes - the set of attribute handles identifying the attributes that should be sent
userSuppliedTag - the user-supplied tag associated with the request
Throws:
AttributeNotRecognized - if an identified attribute was not recognized
AttributeNotOwned - if the federate did not own a specified attribute
FederateInternalError - if an error occurs in the federate

flushAttributeValues

public void flushAttributeValues(byte[] userSuppliedTag)
                          throws ObjectInstanceNotKnown,
                                 AttributeNotDefined,
                                 AttributeNotOwned,
                                 FederateNotExecutionMember,
                                 SaveInProgress,
                                 RestoreInProgress,
                                 RTIinternalError
Flushes all modified attribute values.

Parameters:
userSuppliedTag - the user-supplied tag to associate with the update
Throws:
ObjectInstanceNotKnown - if the object instance is unknown
AttributeNotDefined - if one of the attributes is undefined
AttributeNotOwned - if one of the attributes is not owned
FederateNotExecutionMember - if the federate is not a member of an execution
SaveInProgress - if a save operation is in progress
RestoreInProgress - if a restore operation is in progress
RTIinternalError - if an internal error occurred in the run-time infrastructure

flushAttributeValues

public void flushAttributeValues(byte[] userSuppliedTag,
                                 boolean superFlush)
                          throws ObjectInstanceNotKnown,
                                 AttributeNotDefined,
                                 AttributeNotOwned,
                                 FederateNotExecutionMember,
                                 SaveInProgress,
                                 RestoreInProgress,
                                 RTIinternalError
Flushes all, or all modified attribute values.

Parameters:
userSuppliedTag - the user-supplied tag to associate with the update
superFlush - if true provide updates for all attributes; if false, only provide updates for the modified ones
Throws:
ObjectInstanceNotKnown - if the object instance is unknown
AttributeNotDefined - if one of the attributes is undefined
AttributeNotOwned - if one of the attributes is not owned
FederateNotExecutionMember - if the federate is not a member of an execution
SaveInProgress - if a save operation is in progress
RestoreInProgress - if a restore operation is in progress
RTIinternalError - if an internal error occurred in the run-time infrastructure

getAttributeValuesToFlush

protected void getAttributeValuesToFlush(AttributeHandleValueMap ahvm,
                                         boolean superFlush)
                                  throws RTIinternalError
Places the attribute values to flush into the specified map.

Parameters:
ahvm - the attribute handle value map to populate
superFlush - if true provide updates for all attributes; if false, only provide updates for the modified ones
Throws:
RTIinternalError - if an internal error occurs in the run-time infrastructure

equals

public boolean equals(java.lang.Object otherObjectInstanceProxy)
Checks whether this proxy represents the same object instance as another proxy.

Parameters:
otherObjectInstanceProxy - the object instance proxy to compare this to
Returns:
true if the two proxies represent the same object instance, false otherwise

hashCode

public int hashCode()
Computes and returns a hash code corresponding to the object instance that this proxy represents.

Returns:
a hash code corresponding to the object instance that this proxy represents

toString

public java.lang.String toString()
Returns a string representation of this object instance proxy.

Returns:
a string representation of this object instance proxy

getInstanceHandle

public ObjectInstanceHandle getInstanceHandle()
Returns the object instance handle.

Returns:
the object instance handle

getClassHandle

public ObjectClassHandle getClassHandle()
Returns the object class handle.

Returns:
the object class handle

getName

public java.lang.String getName()
Return the object instance name.

Returns:
the object instance name

setAutoFlushDisabled

public void setAutoFlushDisabled(boolean pAutoFlushDisabled)
Disables or enables auto-flush behavior for this proxy.

Parameters:
pAutoFlushDisabled - true to disable auto-flush, false to enable it

getAutoFlushDisabled

public boolean getAutoFlushDisabled()
Checks whether auto-flush behavior is disabled for this proxy.

Returns:
true if auto-flush is disabled, false otherwise

delete

public void delete()
            throws DeletePrivilegeNotHeld,
                   FederateNotExecutionMember,
                   SaveInProgress,
                   RestoreInProgress,
                   RTIinternalError
Deletes the object instance that this proxy represents. If the instance has already been deleted, this method has no effect.

Throws:
DeletePrivilegeNotHeld - if the delete privilege is not held
FederateNotExecutionMember - if the federate is not a member of an execution
SaveInProgress - if a save operation is in progress
RestoreInProgress - if a restore operation is in progress
RTIinternalError - if an internal error occurred in the run-time infrastructure

setDeleted

protected void setDeleted(boolean pDeleted)
Sets whether the object instance that this proxy represents has been deleted.

Parameters:
pDeleted - whether or not the object instance has been deleted

isDeleted

public boolean isDeleted()
Checks whether the object instance that this proxy represents has been deleted.

Returns:
true if the object instance has been deleted, false otherwise