org.npsnet.xrti.tests
Class HelloWorldEx

java.lang.Object
  extended byorg.npsnet.xrti.tests.HelloWorldEx
All Implemented Interfaces:
HelloWorldExInteractionListener

public class HelloWorldEx
extends java.lang.Object
implements HelloWorldExInteractionListener

A simple test of the XRTI's extension mechanism.

Author:
Andrzej Kapolka

Field Summary
private static byte[] emptyTag
          An empty user-supplied tag.
private static java.lang.String HELLO_WORLD_OBJECT_MODEL_EX
          The extended Hello World object model, stored as a resource.
private  HelloWorldExProxyAmbassador helloWorldExProxyAmbassador
          The extended Hello World proxy ambassador.
private  EconomicCountryProxy ownCountry
          The proxy for our own country.
private  ProxyAmbassador proxyAmbassador
          The root proxy ambassador.
private  RTIambassadorEx rtiAmbassador
          The RTI ambassador.
 
Constructor Summary
HelloWorldEx(java.util.Properties configuration, java.lang.String name, double initialPopulation, double initialGDP, int numberOfTicks)
          Constructor.
 
Method Summary
static void main(java.lang.String[] args)
          Program entry point.
 void receiveCommunication(java.lang.String message, byte[] userSuppliedTag, OrderType sentOrdering, TransportationType theTransport)
          A generic message.
 void receivePrioritizedCommunication(java.lang.String message, double priority, byte[] userSuppliedTag, OrderType sentOrdering, TransportationType theTransport)
          A prioritized message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HELLO_WORLD_OBJECT_MODEL_EX

private static final java.lang.String HELLO_WORLD_OBJECT_MODEL_EX
The extended Hello World object model, stored as a resource.

See Also:
Constant Field Values

emptyTag

private static final byte[] emptyTag
An empty user-supplied tag.


rtiAmbassador

private RTIambassadorEx rtiAmbassador
The RTI ambassador.


proxyAmbassador

private ProxyAmbassador proxyAmbassador
The root proxy ambassador.


helloWorldExProxyAmbassador

private HelloWorldExProxyAmbassador helloWorldExProxyAmbassador
The extended Hello World proxy ambassador.


ownCountry

private EconomicCountryProxy ownCountry
The proxy for our own country.

Constructor Detail

HelloWorldEx

public HelloWorldEx(java.util.Properties configuration,
                    java.lang.String name,
                    double initialPopulation,
                    double initialGDP,
                    int numberOfTicks)
Constructor.

Parameters:
configuration - the list of configuration properties
name - the name of the country to simulate
initialPopulation - the country's initial population
initialGDP - the country's initial GDP
numberOfTicks - the number of ticks to execute
Method Detail

main

public static void main(java.lang.String[] args)
Program entry point.

Parameters:
args - the command line arguments

receiveCommunication

public void receiveCommunication(java.lang.String message,
                                 byte[] userSuppliedTag,
                                 OrderType sentOrdering,
                                 TransportationType theTransport)
                          throws InteractionClassNotRecognized,
                                 InteractionParameterNotRecognized,
                                 InteractionClassNotSubscribed,
                                 FederateInternalError
A generic message.

Specified by:
receiveCommunication in interface HelloWorldExInteractionListener
Parameters:
message - The contents of the message.
userSuppliedTag - a user-supplied tag associated with the interaction
sentOrdering - the type of ordering with which the interaction was sent
theTransport - the type of transport associated with the interaction
Throws:
InteractionClassNotRecognized - if the interaction class was not recognized
InteractionParameterNotRecognized - if a parameter of the interaction was not recognized
InteractionClassNotSubscribed - if the federate had not subscribed to the interaction class
FederateInternalError - if an error occurs in the federate

receivePrioritizedCommunication

public void receivePrioritizedCommunication(java.lang.String message,
                                            double priority,
                                            byte[] userSuppliedTag,
                                            OrderType sentOrdering,
                                            TransportationType theTransport)
                                     throws InteractionClassNotRecognized,
                                            InteractionParameterNotRecognized,
                                            InteractionClassNotSubscribed,
                                            FederateInternalError
A prioritized message.

Specified by:
receivePrioritizedCommunication in interface HelloWorldExInteractionListener
Parameters:
message - The contents of the message.
priority - The priority level of the message.
userSuppliedTag - a user-supplied tag associated with the interaction
sentOrdering - the type of ordering with which the interaction was sent
theTransport - the type of transport associated with the interaction
Throws:
InteractionClassNotRecognized - if the interaction class was not recognized
InteractionParameterNotRecognized - if a parameter of the interaction was not recognized
InteractionClassNotSubscribed - if the federate had not subscribed to the interaction class
FederateInternalError - if an error occurs in the federate