The Encog Project

org.encog.persist
Class EncogPersistedCollection

java.lang.Object
  extended by org.encog.persist.EncogPersistedCollection

public class EncogPersistedCollection
extends java.lang.Object

An EncogPersistedCollection holds a collection of EncogPersistedObjects. This allows the various neural networks and some data sets to be persisted. They are persisted to an XML form. The EncogPersistedCollection does not load the object into memory at once. This allows it to manage large files.

Author:
jheaton

Field Summary
static java.lang.String ATTRIBUTE_DESCRIPTION
          The description attribute.
static java.lang.String ATTRIBUTE_NAME
          The name attribute.
static java.lang.String GENERAL_ERROR
          Generic error message for bad XML.
static java.lang.String TYPE_BASIC_LAYER
          The type is BasicLayer.
static java.lang.String TYPE_BASIC_NET
          The type is BasicNetwork.
static java.lang.String TYPE_CONTEXT_LAYER
          The type is ContextLayer.
static java.lang.String TYPE_DIRECT_SYNAPSE
          The type is DirectSynapse.
static java.lang.String TYPE_NORMALIZATION
          The type is ParseTemplate.
static java.lang.String TYPE_ONE2ONE_SYNAPSE
          The type is OneToOneSynapse.
static java.lang.String TYPE_PROPERTY
          The type is PropertyData.
static java.lang.String TYPE_RADIAL_BASIS_LAYER
          The type is RadialBasisFunctionLayer.
static java.lang.String TYPE_TEXT
          The type is TextData.
static java.lang.String TYPE_TRAINING
          The type is TrainingData.
static java.lang.String TYPE_TRAINING_CONTINUATION
          For training continuation.
static java.lang.String TYPE_WEIGHTED_SYNAPSE
          The type is WeightedSynapse.
static java.lang.String TYPE_WEIGHTLESS_SYNAPSE
          The type is WeightlessSynapse.
 
Constructor Summary
EncogPersistedCollection(java.io.File file)
          Create a persistance collection for the specified file.
EncogPersistedCollection(PersistenceLocation location)
          Create an object based on the specified location.
EncogPersistedCollection(java.lang.String filename)
          Construct an object with the specified filename.
 
Method Summary
 void add(java.lang.String name, EncogPersistedObject obj)
          Add an EncogPersistedObject to the collection.
 void buildDirectory()
          Build a directory of objects.
 void clear()
          Clear the collection.
 void create()
          Create the file.
 void delete(DirectoryEntry d)
          Delete the specified object, use a directory entry.
 void delete(EncogPersistedObject obj)
          Delete the specified object.
 void delete(java.lang.String name)
          Delete the specified object.
 EncogPersistedObject find(DirectoryEntry d)
          Find the specified object, using a DirectoryEntry.
 EncogPersistedObject find(java.lang.String name)
          Called to search all Encog objects in this collection for one with a name that passes what was passed in.
 java.util.Set<DirectoryEntry> getDirectory()
           
 java.lang.String getEncogVersion()
           
 int getFileVersion()
           
 java.lang.String getPlatform()
           
 void mergeTemp()
          Merge the temp file with the main one, call this to make any changes permanent.
static void throwError(java.lang.String tag)
          Throw and log an error.
 void updateProperties(java.lang.String name, java.lang.String newName, java.lang.String newDesc)
          Update any header properties for an Encog object, for example, a rename.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GENERAL_ERROR

public static final java.lang.String GENERAL_ERROR
Generic error message for bad XML.

See Also:
Constant Field Values

TYPE_TEXT

public static final java.lang.String TYPE_TEXT
The type is TextData.

See Also:
Constant Field Values

TYPE_PROPERTY

public static final java.lang.String TYPE_PROPERTY
The type is PropertyData.

See Also:
Constant Field Values

TYPE_BASIC_NET

public static final java.lang.String TYPE_BASIC_NET
The type is BasicNetwork.

See Also:
Constant Field Values

TYPE_BASIC_LAYER

public static final java.lang.String TYPE_BASIC_LAYER
The type is BasicLayer.

See Also:
Constant Field Values

TYPE_CONTEXT_LAYER

public static final java.lang.String TYPE_CONTEXT_LAYER
The type is ContextLayer.

See Also:
Constant Field Values

