dk.deepthought.sidious.greenhouse
Class SensorInput

java.lang.Object
  extended by dk.deepthought.sidious.greenhouse.SensorInput

@Immutable
public final class SensorInput
extends java.lang.Object

This class represents a sensor input from the environment at a specific time.

It holds the id and the value of the given sensor at given time.

Author:
Deepthought

Field Summary
private static org.apache.commons.logging.Log logger
          Logger for this class
private  SuperLinkID superLinkID
          The id of the sensor this represent.
private  double value
          Current value of this sensor.
 
Constructor Summary
SensorInput(SuperLinkID superLinkID, double value)
          Creates a new SensorInput object from the specified SuperLinkID and value.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 boolean equalsOnSuperLinkID(SensorInput sensor)
          Compares two sensor inputs on super link equality.
 SuperLinkID getID()
          Returns the id of this sensor.
 double getValue()
          Gets the value of this sensor.
 int hashCode()
          Method hashes only on SuperLinkID
 SensorInput newInstanceWithNewValue(double value)
          Creates a new instance of this type of SensorInput (i.e.
private  double round(double val)
          Rounds the specified value.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

private static final org.apache.commons.logging.Log logger
Logger for this class


superLinkID

private final SuperLinkID superLinkID
The id of the sensor this represent.


value

private final double value
Current value of this sensor.

Constructor Detail

SensorInput

public SensorInput(SuperLinkID superLinkID,
                   double value)
Creates a new SensorInput object from the specified SuperLinkID and value.

Parameters:
superLinkID - the SuperLink Identifier of this sensor
value - value of this sensor
Method Detail

round

private double round(double val)
Rounds the specified value.

Parameters:
val - the value to round
Returns:
the rounded value

newInstanceWithNewValue

public SensorInput newInstanceWithNewValue(double value)
Creates a new instance of this type of SensorInput (i.e. with the same id) with the specified new value.

Parameters:
value - the value of the new instance
Returns:
a new instance of this SensorInput

getValue

public double getValue()
Gets the value of this sensor.

Returns:
the value of this sensor

equalsOnSuperLinkID

public boolean equalsOnSuperLinkID(SensorInput sensor)
Compares two sensor inputs on super link equality.

Returns true if and only if the SuperLinkID specified sensor and this sensor are equal.

Parameters:
sensor - the input sensor
Returns:
true if sensors have matching SuperLinkID's

getID

public SuperLinkID getID()
Returns the id of this sensor.

Returns:
the id of this sensor

hashCode

public int hashCode()
Method hashes only on SuperLinkID

Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

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


Copyright © Deepthought Development - All Rights Reserved.