2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License as published by
4
* the Free Software Foundation; either version 2 of the License, or
5
* (at your option) any later version.
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
* GNU General Public License for more details.
12
* You should have received a copy of the GNU General Public License
13
* along with this program; if not, write to the Free Software
14
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
* ClusterDefinition.java
19
* Copyright (C) 2005 University of Waikato, Hamilton, New Zealand
23
package weka.datagenerators;
25
import weka.core.OptionHandler;
26
import weka.core.Utils;
28
import java.io.Serializable;
29
import java.util.Enumeration;
32
* Ancestor to all ClusterDefinitions, i.e., subclasses that handle their
33
* own parameters that the cluster generator only passes on.
36
* @author FracPete (fracpete at waikato dot ac dot nz)
37
* @version $Revision: 1.4 $
40
public abstract class ClusterDefinition
41
implements Serializable, OptionHandler {
43
/** for serialization */
44
private static final long serialVersionUID = -5950001207047429961L;
46
/** the parent of the cluster */
47
protected ClusterGenerator m_Parent;
50
* initializes the cluster, without a parent cluster (necessary for GOE)
52
public ClusterDefinition() {
57
* initializes the cluster
59
* @param parent the datagenerator this cluster belongs to
61
public ClusterDefinition(ClusterGenerator parent) {
73
* sets the default values
75
* @throws Exception if setting of defaults fails
77
protected abstract void setDefaults() throws Exception;
80
* Returns a string describing this data generator.
82
* @return a description of the data generator suitable for
83
* displaying in the explorer/experimenter gui
85
public String globalInfo() {
86
return "Contains informations about a certain cluster of a cluster generator.";
90
* Returns an enumeration describing the available options.
92
* @return an enumeration of all the available options
94
public abstract Enumeration listOptions();
97
* Parses a list of options for this object. <p/>
99
* For list of valid options see class description.<p/>
101
* @param options the list of options as an array of strings
102
* @throws Exception if an option is not supported
104
public abstract void setOptions(String[] options) throws Exception;
107
* Gets the current settings of the datagenerator BIRCHCluster.
109
* @return an array of strings suitable for passing to setOptions
111
public abstract String[] getOptions();
114
* returns the parent datagenerator this cluster belongs to
116
* @return the parent this cluster belongs to
118
public ClusterGenerator getParent() {
123
* sets the parent datagenerator this cluster belongs to
125
* @param parent the parent datagenerator
127
public void setParent(ClusterGenerator parent) {
132
* Returns the tip text for this property
134
* @return tip text for this property suitable for
135
* displaying in the explorer/experimenter gui
137
public String parentTipText() {
138
return "The cluster generator this object belongs to.";
142
* returns a string representation of the cluster
144
* @return the cluster definition as string
146
public String toString() {
147
return this.getClass().getName() + ": " + Utils.joinOptions(getOptions());