public class OpenTracEntity extends OpenTracElement
id
Constructor and Description |
---|
OpenTracEntity()
Create an empty uninitialized OpenTracEntity.
|
OpenTracEntity(AX25Callsign station,
short extensionId)
Create an empty uninitialized OpenTracEntity for the specified callsign/SSID and extension ID.
|
OpenTracEntity(byte[] body,
int offset,
int length,
boolean includesExtension)
Read an OpenTracEntity from a byte array.
|
OpenTracEntity(int sequenceNumber,
OpenTracEntity oldEntity)
Create an uninitialized clone of another OpenTracEntity with the changed sequence number.
|
OpenTracEntity(java.lang.String station,
short extensionId)
Create an empty uninitialized OpenTracEntity for the specified callsign/SSID and extension ID.
|
Modifier and Type | Method and Description |
---|---|
void |
appendElement(OpenTracElement element)
Add another element to this entity.
|
int |
computeBody(byte[] buf,
int offset)
Generate an OpenTrac entity ID element for this entity.
|
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
|
boolean |
equalsElement(OpenTracElement other)
Test if this OpenTracElement has the same type and value as another OpenTracElement.
|
java.lang.String |
getCallsign()
Get the callsign of this entity with any appended SSID.
|
java.lang.String |
getEntityName()
Get the full name of this entity with any appended SSID and entity ID
|
short |
getExtensionId()
Get the ID number of the extension being reported by this entity.
|
OpenTracElement |
getMatchingElement(int type)
Get the first element of this entity of the specified OpenTrac element ID.
|
static short |
getNextAvailableEntityId(java.lang.String entityName)
Get an unused entity ID number for an OpenTracEntity record.
|
AX25Message.Precedence |
getPrecedence()
Report the traffic-handling precedence for this entity's elements.
|
int |
getSequenceNumber()
Get the sequence number for the data in this entity.
|
int |
hashCode()
Returns a hash code value for the object.
|
boolean |
isEntityAddressed()
Test if this entity has been properly addressed.
|
boolean |
isEntityEmpty()
Test if this entity has any elements.
|
int |
length()
Return the number of bytes needed to encode this entity, including all its child elements.
|
static void |
reserveEntityId(short id,
java.lang.String entityName)
Reserve an entity ID value as already in use.
|
void |
setCallsign(java.lang.String callsign)
Set the callsign-SSID of this entity.
|
java.lang.String |
valueString()
Returns a string representation of the value of this entity.
|
getId, toString
public OpenTracEntity()
public OpenTracEntity(AX25Callsign station, short extensionId)
station
- AX25Callsign of station containing the entityextensionId
- extension ID for sub-element within the stationpublic OpenTracEntity(java.lang.String station, short extensionId)
station
- String of station containing the entityextensionId
- extension ID for sub-element within the stationpublic OpenTracEntity(int sequenceNumber, OpenTracEntity oldEntity)
sequenceNumber
- the sequence number to use for this copyoldEntity
- OpenTracEntity whose identifiers should be copiedpublic OpenTracEntity(byte[] body, int offset, int length, boolean includesExtension)
body
- byte array to read the entity fromoffset
- zero-based starting position in the array to read the entity fromlength
- number of bytes to read from the arrayincludesExtension
- boolean true if entity includes the extension ID in its encodingpublic static short getNextAvailableEntityId(java.lang.String entityName) throws java.lang.IllegalArgumentException
entityName
- String name of APRS entity that needs an ID (that should be repeated for same object name)java.lang.IllegalArgumentException
- if no entity ID values are left unusedpublic static void reserveEntityId(short id, java.lang.String entityName) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
id
- entity ID value to reserveentityName
- String name of APRS entity that needs an ID (that should be repeated for same object name)java.lang.IllegalArgumentException
- if id value is out of rangejava.lang.IllegalStateException
- if specified entity ID value is already in usepublic short getExtensionId()
public int getSequenceNumber()
public boolean isEntityEmpty()
public OpenTracElement getMatchingElement(int type)
type
- OpenTrac element IDpublic void appendElement(OpenTracElement element)
element
- OpenTracElement to addpublic java.lang.String valueString()
valueString
in class OpenTracElement
public boolean isEntityAddressed()
public java.lang.String getCallsign()
public void setCallsign(java.lang.String callsign)
callsign
- String form of the SSID-qualified callsignpublic java.lang.String getEntityName()
public int computeBody(byte[] buf, int offset)
computeBody
in class OpenTracElement
buf
- byte array to append the element tooffset
- starting index in buf to start appending the elementpublic int length()
length
in class OpenTracElement
public AX25Message.Precedence getPrecedence()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.public boolean equalsElement(OpenTracElement other)
equalsElement
in class OpenTracElement
other
- OpenTracElement to compare against this elementpublic int hashCode()
hashCode
in class java.lang.Object
Object.equals(Object)
,
System.identityHashCode(java.lang.Object)