TYPE_RADIAL_BASIS_LAYER

public static final java.lang.String TYPE_RADIAL_BASIS_LAYER
The type is RadialBasisFunctionLayer.

See Also:
Constant Field Values

TYPE_TRAINING

public static final java.lang.String TYPE_TRAINING
The type is TrainingData.

See Also:
Constant Field Values

TYPE_WEIGHTED_SYNAPSE

public static final java.lang.String TYPE_WEIGHTED_SYNAPSE
The type is WeightedSynapse.

See Also:
Constant Field Values

TYPE_WEIGHTLESS_SYNAPSE

public static final java.lang.String TYPE_WEIGHTLESS_SYNAPSE
The type is WeightlessSynapse.

See Also:
Constant Field Values

TYPE_DIRECT_SYNAPSE

public static final java.lang.String TYPE_DIRECT_SYNAPSE
The type is DirectSynapse.

See Also:
Constant Field Values

TYPE_ONE2ONE_SYNAPSE

public static final java.lang.String TYPE_ONE2ONE_SYNAPSE
The type is OneToOneSynapse.

See Also:
Constant Field Values

TYPE_NORMALIZATION

public static final java.lang.String TYPE_NORMALIZATION
The type is ParseTemplate.

See Also:
Constant Field Values

ATTRIBUTE_NAME

public static final java.lang.String ATTRIBUTE_NAME
The name attribute.

See Also:
Constant Field Values

ATTRIBUTE_DESCRIPTION

public static final java.lang.String ATTRIBUTE_DESCRIPTION
The description attribute.

See Also:
Constant Field Values

TYPE_TRAINING_CONTINUATION

public static final java.lang.String TYPE_TRAINING_CONTINUATION
For training continuation.

See Also:
Constant Field Values
Constructor Detail

EncogPersistedCollection

public EncogPersistedCollection(java.io.File file)
Create a persistance collection for the specified file.

Parameters:
file - The file to load/save.

EncogPersistedCollection

public EncogPersistedCollection(PersistenceLocation location)
Create an object based on the specified location.

Parameters:
location - The location to load/save from.

EncogPersistedCollection

public EncogPersistedCollection(java.lang.String filename)
Construct an object with the specified filename.

Parameters:
filename - The filename to load/save from.
Method Detail

throwError

public static void throwError(java.lang.String tag)
Throw and log an error.

Parameters:
tag - The tag this error is for.

add

public void add(java.lang.String name,
                EncogPersistedObject obj)
Add an EncogPersistedObject to the collection.

Parameters:
name - The name of the object to load.
obj - The object to add.

buildDirectory

public void buildDirectory()
Build a directory of objects. Also load the header information.


clear

public void clear()
Clear the collection.


create

public void create()
Create the file.


delete

public void delete(DirectoryEntry d)
Delete the specified object, use a directory entry.

Parameters:
d - The object to delete.

delete

public void delete(EncogPersistedObject obj)
Delete the specified object.

Parameters:
obj - The object to delete.

delete

public void delete(java.lang.String name)
Delete the specified object.

Parameters:
name - the object name.

find

public EncogPersistedObject find(DirectoryEntry d)
Find the specified object, using a DirectoryEntry.

Parameters:
d - The directory entry to find.
Returns:
The loaded object.

find

public EncogPersistedObject find(java.lang.String name)
Called to search all Encog objects in this collection for one with a name that passes what was passed in.

Parameters:
name - The name we are searching for.
Returns:
The Encog object with the correct name.

getDirectory

public java.util.Set<DirectoryEntry> getDirectory()
Returns:
The directory entries for the objects in this file.

getEncogVersion

public java.lang.String getEncogVersion()
Returns:
the encogVersion

getFileVersion

public int getFileVersion()
Returns:
the fileVersion

getPlatform

public java.lang.String getPlatform()
Returns:
the platform

mergeTemp

public void mergeTemp()
Merge the temp file with the main one, call this to make any changes permanent.


updateProperties

public void updateProperties(java.lang.String name,
                             java.lang.String newName,
                             java.lang.String newDesc)
Update any header properties for an Encog object, for example, a rename.

Parameters:
name - The name of the object to change.
newName - The new name of this object.
newDesc - The description for this object.

The Encog Project