com.isti.trinetwatch.emailer
Class StationDataBlock

java.lang.Object
  extended by com.isti.trinetwatch.emailer.StationDataBlock
All Implemented Interfaces:
java.lang.Comparable

public class StationDataBlock
extends java.lang.Object
implements java.lang.Comparable

Class StationDataBlock defines a station information block; one for each station.


Constructor Summary
StationDataBlock(java.lang.String name, StatusLevelTag statusLevel, UsageLevelTag usageLevel, long timeVal)
          Creates a station information block object.
 
Method Summary
 int compareTo(java.lang.Object cmpObj)
          Compares this object with the given object for order.
 java.lang.String getDisplayString()
          Returns a display string for the station information block.
 java.lang.String getName()
          Returns the station name.
 StatusLevelTag getStatusLevel()
          Returns the status level tag object for the station.
 long getStatusTimeValue()
          Returns the time-of-last-change value for the status level of the station.
 UsageLevelTag getUsageLevel()
          Returns the usage level tag object for the station.
 long getUsageTimeValue()
          Returns the time-of-last-change value for the usage level of the station.
 java.lang.String toString()
          Returns the station name.
 boolean updateStatusUsage(StatusLevelTag sLevel, UsageLevelTag uLevel, long timeVal)
          Updates the status and usage levels for the station.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StationDataBlock

public StationDataBlock(java.lang.String name,
                        StatusLevelTag statusLevel,
                        UsageLevelTag usageLevel,
                        long timeVal)
Creates a station information block object.

Parameters:
name - station name.
statusLevel - status level for station.
usageLevel - usage level for station.
timeVal - the initial time-of-last-change value for this station block.
Method Detail

getName

public java.lang.String getName()
Returns the station name.


getStatusLevel

public StatusLevelTag getStatusLevel()
Returns the status level tag object for the station.


getUsageLevel

public UsageLevelTag getUsageLevel()
Returns the usage level tag object for the station.


updateStatusUsage

public boolean updateStatusUsage(StatusLevelTag sLevel,
                                 UsageLevelTag uLevel,
                                 long timeVal)
Updates the status and usage levels for the station.

Parameters:
statusLevel - status level for station.
usageLevel - usage level for station.
timeVal - time value for this update.
Returns:
true if the status or usage level tag for the station is changed, false if not or if a parameter error is detected.

getStatusTimeValue

public long getStatusTimeValue()
Returns the time-of-last-change value for the status level of the station.


getUsageTimeValue

public long getUsageTimeValue()
Returns the time-of-last-change value for the usage level of the station.


toString

public java.lang.String toString()
Returns the station name.

Overrides:
toString in class java.lang.Object

getDisplayString

public java.lang.String getDisplayString()
Returns a display string for the station information block.


compareTo

public int compareTo(java.lang.Object cmpObj)
Compares this object with the given object for order. The time-of-last-change value for the status level is used for the comparison, with the large time value first (newest first).

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
cmpObj - a 'StationDataBlock' object to compare to.
Returns:
A negative integer, zero or a positive integer as this object is less than, equal to or greater than the given object.
Throws:
'ClassCastException' - if the given object is not of type 'StationDataBlock'.