Class XMLExperiment

All Implemented Interfaces:

public class XMLExperiment extends XMLBasicSerialization
This class serializes and deserializes an Experiment instance to and fro XML.
It omits the options from the Experiment, since these are handled by the get/set-methods. For the Classifier class with all its derivative classes it stores only debug and options. For SplitEvaluator and ResultProducer only the options are retrieved. The PropertyNode is done manually since it has no get/set-methods for its public fields.
Since there's no read-method for m_ClassFirst we always save it as false.
$Revision: 10204 $
FracPete (fracpete at waikato dot ac dot nz)
See Also:
  • Experiment.m_ClassFirst
  • Field Details

  • Constructor Details

    • XMLExperiment

      public XMLExperiment() throws Exception
      initializes the serialization
      Exception - if initialization fails
  • Method Details

    • clear

      public void clear() throws Exception
      generates internally a new XML document and clears also the IgnoreList and the mappings for the Read/Write-Methods
      clear in class XMLBasicSerialization
      Exception - if initializing fails
    • writePropertyNode

      public Element writePropertyNode(Element parent, Object o, String name) throws Exception
      adds the given PropertyNode to a DOM structure.
      parent - the parent of this object, e.g. the class this object is a member of
      o - the Object to describe in XML
      name - the name of the object
      the node that was created
      Exception - if the DOM creation fails
    • readPropertyNode

      public Object readPropertyNode(Element node) throws Exception
      builds the PropertyNode from the given DOM node.
      node - the associated XML node
      the instance created from the XML description
      Exception - if instantiation fails
      See Also:
    • getRevision

      public String getRevision()
      Returns the revision string.
      Specified by:
      getRevision in interface RevisionHandler
      getRevision in class XMLBasicSerialization
      the revision
    • main

      public static void main(String[] args) throws Exception
      for testing only. if the first argument is a filename with ".xml" as extension it tries to generate an instance from the XML description and does a toString() of the generated object. Otherwise it loads the binary file, saves the XML representation in a file with the original filename appended by ".xml" and once again in a binary file with the original filename appended by ".exp".
      args - the commandline arguments
      Exception - if something goes wrong, e.g., file not found