Java 类weka.core.Queue 实例源码

项目:repo.kmeanspp.silhouette_score    文件:Filter.java   
/**
 * Sets the format of output instances. The derived class should use this
 * method once it has determined the outputformat. The output queue is
 * cleared.
 *
 * @param outputFormat the new output format
 */
protected void setOutputFormat(Instances outputFormat) {

  if (outputFormat != null) {
    m_OutputFormat = outputFormat.stringFreeStructure();
    initOutputLocators(m_OutputFormat, null);

    // Rename the relation
    String relationName = outputFormat.relationName() + "-"
      + this.getClass().getName();
    if (this instanceof OptionHandler) {
      String[] options = ((OptionHandler) this).getOptions();
      for (String option : options) {
        relationName += option.trim();
      }
    }
    m_OutputFormat.setRelationName(relationName);
  } else {
    m_OutputFormat = null;
  }
  m_OutputQueue = new Queue();
}
项目:autoweka    文件:Filter.java   
/**
 * Sets the format of output instances. The derived class should use this
 * method once it has determined the outputformat. The 
 * output queue is cleared.
 *
 * @param outputFormat the new output format
 */
protected void setOutputFormat(Instances outputFormat) {

  if (outputFormat != null) {
    m_OutputFormat = outputFormat.stringFreeStructure();
    initOutputLocators(m_OutputFormat, null);

    // Rename the relation
    String relationName = outputFormat.relationName() 
      + "-" + this.getClass().getName();
    if (this instanceof OptionHandler) {
      String [] options = ((OptionHandler)this).getOptions();
      for (int i = 0; i < options.length; i++) {
        relationName += options[i].trim();
      }
    }
    m_OutputFormat.setRelationName(relationName);
  } else {
    m_OutputFormat = null;
  }
  m_OutputQueue = new Queue();
}
项目:umple    文件:Filter.java   
/**
 * Sets the format of output instances. The derived class should use this
 * method once it has determined the outputformat. The output queue is
 * cleared.
 * 
 * @param outputFormat the new output format
 */
protected void setOutputFormat(Instances outputFormat) {

  if (outputFormat != null) {
    m_OutputFormat = outputFormat.stringFreeStructure();
    initOutputLocators(m_OutputFormat, null);

    // Rename the relation
    String relationName = outputFormat.relationName() + "-"
      + this.getClass().getName();
    if (this instanceof OptionHandler) {
      String[] options = ((OptionHandler) this).getOptions();
      for (String option : options) {
        relationName += option.trim();
      }
    }
    m_OutputFormat.setRelationName(relationName);
  } else {
    m_OutputFormat = null;
  }
  m_OutputQueue = new Queue();
}
项目:jbossBA    文件:Filter.java   
/**
 * Sets the format of output instances. The derived class should use this
 * method once it has determined the outputformat. The 
 * output queue is cleared.
 *
 * @param outputFormat the new output format
 */
protected void setOutputFormat(Instances outputFormat) {

  if (outputFormat != null) {
    m_OutputFormat = outputFormat.stringFreeStructure();
    initOutputLocators(m_OutputFormat, null);

    // Rename the relation
    String relationName = outputFormat.relationName() 
      + "-" + this.getClass().getName();
    if (this instanceof OptionHandler) {
      String [] options = ((OptionHandler)this).getOptions();
      for (int i = 0; i < options.length; i++) {
        relationName += options[i].trim();
      }
    }
    m_OutputFormat.setRelationName(relationName);
  } else {
    m_OutputFormat = null;
  }
  m_OutputQueue = new Queue();
}
项目:repo.kmeanspp.silhouette_score    文件:RemoteExperiment.java   
/**
 * Prepares a remote experiment for running, creates sub experiments
 * 
 * @throws Exception if an error occurs
 */
