source: src/main/java/weka/gui/beans/IncrementalClassifierEvent.java @ 10

Last change on this file since 10 was 4, checked in by gnappo, 14 years ago

Import di weka.

File size: 3.9 KB
RevLine 
[4]1/*
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.
6 *
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.
11 *
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.
15 */
16
17/*
18 *    IncrementalClassifierEvent.java
19 *    Copyright (C) 2002 University of Waikato, Hamilton, New Zealand
20 *
21 */
22
23package weka.gui.beans;
24
25import weka.classifiers.Classifier;
26import weka.classifiers.AbstractClassifier;
27import weka.core.Instance;
28import weka.core.Instances;
29
30import java.util.EventObject;
31
32/**
33 * Class encapsulating an incrementally built classifier and current instance
34 *
35 * @author <a href="mailto:mhall@cs.waikato.ac.nz">Mark Hall</a>
36 * @version $Revision: 5928 $
37 * @since 1.0
38 * @see EventObject
39 */
40public class IncrementalClassifierEvent
41  extends EventObject {
42
43  /** for serialization */
44  private static final long serialVersionUID = 28979464317643232L;
45
46  public static final int NEW_BATCH = 0;
47  public static final int WITHIN_BATCH = 1;
48  public static final int BATCH_FINISHED = 2;
49
50  private Instances m_structure;
51  private int m_status;
52  protected Classifier m_classifier;
53  protected Instance m_currentInstance;
54
55  /**
56   * Creates a new <code>IncrementalClassifierEvent</code> instance.
57   *
58   * @param source the source of the event
59   * @param scheme the classifier
60   * @param currentI the current instance
61   * @param status the status
62   */
63  public IncrementalClassifierEvent(Object source, Classifier scheme,
64                         Instance currentI, int status) {
65    super(source);
66    //    m_trainingSet = trnI;
67    m_classifier = scheme;
68    m_currentInstance = currentI;
69    m_status = status;
70  }
71
72  /**
73   * Creates a new incremental classifier event that encapsulates
74   * header information and classifier.
75   *
76   * @param source an <code>Object</code> value
77   * @param scheme a <code>Classifier</code> value
78   * @param structure an <code>Instances</code> value
79   */
80  public IncrementalClassifierEvent(Object source, Classifier scheme,
81                                    Instances structure) {
82    super(source);
83    m_structure = structure;
84    m_status = NEW_BATCH;
85    m_classifier = scheme;
86  }
87
88  public IncrementalClassifierEvent(Object source) {
89    super(source);
90  }
91
92  /**
93   * Get the classifier
94   *
95   * @return the classifier
96   */
97  public Classifier getClassifier() {
98    return m_classifier;
99  }
100 
101  public void setClassifier(Classifier c) {
102    m_classifier = c;
103  }
104
105  /**
106   * Get the current instance
107   *
108   * @return the current instance
109   */
110  public Instance getCurrentInstance() {
111    return m_currentInstance;
112  }
113
114  /**
115   * Set the current instance for this event
116   *
117   * @param i an <code>Instance</code> value
118   */
119  public void setCurrentInstance(Instance i) {
120    m_currentInstance = i;
121  }
122
123  /**
124   * Get the status
125   *
126   * @return an <code>int</code> value
127   */
128  public int getStatus() {
129    return m_status;
130  }
131
132  /**
133   * Set the status
134   *
135   * @param s an <code>int</code> value
136   */
137  public void setStatus(int s) {
138    m_status = s;
139  }
140
141  /**
142   * Set the instances structure
143   *
144   * @param structure an <code>Instances</code> value
145   */
146  public void setStructure(Instances structure) {
147    m_structure = structure;
148    m_currentInstance = null;
149    m_status = NEW_BATCH;
150  }
151
152  /**
153   * Get the instances structure (may be null if this is not
154   * a NEW_BATCH event)
155   *
156   * @return an <code>Instances</code> value
157   */
158  public Instances getStructure() {
159    return m_structure;
160  }
161}
162
Note: See TracBrowser for help on using the repository browser.