|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.vergil.actor.ActorGraphModel.LinkModel
public class ActorGraphModel.LinkModel
The model for links that connect two ports, or a port and a vertex.
Nested Class Summary | |
---|---|
class |
ActorGraphModel.LinkModel.LinkChangeListener
This change listener is responsible for dispatching graph events when an edge is moved. |
Constructor Summary | |
---|---|
ActorGraphModel.LinkModel()
|
Method Summary | |
---|---|
private double[] |
_getNewLocation(NamedObj semanticHead,
NamedObj semanticTail,
boolean headIsActorPort,
boolean tailIsActorPort)
Get a location for a new relations between the ports denoted by semanticHead and semanticTail. |
private java.lang.String |
_linkMoML(NamedObj container,
java.lang.StringBuffer moml,
java.lang.StringBuffer failmoml,
NamedObj linkHead,
NamedObj linkTail)
Append moml to the given buffer that connects a link with the given head and tail. |
private void |
_linkWithRelation(java.lang.StringBuffer moml,
java.lang.StringBuffer failmoml,
CompositeEntity container,
NamedObj semanticObject,
int relationIndex,
java.lang.String relationName)
Append moml to the given buffer that connects a relation with the given semanticObject. |
private void |
_setHeadOrTail(java.lang.Object edge,
java.lang.Object newLinkHeadOrTail,
boolean isHead)
Connect the given edge to the given head or tail node. |
private boolean |
_unlinkMoML(NamedObj container,
java.lang.StringBuffer moml,
NamedObj linkHead,
NamedObj linkTail,
Relation relation)
Append moml to the given buffer that disconnects a link with the given head, tail, and relation. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ActorGraphModel.LinkModel()
Method Detail |
---|
public boolean acceptHead(java.lang.Object edge, java.lang.Object node)
acceptHead
in interface MutableEdgeModel
edge
- The edge to attach, which is assumed to be a link.node
- The node to attach to.
public boolean acceptTail(java.lang.Object edge, java.lang.Object node)
acceptTail
in interface MutableEdgeModel
edge
- The edge to attach, which is assumed to be a link.node
- The node to attach to.
public void addNewVertexToLink(java.lang.StringBuffer moml, java.lang.StringBuffer failmoml, CompositeEntity container, Link oldLink, java.lang.String newRelationName, double x, double y)
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.public java.lang.String getDeleteEdgeMoML(java.lang.Object edge)
edge
- The edge.
public java.lang.Object getHead(java.lang.Object edge)
getHead
in interface EdgeModel
edge
- The edge, which is assumed to be a link.
setHead(Object, Object)
public java.lang.Object getTail(java.lang.Object edge)
getTail
in interface EdgeModel
edge
- The edge, which is assumed to be a link.
setTail(Object, Object)
public boolean isDirected(java.lang.Object edge)
isDirected
in interface EdgeModel
edge
- The edge, which is assumed to be a link.
public void setHead(java.lang.Object edge, java.lang.Object newLinkHead)
setHead
in interface MutableEdgeModel
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.getHead(Object)
public void setTail(java.lang.Object edge, java.lang.Object newLinkTail)
setTail
in interface MutableEdgeModel
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.getTail(Object)
private double[] _getNewLocation(NamedObj semanticHead, NamedObj semanticTail, boolean headIsActorPort, boolean tailIsActorPort)
semanticHead
- The head for the new relation.semanticTail
- The tail for the new relation.headIsActorPort
- A flag that specifies whether this is a
actor port of a actor or a stand-alone port.tailIsActorPort
- A flag that specifies whether this is a
actor port of a actor or a stand-alone port.
private java.lang.String _linkMoML(NamedObj container, java.lang.StringBuffer moml, java.lang.StringBuffer failmoml, NamedObj linkHead, NamedObj linkTail) throws java.lang.Exception
container
- The container composite actor.moml
- The string buffer to write the MoML to.failmoml
- The string buffer to write alternative
MoML to, to be used if the first MoML fails.linkHead
- The head vertex or port.linkTail
- The tail vertex or port.
java.lang.Exception
private void _linkWithRelation(java.lang.StringBuffer moml, java.lang.StringBuffer failmoml, CompositeEntity container, NamedObj semanticObject, int relationIndex, java.lang.String relationName)
moml
- The string buffer to write the MoML to.failmoml
- The string buffer to write alternative
MoML to, to be used if the first MoML fails.container
- The container composite actor.semanticObject
- The semantic object (relation or port).relationIndex
- The index of the relation at the port.relationName
- The name of the relation.private void _setHeadOrTail(java.lang.Object edge, java.lang.Object newLinkHeadOrTail, boolean isHead)
edge
- The edge, which is assumed to be a link.newLinkHeadOrTail
- The new head or tail for the edge,
which is assumed to be a location representing a port,
a port or a vertex.isHead
- True when newLinkHeadOrTail represents the headsetHead(Object, Object)
,
setTail(Object, Object)
private boolean _unlinkMoML(NamedObj container, java.lang.StringBuffer moml, NamedObj linkHead, NamedObj linkTail, Relation relation)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |