org.encog.persist
Class EncogPersistedCollection

java.lang.Object
  extended by org.encog.persist.EncogPersistedCollection
All Implemented Interfaces:
EncogCollection

public class EncogPersistedCollection
extends Object
implements EncogCollection

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 String ATTRIBUTE_DESCRIPTION
          The description attribute.
static String ATTRIBUTE_NAME
          The name attribute.
static String GENERAL_ERROR
          Generic error message for bad XML.
static String TYPE_BASIC_LAYER
          The type is BasicLayer.
static String TYPE_BASIC_NET
          The type is BasicNetwork.
static String TYPE_BINARY
           
static String TYPE_CONTEXT_LAYER
          The type is ContextLayer.
static String TYPE_DIRECT_SYNAPSE
          The type is DirectSynapse.
static String TYPE_NORMALIZATION
          The type is ParseTemplate.
static String TYPE_ONE2ONE_SYNAPSE
          The type is OneToOneSynapse.
static String TYPE_POPULATION
          The basic population.
static String TYPE_PROPERTY
          The type is PropertyData.
static String TYPE_RADIAL_BASIS_LAYER
          The type is RadialBasisFunctionLayer.
static String TYPE_SCRIPT
           
static String TYPE_SVM
           
static String TYPE_TEXT
          The type is TextData.
static String TYPE_TRAINING
          The type is TrainingData.
static String TYPE_TRAINING_CONTINUATION
          For training continuation.
static String TYPE_WEIGHTED_SYNAPSE
          The type is WeightedSynapse.
static String TYPE_WEIGHTLESS_SYNAPSE
          The type is WeightlessSynapse.
 
Constructor Summary
EncogPersistedCollection(File file)
          Create a persistance collection for the specified file.
EncogPersistedCollection(PersistenceLocation location)
          Create an object based on the specified location.
EncogPersistedCollection(String filename)
          Construct an object with the specified filename.
 
Method Summary
 void add(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(String name)
          Delete the specified object.
 boolean exists(String name)
          Determine if the specified resource exists.
 EncogPersistedObject find(DirectoryEntry d)
          Find the specified object, using a DirectoryEntry.
 EncogPersistedObject find(String name)
          Called to search all Encog objects in this collection for one with a name that passes what was passed in.
 Collection<DirectoryEntry> getDirectory()
           
 String getEncogVersion()
           
 int getFileVersion()
           
 PersistenceLocation getLocation()
           
 String getPlatform()
           
 void mergeTemp()
          Merge the temp file with the main one, call this to make any changes permanent.
static void throwError(String tag)
          Throw and log an error.
 void updateProperties(String name, String newName, 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 String GENERAL_ERROR
Generic error message for bad XML.

See Also:
Constant Field Values

TYPE_TEXT

public static final String TYPE_TEXT
The type is TextData.

See Also:
Constant Field Values

TYPE_PROPERTY

public static final String TYPE_PROPERTY
The type is PropertyData.

See Also:
Constant Field Values

TYPE_BASIC_NET

public static final String TYPE_BASIC_NET
The type is BasicNetwork.

See Also:
Constant Field Values

TYPE_BASIC_LAYER

public static final String TYPE_BASIC_LAYER
The type is BasicLayer.

See Also:
Constant Field Values

TYPE_CONTEXT_LAYER

public static final String TYPE_CONTEXT_LAYER
The type is ContextLayer.

See Also:
Constant Field Values

TYPE_RADIAL_BASIS_LAYER

public static final String TYPE_RADIAL_BASIS_LAYER
The type is RadialBasisFunctionLayer.

See Also:
Constant Field Values

TYPE_TRAINING

public static final String TYPE_TRAINING
The type is TrainingData.

See Also:
Constant Field Values

TYPE_WEIGHTED_SYNAPSE

public static final String TYPE_WEIGHTED_SYNAPSE
The type is WeightedSynapse.

See Also:
Constant Field Values

TYPE_WEIGHTLESS_SYNAPSE

public static final String TYPE_WEIGHTLESS_SYNAPSE
The type is WeightlessSynapse.

See Also:
Constant Field Values

TYPE_DIRECT_SYNAPSE

public static final String TYPE_DIRECT_SYNAPSE
The type is DirectSynapse.

See Also:
Constant Field Values

TYPE_ONE2ONE_SYNAPSE

public static final String TYPE_ONE2ONE_SYNAPSE
The type is OneToOneSynapse.

See Also:
Constant Field Values

TYPE_NORMALIZATION

public static final String TYPE_NORMALIZATION
The type is ParseTemplate.

See Also:
Constant Field Values

ATTRIBUTE_NAME

public static final String ATTRIBUTE_NAME
The name attribute.

See Also:
Constant Field Values

ATTRIBUTE_DESCRIPTION

public static final String ATTRIBUTE_DESCRIPTION
The description attribute.

See Also:
Constant Field Values

TYPE_TRAINING_CONTINUATION

public static final String TYPE_TRAINING_CONTINUATION
For training continuation.

See Also:
Constant Field Values

TYPE_POPULATION

public static final String TYPE_POPULATION
The basic population.

See Also:
Constant Field Values

TYPE_SVM

public static final String TYPE_SVM
See Also:
Constant Field Values

TYPE_BINARY

public static final String TYPE_BINARY
See Also:
Constant Field Values

TYPE_SCRIPT

public static final String TYPE_SCRIPT
See Also:
Constant Field Values
Constructor Detail

EncogPersistedCollection

public EncogPersistedCollection(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(String filename)
Construct an object with the specified filename.

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

throwError

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

Parameters:
tag - The tag this error is for.

add

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

Specified by:
add in interface EncogCollection
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.

Specified by:
buildDirectory in interface EncogCollection

clear

public void clear()
Clear the collection.

Specified by:
clear in interface EncogCollection

create

public void create()
Create the file.


delete

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

Specified by:
delete in interface EncogCollection
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(String name)
Delete the specified object.

Specified by:
delete in interface EncogCollection
Parameters:
name - the object name.

find

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

Specified by:
find in interface EncogCollection
Parameters:
d - The directory entry to find.
Returns:
The loaded object.

find

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

Specified by:
find in interface EncogCollection
Parameters:
name - The name we are searching for.
Returns:
The Encog object with the correct name.

getDirectory

public Collection<DirectoryEntry> getDirectory()
Specified by:
getDirectory in interface EncogCollection
Returns:
The directory entries for the objects in this file.

getEncogVersion

public String getEncogVersion()
Specified by:
getEncogVersion in interface EncogCollection
Returns:
the encogVersion

getFileVersion

public int getFileVersion()
Specified by:
getFileVersion in interface EncogCollection
Returns:
the fileVersion

getPlatform

public String getPlatform()
Specified by:
getPlatform in interface EncogCollection
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(String name,
                             String newName,
                             String newDesc)
Update any header properties for an Encog object, for example, a rename.

Specified by:
updateProperties in interface EncogCollection
Parameters:
name - The name of the object to change.
newName - The new name of this object.
newDesc - The description for this object.

exists

public boolean exists(String name)
Determine if the specified resource exists.

Specified by:
exists in interface EncogCollection
Parameters:
name - The name of the resource to check.
Returns:
True if it exists.

getLocation

public PersistenceLocation getLocation()
Specified by:
getLocation in interface EncogCollection
Returns:
The location this collection is stored at.


Copyright © 2011. All Rights Reserved.