@Override
public void initialize() throws Exception {
  if (m_baseExperiment == null) {
    throw new Exception("No base experiment specified!");
  }

  m_experimentAborted = false;
  m_finishedCount = 0;
  m_failedCount = 0;
  m_RunNumber = getRunLower();
  m_DatasetNumber = 0;
  m_PropertyNumber = 0;
  m_CurrentProperty = -1;
  m_CurrentInstances = null;
  m_Finished = false;

  if (m_remoteHosts.size() == 0) {
    throw new Exception("No hosts specified!");
  }
  // initialize all remote hosts to available
  m_remoteHostsStatus = new int[m_remoteHosts.size()];
  m_remoteHostFailureCounts = new int[m_remoteHosts.size()];

  m_remoteHostsQueue = new Queue();
  // prime the hosts queue
  for (int i = 0; i < m_remoteHosts.size(); i++) {
    m_remoteHostsQueue.push(new Integer(i));
  }

  // set up sub experiments
  m_subExpQueue = new Queue();
  int numExps;
  if (getSplitByDataSet()) {
    numExps = m_baseExperiment.getDatasets().size();
  } else {
    numExps = getRunUpper() - getRunLower() + 1;
  }
  m_subExperiments = new Experiment[numExps];
  m_subExpComplete = new int[numExps];
  // create copy of base experiment
  SerializedObject so = new SerializedObject(m_baseExperiment);

  if (getSplitByDataSet()) {
    for (int i = 0; i < m_baseExperiment.getDatasets().size(); i++) {
      m_subExperiments[i] = (Experiment) so.getObject();
      // one for each data set
      DefaultListModel temp = new DefaultListModel();
      temp.addElement(m_baseExperiment.getDatasets().get(i));
      m_subExperiments[i].setDatasets(temp);
      m_subExpQueue.push(new Integer(i));
    }
  } else {
    for (int i = getRunLower(); i <= getRunUpper(); i++) {
      m_subExperiments[i - getRunLower()] = (Experiment) so.getObject();
      // one run for each sub experiment
      m_subExperiments[i - getRunLower()].setRunLower(i);
      m_subExperiments[i - getRunLower()].setRunUpper(i);

      m_subExpQueue.push(new Integer(i - getRunLower()));
    }
  }
}
项目:repo.kmeanspp.silhouette_score    文件:Filter.java   
/**
 * Clears the output queue.
 */
protected void resetQueue() {

  m_OutputQueue = new Queue();
}
项目:autoweka    文件:RemoteExperiment.java   
/**
  * Prepares a remote experiment for running, creates sub experiments
  *
  * @throws Exception if an error occurs
  */
 public void initialize() throws Exception {
   if (m_baseExperiment == null) {
     throw new Exception("No base experiment specified!");
   }

   m_experimentAborted = false;
   m_finishedCount = 0;
   m_failedCount = 0;
   m_RunNumber = getRunLower();
   m_DatasetNumber = 0;
   m_PropertyNumber = 0;
   m_CurrentProperty = -1;
   m_CurrentInstances = null;
   m_Finished = false;

   if (m_remoteHosts.size() == 0) {
     throw new Exception("No hosts specified!");
   }
   // initialize all remote hosts to available
   m_remoteHostsStatus = new int [m_remoteHosts.size()];    
   m_remoteHostFailureCounts = new int [m_remoteHosts.size()];

   m_remoteHostsQueue = new Queue();
   // prime the hosts queue
   for (int i=0;i<m_remoteHosts.size();i++) {
     m_remoteHostsQueue.push(new Integer(i));
   }

   // set up sub experiments
   m_subExpQueue = new Queue();
   int numExps;
   if (getSplitByDataSet()) {
     numExps = m_baseExperiment.getDatasets().size();
   } else {
     numExps = getRunUpper() - getRunLower() + 1;
   }
   m_subExperiments = new Experiment[numExps];
   m_subExpComplete = new int[numExps];
   // create copy of base experiment
   SerializedObject so = new SerializedObject(m_baseExperiment);

   if (getSplitByDataSet()) {
     for (int i = 0; i < m_baseExperiment.getDatasets().size(); i++) {
m_subExperiments[i] = (Experiment)so.getObject();
// one for each data set
DefaultListModel temp = new DefaultListModel();
temp.addElement(m_baseExperiment.getDatasets().elementAt(i));
m_subExperiments[i].setDatasets(temp);
m_subExpQueue.push(new Integer(i));
     }
   } else {
     for (int i = getRunLower(); i <= getRunUpper(); i++) {
m_subExperiments[i-getRunLower()] = (Experiment)so.getObject();
// one run for each sub experiment
m_subExperiments[i-getRunLower()].setRunLower(i);
m_subExperiments[i-getRunLower()].setRunUpper(i);

m_subExpQueue.push(new Integer(i-getRunLower()));
     }    
   }
 }
