Package org.ka2ddo.yaac.core
Class LocalObjectTracker
java.lang.Object
org.ka2ddo.yaac.core.LocalObjectTracker
- All Implemented Interfaces:
Iterable<LocalObjectTracker.ObjectLink>
,AprsMessageListener
public class LocalObjectTracker
extends Object
implements AprsMessageListener, Iterable<LocalObjectTracker.ObjectLink>
This class manages and tracks the state of Objects being originated by the
local station. It handles shutting down an Object when some other station
takes it over, and adding Objects to this list when locally created or
taken over from other stations.
- Author:
- Andrew Pavlin, KA2DDO
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
This interfaces defines an object that can be informed about changes to the ObjectReports stored in the LocalObjectTracker,static class
This class maintains an association between a local ObjectReport and the ObjectReportSender used to transmit this object to the network (assuming that the Object is enabled for transmission). -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(ObjectReport or) Add another ObjectReport to the tracker, that does not currently have an ObjectReportSender.void
add
(ObjectReportSender ors) Add another ObjectReport to the tracker, that in currently encapsulated by an ObjectReportSender.void
Register a listener to be informed of changes in the tracker.void
Delivers the next message received by YAAC that is an APRS message.get
(int index) Get the Nth ObjectReport record in the tracker.Get the ObjectReport record in the tracker with a specified object name,static LocalObjectTracker
Get the singleton instance of the LocalObjectTracker.int
Get the zero-based index of the tracked ObjectReport with the specified nameiterator()
Returns an iterator over elements of typeObjectLink
.void
Stop tracking an ObjectReport with the specified name.void
Unregister a listener to be informed of changes in the tracker.int
size()
Report the number of ObjectReports currently being tracked.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
getInstance
Get the singleton instance of the LocalObjectTracker.- Returns:
- LocalObjectTracker instance
-
aprsMessageReceived
Delivers the next message received by YAAC that is an APRS message.- Specified by:
aprsMessageReceived
in interfaceAprsMessageListener
- Parameters:
msg
- some subclass of Message containing the message contents; the message should have an AX25Frame connected to it- See Also:
-
size
public int size()Report the number of ObjectReports currently being tracked.- Returns:
- count of ObjectReports
-
get
Get the Nth ObjectReport record in the tracker.- Parameters:
index
- zero-based index of record to fetch- Returns:
- ObjectLink wrapper around selected ObjectReport
- Throws:
IndexOutOfBoundsException
- if index is negative or greater than the number of entries in the tracker
-
get
Get the ObjectReport record in the tracker with a specified object name,- Parameters:
objectName
- String of object name- Returns:
- ObjectLink wrapper around selected ObjectReport, or null if no ObjectReport with specified name
-
add
Add another ObjectReport to the tracker, that does not currently have an ObjectReportSender.- Parameters:
or
- ObjectReport to add
-
add
Add another ObjectReport to the tracker, that in currently encapsulated by an ObjectReportSender.- Parameters:
ors
- ObjectReportSender to add
-
remove
Stop tracking an ObjectReport with the specified name.- Parameters:
objectName
- String name of object to unregister
-
iterator
Returns an iterator over elements of typeObjectLink
.- Specified by:
iterator
in interfaceIterable<LocalObjectTracker.ObjectLink>
- Returns:
- an Iterator.
-
indexOf
Get the zero-based index of the tracked ObjectReport with the specified name- Parameters:
objectName
- String name of ObjectReport- Returns:
- zero-based index of the object, or -1 if not in the tracker
-
addLocalObjectListener
Register a listener to be informed of changes in the tracker.- Parameters:
l
- LocalObjectListener to register
-
removeLocalObjectListener
Unregister a listener to be informed of changes in the tracker.- Parameters:
l
- LocalObjectListener to unregister
-