ccvisu
Class Cluster

java.lang.Object
  extended by ccvisu.Cluster

public class Cluster
extends java.lang.Object

A class with a list of nodes that compute some informations on them

Version:
$Revision: 1.3 $; $Date: 2006/11/25 10:41:07 $
Author:
Damien Zufferey

Field Summary
private  float averageRadius
           
private  boolean changed
          true if needs to recompute radius, center,...
private  java.awt.Color color
          color of the cluster
static int CONTAINS
          used as mode for the method addPattern
static int ENDS
          used as mode for the method addPattern
static int EQUALS
          used as mode for the method addPattern
private static GraphData graph
          pointer to the data
private static java.lang.String[] indexToCltName
          contain the name of node's cluster
 boolean info
          used to know if the circle and cross should be drawn
private  java.lang.String name
          name of the cluster
private  java.util.Vector<java.lang.Integer> nodes
          list of int representing the index of nodes in the GraphData
static int STARTS
          used as mode for the method addPattern
 boolean visible
          used to know if the cluster should be drawn
private static WriterDataGraphicsDISP writer
           
private  float x
          x-coordinate of the barycenter
private  float y
          y-coordinate of the barycenter
private  float z
          z-coordinate of the barycenter
 
Constructor Summary
Cluster(java.lang.String name)
          Contructor
Cluster(java.lang.String name, java.awt.Color color)
          Constructor
 
Method Summary
 void addNode(GraphVertex vertex)
          add the given node to the cluster
 void addNodeByIndex_WO_COLOR(int index)
          add the node that corresponds to the index-th node in graph(GraphData) without changing his color function used only to assign to default cluster at begining
 void addNodeByIndex(int index)
          add the node that corresponds to the index-th node in graph(GraphData)
 void addPattern(java.lang.String pattern, int mode)
          adds nodes to a cluster in function of a given pattern
private  void compute()
          compute the informations provided by the cluster
 void filter(java.lang.String pattern, int mode, boolean keep)
           
 float getAverageRadius()
           
 java.awt.Color getColor()
           
 java.lang.String getName()
           
 GraphVertex getNode(int i)
          return the i-th element of the Cluster this method's purpose is to easily iterate on each node of the cluster
 float getX()
          return the x-coordinate of the barycenter
 float getY()
          return the y-coordinate of the barycenter
 float getZ()
          return the z-coordinate of the barycenter
 void graphchanged()
          tells the cluster to recompute its informations
static void init(WriterDataGraphicsDISP writer, GraphData graph)
          initialize Data common to all clusters
 java.util.Iterator Iterator()
          return an iterator on the index of the cluster's nodes
 void removeNode(GraphVertex vertex)
          remove from cluster the given node
 void removeNodeByIndex(int index)
          remove the node that corresponds to the index-th node in graph(GraphData)
 void setColor(java.awt.Color color)
           
 void setName(java.lang.String name)
           
 int size()
          return the size of the cluster
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EQUALS

public static final int EQUALS
used as mode for the method addPattern

See Also:
Constant Field Values

CONTAINS

public static final int CONTAINS
used as mode for the method addPattern

See Also:
Constant Field Values

STARTS

public static final int STARTS
used as mode for the method addPattern

See Also:
Constant Field Values

ENDS

public static final int ENDS
used as mode for the method addPattern

See Also:
Constant Field Values

indexToCltName

private static java.lang.String[] indexToCltName
contain the name of node's cluster


name

private java.lang.String name
name of the cluster


nodes

private java.util.Vector<java.lang.Integer> nodes
list of int representing the index of nodes in the GraphData


color

private java.awt.Color color
color of the cluster


x

private float x
x-coordinate of the barycenter


y

private float y
y-coordinate of the barycenter


z

private float z
z-coordinate of the barycenter


averageRadius

private float averageRadius

graph

private static GraphData graph
pointer to the data


writer

private static WriterDataGraphicsDISP writer

visible

public boolean visible
used to know if the cluster should be drawn


info

public boolean info
used to know if the circle and cross should be drawn


changed

private boolean changed
true if needs to recompute radius, center,...

Constructor Detail

Cluster

public Cluster(java.lang.String name)
Contructor

Parameters:
name - the cluster's name

Cluster

public Cluster(java.lang.String name,
               java.awt.Color color)
Constructor

Parameters:
name - the cluster's name
color - the cluster's color
Method Detail

addNode

public void addNode(GraphVertex vertex)
add the given node to the cluster

Parameters:
vertex -

addNodeByIndex

public void addNodeByIndex(int index)
add the node that corresponds to the index-th node in graph(GraphData)

Parameters:
index -

addNodeByIndex_WO_COLOR

public void addNodeByIndex_WO_COLOR(int index)
add the node that corresponds to the index-th node in graph(GraphData) without changing his color function used only to assign to default cluster at begining

Parameters:
index -

removeNode

public void removeNode(GraphVertex vertex)
remove from cluster the given node

Parameters:
vertex -

removeNodeByIndex

public void removeNodeByIndex(int index)
remove the node that corresponds to the index-th node in graph(GraphData)

Parameters:
index -

Iterator

public java.util.Iterator Iterator()
return an iterator on the index of the cluster's nodes

Returns:
iterator

addPattern

public void addPattern(java.lang.String pattern,
                       int mode)
adds nodes to a cluster in function of a given pattern

Parameters:
pattern -
mode - the way of using the pattern.

filter

public void filter(java.lang.String pattern,
                   int mode,
                   boolean keep)

getNode

public GraphVertex getNode(int i)
return the i-th element of the Cluster this method's purpose is to easily iterate on each node of the cluster

Parameters:
i - index
Returns:
a vertex of the graph

getColor

public java.awt.Color getColor()
Returns:
return the color of the cluster.

setColor

public void setColor(java.awt.Color color)
Parameters:
color - color to define.

getName

public java.lang.String getName()
Returns:
return the name of the cluster.

setName

public void setName(java.lang.String name)
Parameters:
name - name to define.

getAverageRadius

public float getAverageRadius()
Returns:
return the averageRadius.

getX

public float getX()
return the x-coordinate of the barycenter

Returns:
x

getY

public float getY()
return the y-coordinate of the barycenter

Returns:
y

getZ

public float getZ()
return the z-coordinate of the barycenter

Returns:
z

size

public int size()
return the size of the cluster

Returns:
return the size of the cluster

compute

private void compute()
compute the informations provided by the cluster


init

public static void init(WriterDataGraphicsDISP writer,
                        GraphData graph)
initialize Data common to all clusters

Parameters:
writer -
graph -

graphchanged

public void graphchanged()
tells the cluster to recompute its informations