Java 类weka.core.json.JSONNode 实例源码

项目:repo.kmeanspp.silhouette_score    文件:JSONLoader.java   
/**
  * Determines and returns (if possible) the structure (internally the 
  * header) of the data set as an empty set of instances.
  *
  * @return             the structure of the data set as an empty set 
  *                 of Instances
  * @throws IOException     if an error occurs
  */
 public Instances getStructure() throws IOException {
   if (m_sourceReader == null)
     throw new IOException("No source has been specified");

   if (m_structure == null) {
     try {
m_JSON      = JSONNode.read(m_sourceReader);
m_structure = new Instances(JSONInstances.toHeader(m_JSON), 0);
     }
     catch (IOException ioe) {
// just re-throw it
throw ioe;
     }
     catch (Exception e) {
throw new RuntimeException(e);
     }
   }

   return new Instances(m_structure, 0);
 }
项目:autoweka    文件:JSONLoader.java   
/**
  * Determines and returns (if possible) the structure (internally the 
  * header) of the data set as an empty set of instances.
  *
  * @return             the structure of the data set as an empty set 
  *                 of Instances
  * @throws IOException     if an error occurs
  */
 public Instances getStructure() throws IOException {
   if (m_sourceReader == null)
     throw new IOException("No source has been specified");

   if (m_structure == null) {
     try {
m_JSON      = JSONNode.read(m_sourceReader);
m_structure = new Instances(JSONInstances.toHeader(m_JSON), 0);
     }
     catch (IOException ioe) {
// just re-throw it
throw ioe;
     }
     catch (Exception e) {
throw new RuntimeException(e);
     }
   }

   return new Instances(m_structure, 0);
 }
项目:umple    文件:JSONLoader.java   
/**
  * Determines and returns (if possible) the structure (internally the 
  * header) of the data set as an empty set of instances.
  *
  * @return             the structure of the data set as an empty set 
  *                 of Instances
  * @throws IOException     if an error occurs
  */
 public Instances getStructure() throws IOException {
   if (m_sourceReader == null)
     throw new IOException("No source has been specified");

   if (m_structure == null) {
     try {
m_JSON      = JSONNode.read(m_sourceReader);
m_structure = new Instances(JSONInstances.toHeader(m_JSON), 0);
     }
     catch (IOException ioe) {
// just re-throw it
throw ioe;
     }
     catch (Exception e) {
throw new RuntimeException(e);
     }
   }

   return new Instances(m_structure, 0);
 }
项目:repo.kmeanspp.silhouette_score    文件:JSONSaver.java   
/**
 * Writes a Batch of instances.
 * 
 * @throws IOException throws IOException if saving in batch mode is not
 *           possible
 */
@Override
public void writeBatch() throws IOException {
  if (getInstances() == null) {
    throw new IOException("No instances to save");
  }

  if (getRetrieval() == INCREMENTAL) {
    throw new IOException("Batch and incremental saving cannot be mixed.");
  }

  setRetrieval(BATCH);
  setWriteMode(WRITE);

  PrintWriter outW;
  if ((retrieveFile() == null) && (getWriter() == null)) {
    outW = new PrintWriter(System.out);
  } else {
    outW = new PrintWriter(getWriter());
  }

  JSONNode json = JSONInstances.toJSON(getInstances());
  StringBuffer buffer = new StringBuffer();
  json.toString(buffer);
  outW.println(buffer.toString());
  outW.flush();

  if (getWriter() != null) {
    outW.close();
  }

  setWriteMode(WAIT);
  outW = null;
  resetWriter();
  setWriteMode(CANCEL);
}
项目:autoweka    文件:JSONSaver.java   
/**
 * Writes a Batch of instances.
 * 
 * @throws IOException  throws IOException if saving in batch mode 
 *              is not possible
 */
public void writeBatch() throws IOException {
  if (getInstances() == null)
    throw new IOException("No instances to save");

  if (getRetrieval() == INCREMENTAL)
    throw new IOException("Batch and incremental saving cannot be mixed.");

  setRetrieval(BATCH);
  setWriteMode(WRITE);

  PrintWriter outW;
  if ((retrieveFile() == null) && (getWriter() == null))
    outW = new PrintWriter(System.out);
  else
    outW = new PrintWriter(getWriter());

  JSONNode json = JSONInstances.toJSON(getInstances());
  StringBuffer buffer = new StringBuffer();
  json.toString(buffer);
  outW.println(buffer.toString());
  outW.flush();

  if (getWriter() != null)
    outW.close();

  setWriteMode(WAIT);
  outW = null;
  resetWriter();
  setWriteMode(CANCEL);
}
项目:umple    文件:JSONSaver.java   
/**
 * Writes a Batch of instances.
 * 
 * @throws IOException throws IOException if saving in batch mode is not
 *           possible
 */
@Override
public void writeBatch() throws IOException {
  if (getInstances() == null) {
    throw new IOException("No instances to save");
  }

  if (getRetrieval() == INCREMENTAL) {
    throw new IOException("Batch and incremental saving cannot be mixed.");
  }

  setRetrieval(BATCH);
  setWriteMode(WRITE);

  PrintWriter outW;
  if ((retrieveFile() == null) && (getWriter() == null)) {
    outW = new PrintWriter(System.out);
  } else {
    outW = new PrintWriter(getWriter());
  }

  JSONNode json = JSONInstances.toJSON(getInstances());
  StringBuffer buffer = new StringBuffer();
  json.toString(buffer);
  outW.println(buffer.toString());
  outW.flush();

  if (getWriter() != null) {
    outW.close();
  }

  setWriteMode(WAIT);
  outW = null;
  resetWriter();
  setWriteMode(CANCEL);
}