~ubuntu-branches/ubuntu/wily/weka/wily

« back to all changes in this revision

Viewing changes to src/main/java/weka/gui/streams/InstanceLoader.java

  • Committer: Bazaar Package Importer
  • Author(s): tony mancill
  • Date: 2011-08-05 22:40:50 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20110805224050-a01vkwst9epdi4sw
Tags: 3.6.5-1
* Team upload.
* New upstream version (Closes: #632082, #598400)
* Bump Standards-Version to 3.9.2 (no changes required).
* Freshen jar.patch; remove java_cup.patch (incorporated upstream)
* Add README.source to document process of obtaining .png resources.
* Add myself to Uploaders.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 * A bean that produces a stream of instances from a file.
43
43
 *
44
44
 * @author Len Trigg (trigg@cs.waikato.ac.nz)
45
 
 * @version $Revision: 1.5 $
 
45
 * @version $Revision: 7059 $
46
46
 */
47
47
public class InstanceLoader
48
48
  extends JPanel 
70
70
    public void run() {
71
71
      
72
72
      try {
73
 
        m_StartBut.setText("Stop");
 
73
        m_StartBut.setText(Messages.getInstance().getString("InstanceLoader_LoadThread_Run_StartBut_SetText_Text"));
74
74
        m_StartBut.setBackground(Color.red);
75
75
        if (m_Debug) {
76
 
          System.err.println("InstanceLoader::LoadThread::run()");
 
76
          System.err.println(Messages.getInstance().getString("InstanceLoader_LoadThread_Run_Error_Text_First"));
77
77
        }
78
78
        // Load the instances one at a time and pass them on to the listener
79
79
        Reader input = new BufferedReader(
80
80
                       new FileReader(m_FileNameTex.getText()));
81
81
        m_OutputInstances = new Instances(input, 1);
82
82
        if (m_Debug) {
83
 
          System.err.println("InstanceLoader::LoadThread::run()"
84
 
                             + " - Instances opened from: "
85
 
                             + m_FileNameTex.getText());
 
83
          System.err.println(Messages.getInstance().getString("InstanceLoader_LoadThread_Run_Error_Text_Second") + m_FileNameTex.getText());
86
84
        }
87
85
        InstanceEvent ie = new InstanceEvent(m_IP,
88
86
                                             InstanceEvent.FORMAT_AVAILABLE);
92
90
            return;
93
91
          }
94
92
          if (m_Debug) {
95
 
            System.err.println("InstanceLoader::LoadThread::run()"
96
 
                               + " - read instance");
 
93
            System.err.println(Messages.getInstance().getString("InstanceLoader_LoadThread_Run_Error_Text_Third"));
97
94
          }
98
95
          // put the instance into a queue?
99
96
          m_OutputInstance = m_OutputInstances.instance(0);
107
104
        System.err.println(ex.getMessage());
108
105
      } finally {
109
106
        m_LoaderThread = null;
110
 
        m_StartBut.setText("Start");
 
107
        m_StartBut.setText(Messages.getInstance().getString("InstanceLoader_LoadThread_Run_StatusBut_SetText_Text"));
111
108
        m_StartBut.setBackground(Color.green);
112
109
      }
113
110
    }
115
112
 
116
113
  public InstanceLoader() {
117
114
    setLayout(new BorderLayout());
118
 
    m_StartBut = new JButton("Start");
 
115
    m_StartBut = new JButton(Messages.getInstance().getString("InstanceLoader_StartBut_JButton_Text"));
119
116
    m_StartBut.setBackground(Color.green);
120
 
    add("West",m_StartBut);
 
117
    add(Messages.getInstance().getString("InstanceLoader_StartBut_JButton_Add_Text_First"), m_StartBut);
121
118
    m_StartBut.addActionListener(this);
122
119
    m_FileNameTex = new JTextField("/home/trigg/datasets/UCI/iris.arff");
123
 
    add("Center",m_FileNameTex);
 
120
    add(Messages.getInstance().getString("InstanceLoader_StartBut_JButton_Add_Text_Second"), m_FileNameTex);
124
121
    m_Listeners = new Vector();
125
122
    //    setSize(60,40);
126
123
  }
157
154
  protected void notifyInstanceProduced(InstanceEvent e) {
158
155
    
159
156
    if (m_Debug) {
160
 
      System.err.println("InstanceLoader::notifyInstanceProduced()");
 
157
      System.err.println(Messages.getInstance().getString("InstanceLoader_NotifyInstanceProduced_Error_Text"));
161
158
    }
162
159
    Vector l;
163
160
    synchronized (this) {
176
173
  public Instances outputFormat() throws Exception {
177
174
    
178
175
    if (m_OutputInstances == null) {
179
 
      throw new Exception("No output format defined.");
 
176
      throw new Exception(Messages.getInstance().getString("InstanceLoader_OutputFormat_Exception_Text"));
180
177
    }
181
178
    return new Instances(m_OutputInstances,0);
182
179
  }