Package org.ka2ddo.yaac.healthmonitor
Class MonitoredStationList
java.lang.Object
org.ka2ddo.yaac.healthmonitor.MonitoredStationList
- All Implemented Interfaces:
TrackerListener
List of MonitoredStation objects that is persisted to YAAC's Java preferences section.
- Author:
- Andrew Pavlin. KA2DDO
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Register a listener to be informed when the MonitoredStationList membership changes.int
addStation
(MonitoredStation station) Add a new monitored station record to the list.findStation
(String callsign) Find a MonitoredStation record by its callsign string.void
fireMonitoredStationUpdated
(int index) Announce to all registered listeners that something has changed about one of the entries in this list.static MonitoredStationList
Get the list of monitored stations.getStation
(int index) Get a MonitoredStation object by its list index,int
Get the quantity of stations currently being monitored.int
getStationCount
(MonitorType... types) Get the quantity of stations of the specified type currently being monitored.int
indexOf
(MonitoredStation station) Get the position index in the list of the specified MonitoredStation.void
messageAdded
(StationState ss, int index, AX25Message msg) Called when a Message is added to the history for a station in the tracker.void
messageDeleted
(StationState ss, int index, AX25Message msg) Called when a AX25Message is deleted from the history for a station in the tracker.void
Unregister a listener from being informed when the MonitoredStationList membership changes.void
removeStation
(int index) Delete a MonitoredStation from the list of monitored stations.void
stationAdded
(StationState ss, int index) Called when a new station is initially added to the tracker.void
stationDeleted
(StationState ss, int index) Called when an existing station is deleted from the tracker.void
Called when an existing station is updated with new information in the tracker.
-
Method Details
-
getInstance
Get the list of monitored stations.- Returns:
- singleton instance of MonitoredStationList
-
getStationCount
public int getStationCount()Get the quantity of stations currently being monitored.- Returns:
- count of stations in the list
-
getStationCount
Get the quantity of stations of the specified type currently being monitored.- Parameters:
types
- list of MonitorType of the stations to be counted- Returns:
- count of stations in the list
-
getStation
Get a MonitoredStation object by its list index,- Parameters:
index
- zero-based position index of MonitoredStation in the list- Returns:
- MonitoredStation at that position
- Throws:
ArrayIndexOutOfBoundsException
- if index < 0 or index >= the length of the list
-
findStation
Find a MonitoredStation record by its callsign string.- Parameters:
callsign
- String callsign-SSID of monitored station to look up- Returns:
- matching MonitoredStation or null if no match
-
indexOf
Get the position index in the list of the specified MonitoredStation.- Parameters:
station
- MonitoredStation record to look up in list (must be an entry in the list, not a clone)- Returns:
- zero-based index in the list for the station, or -1 if not in list
-
addStation
Add a new monitored station record to the list.- Parameters:
station
- MonitoredStation record to add to list- Returns:
- zero-based index in the list where record was appended
- Throws:
IllegalArgumentException
- if this MonitoredStation record or another one with the same callsign string is already in the list
-
removeStation
public void removeStation(int index) Delete a MonitoredStation from the list of monitored stations.- Parameters:
index
- zero-based index of station to remove
-
fireMonitoredStationUpdated
public void fireMonitoredStationUpdated(int index) Announce to all registered listeners that something has changed about one of the entries in this list.- Parameters:
index
- zero-based index of modified record
-
addListener
Register a listener to be informed when the MonitoredStationList membership changes.- Parameters:
l
- MonitoredStationListener to register
-
removeListener
Unregister a listener from being informed when the MonitoredStationList membership changes.- Parameters:
l
- MonitoredStationListener to unregister
-
messageAdded
Called when a Message is added to the history for a station in the tracker.- Specified by:
messageAdded
in interfaceTrackerListener
- Parameters:
ss
- StationState containing the station's informationindex
- zero-based index of the message added to the StationState objectmsg
- APRS Message object being added to the tracker; note that non-APRS packets that can still be decoded (such as OpenTRAC) will also be passed here; AX25Frames that cannot be decoded will pass null here
-
messageDeleted
Called when a AX25Message is deleted from the history for a station in the tracker.- Specified by:
messageDeleted
in interfaceTrackerListener
- Parameters:
ss
- StationState containing the station's information; the AX25Message will already be removed from the StationState objectindex
- zero-based index of the message removed from the StationState objectmsg
- APRS Message object being removed from the tracker; note that non-APRS packets that can still be decoded (such as OpenTRAC) will also be passed here; AX25Frames that cannot be decoded will pass null here
-
stationAdded
Called when a new station is initially added to the tracker.- Specified by:
stationAdded
in interfaceTrackerListener
- Parameters:
ss
- StationState containing the station's information; the initial AX25Message will not yet be stored within the StationState objectindex
- zero-based integer sequence number for this station in the StationTracker
-
stationUpdated
Called when an existing station is updated with new information in the tracker.- Specified by:
stationUpdated
in interfaceTrackerListener
- Parameters:
ss
- StationState containing the station's information; the new AX25Message will not yet be stored within the StationState object
-
stationDeleted
Called when an existing station is deleted from the tracker.- Specified by:
stationDeleted
in interfaceTrackerListener
- Parameters:
ss
- StationState containing the station's informationindex
- zero-based integer sequence number for this station in the StationTracker
-