pl.edu.agh.cast.model.visual.backward
Class ConnectionGroup

java.lang.Object
  extended by pl.edu.agh.cast.model.visual.backward.ModelElement
      extended by pl.edu.agh.cast.model.visual.backward.ConnectionGroup
All Implemented Interfaces:
PropertyChangeListener, Serializable, EventListener, IPropertyChangeProvider, AttributeValueContainer

public class ConnectionGroup
extends ModelElement

Stores list of all connections between two nodes.

Author:
AGH CAST Team
See Also:
Serialized Form

Field Summary
static String CONNECTION_COUNT_CHANGED
          Name of the Connection count changed event.
static String DOUBLE_CONNECTION_SOURCE_LABEL
          Name of the Connection double line source-to-target label changed event.
static String DOUBLE_CONNECTION_TARGET_LABEL
          Name of the Connection double line target-to-source label changed event.
static String LINE_COLOR
          Name of the Line color changed event.
static String LINE_THICKNESS
          Name of the Line thickness changed event.
static String SINGLE_CONNECTION_LABEL
          Name of the Connection single line label changed event.
static String VARIABLE_THICKNESS_CONNECTION_LABEL
          Name of the Variable thickness line label changed event.
 
Fields inherited from class pl.edu.agh.cast.model.visual.backward.ModelElement
ATTRIBUTE_CHANGE, attributeValues
 
Constructor Summary
ConnectionGroup(Node left, Node right, ConnectionGroupAttributeManager attributeManager)
          Creates a connection group.
 
Method Summary
 void addConnection(Connection connection)
          Adds new Connection to this group.
 void addConnectionGroupToNodes()
          Adds this connection group to both nodes.
 void addLeftConnection(Connection connection)
          Adds a new Connection originating from left node.
 void addRightConnection(Connection connection)
          Adds a new Connection originating from right node.
 void copyTo(ConnectionGroup that)
          Copies all fields of this ConnectionGroup instance to that instance.
 boolean equals(Object obj)
          Two ConnectionGroups are equal if their sources and targets are equal.
 List<Connection> getAllConnections()
          Returns the list of all Connections in this group.
 AttributeManager getAttributeManager()
          Returns attribute manager for this container.
 int getConnectionCount()
           
 List<Connection> getLeftConnections()
          Deprecated. Use getSourceConnectionsFor(Node)
 ConnectionGroupAttributeManager getPropertyManager()
           
 List<Connection> getRightConnections()
          Deprecated. Use getTargetConnectionsFor(Node)
 Node getSource()
           
 int getSourceConnectionCountFor(Node node)
          Returns the number of connections from source to target for given Node.
 List<Connection> getSourceConnectionsFor(Node node)
          Returns a list of source Connections for node.
 Node getTarget()
           
 int getTargetConnectionCountFor(Node node)
          Returns the number of connections from target to source for given Node.
 List<Connection> getTargetConnectionsFor(Node node)
          Returns a list of target Connections for node.
 int hashCode()
          
 boolean isBetween(Node node1, Node node2)
          Checks if this connection group is between two given nodes.
 void removeConnection(Connection connection)
          Removes Connection to this group.
 void removeConnectionGroupFromNodes()
          Removes this connection group from both nodes - counterpart of addConnectionGroupToNodes().
 void removeLeftConnection(Connection connection)
          Removes a Connection originating from left node.
 void removeRightConnection(Connection connection)
          Removes a Connection originating from right node.
 void setSource(Node node)
          Sets source node of this connection group.
 void setTarget(Node node)
          Sets target node of this connection group.
 String toString()
          
 
Methods inherited from class pl.edu.agh.cast.model.visual.backward.ModelElement
addPropertyChangeListener, bindToAttributeManager, copyAttributes, copyAttributeValues, firePropertyChange, getAllValues, getAttributeValue, getMid, isAttributeEditable, isAttributeSettable, isSaved, propertyChange, readResolve, removePropertyChangeListener, removePropertyValue, setAttributeValue, setAttributeValue, setMid, setSaved
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CONNECTION_COUNT_CHANGED

public static final String CONNECTION_COUNT_CHANGED
Name of the Connection count changed event.

See Also:
Constant Field Values

SINGLE_CONNECTION_LABEL

public static final String SINGLE_CONNECTION_LABEL
Name of the Connection single line label changed event.

See Also:
Constant Field Values

DOUBLE_CONNECTION_SOURCE_LABEL

public static final String DOUBLE_CONNECTION_SOURCE_LABEL
Name of the Connection double line source-to-target label changed event.

See Also:
Constant Field Values

DOUBLE_CONNECTION_TARGET_LABEL

public static final String DOUBLE_CONNECTION_TARGET_LABEL
Name of the Connection double line target-to-source label changed event.

