TaskStatusInfo.java
Upload User: rhdiban
Upload Date: 2013-08-09
Package Size: 15085k
Code Size: 3k
Category:

Windows Develop

Development Platform:

Java

  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.  *    TaskStatusInfo.java
  18.  *    Copyright (C) 2001 Mark Hall
  19.  *
  20.  */
  21. package weka.experiment;
  22. import java.io.Serializable;
  23. /**
  24.  * A class holding information for tasks being executed
  25.  * on RemoteEngines. Also holds an object encapsulating any returnable result
  26.  * produced by the task (Note: result object must be serializable). Task
  27.  * objects execute methods return instances of this class. RemoteEngines also
  28.  * use this class for storing progress information for tasks that they
  29.  * execute.
  30.  *
  31.  * @author <a href="mailto:mhall@cs.waikato.ac.nz">Mark Hall</a>
  32.  * @version $Revision: 1.2 $
  33.  */
  34. public class TaskStatusInfo implements Serializable {
  35.   
  36.   public static final int TO_BE_RUN = 0;
  37.   public static final int PROCESSING=1;
  38.   public static final int FAILED=2;
  39.   public static final int FINISHED=3;
  40.   /**
  41.    * Holds current execution status.
  42.    */
  43.   private int m_ExecutionStatus = TO_BE_RUN;
  44.   /**
  45.    * Holds current status message.
  46.    */
  47.   private String m_StatusMessage = "New Task";
  48.   /**
  49.    * Holds task result. Set to null for no returnable result.
  50.    */
  51.   private Object m_TaskResult = null;
  52.   /**
  53.    * Set the execution status of this Task.
  54.    *
  55.    * @param newStatus the new execution status code
  56.    */
  57.   public void setExecutionStatus(int newStatus) {
  58.     m_ExecutionStatus = newStatus;
  59.   }
  60.   /**
  61.    * Get the execution status of this Task.
  62.    * @return the execution status
  63.    */
  64.   public int getExecutionStatus() {
  65.     return m_ExecutionStatus;
  66.   }
  67.   /**
  68.    * Set the status message.
  69.    *
  70.    * @param newMessage the new status message
  71.    */
  72.   public void setStatusMessage(String newMessage) {
  73.     m_StatusMessage = newMessage;
  74.   }
  75.   /**
  76.    * Get the status message.
  77.    *
  78.    * @return the status message
  79.    */
  80.   public String getStatusMessage() {
  81.     return m_StatusMessage;
  82.   }
  83.   /**
  84.    * Set the returnable result for this task..
  85.    *
  86.    * @param taskResult the new returnable result for the task. null if no
  87.    * result is returnable.
  88.    */
  89.   public void setTaskResult(Object taskResult) {
  90.     m_TaskResult = taskResult;
  91.   }
  92.   /**
  93.    * Get the returnable result of this task.
  94.    *
  95.    * @return an object encapsulating the result of executing the task. May
  96.    * be null if the task has no returnable result (eg. a remote experiment
  97.    * task that sends its results to a data base).
  98.    */
  99.   public Object getTaskResult() {
  100.     return m_TaskResult;
  101.   }
  102. }