|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fdda.model.impl.WorkingPart | +--fdda.model.impl.Connection
The implementation of the Connection interface.
Connection
Field Summary | |
protected WorkingPart |
graphicalRepresentation
the graphical representation of the part |
Fields inherited from interface fdda.model.Connection |
DIRECTED_PROPERTY_NAME, SPEED_PROPERTY_NAME |
Fields inherited from interface fdda.model.WorkingPart |
WORKING_PROPERTY_NAME |
Constructor Summary | |
Connection(int nr,
boolean directed,
Node startNode,
Node endNode,
Line graphicalRepresentation)
The constructor. |
Method Summary | |
void |
addProperty(Property property)
Adds a property to the holder. |
void |
addPropertyListener(PropertyListener listener)
Adds a PropertyListener (Observer pattern). |
void |
changeProperty(Property property)
Changes a property of the holder - i.e., replaces the property with the name of the parameter property with the parameter. |
protected void |
firePropertyAdded(Property property)
Notifies the listeners that a property has been added. |
void |
firePropertyChanged(Property property)
Informs the listeners that a property has been changed. |
protected void |
firePropertyRemoved(Property property)
Notifies the listeners that a property has been removed. |
Node |
getEndNode()
Returns the node where the connection ends. |
Line |
getGraphicalRepresentation()
Returns the graphical representation of the connection |
int |
getNr()
Returns the internal number of the connection, which is unique. |
Iterator |
getProperties()
Returns an Iterator over the properties of the holder. |
Property |
getProperty(String name)
Returns a property of the holder. |
double |
getSpeed()
Returns the speed of the connection. |
Node |
getStartNode()
Returns the node where the connection starts. |
boolean |
isDirected()
Returns whether the connection is directed |
boolean |
isWorking()
Returns whether the part is currently working. |
void |
propertyAdded(PropertyEvent pe)
Called whenever a property is added to the PropertyHolder. |
void |
propertyChanged(PropertyEvent pe)
Called whenever a property of the PropertyHolder is changed. |
void |
propertyRemoved(PropertyEvent pe)
Called whenever a property is removed from the PropertyHolder. |
void |
removeProperty(Property property)
Removes a property from the holder. |
void |
removePropertyListener(PropertyListener listener)
Removes a PropertyListener (Observer pattern). |
void |
setDirected(boolean directed)
Specifies whether the connection is directed. |
void |
setWorking(boolean working)
Sets whether the part is currently working. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface fdda.model.PropertyHolder |
addProperty, addPropertyListener, changeProperty, firePropertyChanged, getProperties, getProperty, removeProperty, removePropertyListener |
Methods inherited from interface fdda.model.WorkingPart |
isWorking, setWorking |
Methods inherited from interface fdda.model.PropertyListener |
propertyAdded, propertyRemoved |
Field Detail |
protected WorkingPart graphicalRepresentation
Constructor Detail |
public Connection(int nr, boolean directed, Node startNode, Node endNode, Line graphicalRepresentation)
nr
- the internal number (ID) of the connectiondirected
- whether the connection shall be directedstartNode
- the start nodeendNode
- the end nodegraphicalRepresentation
- the graphical representationMethod Detail |
public int getNr()
Connection
getNr
in interface Connection
public Node getStartNode()
Connection
getStartNode
in interface Connection
public Node getEndNode()
Connection
getEndNode
in interface Connection
public Line getGraphicalRepresentation()
Connection
getGraphicalRepresentation
in interface Connection
public boolean isDirected()
Connection
isDirected
in interface Connection
public void setDirected(boolean directed)
Connection
setDirected
in interface Connection
directed
- whether the connection shall be directedpublic double getSpeed()
Connection
getSpeed
in interface Connection
public void propertyChanged(PropertyEvent pe)
PropertyListener
propertyChanged
in interface PropertyListener
propertyChanged
in class WorkingPart
pe
- the PropertyEventpublic boolean isWorking()
WorkingPart
isWorking
in interface WorkingPart
public final void setWorking(boolean working)
WorkingPart
setWorking
in interface WorkingPart
working
- whether the part is workingpublic Iterator getProperties()
PropertyHolder
getProperties
in interface PropertyHolder
public Property getProperty(String name)
PropertyHolder
getProperty
in interface PropertyHolder
name
- the name of the property
public void addProperty(Property property)
PropertyHolder
addProperty
in interface PropertyHolder
public void removeProperty(Property property)
PropertyHolder
removeProperty
in interface PropertyHolder
property
- the property to be removed, must not be nullpublic void changeProperty(Property property)
PropertyHolder
changeProperty
in interface PropertyHolder
property
- the new property, must not be nullpublic void addPropertyListener(PropertyListener listener)
PropertyHolder
addPropertyListener
in interface PropertyHolder
listener
- the listener to be addedEventListenerList
public void removePropertyListener(PropertyListener listener)
PropertyHolder
removePropertyListener
in interface PropertyHolder
listener
- the listener to be removedEventListenerList
public void firePropertyChanged(Property property)
PropertyHolder
firePropertyChanged
in interface PropertyHolder
property
- the property that was changed.protected void firePropertyAdded(Property property)
property
- the added propertyEventListenerList
protected void firePropertyRemoved(Property property)
property
- the added propertyEventListenerList
public void propertyAdded(PropertyEvent pe)
PropertyListener
propertyAdded
in interface PropertyListener
pe
- the PropertyEventpublic void propertyRemoved(PropertyEvent pe)
PropertyListener
propertyRemoved
in interface PropertyListener
pe
- the PropertyEvent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |