pl.edu.agh.cast.schema.editor.layout.algorithm
Class AbstractGroupingLayoutAlgorithm

java.lang.Object
  extended by pl.edu.agh.cast.schema.editor.layout.algorithm.AbstractLayoutAlgorithm
      extended by pl.edu.agh.cast.schema.editor.layout.algorithm.AbstractGroupingLayoutAlgorithm
All Implemented Interfaces:
ILayoutAlgorithm
Direct Known Subclasses:
GroupLayoutAlgorithm, Peacock3LayoutAlgorithm

public abstract class AbstractGroupingLayoutAlgorithm
extends AbstractLayoutAlgorithm

Abstract layout algorithm that provides helper methods for algorithms requiring grouping entities. Provides methods for finding main entities, neighbors, not connected nodes etc.

Author:
AGH CAST Team

Constructor Summary
AbstractGroupingLayoutAlgorithm()
           
 
Method Summary
protected  void drawNotConnected(Collection<ISchemaNode> notConnected)
          Lays out the nodes provided in argument horizontally in the upper left corner of the diagram
protected  List<ISchemaNode> getMainEntities(Collection<ISchemaNode> nodes)
          Returns a list of nodes that are marked as main.
protected  List<ISchemaNode> getNeighbors(Collection<ISchemaNode> nodes, ISchemaNode mainNode)
          Returns list of nodes connected with a given node
protected  List<ISchemaNode> getNotConnected(Collection<ISchemaNode> nodes)
          Searches for nodes that are not connected to any other node
protected  boolean isConnected(ISchemaNode first, ISchemaNode second)
          Checks for a connection between two nodes
 
Methods inherited from class pl.edu.agh.cast.schema.editor.layout.algorithm.AbstractLayoutAlgorithm
getCenterOfGravity, getUpperLeftCorner, getWorkUnits, layoutNodes, setNodesPositions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractGroupingLayoutAlgorithm

public AbstractGroupingLayoutAlgorithm()
Method Detail

getMainEntities

protected List<ISchemaNode> getMainEntities(Collection<ISchemaNode> nodes)
Returns a list of nodes that are marked as main.

Parameters:
nodes - collection of nodes to be searched
Returns:
list of main entities

getNeighbors

protected List<ISchemaNode> getNeighbors(Collection<ISchemaNode> nodes,
                                         ISchemaNode mainNode)
Returns list of nodes connected with a given node

Parameters:
nodes - collection of nodes to be considered
mainNode - node whose neighbors should be found
Returns:
list of mainNode's neighbors

getNotConnected

protected List<ISchemaNode> getNotConnected(Collection<ISchemaNode> nodes)
Searches for nodes that are not connected to any other node

Parameters:
nodes - collection of nodes to consider
Returns:
list of orphaned nodes

isConnected

protected boolean isConnected(ISchemaNode first,
                              ISchemaNode second)
Checks for a connection between two nodes

Parameters:
first - first node
second - second node
Returns:
true if there is a connection between two nodes and the nodes are different; false if there is no connection, the nodes are identical or one of them is null

drawNotConnected

protected void drawNotConnected(Collection<ISchemaNode> notConnected)
Lays out the nodes provided in argument horizontally in the upper left corner of the diagram

Parameters:
notConnected -


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