weka.clusterers
Class Cluster

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.ArrayList
              extended byweka.clusterers.Cluster
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.util.RandomAccess, java.io.Serializable

public class Cluster
extends java.util.ArrayList

See Also:
Serialized Form

Field Summary
 int clusterID
          corresponds to a cluster ID number, useful for identifying the cluster
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Cluster()
          Creates an empty cluster
Cluster(int id)
          Creates an empty cluster with an id
Cluster(java.lang.Object o)
          Creates a singleton cluster, assignes weight 1 to the instance
Cluster(java.lang.Object o, double wt)
          Creates a singleton cluster, assignes specified weight to the instance
 
Method Summary
 boolean add(java.lang.Object o)
          Adds an object to the cluster with default weight 1
 boolean add(java.lang.Object instance, double wt)
          Adds an object to the cluster with specified weight
 void copyElements(Cluster old_cluster)
          Adds elements from another cluster to this cluster.
 java.lang.String toString()
           
 double weightAt(int index)
          Returns the weight of the element at the given position.
 
Methods inherited from class java.util.ArrayList
add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, remove, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList
 

Field Detail

clusterID

public int clusterID
corresponds to a cluster ID number, useful for identifying the cluster

Constructor Detail

Cluster

public Cluster()
Creates an empty cluster


Cluster

public Cluster(int id)
Creates an empty cluster with an id


Cluster

public Cluster(java.lang.Object o)
Creates a singleton cluster, assignes weight 1 to the instance

Parameters:
o - object to be added to the cluster

Cluster

public Cluster(java.lang.Object o,
               double wt)
Creates a singleton cluster, assignes specified weight to the instance

Parameters:
o - object to be added to the cluster
wt - weight of the object
Method Detail

add

public boolean add(java.lang.Object o)
Adds an object to the cluster with default weight 1

Parameters:
o - object to be added to the cluster

add

public boolean add(java.lang.Object instance,
                   double wt)
Adds an object to the cluster with specified weight

Parameters:
wt - weight of the object

weightAt

public double weightAt(int index)
                throws java.lang.Exception
Returns the weight of the element at the given position.

Parameters:
index - the element's index
Returns:
the weight of the element with the given index
Throws:
java.lang.Exception

copyElements

public void copyElements(Cluster old_cluster)
                  throws java.lang.Exception
Adds elements from another cluster to this cluster. Weights are kept the same

Parameters:
old_cluster - a Cluster containing elements to be added
Throws:
java.lang.Exception

toString

public java.lang.String toString()