|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.jaetzold.art.platform.BaseSensorPort
Base class for easy implementation of the interface SensorPort
.
The only thing required is to feed the contructor with the desired parameters and implement the factory-method for the peers: getPeerFor(Sensor)
Field Summary | |
protected Port[] |
excludedPorts
Default is an array of length 0. |
protected long |
granularity
Default is -1 which means all 64 bits are used. |
protected Object |
identifier
Default is a new plain Object. |
protected RobotInterface |
iface
The interface-representation we're associated with. |
protected double |
maximumValue
|
protected double |
minimumValue
Default is Double.NEGATIVE_INFINITY. |
protected int |
portNumber
Default is 0. |
Constructor Summary | |
BaseSensorPort()
Constructs a new SensorPort with dumb default values for it's properties. |
|
BaseSensorPort(RobotInterface iface,
Object identifier,
int portNumber,
double minimumValue,
double maximumValue,
long granularity,
Port[] excludedPorts)
Constructs a new SensorPort with the given values for it's properties. |
Method Summary | |
boolean |
conformsTo(Object identifier)
Tells whether the given Object somehow identifies this Port. |
void |
connectWith(Sensor sensor)
Connects the given Sensor to this port. |
void |
disconnect(Sensor sensor)
Disconnects the given Sensor from this port. |
boolean |
equals(Object o)
|
Port[] |
getExcludedPorts()
Returns an Array consisting of all Ports which cannot be used together with this port at a given time. |
long |
getGranularity()
Returns the number of different values which this port can put out or read in. |
double |
getMaximumValue()
Default is Double.POSITIVE_INFINITY. |
double |
getMinimumValue()
Returns the minimum value this port can really put out or read in. |
abstract SensorPeer |
getPeerFor(Sensor sensor)
This is the Factory-method for creating peers. |
Object |
getPortID()
Returns some Object describing this instance of a Port. |
int |
getPortNumber()
Returns a numeric id for this Port which is maybe easier to interpret by code than the result of getPortID() . |
String |
toString()
Returns identifier.toString() |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int portNumber
protected Object identifier
protected double minimumValue
protected double maximumValue
protected long granularity
protected Port[] excludedPorts
protected RobotInterface iface
Constructor Detail |
public BaseSensorPort()
SensorPort
SensorPort
public BaseSensorPort(RobotInterface iface, Object identifier, int portNumber, double minimumValue, double maximumValue, long granularity, Port[] excludedPorts)
SensorPort
SensorPort
Method Detail |
public int getPortNumber()
Port
getPortID()
.getPortNumber
in interface Port
de.jaetzold.art.Port
Port.getPortID()
public Object getPortID()
Port
conformsTo(Object)
with it as a parameter will yield true as a result.The current implementations use a String which is equal to the names printed on the hardware-interface or used in its manual.getPortID
in interface Port
de.jaetzold.art.Port
Port.getPortNumber()
,
Port.conformsTo(Object)
,
RobotInterface.getPort(Object)
public double getMinimumValue()
Port
getMinimumValue
in interface Port
public double getMaximumValue()
getMaximumValue
in interface Port
public long getGranularity()
Port
getGranularity
in interface Port
public Port[] getExcludedPorts()
Port
getExcludedPorts
in interface Port
public boolean conformsTo(Object identifier)
Port
conformsTo
in interface Port
public String toString()
identifier.toString()
toString
in class Object
identifier
public abstract SensorPeer getPeerFor(Sensor sensor)
getPeerFor
in interface SensorPort
de.jaetzold.art.SensorPort
SensorPort.connectWith(Sensor)
,
RawSensor.connectWith(SensorPort)
public void connectWith(Sensor sensor)
SensorPort
connectWith
in interface SensorPort
de.jaetzold.art.SensorPort
Sensor.connectWith(Port)
public void disconnect(Sensor sensor)
SensorPort
disconnect
in interface SensorPort
de.jaetzold.art.SensorPort
Sensor.disconnect()
public boolean equals(Object o)
equals
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |