org.joone.edit
Class XMLNetStorageFormat
- java.lang.Object
-
- org.joone.edit.XMLNetStorageFormat
-
- All Implemented Interfaces:
- NetStorageFormat
public class XMLNetStorageFormat extends java.lang.Object implements NetStorageFormat
A XMLNetStorageFormat is a XML based file format to store and restore NeuralNets. It uses XStream serialization mechanism to store NeuralNets. The XMLNetStorageFormat has the file extension "xml" (e.g. my_net.xml).
-
-
Constructor Summary
Constructors Constructor and Description XMLNetStorageFormat()Create a StandardNetStorageFormat for storing and restoring NeuralNets.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.StringcreateFileDescription()Factory method to create a file description for the file type when displaying the associated FileFilter.booleanequals(java.lang.Object compareObject)Test, whether two NetStorageFormats are the same.java.lang.StringgetFileDescription()Return the file description for the file type of the storage formatjava.lang.StringgetFileExtension()Return the file extension for the storage formatjavax.swing.filechooser.FileFiltergetFileFilter()Return the FileFilter used to identify NeuralNet files with the correct file extension for this NetStorageFormat.NeuralNetrestore(java.lang.String fileName)Restore a NeuralNet from a file with a given name.voidsetFileDescription(java.lang.String newFileDescription)Set the file description for the file type of the storage formatvoidsetFileExtension(java.lang.String newFileExtension)Set the file extension for the storage formatvoidsetFileFilter(javax.swing.filechooser.FileFilter newFileFilter)Set the FileFilter used to identify NeuralNet files with the correct file extension for this NetStorageFormat.java.lang.Stringstore(java.lang.String fileName, NeuralNet saveNeuralNet)Store a NeuralNet under a given name.
-
-
-
Constructor Detail
-
XMLNetStorageFormat
public XMLNetStorageFormat()
Create a StandardNetStorageFormat for storing and restoring NeuralNets.
-
-
Method Detail
-
setFileExtension
public void setFileExtension(java.lang.String newFileExtension)
Set the file extension for the storage format- Parameters:
file- extension
-
getFileExtension
public java.lang.String getFileExtension()
Return the file extension for the storage format- Returns:
- file extension
-
createFileDescription
public java.lang.String createFileDescription()
Factory method to create a file description for the file type when displaying the associated FileFilter.- Returns:
- new file description
-
setFileDescription
public void setFileDescription(java.lang.String newFileDescription)
Set the file description for the file type of the storage format- Parameters:
newFileDescription- description of the file type
-
getFileDescription
public java.lang.String getFileDescription()
Return the file description for the file type of the storage format- Returns:
- description of the file type
-
setFileFilter
public void setFileFilter(javax.swing.filechooser.FileFilter newFileFilter)
Set the FileFilter used to identify NeuralNet files with the correct file extension for this NetStorageFormat.- Parameters:
newFileFilter- FileFilter for this StorageFormat
-
getFileFilter
public javax.swing.filechooser.FileFilter getFileFilter()
Return the FileFilter used to identify NeuralNet files with the correct file extension for this NetStorageFormat.- Specified by:
getFileFilterin interfaceNetStorageFormat- Returns:
- FileFilter for this StorageFormat
-
store
public java.lang.String store(java.lang.String fileName, NeuralNet saveNeuralNet) throws java.io.IOExceptionStore a NeuralNet under a given name. If the file name does not have the correct file extension, then the file extension is added.- Specified by:
storein interfaceNetStorageFormat- Parameters:
fileName- file name of the NeuralNet under which it should be storedsaveNeuralNet- NeuralNet to be saved- Returns:
- file name with correct file extension
- Throws:
java.io.IOException
-
restore
public NeuralNet restore(java.lang.String fileName) throws java.io.IOException
Restore a NeuralNet from a file with a given name.- Specified by:
restorein interfaceNetStorageFormat- Parameters:
name- of the file in which the NeuralNet has been saved- Returns:
- restored NeuralNet
- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object compareObject)
Test, whether two NetStorageFormats are the same. They are the same if they both support the same file extension.- Overrides:
equalsin classjava.lang.Object- Returns:
- true, if both StorageFormats have the same file extension, false otherwise
-
-
DataMelt 3.0 © DataMelt by jWork.ORG