cgl.narada.topology.viewer
Class SCluster

java.lang.Object
  extended by cgl.narada.topology.viewer.Node
      extended by cgl.narada.topology.viewer.SCluster

public class SCluster
extends Node

This class represents all the super clusters consisting of clusters. The super cluster is third level in the node address. If node's address is 1.2.3.4 then the super cluster id is 2


Field Summary
 List clusters
           
 
Fields inherited from class cgl.narada.topology.viewer.Node
clients, INVALID_VALUE, nodeId, nodeLocation, parentClusterId, parentSClusterId, parentSSClusterId
 
Constructor Summary
SCluster(int pSClusterId, int pSSClusterId)
          Only constructor
 
Method Summary
 void deleteAllClusters(List nodesToBeDeleted)
          Deletes all the cluster present in this super cluster.
 void deleteCluster(int clusterId, int nodeId, List nodesToBeDeleted)
          Deletes an existing cluster inside the super cluster only if that cluster is empty and then repositions all other clusters.
 void drawSuperCluster(Graphics g, int limitX1, int limitY1, int limitX2, int limitY2)
          Draws the super cluster only if its part is visible on the screen.
 Node getNodeAtParticularCoordinates(int x, int y)
          Finds out cluster nearest to the specified coordinates.
 Node getParticularNode(int clusterId, int nodeId)
          Returns a node in this super cluster with specified cluster and node id.
 void insertCluster(int clusterId, int nodeId)
          Add a new cluster to the list.
 void repositionClusters()
          Gets the new Position objects and assign then to all the clusters inside this super cluster.
 
Methods inherited from class cgl.narada.topology.viewer.Node
addClient, addTopic, canFitOnPanel, deleteAllClients, deleteAllTopics, deleteClient, deleteTopic, drawNode, getAllClients, getClient, getNodeAddress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clusters

public List clusters
Constructor Detail

SCluster

public SCluster(int pSClusterId,
                int pSSClusterId)
Only constructor

Method Detail

insertCluster

public void insertCluster(int clusterId,
                          int nodeId)
                   throws TopologyException
Add a new cluster to the list. Depending upon the total number of clusters in the list, decide the new positions for each of the cluster.

Parameters:
clusterId - id of a cluster
nodeId - id of a node to be inserted
Throws:
TopologyException - if due to some problem cluster is found null during node insertion

deleteCluster

public void deleteCluster(int clusterId,
                          int nodeId,
                          List nodesToBeDeleted)
                   throws TopologyException
Deletes an existing cluster inside the super cluster only if that cluster is empty and then repositions all other clusters. If the cluster does not become empty after the node deletion then just pass the control to the Cluster for deletion of the node.

Parameters:
clusterId - id of a cluster containing node to be deleted.
nodeId - id of a node to be deleted.
nodesToBeDeleted - a List which will contain node addresses of the nodes being deleted.
Throws:
TopologyException - if no such cluster id found while node deletion.

deleteAllClusters

public void deleteAllClusters(List nodesToBeDeleted)
Deletes all the cluster present in this super cluster.

Parameters:
nodesToBeDeleted - a List which will contain node addresses of the nodes being deleted.

getNodeAtParticularCoordinates

public Node getNodeAtParticularCoordinates(int x,
                                           int y)
Finds out cluster nearest to the specified coordinates. Then passes control to the cluster for finding a nearest node.

Parameters:
x - X-coordinate
y - Y-coordinate
Returns:
Node nearest to specified coordinates.

drawSuperCluster

public void drawSuperCluster(Graphics g,
                             int limitX1,
                             int limitY1,
                             int limitX2,
                             int limitY2)
Draws the super cluster only if its part is visible on the screen. Draws all the clusters inside it.

Parameters:
g - Graphics object for image drawing.
limitX1 - lower limit for X-coordinate
limitY1 - lower limit for Y-coordinate
limitX2 - upper limit for X-coordinate
limitY2 - upper limit for Y-coordinate

getParticularNode

public Node getParticularNode(int clusterId,
                              int nodeId)
Returns a node in this super cluster with specified cluster and node id.

Parameters:
clusterId - id of a cluster.
nodeId - id of a node.
Returns:
Node

repositionClusters

public void repositionClusters()
Gets the new Position objects and assign then to all the clusters inside this super cluster. Recurdively calls repositionNodes() for each of the cluster.



For comments and suggestions please send e-mail to The NaradaBrokering Project