项目:autoweka    文件:Filter.java   
/**
 * Clears the output queue.
 */
protected void resetQueue() {

  m_OutputQueue = new Queue();
}
项目:umple    文件:RemoteExperiment.java   
/**
 * Prepares a remote experiment for running, creates sub experiments
 * 
 * @throws Exception if an error occurs
 */
@Override
public void initialize() throws Exception {
  if (m_baseExperiment == null) {
    throw new Exception("No base experiment specified!");
  }

  m_experimentAborted = false;
  m_finishedCount = 0;
  m_failedCount = 0;
  m_RunNumber = getRunLower();
  m_DatasetNumber = 0;
  m_PropertyNumber = 0;
  m_CurrentProperty = -1;
  m_CurrentInstances = null;
  m_Finished = false;

  if (m_remoteHosts.size() == 0) {
    throw new Exception("No hosts specified!");
  }
  // initialize all remote hosts to available
  m_remoteHostsStatus = new int[m_remoteHosts.size()];
  m_remoteHostFailureCounts = new int[m_remoteHosts.size()];

  m_remoteHostsQueue = new Queue();
  // prime the hosts queue
  for (int i = 0; i < m_remoteHosts.size(); i++) {
    m_remoteHostsQueue.push(new Integer(i));
  }

  // set up sub experiments
  m_subExpQueue = new Queue();
  int numExps;
  if (getSplitByDataSet()) {
    numExps = m_baseExperiment.getDatasets().size();
  } else {
    numExps = getRunUpper() - getRunLower() + 1;
  }
  m_subExperiments = new Experiment[numExps];
  m_subExpComplete = new int[numExps];
  // create copy of base experiment
  SerializedObject so = new SerializedObject(m_baseExperiment);

  if (getSplitByDataSet()) {
    for (int i = 0; i < m_baseExperiment.getDatasets().size(); i++) {
      m_subExperiments[i] = (Experiment) so.getObject();
      // one for each data set
      DefaultListModel temp = new DefaultListModel();
      temp.addElement(m_baseExperiment.getDatasets().get(i));
      m_subExperiments[i].setDatasets(temp);
      m_subExpQueue.push(new Integer(i));
    }
  } else {
    for (int i = getRunLower(); i <= getRunUpper(); i++) {
      m_subExperiments[i - getRunLower()] = (Experiment) so.getObject();
      // one run for each sub experiment
      m_subExperiments[i - getRunLower()].setRunLower(i);
      m_subExperiments[i - getRunLower()].setRunUpper(i);

      m_subExpQueue.push(new Integer(i - getRunLower()));
    }
  }
}
项目:umple    文件:Filter.java   
/**
 * Clears the output queue.
 */
protected void resetQueue() {

  m_OutputQueue = new Queue();
}
项目:jbossBA    文件:RemoteExperiment.java   
/**
  * Prepares a remote experiment for running, creates sub experiments
  *
  * @throws Exception if an error occurs
  */
 public void initialize() throws Exception {
   if (m_baseExperiment == null) {
     throw new Exception("No base experiment specified!");
   }

   m_experimentAborted = false;
   m_finishedCount = 0;
   m_failedCount = 0;
   m_RunNumber = getRunLower();
   m_DatasetNumber = 0;
   m_PropertyNumber = 0;
   m_CurrentProperty = -1;
   m_CurrentInstances = null;
   m_Finished = false;

   if (m_remoteHosts.size() == 0) {
     throw new Exception("No hosts specified!");
   }
   // initialize all remote hosts to available
   m_remoteHostsStatus = new int [m_remoteHosts.size()];    
   m_remoteHostFailureCounts = new int [m_remoteHosts.size()];

   m_remoteHostsQueue = new Queue();
   // prime the hosts queue
   for (int i=0;i<m_remoteHosts.size();i++) {
     m_remoteHostsQueue.push(new Integer(i));
   }

   // set up sub experiments
   m_subExpQueue = new Queue();
   int numExps;
   if (getSplitByDataSet()) {
     numExps = m_baseExperiment.getDatasets().size();
   } else {
     numExps = getRunUpper() - getRunLower() + 1;
   }
   m_subExperiments = new Experiment[numExps];
   m_subExpComplete = new int[numExps];
   // create copy of base experiment
   SerializedObject so = new SerializedObject(m_baseExperiment);

   if (getSplitByDataSet()) {
     for (int i = 0; i < m_baseExperiment.getDatasets().size(); i++) {
m_subExperiments[i] = (Experiment)so.getObject();
// one for each data set
DefaultListModel temp = new DefaultListModel();
temp.addElement(m_baseExperiment.getDatasets().elementAt(i));
m_subExperiments[i].setDatasets(temp);
m_subExpQueue.push(new Integer(i));
     }
   } else {
     for (int i = getRunLower(); i <= getRunUpper(); i++) {
m_subExperiments[i-getRunLower()] = (Experiment)so.getObject();
// one run for each sub experiment
m_subExperiments[i-getRunLower()].setRunLower(i);
m_subExperiments[i-getRunLower()].setRunUpper(i);

m_subExpQueue.push(new Integer(i-getRunLower()));
     }    
   }
 }
