org.ka2ddo.yaac.healthmonitor
Class MonitoredStationList

java.lang.Object
  extended by org.ka2ddo.yaac.healthmonitor.MonitoredStationList
All Implemented Interfaces:
TrackerListener

public class MonitoredStationList
extends java.lang.Object
implements TrackerListener

List of MonitoredStation objects that is persisted to YAAC's Java preferences section.


Method Summary
 void addListener(MonitoredStationListener l)
          Register a listener to be informed when the MonitoredStationList membership changes.
 int addStation(MonitoredStation station)
          Add a new monitored station record to the list.
 MonitoredStation findStation(java.lang.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 getInstance()
          Get the list of monitored stations.
 MonitoredStation getStation(int index)
          Get a MonitoredStation object by its list index,
 int getStationCount()
          Get the quantity of stations 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 removeListener(MonitoredStationListener l)
          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 stationUpdated(StationState ss)
          Called when an existing station is updated with new information in the tracker.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static MonitoredStationList 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

getStation

public MonitoredStation getStation(int index)
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:
java.lang.ArrayIndexOutOfBoundsException - if index < 0 or index >= the length of the list

findStation

public MonitoredStation findStation(java.lang.String callsign)
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

public int indexOf(MonitoredStation station)
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

public int addStation(MonitoredStation station)
               throws java.lang.IllegalArgumentException
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:
java.lang.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

public void addListener(MonitoredStationListener l)
Register a listener to be informed when the MonitoredStationList membership changes.

Parameters:
l - MonitoredStationListener to register

removeListener

public void removeListener(MonitoredStationListener l)
Unregister a listener from being informed when the MonitoredStationList membership changes.

Parameters:
l - MonitoredStationListener to unregister

messageAdded

public void messageAdded(StationState ss,
                         int index,
                         AX25Message msg)
Called when a Message is added to the history for a station in the tracker.

Specified by:
messageAdded in interface TrackerListener
Parameters:
ss - StationState containing the station's information
index - zero-based index of the message added to the StationState object
msg - 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

public void messageDeleted(StationState ss,
                           int index,
                           AX25Message msg)
Called when a AX25Message is deleted from the history for a station in the tracker.

Specified by:
messageDeleted in interface TrackerListener
Parameters:
ss - StationState containing the station's information; the AX25Message will already be removed from the StationState object
index - zero-based index of the message removed from the StationState object
msg - 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

public void stationAdded(StationState ss,
                         int index)
Called when a new station is initially added to the tracker.

Specified by:
stationAdded in interface TrackerListener
Parameters:
ss - StationState containing the station's information; the initial AX25Message will not yet be stored within the StationState object
index - zero-based integer sequence number for this station in the StationTracker

stationUpdated

public void stationUpdated(StationState ss)
Called when an existing station is updated with new information in the tracker.

Specified by:
stationUpdated in interface TrackerListener
Parameters:
ss - StationState containing the station's information; the new AX25Message will not yet be stored within the StationState object

stationDeleted

public void stationDeleted(StationState ss,
                           int index)
Called when an existing station is deleted from the tracker.

Specified by:
stationDeleted in interface TrackerListener
Parameters:
ss - StationState containing the station's information
index - zero-based integer sequence number for this station in the StationTracker