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.core.Matrix
- weka.core.matrix.Matrix
- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static StringVAL_CELLSthe matrix cellsstatic StringVAL_KEYthe value for a mapping-key, e.g., Mapsstatic StringVAL_MAPPINGthe value for mapping, e.g., Mapsstatic StringVAL_VALUEthe value for mapping-value, e.g., Maps-
Fields inherited from class weka.core.xml.XMLSerialization
ATT_ARRAY, ATT_ARRAY_DEFAULT, ATT_CLASS, ATT_NAME, ATT_NULL, ATT_NULL_DEFAULT, ATT_PRIMITIVE, ATT_PRIMITIVE_DEFAULT, ATT_VERSION, DOCTYPE, ROOT_NODE, SUPPRESS_PROPERTY_WARNINGS, TAG_OBJECT, VAL_NO, VAL_ROOT, VAL_YES
-
-
Constructor Summary
Constructors Constructor Description XMLBasicSerialization()initializes the serialization
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()generates internally a new XML document and clears also the IgnoreList and the mappings for the Read/Write-MethodsStringgetRevision()Returns the revision string.ObjectreadCollection(Element node)builds the Collection from the given DOM node.ObjectreadColor(Element node)builds the Color object from the given DOM node.ObjectreadCostMatrix(Element node)builds the Matrix from the given DOM node.ObjectreadCostMatrixOld(Element node)builds the Matrix (old) from the given DOM node.ObjectreadDefaultListModel(Element node)builds the DefaultListModel from the given DOM node.ObjectreadMap(Element node)builds the Map from the given DOM node.ObjectreadMatrix(Element node)builds the Matrix from the given DOM node.ObjectreadMatrixOld(Element node)builds the Matrix (old) from the given DOM node.ElementwriteCollection(Element parent, Object o, String name)adds the given Collection to a DOM structure.ElementwriteColor(Element parent, Object o, String name)adds the given Color to a DOM structure.ElementwriteCostMatrix(Element parent, Object o, String name)adds the given CostMatrix to a DOM structure.ElementwriteCostMatrixOld(Element parent, Object o, String name)adds the given CostMatrix (old) to a DOM structure.ElementwriteDefaultListModel(Element parent, Object o, String name)adds the given DefaultListModel to a DOM structure.ElementwriteMap(Element parent, Object o, String name)adds the given Map to a DOM structure.ElementwriteMatrix(Element parent, Object o, String name)adds the given Matrix to a DOM structure.ElementwriteMatrixOld(Element parent, Object o, String name)adds the given Matrix (old) to a DOM structure.-
Methods inherited from class weka.core.xml.XMLSerialization
fromXML, getVersion, main, read, read, read, read, readBooleanFromXML, readByteFromXML, readCharFromXML, readDoubleFromXML, readFloatFromXML, readFromXML, readFromXML, readIntFromXML, readLongFromXML, readShortFromXML, setSuppressWarnings, toXML, write, write, write, write, writeToXML
-
-
-
-
Field Detail
-
VAL_MAPPING
public static final String VAL_MAPPING
the value for mapping, e.g., Maps- See Also:
- Constant Field Values
-
VAL_KEY
public static final String VAL_KEY
the value for a mapping-key, e.g., Maps- See Also:
- Constant Field Values
-
VAL_VALUE
public static final String VAL_VALUE
the value for mapping-value, e.g., Maps- See Also:
- Constant Field Values
-
VAL_CELLS
public static final String VAL_CELLS
the matrix cells- See Also:
- Constant Field Values
-
-
Method Detail
-
clear
public void clear() throws Exceptiongenerates internally a new XML document and clears also the IgnoreList and the mappings for the Read/Write-Methods- Overrides:
clearin classXMLSerialization- 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.
-
readColor
public Object readColor(Element node) throws Exception
builds the Color object from the given DOM node.
-
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 ofo- the Object to describe in XMLname- the name of the object- Returns:
- the node that was created
- Throws:
Exception- if the DOM creation fails- See Also:
DefaultListModel
-
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:
DefaultListModel
-
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 ofo- the Object to describe in XMLname- the name of the object- Returns:
- the node that was created
- Throws:
Exception- if the DOM creation fails- See Also:
Collection
-
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:
Collection
-
writeMap
public Element writeMap(Element parent, Object o, String name) throws Exception
adds the given Map to a DOM structure.
-
readMap
public Object readMap(Element node) throws Exception
builds the Map from the given DOM node.
-
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 ofo- the Object to describe in XMLname- the name of the object- Returns:
- the node that was created
- Throws:
Exception- if the DOM creation fails- See Also:
CostMatrix
-
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:
CostMatrix
-
writeMatrix
public Element writeMatrix(Element parent, Object o, String name) throws Exception
adds the given Matrix to a DOM structure.
-
readMatrix
public Object readMatrix(Element node) throws Exception
builds the Matrix from the given DOM node.
-
writeMatrixOld
public Element writeMatrixOld(Element parent, Object o, String name) throws Exception
adds the given Matrix (old) to a DOM structure.
-
readMatrixOld
public Object readMatrixOld(Element node) throws Exception
builds the Matrix (old) from the given DOM node.
-
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 ofo- the Object to describe in XMLname- the name of the object- Returns:
- the node that was created
- Throws:
Exception- if the DOM creation fails- See Also:
CostMatrix
-
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:
CostMatrix
-
getRevision
public String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classXMLSerialization- Returns:
- the revision
-
-