org.robokind.api.motion
Class AbstractJoint

java.lang.Object
  extended by org.robokind.api.common.property.PropertyChangeNotifier
      extended by org.robokind.api.motion.AbstractJoint
All Implemented Interfaces:
PropertyChangeListener, EventListener, org.robokind.api.common.property.PropertyChangeSource, Joint
Direct Known Subclasses:
ServoJoint

public abstract class AbstractJoint
extends org.robokind.api.common.property.PropertyChangeNotifier
implements Joint, PropertyChangeListener

Abstract implementation providing much of the functionality need to implement various Joints.

Author:
Matthew Stevenson

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.robokind.api.motion.Joint
Joint.Id
 
Field Summary
protected  Map<String,JointProperty> myProperties
          JointProperties available from this Joint
 
Fields inherited from interface org.robokind.api.motion.Joint
PROP_ENABLED, PROP_GOAL_POSITION
 
Constructor Summary
AbstractJoint(Joint.Id id)
          Creates a new AbstractJoint with the given Id.
 
Method Summary
protected  void addProperty(JointProperty prop)
          Adds a JointProperty to the Joint
 Joint.Id getId()
          Returns the Joint's logical id.
 Collection<JointProperty> getProperties()
           
 JointProperty getProperty(String name)
          Returns the JointProperty with the given name.
<T> JointProperty<T>
getProperty(String name, Class<T> propertyType)
          Returns the JointProperty with the given name, ensuring the value is assignable to propertyType.
 void propertyChange(PropertyChangeEvent pce)
          Used to broadcast PropertyChangeEvents from internal sources such as JointProperties or, in the case of a ServoJoint, a Servo.
protected  void removeProperty(JointProperty prop)
          Removes a JointProperty from the Joint
 
Methods inherited from class org.robokind.api.common.property.PropertyChangeNotifier
addPropertyChangeListener, addPropertyChangeListener, clearAllListeners, clearListeners, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.robokind.api.motion.Joint
getDefaultPosition, getEnabled, getGoalPosition, getName, getPositionRange, setEnabled
 
Methods inherited from interface org.robokind.api.common.property.PropertyChangeSource
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 

Field Detail

myProperties

protected Map<String,JointProperty> myProperties
JointProperties available from this Joint

Constructor Detail

AbstractJoint

public AbstractJoint(Joint.Id id)
Creates a new AbstractJoint with the given Id.

Parameters:
id - Joint.Id of the new Joint
Method Detail

getId

public Joint.Id getId()
Description copied from interface: Joint
Returns the Joint's logical id.

Specified by:
getId in interface Joint
Returns:
Joint's logical id

addProperty

protected void addProperty(JointProperty prop)
Adds a JointProperty to the Joint

Parameters:
prop - JointProperty to add

removeProperty

protected void removeProperty(JointProperty prop)
Removes a JointProperty from the Joint

Parameters:
prop - JointProperty to remove

getProperty

public <T> JointProperty<T> getProperty(String name,
                                        Class<T> propertyType)
Description copied from interface: Joint
Returns the JointProperty with the given name, ensuring the value is assignable to propertyType.

Specified by:
getProperty in interface Joint
Type Parameters:
T - Value Type returned by the JointProperty
Parameters:
name - name of the JointProperty
propertyType - Class for T
Returns:
the JointProperty with the given name and value assignable to propertyType

getProperty

public JointProperty getProperty(String name)
Description copied from interface: Joint
Returns the JointProperty with the given name.

Specified by:
getProperty in interface Joint
Parameters:
name - name of the JointProperty
Returns:
the JointProperty with the given name

getProperties

public Collection<JointProperty> getProperties()
Specified by:
getProperties in interface Joint

propertyChange

public void propertyChange(PropertyChangeEvent pce)
Used to broadcast PropertyChangeEvents from internal sources such as JointProperties or, in the case of a ServoJoint, a Servo.

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
pce - internal PropertyChangeEvent to


Copyright © 2011-2013. All Rights Reserved.