software.common
Class Cluster

java.lang.Object
  extended by software.common.Cluster
All Implemented Interfaces:
java.io.Serializable

public class Cluster
extends java.lang.Object
implements java.io.Serializable

A cluster has a center of mass, is in a rectangle of coordonates ((xmin,ymin),(xmax,ymax)) and containes a number of points (different from the number of points in the rectangle) A cluster is only a wrapper around those values

Author:
Stefan
See Also:
Serialized Form

Constructor Summary
Cluster()
          empty constructor
Cluster(Cluster model)
          Clones a current Cluster
Cluster(java.awt.Color color, java.awt.Color colorVariation, double discountinuity)
          cluster without a center of mass, only for colors (used in authoring)
Cluster(org.w3c.dom.Node dotNode)
          constructs a cluster from an xml node (many elements can be missing)
 
Method Summary
 void affineTransform(java.awt.geom.AffineTransform affine)
           
 Cluster clone()
          Returns a new Cluster, with the same fields as this one
 double distance(Cluster c)
           
 java.awt.geom.Point2D.Double getCenterOfMass()
           
 java.awt.Color getColor()
           
 java.awt.Color getColorVariation()
           
 double getDiscountinuity()
           
 java.lang.String getName()
           
 org.w3c.dom.Element getNodeXY(org.w3c.dom.Document doc)
           
 org.w3c.dom.Element getNodeXYFromTo(org.w3c.dom.Document doc)
           
 double getNumberofPoints()
           
 double getXmax()
           
 double getXmin()
           
 double getYmax()
           
 double getYmin()
           
 void rotate(java.awt.geom.Point2D.Double pivot, double alpha)
          rotates the center of mass
 void scale(double scalling)
          scales the center of mass
 void setCenterOfMass(java.awt.geom.Point2D.Double centerOfMass)
           
 void setColor(java.awt.Color color)
           
 void setColorVariation(java.awt.Color colorVariation)
           
 void setDiscountinuity(double discountinuity)
           
 void setName(java.lang.String name)
           
 void setNumberofPoints(double numberofPoints)
           
 void setXmax(double xmax)
           
 void setXmin(double xmin)
           
 void setYmax(double ymax)
           
 void setYmin(double ymin)
           
static java.lang.String toHex(java.awt.Color c)
           
 java.lang.String toString()
          An xml representation of the cluster
 java.lang.String toXMLString()
           
 void translate(double tx, double ty)
          translates the center of mass
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Cluster

public Cluster()
empty constructor


Cluster

public Cluster(Cluster model)
Clones a current Cluster

Parameters:
model -

Cluster

public Cluster(java.awt.Color color,
               java.awt.Color colorVariation,
               double discountinuity)
cluster without a center of mass, only for colors (used in authoring)

Parameters:
color -
colorVariation -
discountinuity -

Cluster

public Cluster(org.w3c.dom.Node dotNode)
constructs a cluster from an xml node (many elements can be missing)

Parameters:
dotNode -
Method Detail

affineTransform

public void affineTransform(java.awt.geom.AffineTransform affine)
Parameters:
affine - applies this affine transformation to all the geometrical elements of a cluster

scale

public void scale(double scalling)
scales the center of mass

Parameters:
scalling -

rotate

public void rotate(java.awt.geom.Point2D.Double pivot,
                   double alpha)
rotates the center of mass

Parameters:
pivot - - the center of rotation
alpha -

translate

public void translate(double tx,
                      double ty)
translates the center of mass

Parameters:
tx -
ty -

clone

public Cluster clone()
Returns a new Cluster, with the same fields as this one

Overrides:
clone in class java.lang.Object

distance

public double distance(Cluster c)
Parameters:
c -
Returns:
the distance between the center of mass of this cluster and the parameter

toString

public java.lang.String toString()
An xml representation of the cluster

Overrides:
toString in class java.lang.Object

toXMLString

public java.lang.String toXMLString()
Returns:
An xml representation of the cluster

getCenterOfMass

public java.awt.geom.Point2D.Double getCenterOfMass()

setCenterOfMass

public void setCenterOfMass(java.awt.geom.Point2D.Double centerOfMass)

getNumberofPoints

public double getNumberofPoints()

setNumberofPoints

public void setNumberofPoints(double numberofPoints)

getXmax

public double getXmax()

setXmax

public void setXmax(double xmax)

getXmin

public double getXmin()

setXmin

public void setXmin(double xmin)

getYmax

public double getYmax()

setYmax

public void setYmax(double ymax)

getYmin

public double getYmin()

setYmin

public void setYmin(double ymin)

getColor

public java.awt.Color getColor()

setColor

public void setColor(java.awt.Color color)

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getColorVariation

public java.awt.Color getColorVariation()

setColorVariation

public void setColorVariation(java.awt.Color colorVariation)

getDiscountinuity

public double getDiscountinuity()

setDiscountinuity

public void setDiscountinuity(double discountinuity)

getNodeXY

public org.w3c.dom.Element getNodeXY(org.w3c.dom.Document doc)

getNodeXYFromTo

public org.w3c.dom.Element getNodeXYFromTo(org.w3c.dom.Document doc)

toHex

public static java.lang.String toHex(java.awt.Color c)