Package weka.core.xml

Class XMLBasicSerialization

java.lang.Object
weka.core.xml.XMLSerialization
weka.core.xml.XMLBasicSerialization
All Implemented Interfaces:
RevisionHandler
Direct Known Subclasses:
XMLBeans, XMLClassifier, XMLExperiment

public class XMLBasicSerialization extends XMLSerialization
This serializer contains some read/write methods for common classes that are not beans-conform. Currently supported are:
  • java.util.HashMap
  • java.util.LinkedHashMap
  • java.util.HashSet
  • java.util.Hashtable
  • java.util.LinkedList
  • java.util.Properties
  • java.util.Stack
  • java.util.TreeMap
  • java.util.TreeSet
  • java.util.Vector
  • javax.swing.DefaultListModel
  • java.awt.Color
Weka classes:
  • weka.core.Matrix
  • weka.core.matrix.Matrix
Version:
$Revision: 11865 $
Author:
FracPete (fracpete at waikato dot ac dot nz)
  • Field Details

  • Constructor Details

    • XMLBasicSerialization

      public XMLBasicSerialization() throws Exception
      initializes the serialization
      Throws:
      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
      Overrides:
      clear in class XMLSerialization
      Throws:
      Exception - if initializing fails
    • writeColor

      public Element writeColor(Element parent, Object o, String name) throws Exception
      adds the given Color to a DOM structure.
      Parameters:
      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
      Returns:
      the node that was created
      Throws:
      Exception - if the DOM creation fails
      See Also:
    • readColor

      public Object readColor(Element node) throws Exception
      builds the Color object from the given DOM node.
      Parameters:
      node - the associated XML node
      Returns:
      the instance created from the XML description
      Throws:
      Exception - if instantiation fails
      See Also:
    • writeDefaultListModel

      public Element writeDefaultListModel(Element parent, Object o, String name) throws Exception
      adds the given DefaultListModel to a DOM structure.
      Parameters:
      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
      Returns:
      the node that was created
      Throws:
      Exception - if the DOM creation fails
      See Also:
    • readDefaultListModel

      public Object readDefaultListModel(Element node) throws Exception
      builds the DefaultListModel from the given DOM node.
      Parameters:
      node - the associated XML node
      Returns:
      the instance created from the XML description
      Throws:
      Exception - if instantiation fails
      See Also:
    • writeCollection

      public Element writeCollection(Element parent, Object o, String name) throws Exception
      adds the given Collection to a DOM structure.
      Parameters:
      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
      Returns:
      the node that was created
      Throws:
      Exception - if the DOM creation fails
      See Also:
    • readCollection

      public Object readCollection(Element node) throws Exception
      builds the Collection from the given DOM node.
      Parameters:
      node - the associated XML node
      Returns:
      the instance created from the XML description
      Throws:
      Exception - if instantiation fails
      See Also:
    • writeMap

      public Element writeMap(Element parent, Object o, String name) throws Exception
      adds the given Map to a DOM structure.
      Parameters:
      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
      Returns:
      the node that was created
      Throws:
      Exception - if the DOM creation fails
      See Also:
    • readMap

      public Object readMap(Element node) throws Exception
      builds the Map from the given DOM node.
      Parameters:
      node - the associated XML node
      Returns:
      the instance created from the XML description
      Throws:
      Exception - if instantiation fails
      See Also:
    • writeCostMatrix

      public Element writeCostMatrix(Element parent, Object o, String name) throws Exception
      adds the given CostMatrix to a DOM structure.
      Parameters:
      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
      Returns:
      the node that was created
      Throws:
      Exception - if the DOM creation fails
      See Also:
    • readCostMatrix

      public Object readCostMatrix(Element node) throws Exception
      builds the Matrix from the given DOM node.
      Parameters:
      node - the associated XML node
      Returns:
      the instance created from the XML description
      Throws:
      Exception - if instantiation fails
      See Also:
    • writeMatrix

      public Element writeMatrix(Element parent, Object o, String name) throws Exception
      adds the given Matrix to a DOM structure.
      Parameters:
      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
      Returns:
      the node that was created
      Throws:
      Exception - if the DOM creation fails
      See Also:
    • readMatrix

      public Object readMatrix(Element node) throws Exception
      builds the Matrix from the given DOM node.
      Parameters:
      node - the associated XML node
      Returns:
      the instance created from the XML description
      Throws:
      Exception - if instantiation fails
      See Also:
    • writeMatrixOld

      public Element writeMatrixOld(Element parent, Object o, String name) throws Exception
      adds the given Matrix (old) to a DOM structure.
      Parameters:
      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
      Returns:
      the node that was created
      Throws:
      Exception - if the DOM creation fails
      See Also:
    • readMatrixOld

      public Object readMatrixOld(Element node) throws Exception
      builds the Matrix (old) from the given DOM node.
      Parameters:
      node - the associated XML node
      Returns:
      the instance created from the XML description
      Throws:
      Exception - if instantiation fails
      See Also:
    • writeCostMatrixOld

      public Element writeCostMatrixOld(Element parent, Object o, String name) throws Exception
      adds the given CostMatrix (old) to a DOM structure.
      Parameters:
      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
      Returns:
      the node that was created
      Throws:
      Exception - if the DOM creation fails
      See Also:
    • readCostMatrixOld

      public Object readCostMatrixOld(Element node) throws Exception
      builds the Matrix (old) from the given DOM node.
      Parameters:
      node - the associated XML node
      Returns:
      the instance created from the XML description
      Throws:
      Exception - if instantiation fails
      See Also:
    • getRevision

      public String getRevision()
      Returns the revision string.
      Specified by:
      getRevision in interface RevisionHandler
      Overrides:
      getRevision in class XMLSerialization
      Returns:
      the revision