/* File: RadioCommunicationsFamily.java CVS Info: $Id: RadioCommunicationsFamily.java,v 1.0 2000/06/07 18:00:00 laflam Exp $ Compiler: jdk 1.3 */ package mil.navy.nps.dis; // package for Naval Postgraduate School DIS Library import mil.navy.nps.util.*; // General-purpose utilities import mil.navy.nps.disEnumerations.*; // Enumerations for DIS import java.lang.*; // Native Java Language Stuff import java.util.*; // utility stuff import java.io.*; // input/output for serialization /** * Abstract (uninstantiated) parent class for RadioCommunicationsFamily. * *@version 1.0 *@author David W. Laflam (http://www.web3d.org/WorkingGroups/vrtp/dis-java-vrml/) *@author Don Brutzman (http://www.web3d.org/WorkingGroups/vrtp/dis-java-vrml/) *@author Don McGregor (http://www.web3d.org/WorkingGroups/vrtp/dis-java-vrml/) * *
 *
 *
 *
 *sizeOf = 288 ????????????????? bytes
     */
    public final static int     sizeOf = 288;       // is this the PDU Size Total DWL         
                                                    // size of object as written to wire
/**
 *Default constructor
 * - creates entityID, radioID
 * - fills with zeros for all values of the following parameters:
 *   entityID, radioID.
 */
public RadioCommunicationsFamily()
{
	
   super.setPduType(PduTypeField.RECEIVER);
   entityID  = new EntityID();
   radioID = new UnsignedShort(0);
   return;
}
// Methods 
/**
 * Make a copy of the object. This requires a deep copy, so we don't have two
 * objects sharing pointers to the same data.
 * @return a new RadioCommunicationsFamily PDU entity
 */
public Object clone()
{
 RadioCommunicationsFamily   newRadioCommunicationsFamily = (RadioCommunicationsFamily)super.clone(); 
 // So this will inherit from the super class 
 newRadioCommunicationsFamily.setEntityID(this.getEntityID());
 newRadioCommunicationsFamily.setRadioID(this.getRadioID());
 return newRadioCommunicationsFamily;
}
/**
 * Serialize and write out the output stream, order is important here since
 * it needs to conform to the DIS standard
 * @exception RuntimeException when IO error occurs.
 */
public void serialize(DataOutputStream outputStream)
{
    super.serialize(outputStream);      // To write out header info
    try
    {
        entityID.serialize(outputStream);
        radioID.serialize(outputStream);
    }
    catch (Exception someError)
    {
        throw new
            RuntimeException("Exception in RadioCommunicationsFamily. Error writing to wire ." + someError);
    }
    return;
}
/**
 * Deserialize the input stream, and order is important here, since we need to
 * read in the same order as specified by the DIS standard
 * @exception RuntimeException when IO error occurs.
 */
public void deSerialize(DataInputStream inputStream)
{
    super.deSerialize(inputStream);     //To read in all the header info
    try
    {
        entityID.deSerialize(inputStream);
        radioID.deSerialize(inputStream);
     }
    catch (Exception someError)
        {
            throw new
                RuntimeException("Exception in RadioCommunicationsFamily. Error reading from wire." + someError );
        }
}
/**
 * Returns the length of the entity
 * @return an integer length of the entity
 */
public int length()
{
    return sizeOf;          // EntityTypes are this long, always.  This is the 288
}
/**
 * Returns the PDU name - RadioCommunicationsFamily
 * @return a string "RadioCommunicationsFamily"
 */
public String pduName()
{
  return new String("RadioCommunicationsFamily");
}
/**
 * Print the values of the following object out, with correct level of
 * indentation on the page for entityID and  radioID.
 * 
 */
public void printValues(int indentLevel, PrintStream printStream)
{
  StringBuffer indent = ProtocolDataUnit.getPaddingOfLength(indentLevel);
  int          idx, superclassIndent = indentLevel;
    printStream.println();
    printStream.println("RadioCommunicationsFamily PDU-");
    // ugly wart: get the superclass over to the left a couple pixels, if we have any to spare,
    // so the header info will be indented a bit less.
    if(superclassIndent > 0)
      superclassIndent -= 1;
    super.printValues(superclassIndent, printStream);
    entityID.printValues(indentLevel, printStream);
    
    return;
}
//Accessor (Set and Get methods) 
/**
 * Gets RadioCommunicationProtocolFamily entity ID.
 * Each Entity in a given exercise executing on a DIS application shall be assigned an Entity Identifier Record
 * Unique to the exercise.
 * @return a clone of the firing entity ID
 */
public EntityID getEntityID()
{
	return (EntityID)entityID.clone();
}
/**
 * Sets RadioCommunicationProtocolFamily entity ID
 * Each Entity in a given exercise executing on a DIS application shall be assigned an Entity Identifier Record
 * Unique to the exercise.
 * @param pEntityID the firing entity ID
 */
public void setEntityID(EntityID pEntityID)
{
	entityID = pEntityID;
}
/**
 * Gets RadioCommunicationProtocolFamily entity ID.
 * Each Entity in a given exercise executing on a DIS application shall be assigned an Entity Identifier Record
 * Unique to the exercise.
 * @return a clone of the radioID entity ID
 */
 
 
public UnsignedShort getRadioID()
{
	return (UnsignedShort)radioID.clone();
}
/**
 * Sets RadioID.
 * Each Entity in a given exercise executing on a DIS application shall be assigned an Entity Identifier Record
 * Unique to the exercise.
 * @param pTargetEntityID target entity ID value
 */
public void setRadioID(UnsignedShort pRadioID)
{
	radioID = pRadioID;
}
} // end of class RadioCommunicationsFamily