net.sf.sensor.gauge
Class GaugeRuntime

java.lang.Object
  extended bynet.sf.sensor.gauge.GaugeRuntime

public class GaugeRuntime
extends Object

Main entry point for working with gauges, which are simple sensors that measure the value of a single numeric property.

Author:
Age Mooy

Constructor Summary
GaugeRuntime()
           
 
Method Summary
 void addGauge(Gauge gauge)
          Register a new Gauge with the runtime using its own label as the key.
 Gauge getGauge(String label)
          Retrieves the Gauge matching the specified label.
 List getGauges()
          Returns a List<Gauge> of all registered gauges.
 Gauge removeGauge(String label)
          Removes the Gauge matching the specified label.
 void setGauges(List gauges)
          Registers all gauges in the specified List<Gauge> with the runtime using their own labels as keys.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GaugeRuntime

public GaugeRuntime()
Method Detail

addGauge

public void addGauge(Gauge gauge)
Register a new Gauge with the runtime using its own label as the key.

Parameters:
gauge - an instance of Gauge. Nulls are silently ignored.

setGauges

public void setGauges(List gauges)
Registers all gauges in the specified List<Gauge> with the runtime using their own labels as keys.

Parameters:
gauges - a List<Gauge>. Nulls are silently ignored.

getGauge

public Gauge getGauge(String label)
Retrieves the Gauge matching the specified label.

Parameters:
label - a label String that should map to an instance of Gauge
Returns:
the instance of Gauge mapped to the specified label or null if no instance could be found.

removeGauge

public Gauge removeGauge(String label)
Removes the Gauge matching the specified label.

Parameters:
label - a label String that should map to an instance of Gauge
Returns:
the instance of Gauge that was mapped to the specified label or null if no instance could be found.

getGauges

public List getGauges()
Returns a List<Gauge> of all registered gauges. The list will be in semi-random order since the gauges are internally stored in a Map and the List is created on demand.

Returns:
a List<Gauge> of all registered gauges. todo: add a bit of optimization to prevent new lists being created all the time.


Copyright © 2005-2006 SourceForge. All Rights Reserved.