Package ptolemy.vergil.actor
Class ActorGraphModel.LinkModel
- java.lang.Object
-
- ptolemy.vergil.actor.ActorGraphModel.LinkModel
-
- All Implemented Interfaces:
EdgeModel
,MutableEdgeModel
- Enclosing class:
- ActorGraphModel
public class ActorGraphModel.LinkModel extends java.lang.Object implements MutableEdgeModel
The model for links that connect two ports, or a port and a vertex.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ActorGraphModel.LinkModel.LinkChangeListener
This change listener is responsible for dispatching graph events when an edge is moved.
-
Constructor Summary
Constructors Constructor Description LinkModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acceptHead(java.lang.Object edge, java.lang.Object node)
Return true if the head of the given edge can be attached to the given node.boolean
acceptTail(java.lang.Object edge, java.lang.Object node)
Return true if the tail of the given edge can be attached to the given node.void
addNewVertexToLink(java.lang.StringBuffer moml, java.lang.StringBuffer failmoml, CompositeEntity container, Link oldLink, java.lang.String newRelationName, double x, double y)
Generate the moml to add a vertex to an exist link.java.lang.String
getDeleteEdgeMoML(java.lang.Object edge)
Return a MoML String that will delete the given edge from the Ptolemy model.java.lang.Object
getHead(java.lang.Object edge)
Return the head node of the given edge.java.lang.Object
getTail(java.lang.Object edge)
Return the tail node of the specified edge.boolean
isDirected(java.lang.Object edge)
Return true if this edge is directed.void
setHead(java.lang.Object edge, java.lang.Object newLinkHead)
Connect the given edge to the given head node.void
setTail(java.lang.Object edge, java.lang.Object newLinkTail)
Connect the given edge to the given tail node.
-
-
-
Method Detail
-
acceptHead
public boolean acceptHead(java.lang.Object edge, java.lang.Object node)
Return true if the head of the given edge can be attached to the given node.- Specified by:
acceptHead
in interfaceMutableEdgeModel
- Parameters:
edge
- The edge to attach, which is assumed to be a link.node
- The node to attach to.- Returns:
- True if the node is a port or a vertex, or a location representing a port.
-
acceptTail
public boolean acceptTail(java.lang.Object edge, java.lang.Object node)
Return true if the tail of the given edge can be attached to the given node.- Specified by:
acceptTail
in interfaceMutableEdgeModel
- Parameters:
edge
- The edge to attach, which is assumed to be a link.node
- The node to attach to.- Returns:
- True if the node is a port or a vertex, or a location representing a port.
-
addNewVertexToLink
public void addNewVertexToLink(java.lang.StringBuffer moml, java.lang.StringBuffer failmoml, CompositeEntity container, Link oldLink, java.lang.String newRelationName, double x, double y)
Generate the moml to add a vertex to an exist link.- Parameters:
moml
- The moml to add the vertex to the link.failmoml
- The moml to undo these changed when something goes wrong.container
- The container.oldLink
- The link that will be replace by two new once and a vertex in between.newRelationName
- The name of the new relation.x
- The x coordinate of the location of the vertex.y
- The y coordinate of the location of the vertex.
-
getDeleteEdgeMoML
public java.lang.String getDeleteEdgeMoML(java.lang.Object edge)
Return a MoML String that will delete the given edge from the Ptolemy model.- Parameters:
edge
- The edge.- Returns:
- A valid MoML string.
-
getHead
public java.lang.Object getHead(java.lang.Object edge)
Return the head node of the given edge.- Specified by:
getHead
in interfaceEdgeModel
- Parameters:
edge
- The edge, which is assumed to be a link.- Returns:
- The node that is the head of the specified edge.
- See Also:
setHead(Object, Object)
-
getTail
public java.lang.Object getTail(java.lang.Object edge)
Return the tail node of the specified edge.- Specified by:
getTail
in interfaceEdgeModel
- Parameters:
edge
- The edge, which is assumed to be a link.- Returns:
- The node that is the tail of the specified edge.
- See Also:
setTail(Object, Object)
-
isDirected
public boolean isDirected(java.lang.Object edge)
Return true if this edge is directed. In this model, none of edges are directed, so this always returns false.- Specified by:
isDirected
in interfaceEdgeModel
- Parameters:
edge
- The edge, which is assumed to be a link.- Returns:
- False.
-
setHead
public void setHead(java.lang.Object edge, java.lang.Object newLinkHead)
Connect the given edge to the given head node. This class queues a new change request with the ptolemy model to make this modification.- Specified by:
setHead
in interfaceMutableEdgeModel
- Parameters:
edge
- The edge, which is assumed to be a link.newLinkHead
- The new head for the edge, which is assumed to be a location representing a port, a port or a vertex.- See Also:
getHead(Object)
-
setTail
public void setTail(java.lang.Object edge, java.lang.Object newLinkTail)
Connect the given edge to the given tail node. This class queues a new change request with the ptolemy model to make this modification.- Specified by:
setTail
in interfaceMutableEdgeModel
- Parameters:
edge
- The edge, which is assumed to be a link.newLinkTail
- The new tail for the edge, which is assumed to be a location representing a port, a port or a vertex.- See Also:
getTail(Object)
-
-