项目:jbossBA    文件:Filter.java   
/**
 * Clears the output queue.
 */
protected void resetQueue() {

  m_OutputQueue = new Queue();
}
项目:repo.kmeanspp.silhouette_score    文件:Filter.java   
/**
 * Sets the format of the input instances. If the filter is able to determine
 * the output format before seeing any input instances, it does so here. This
 * default implementation clears the output format and output queue, and the
 * new batch flag is set. Overriders should call
 * <code>super.setInputFormat(Instances)</code>
 *
 * @param instanceInfo an Instances object containing the input instance
 *          structure (any instances contained in the object are ignored -
 *          only the structure is required).
 * @return true if the outputFormat may be collected immediately
 * @throws Exception if the inputFormat can't be set successfully
 */
public boolean setInputFormat(Instances instanceInfo) throws Exception {

  testInputFormat(instanceInfo);

  m_InputFormat = instanceInfo.stringFreeStructure();
  m_OutputFormat = null;
  m_OutputQueue = new Queue();
  m_NewBatch = true;
  m_FirstBatchDone = false;
  initInputLocators(m_InputFormat, null);
  return false;
}
项目:repo.kmeanspp.silhouette_score    文件:Filter.java   
/**
 * Input an instance for filtering. Ordinarily the instance is processed and
 * made available for output immediately. Some filters require all instances
 * be read before producing output, in which case output instances should be
 * collected after calling batchFinished(). If the input marks the start of a
 * new batch, the output queue is cleared. This default implementation assumes
 * all instance conversion will occur when batchFinished() is called.
 *
 * @param instance the input instance
 * @return true if the filtered instance may now be collected with output().
 * @throws NullPointerException if the input format has not been defined.
 * @throws Exception if the input instance was not of the correct format or if
 *           there was a problem with the filtering.
 */
public boolean input(Instance instance) throws Exception {

  if (m_InputFormat == null) {
    throw new NullPointerException("No input instance format defined");
  }
  if (m_NewBatch) {
    m_OutputQueue = new Queue();
    m_NewBatch = false;
  }
  bufferInput(instance);
  return false;
}
项目:autoweka    文件:Filter.java   
/**
 * Sets the format of the input instances. If the filter is able to
 * determine the output format before seeing any input instances, it
 * does so here. This default implementation clears the output format
 * and output queue, and the new batch flag is set. Overriders should
 * call <code>super.setInputFormat(Instances)</code>
 *
 * @param instanceInfo an Instances object containing the input instance
 * structure (any instances contained in the object are ignored - only the
 * structure is required).
 * @return true if the outputFormat may be collected immediately
 * @throws Exception if the inputFormat can't be set successfully 
 */
public boolean setInputFormat(Instances instanceInfo) throws Exception {

  testInputFormat(instanceInfo);

  m_InputFormat = instanceInfo.stringFreeStructure();
  m_OutputFormat = null;
  m_OutputQueue = new Queue();
  m_NewBatch = true;
  m_FirstBatchDone = false;
  initInputLocators(m_InputFormat, null);
  return false;
}
项目:autoweka    文件:Filter.java   
/**
 * Input an instance for filtering. Ordinarily the instance is
 * processed and made available for output immediately. Some filters
 * require all instances be read before producing output, in which
 * case output instances should be collected after calling
 * batchFinished(). If the input marks the start of a new batch, the
 * output queue is cleared. This default implementation assumes all
 * instance conversion will occur when batchFinished() is called.
 *
 * @param instance the input instance
 * @return true if the filtered instance may now be
 * collected with output().
 * @throws NullPointerException if the input format has not been
 * defined.
 * @throws Exception if the input instance was not of the correct 
 * format or if there was a problem with the filtering.  
 */