See Also:
Constant Field Values

VARIABLE_THICKNESS_CONNECTION_LABEL

public static final String VARIABLE_THICKNESS_CONNECTION_LABEL
Name of the Variable thickness line label changed event.

See Also:
Constant Field Values

LINE_THICKNESS

public static final String LINE_THICKNESS
Name of the Line thickness changed event.

See Also:
Constant Field Values

LINE_COLOR

public static final String LINE_COLOR
Name of the Line color changed event.

See Also:
Constant Field Values
Constructor Detail

ConnectionGroup

public ConnectionGroup(Node left,
                       Node right,
                       ConnectionGroupAttributeManager attributeManager)
Creates a connection group.

Parameters:
left - left side node; may not be null
right - right side node; may not be null
attributeManager - AttributeManager for this ConnectionGroup
Method Detail

getConnectionCount

public int getConnectionCount()

getTargetConnectionCountFor

public int getTargetConnectionCountFor(Node node)
Returns the number of connections from target to source for given Node.

Parameters:
node - the node to count connections for
Returns:
number of connections from target to source

getSourceConnectionCountFor

public int getSourceConnectionCountFor(Node node)
Returns the number of connections from source to target for given Node.

Parameters:
node - the node to count connections for
Returns:
number of connections from source to target

getLeftConnections

@Deprecated
public List<Connection> getLeftConnections()
Deprecated. Use getSourceConnectionsFor(Node)

Returns list of connections originating from left node.

Returns:
list of connections originating from left node

getRightConnections

@Deprecated
public List<Connection> getRightConnections()
Deprecated. Use getTargetConnectionsFor(Node)

Returns list of connections originating from right node.

Returns:
list of connections originating from right node

getSourceConnectionsFor

public List<Connection> getSourceConnectionsFor(Node node)
Returns a list of source Connections for node.

Parameters:
node - Node to get source Connections for
Returns:
list of source connections for the node

getTargetConnectionsFor

public List<Connection> getTargetConnectionsFor(Node node)
Returns a list of target Connections for node.

Parameters:
node - Node to get target Connections for
Returns:
list of target connections for the node

getAllConnections

public List<Connection> getAllConnections()
Returns the list of all Connections in this group.

Returns:
list of all Connections in this group

getSource

public Node getSource()

setSource

public void setSource(Node node)
Sets source node of this connection group.

Parameters:
node - source node; may not be null
Throws:
IllegalArgumentException - if node is null

getTarget

public Node getTarget()

setTarget

public void setTarget(Node node)
Sets target node of this connection group.

Parameters:
node - target node; may not be null
Throws:
IllegalArgumentException - if node is null

addLeftConnection

public void addLeftConnection(Connection connection)
Adds a new Connection originating from left node.

Parameters:
connection - new Connection originating from left node

addRightConnection

public void addRightConnection(Connection connection)
Adds a new Connection originating from right node.

Parameters:
connection - new Connection originating from right node

removeLeftConnection

public void removeLeftConnection(Connection connection)
Removes a Connection originating from left node.

Parameters:
connection - Connection originating from left node

removeRightConnection

public void removeRightConnection(Connection connection)
Removes a Connection originating from right node.

Parameters:
connection - Connection originating from right node

addConnectionGroupToNodes

public void addConnectionGroupToNodes()
Adds this connection group to both nodes.


removeConnectionGroupFromNodes

public void removeConnectionGroupFromNodes()
Removes this connection group from both nodes - counterpart of addConnectionGroupToNodes().


isBetween

public boolean isBetween(Node node1,
                         Node node2)
Checks if this connection group is between two given nodes.

Parameters:
node1 - first node
node2 - second node
Returns:
true if this connection group is between two given nodes

addConnection

public void addConnection(Connection connection)
Adds new Connection to this group.

Parameters:
connection - new Connection

removeConnection

public void removeConnection(Connection connection)
Removes Connection to this group.

Parameters:
connection - Connection to remove

toString

public String toString()

Overrides:
toString in class Object
See Also:
Object.toString()

getPropertyManager

public ConnectionGroupAttributeManager getPropertyManager()

equals

public boolean equals(Object obj)
Two ConnectionGroups are equal if their sources and targets are equal.

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

copyTo

public void copyTo(ConnectionGroup that)
Copies all fields of this ConnectionGroup instance to that instance.

Parameters:
that - instance of ConnectionGroup to copy this instance to

getAttributeManager

public AttributeManager getAttributeManager()
Returns attribute manager for this container.

Specified by:
getAttributeManager in interface AttributeValueContainer
Specified by:
getAttributeManager in class ModelElement
Returns:
attribute manager for this container
See Also:
ModelElement.getAttributeManager()


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.