source: src/main/java/weka/gui/boundaryvisualizer/RemoteResult.java @ 14

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

Import di weka.

File size: 2.9 KB
Line 
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 *   RemoteResult.java
19 *   Copyright (C) 2003 University of Waikato, Hamilton, New Zealand
20 *
21 */
22
23package weka.gui.boundaryvisualizer;
24
25import java.io.Serializable;
26
27/**
28 * Class that encapsulates a result (and progress info) for part
29 * of a distributed boundary visualization. The result of a sub-task
30 * is the probabilities necessary to display one row of the final
31 * visualization.
32 *
33 * @author <a href="mailto:mhall@cs.waikato.ac.nz">Mark Hall</a>
34 * @version $Revision: 1.3 $
35 * @since 1.0
36 * @see Serializable
37 */
38public class RemoteResult
39  implements Serializable {
40
41  /** for serialization */
42  private static final long serialVersionUID = 1873271280044633808L;
43
44  /** the row number that this result corresponds to */
45  private int m_rowNumber;
46
47  /** how many pixels in a row */
48  private int m_rowLength;
49
50  /** the result - ie. the probability distributions produced by the
51   * classifier for this row in the visualization */
52  private double [][] m_probabilities;
53
54  /** progress on computing this row */
55  private int m_percentCompleted;
56
57  /**
58   * Creates a new <code>RemoteResult</code> instance.
59   *
60   * @param rowNum the row number
61   * @param rowLength the number of pixels in the row
62   */
63  public RemoteResult(int rowNum, int rowLength) {
64    m_probabilities = new double[rowLength][0];
65  }
66 
67  /**
68   * Store the classifier's distribution for a particular pixel in the
69   * visualization
70   *
71   * @param index the pixel
72   * @param distribution the probability distribution from the classifier
73   */
74  public void setLocationProbs(int index, double [] distribution) {
75    m_probabilities[index] = distribution;
76  }
77
78  /**
79   * Return the probability distributions  for this row in the visualization
80   *
81   * @return the probability distributions
82   */
83  public double [][] getProbabilities() {
84    return m_probabilities;
85  }
86
87  /**
88   * Set the progress for this row so far
89   *
90   * @param pc a percent completed value
91   */
92  public void setPercentCompleted(int pc) {
93    m_percentCompleted = pc;
94  }
95
96  /**
97   * Return the progress for this row
98   *
99   * @return a percent completed value
100   */
101  public int getPercentCompleted() {
102    return m_percentCompleted;
103  }
104}
Note: See TracBrowser for help on using the repository browser.