/* File: RadioEntityType.java CVS Info: $Id: RadioEntityType.java,v 1.2 2000/07/03 18:44:35 laflam Exp $ Compiler: jdk 1.3 */ package mil.navy.nps.dis; 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 /** * Entity Radio Type * *@version 1.0 *@author Don McGregor (http://www.web3d.org/WorkingGroups/vrtp/dis-java-vrml/) * *
* *
sizeOf = 64 bytes
.
*/
public final int sizeOf = 64; // object is 64 bytes long
/**
*Constructs an new RadioEntityType Object, centered.
*/
public RadioEntityType()
{
// default constructor
entityKind = new UnsignedByte(0); // 8 bit enumeration
domain = new UnsignedByte(0); // 8 bit enumeration
country = new UnsignedShort(0); //16 bit enumeration
category = new UnsignedByte(0); // 8 bit enumeration
nomenclatureVersion = new UnsignedByte(0); // 8 bit enumeration
nomenclature = new UnsignedShort(0); //16 bit enumeration
return;
} // end public RadioEntityType()
/**
*Constructs a new RadioEntityType Object whose coordinate values are passed in parameters.
*
*@param pEntityKind the first
*@param pDomain the second
*@param pCountry the third
*@param pCategory the fourth
*@param pNomenclatureVersion the fifth
*@param pNomenclature the sixth
*/
// public RadioEntityType(double pX, double pY, double pZ)
public RadioEntityType(UnsignedByte pEntityKind, UnsignedByte pDomain, UnsignedShort pCountry, UnsignedByte pCategory, UnsignedByte pNomenclatureVersion, UnsignedShort pNomenclature)
{
entityKind = pEntityKind ;
domain = pDomain ;
country = pCountry ;
category = pCategory ;
nomenclatureVersion = pNomenclatureVersion ;
nomenclature = pNomenclature ;
return;
} // end public RadioEntityType()
public Object clone()
{
RadioEntityType newRadioEntityType = new RadioEntityType(entityKind, domain, country, category, nomenclatureVersion, nomenclature);
return newRadioEntityType;
}// end public Object clone()
/**
*@exception RuntimeException when IO error occurs.
*/
public void serialize(DataOutputStream outputStream)
{
// write out the data to an output stream. Order is important here, since
// it needs to conform to the DIS standard.
//super.serialize(outputStream); // No need to call super, since no ivars are in our direct superclass
try
{
//**********// We must ask Don McGregor to see if this does conform to the DIS Standard (HOT HOT HOT)
//entityKind, domain, country, category, nomenclatureVersion, nomenclature
outputStream.writeByte((byte)entityKind.intValue()); //8 bit enumeration
outputStream.writeByte((byte)domain.intValue()); //8 bit enumeration
outputStream.writeShort((short)country.intValue()); //16 bit enumeration
outputStream.writeByte((byte)category.intValue()); //8 bit enumeration
outputStream.writeByte((byte)nomenclatureVersion.intValue()); //8 bit enumeration
outputStream.writeShort((short)nomenclature.intValue()); //16 bit enumeration
}
catch (IOException ioError)
{
throw new
RuntimeException("Exception in RadioEntityType.serialize, error writing to wire.");
}
} // end public void serialize
/**
*@exception RuntimeException when IO error occurs.
*/
public void deSerialize(DataInputStream pInputStream)
{
try
{
entityKind = new UnsignedByte (pInputStream.readByte()); //8 bit enumeration
domain = new UnsignedByte (pInputStream.readByte()); //8 bit enumeration
country = new UnsignedShort (pInputStream.readShort()); //16 bit enumeration
category = new UnsignedByte (pInputStream.readByte()); //8 bit enumeration
nomenclatureVersion = new UnsignedByte (pInputStream.readByte()); //8 bit enumeration
nomenclature = new UnsignedShort (pInputStream.readShort()); //16 bit enumeration
}
catch (IOException ioError)
{
throw new
RuntimeException("Exception in RadioEntityType.deSerialize,. Error reading from wire.");
}
}// end public void deSerialize
public int length()
{
return sizeOf; // EntityTypes are this long, always.
} // end public int length()
public void printValues(int indentLevel, PrintStream printStream)
{
// print the values of the object out, with correct level of
// indentation on the page.
//entityKind, domain, country, category, nomenclatureVersion, nomenclature
StringBuffer indent = ProtocolDataUnit.getPaddingOfLength(indentLevel);
int idx, superclassIndent = indentLevel;
printStream.println(indent + "RadioEntityType entityKind: " + entityKind);
printStream.println(indent + "RadioEntityType domain: " + domain);
printStream.println(indent + "RadioEntityType country: " + country);
printStream.println(indent + "RadioEntityType category: " + category);
printStream.println(indent + "RadioEntityType nomenclatureVersion: " + nomenclatureVersion);
printStream.println(indent + "RadioEntityType nomenclature: " + nomenclature);
return;
} // end public void printValues()
// Accessor methods (set and get)
/**
* Gets the EntityKind
* @return entityKind
*/
public UnsignedByte getEntityKind()
{
return entityKind;
}
/**
* Sets the EntityKind
* @param pEntityKind a EntityKind
*/
public void setEntityKind(UnsignedByte pEntityKind)
{
entityKind = pEntityKind;
}
/**
* Gets the Domain
* @return domain
*/
public UnsignedByte getDomain()
{
return domain;
}
/**
* Sets the Domain
* @param pDomain a Domain
*/
public void setDomain(UnsignedByte pDomain)
{
domain = pDomain;
}
/**
* Gets the Country
* @return country
*/
public UnsignedShort getCountry()
{
return country;
}
/**
* Sets the Country
* @param pCountry a Country
*/
public void setCountry(UnsignedShort pCountry)
{
country = pCountry;
}
/**
* Gets the Category
* @return category
*/
public UnsignedByte getCategory()
{
return category;
}
/**
* Sets the Category
* @param pCategory a Category
*/
public void setCategory(UnsignedByte pCategory)
{
category = pCategory;
}
/**
* Gets the NomenclatureVersion
* @return nomenclatureVersion
*/
public UnsignedByte getNomenclatureVersion()
{
return nomenclatureVersion;
}
/**
* Sets the NomenclatureVersion
* @param pNomenclatureVersion a NomenclatureVersion
*/
public void setNomenclatureVersion(UnsignedByte pNomenclatureVersion)
{
nomenclatureVersion = pNomenclatureVersion;
}
/**
* Gets the Nomenclature
* @return nomenclature
*/
public UnsignedShort getNomenclature()
{
return nomenclature;
}
/**
* Sets the Nomenclature
* @param pNomenclature a Nomenclature
*/
public void setNomenclature(UnsignedShort pNomenclature)
{
nomenclature = pNomenclature;
}
/**
* String toString
* Used for debuging
*/
public String toString ()
{
String result;
result = " entityKind = " +entityKind + " domain = " + domain + " country= " + country +
" category =" + category + " nomenclatureVersion = " +nomenclatureVersion + " padding1 = " + nomenclature;
return result ;
}
} // end of class RadioEntityType