de.jaetzold.art
Interface Port

All Known Subinterfaces:
ActuatorPort, SensorPort

public interface Port

A Port describes what data in which format an interface can deliver. A Port usually knows how to create a Peer for Objects if they are needed but this interface leaves it open which type the Peer might be and which method should be used for it. Subclasses can specify which types of Peers they create under which circumstances. A usual Port consists therefore mainly of a method for retrieving a peer associated with the port, methods which give information about the capabilities and attributes of the port as well as methods for connecting and disconnecting other Objects.


Method Summary
 boolean conformsTo(Object identifier)
          Tells whether the given Object somehow identifies this Port.
 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()
          Returns the maximum value this port can really put out or read in.
 double getMinimumValue()
          Returns the minimum value this port can really put out or read in.
 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().
 

Method Detail

getPortNumber

public int getPortNumber()
Returns a numeric id for this Port which is maybe easier to interpret by code than the result of getPortID().
See Also:
getPortID()

getPortID

public Object getPortID()
Returns some Object describing this instance of a Port. It describes the Port in the sense that a call to 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.
See Also:
getPortNumber(), conformsTo(Object), RobotInterface.getPort(Object)

getExcludedPorts

public Port[] getExcludedPorts()
Returns an Array consisting of all Ports which cannot be used together with this port at a given time.

getMinimumValue

public double getMinimumValue()
Returns the minimum value this port can really put out or read in. If Port is an ActuatorPort any value less than that will produce the same output as the value returned by this method. If this Port is a SensorPort then this Method returns the minimum Value you could expect to get from this Port. This value is only correct if the Sensor connected to this Port gets no special type of Peer.

getMaximumValue

public double getMaximumValue()
Returns the maximum value this port can really put out or read in. If Port is an ActuatorPort any value greater than that will produce the same output as the value returned by this method. If this Port is a SensorPort then this Method returns the maximum Value you could expect to get from this Port. This value is only correct if the Sensor connected to this Port gets no special type of Peer.

getGranularity

public long getGranularity()
Returns the number of different values which this port can put out or read in. That means this value will always be greater than 1, with a value of 2 meaning that an actuator for this port can only be switched on or off and a Sensor will only deliver two different values. This value is only correct if the Sensor connected to this Port gets no special type of Peer.

conformsTo

public boolean conformsTo(Object identifier)
Tells whether the given Object somehow identifies this Port. The provided implementations for Fischertechnik and Mindstorms use Strings which are equal to the Names printed on the hardware-interface to identify Ports.