com.jamonapi
Class MonKeyImp

java.lang.Object
  extended by com.jamonapi.MonKeyImp
All Implemented Interfaces:
MonKey, MonKeyItem
Direct Known Subclasses:
Log4jMonKey

public class MonKeyImp
extends java.lang.Object
implements MonKey

A key implmentation for label, and units type monitors. Note this could also be implemented with the following use of MonKeyBase. This class predates that one and would not have to use a Map for basic functions and so MAY be more efficient (this wasn't tested). Using label, and units is the most common monitor that will be used in most cases.>

This could be implemented like the following.

LinkedHashMap lm=new LinkedHashMap();
    lm.put("Label", "mypakcage.myclass");
    lm.put(""Units", "ms.");
    MonKey mk=new MonKeyBase(lm);
 


Field Summary
 
Fields inherited from interface com.jamonapi.MonKey
LABEL_HEADER, UNITS_HEADER
 
Constructor Summary
MonKeyImp(MonKeyItem keyItem, java.lang.String units)
           
MonKeyImp(java.lang.String summaryLabel, java.lang.Object details, java.lang.String units)
          Object details can be an Object[], a Collection, or a Java Object.
MonKeyImp(java.lang.String summaryLabel, java.lang.String units)
           
 
Method Summary
 boolean equals(java.lang.Object compareKey)
          This method is called automatically by a HashMap when this class is used as a HashMap key.
 java.util.List getBasicHeader(java.util.List header)
          i.e.
 java.util.List getBasicRowData(java.util.List rowData)
          Get all data for a row excluding row ranges, and put key data into one cell
 java.lang.Object getDetails()
           
 java.util.List getDisplayHeader(java.util.List header)
          i.e.
 java.util.List getHeader(java.util.List header)
          i.e.
 java.lang.String getLabel()
          Returns the label for the monitor
 java.lang.Object getParam()
          Used to get any arbitrary Object into the key.
 java.lang.String getRangeKey()
          Uses this value to look up an associated Range
 java.util.List getRowData(java.util.List rowData)
          Get all data for a row including range data
 java.util.List getRowDisplayData(java.util.List rowData)
          Get data excluding ranges, but break out key columns
 int getSize()
          Returns the size of the key in characters within the key.
 java.lang.String getUnits()
          Returns the units for the monitor
 java.lang.Object getValue(java.lang.String key)
          Returns any object that has a named key.
 int hashCode()
          Used when key is put into a Map to look up the monitor
 void setDetails(java.lang.Object details)
           
 void setParam(java.lang.Object param)
          Used to set any arbitrary Object into the key.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MonKeyImp

public MonKeyImp(java.lang.String summaryLabel,
                 java.lang.String units)

MonKeyImp

public MonKeyImp(java.lang.String summaryLabel,
                 java.lang.Object details,
                 java.lang.String units)
Object details can be an Object[], a Collection, or a Java Object.


MonKeyImp

public MonKeyImp(MonKeyItem keyItem,
                 java.lang.String units)
Method Detail

getLabel

public java.lang.String getLabel()
Returns the label for the monitor

Specified by:
getLabel in interface MonKey

getUnits

public java.lang.String getUnits()
Returns the units for the monitor


getDetails

public java.lang.Object getDetails()
Specified by:
getDetails in interface MonKeyItem

setDetails

public void setDetails(java.lang.Object details)
Specified by:
setDetails in interface MonKeyItem

getValue

public java.lang.Object getValue(java.lang.String key)
Returns any object that has a named key. In this keys case 'label' and 'units' makes sense, but any values are acceptible.

Specified by:
getValue in interface MonKey

getParam

public java.lang.Object getParam()
Used to get any arbitrary Object into the key. It will not be used as part of the key, however it can be retrieved later for example in the JAMonBufferListener.

Returns:
Object

setParam

public void setParam(java.lang.Object param)
Used to set any arbitrary Object into the key. It will not be used as part of the key, however it can be retrieved later for example in the JAMonBufferListener.


equals

public boolean equals(java.lang.Object compareKey)
This method is called automatically by a HashMap when this class is used as a HashMap key. A Coordinate is considered equal if its x and y variables have the same value.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Used when key is put into a Map to look up the monitor

Overrides:
hashCode in class java.lang.Object

getBasicHeader

public java.util.List getBasicHeader(java.util.List header)
i.e. Label


getDisplayHeader

public java.util.List getDisplayHeader(java.util.List header)
i.e. Get the display header. Often same as getHeader


getHeader

public java.util.List getHeader(java.util.List header)
i.e. Get all key columns as part of the header i.e. Label, Units. This will include range headers


getBasicRowData

public java.util.List getBasicRowData(java.util.List rowData)
Get all data for a row excluding row ranges, and put key data into one cell


getRowData

public java.util.List getRowData(java.util.List rowData)
Get all data for a row including range data


getRowDisplayData

public java.util.List getRowDisplayData(java.util.List rowData)
Get data excluding ranges, but break out key columns


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getRangeKey

public java.lang.String getRangeKey()
Description copied from interface: MonKey
Uses this value to look up an associated Range

Specified by:
getRangeKey in interface MonKey

getSize

public int getSize()
Description copied from interface: MonKey
Returns the size of the key in characters within the key. Note it doesn't calculate the actual memory footprint as unicode characters take more memory than a single character in a string. This info is used to limit the memory footprint of jamon.

Specified by:
getSize in interface MonKey
Returns:
returns the size of the key