public boolean input(Instance instance) throws Exception {

  if (m_InputFormat == null) {
    throw new NullPointerException("No input instance format defined");
  }
  if (m_NewBatch) {
    m_OutputQueue = new Queue();
    m_NewBatch = false;
  }
  bufferInput(instance);
  return false;
}
项目:umple    文件:Filter.java   
/**
 * Sets the format of the input instances. If the filter is able to determine
 * the output format before seeing any input instances, it does so here. This
 * default implementation clears the output format and output queue, and the
 * new batch flag is set. Overriders should call
 * <code>super.setInputFormat(Instances)</code>
 * 
 * @param instanceInfo an Instances object containing the input instance
 *          structure (any instances contained in the object are ignored -
 *          only the structure is required).
 * @return true if the outputFormat may be collected immediately
 * @throws Exception if the inputFormat can't be set successfully
 */
public boolean setInputFormat(Instances instanceInfo) throws Exception {

  testInputFormat(instanceInfo);

  m_InputFormat = instanceInfo.stringFreeStructure();
  m_OutputFormat = null;
  m_OutputQueue = new Queue();
  m_NewBatch = true;
  m_FirstBatchDone = false;
  initInputLocators(m_InputFormat, null);
  return false;
}
项目:umple    文件:Filter.java   
/**
 * Input an instance for filtering. Ordinarily the instance is processed and
 * made available for output immediately. Some filters require all instances
 * be read before producing output, in which case output instances should be
 * collected after calling batchFinished(). If the input marks the start of a
 * new batch, the output queue is cleared. This default implementation assumes
 * all instance conversion will occur when batchFinished() is called.
 * 
 * @param instance the input instance
 * @return true if the filtered instance may now be collected with output().
 * @throws NullPointerException if the input format has not been defined.
 * @throws Exception if the input instance was not of the correct format or if
 *           there was a problem with the filtering.
 */
public boolean input(Instance instance) throws Exception {

  if (m_InputFormat == null) {
    throw new NullPointerException("No input instance format defined");
  }
  if (m_NewBatch) {
    m_OutputQueue = new Queue();
    m_NewBatch = false;
  }
  bufferInput(instance);
  return false;
}
项目:jbossBA    文件:Filter.java   
/**
 * Sets the format of the input instances. If the filter is able to
 * determine the output format before seeing any input instances, it
 * does so here. This default implementation clears the output format
 * and output queue, and the new batch flag is set. Overriders should
 * call <code>super.setInputFormat(Instances)</code>
 *
 * @param instanceInfo an Instances object containing the input instance
 * structure (any instances contained in the object are ignored - only the
 * structure is required).
 * @return true if the outputFormat may be collected immediately
 * @throws Exception if the inputFormat can't be set successfully 
 */
public boolean setInputFormat(Instances instanceInfo) throws Exception {

  testInputFormat(instanceInfo);

  m_InputFormat = instanceInfo.stringFreeStructure();
  m_OutputFormat = null;
  m_OutputQueue = new Queue();
  m_NewBatch = true;
  m_FirstBatchDone = false;
  initInputLocators(m_InputFormat, null);
  return false;
}
项目:jbossBA    文件:Filter.java   
/**
 * Input an instance for filtering. Ordinarily the instance is
 * processed and made available for output immediately. Some filters
 * require all instances be read before producing output, in which
 * case output instances should be collected after calling
 * batchFinished(). If the input marks the start of a new batch, the
 * output queue is cleared. This default implementation assumes all
 * instance conversion will occur when batchFinished() is called.
 *
 * @param instance the input instance
 * @return true if the filtered instance may now be
 * collected with output().
 * @throws NullPointerException if the input format has not been
 * defined.
 * @throws Exception if the input instance was not of the correct 
 * format or if there was a problem with the filtering.  
 */
public boolean input(Instance instance) throws Exception {

  if (m_InputFormat == null) {
    throw new NullPointerException("No input instance format defined");
  }
  if (m_NewBatch) {
    m_OutputQueue = new Queue();
    m_NewBatch = false;
  }
  bufferInput(instance);
  return false;
}