net.sourceforge.e4graph
Interface Storage


public interface Storage

The Storageclass provides persistent storage of markers and elements reachable from those markers. A user application may have any number of storages open at a given time, limited only by the available machine resources.

Author:
Ryan Shaw

Field Summary
static int BINARY_SPACE
           
static int FLOAT_SPACE
           
static int INT_SPACE
           
static int MARKER_SPACE
           
static int NAME_SPACE
           
static int NODE_SPACE
           
static int SPACE_ALLOC
           
static int SPACE_AVAIL
           
static int SPACE_FREED
           
static int SPACE_USED
           
static int STRING_SPACE
           
static int VERTEX_SPACE
           
 
Method Summary
 void addMarkerAdditionListener(MarkerAdditionListener l)
          Adds the specified marker addition listener to receive marker addition events from this storage.
 void addMarkerDeletionListener(MarkerDeletionListener l)
          Adds the specified marker deletion listener to receive marker deletion events from this storage.
 void addNodeAdditionListener(NodeAdditionListener l)
          Adds the specified node addition listener to receive node addition events from this storage.
 void addNodeDeletionListener(NodeDeletionListener l)
          Adds the specified node deletion listener to receive node deletion events from this storage.
 void addVertexAdditionListener(VertexAdditionListener l)
          Adds the specified vertex addition listener to receive vertex addition events from this storage.
 void addVertexDeletionListener(VertexDeletionListener l)
          Adds the specified vertex deletion listener to receive vertex deletion events from this storage.
 void addVertexModificationListener(VertexModificationListener l)
          Adds the specified vertex modification listener to receive vertex modification events from this storage.
 void close()
          Releases a storage's resources and closes it immediately, committing if necessary.
 void commit()
          Commits any changes that have been made to the storage immediately.
 boolean containsMarker(java.lang.String name)
          Returns true if a marker with the specified name exists in this storage.
 void copyInto(Storage otherStorage, boolean forceCommit)
          Copies the contents of the receiver to otherStorage.
 void delete()
          Deletes the underlying storage.
 boolean getAutoCommit()
          Gets the current auto-commit state.
 java.lang.String getDriver()
          Returns the name of the driver used to open this storage, or null if the storage is closed.
 Node getMarkedNode(java.lang.String name)
          Returns the node marked by the marker with the specified name.
 Marker getMarker(long id)
          Returns the marker with the specified unique ID if it exists, otherwise returns null.
 Marker getMarker(java.lang.String name)
          Returns the marker with the specified name if it exists, otherwise returns null.
 int getMarkerCount()
          Returns the number of markers existing within this storage.
 java.lang.String getName()
          Returns the name of the storage, or null if the storage is closed.
 Node getNode(long id)
          Returns the node with the specified unique ID if it exists, otherwise returns null.
 int getStatistic(int space, int stat)
          Retrieves statistics about the use of various allocation spaces within a storage.
 Vertex getVertex(long id)
          Returns the vertex with the specified unique ID if it exists, otherwise returns null.
 boolean isClosed()
          Tests to see if a storage is closed.
 boolean isDirty()
          Returns truetrue if there are uncommitted modifications to this storage; otherwise returns false.
 boolean isEmpty()
          Returns true if the storage is empty, that is, it contains no markers or other elements.
 void markDirty()
          Marks the storage as dirty, i.e.
 java.util.Iterator markers()
          Returns an iterator over all the markers in this storage.
 java.util.Iterator nodes()
          Returns an iterator over all the nodes in this storage.
 void removeAll()
          Removes all markers and elements reachable from those markers from this storage.
 void removeMarkerAdditionListener(MarkerAdditionListener l)
          Removes the specified marker addition listener so that it no longer receives marker addition events from this storage.
 void removeMarkerDeletionListener(MarkerDeletionListener l)
          Removes the specified marker deletion listener so that it no longer receives marker deletion events from this storage.
 void removeNodeAdditionListener(NodeAdditionListener l)
          Removes the specified node addition listener so that it no longer receives node addition events from this storage.
 void removeNodeDeletionListener(NodeDeletionListener l)
          Removes the specified node deletion listener so that it no longer receives node deletion events from this storage.
 void removeVertexAdditionListener(VertexAdditionListener l)
          Removes the specified vertex addition listener so that it no longer receives vertex addition events from this storage.
 void removeVertexDeletionListener(VertexDeletionListener l)
          Removes the specified vertex deletion listener so that it no longer receives vertex deletion events from this storage.
 void removeVertexModificationListener(VertexModificationListener l)
          Removes the specified vertex modification listener so that it no longer receives vertex modification events from this storage.
 void setAutoCommit(boolean autoCommit)
          Sets this storage's auto-commit mode.
 java.util.Iterator vertices()
          Returns an iterator over all the vertices in this storage.
 java.util.Iterator vertices(VertexFilter filter)
          Returns an iterator over vertices in this storage accepted by the specified filter.
 

Field Detail

MARKER_SPACE

public static final int MARKER_SPACE

NODE_SPACE

public static final int NODE_SPACE

VERTEX_SPACE

public static final int VERTEX_SPACE

NAME_SPACE

public static final int NAME_SPACE

STRING_SPACE

public static final int STRING_SPACE

INT_SPACE

public static final int INT_SPACE

FLOAT_SPACE

public static final int FLOAT_SPACE

BINARY_SPACE

public static final int BINARY_SPACE

SPACE_USED

public static final int SPACE_USED

SPACE_AVAIL

public static final int SPACE_AVAIL

SPACE_FREED

public static final int SPACE_FREED

SPACE_ALLOC

public static final int SPACE_ALLOC
Method Detail

setAutoCommit

public void setAutoCommit(boolean autoCommit)
Sets this storage's auto-commit mode. If a storage is in auto-commit mode, changes are automatically committed when the storage is closed.
Parameters:
autoCommit - true enables auto-commit; false disables auto-commit.

getAutoCommit

public boolean getAutoCommit()
Gets the current auto-commit state.
Returns:
the current state of auto-commit mode

commit

public void commit()
            throws E4GraphException
Commits any changes that have been made to the storage immediately.
Throws:
E4GraphException - if an error occurs

delete

public void delete()
            throws E4GraphException
Deletes the underlying storage. No events are fired because of the deletion of storage elements.
Throws:
E4GraphException - if an error occurs

isClosed

public boolean isClosed()
Tests to see if a storage is closed.
Returns:
true if the storage is closed; false if it's still open

close

public void close()
           throws E4GraphException
Releases a storage's resources and closes it immediately, committing if necessary. When a storage is closed, and markers, nodes or vertices referring to elements within that storage become invalid.
Throws:
E4GraphException - if an error occurs

copyInto

public void copyInto(Storage otherStorage,
                     boolean forceCommit)
              throws E4GraphException
Copies the contents of the receiver to otherStorage. The previous contents of otherStorage are deleted, and no events are fired because of the deletion. If forceCommit is true, otherStorage will be be committed after the copy is done.

After this operation, the contents of this storage and otherStorage are identical. Changes made to one storage after the copy are not reflected in the other storage.

Listeners registered with otherStorage stay in effect and may be called when events fire after the copy, if changes are made to otherStorage.

Parameters:
otherStorage - the storage into which the contents of this storage will be copied
forceCommit - whether or not to commit the other storage after the copy
Throws:
E4GraphException - if an error occurs

isDirty

public boolean isDirty()
Returns truetrue if there are uncommitted modifications to this storage; otherwise returns false.
Returns:
true if there are uncommitted modifications, false otherwise

markDirty

public void markDirty()
Marks the storage as dirty, i.e. it has been modified and not yet committed.

getMarkerCount

public int getMarkerCount()
Returns the number of markers existing within this storage.
Returns:
number of markers

containsMarker

public boolean containsMarker(java.lang.String name)
Returns true if a marker with the specified name exists in this storage. Returns false if no marker by that name exists.
Parameters:
name - name of the marker to look for
Returns:
true if a marker by that name exists, false otherwise

getMarker

public Marker getMarker(java.lang.String name)
                 throws E4GraphException
Returns the marker with the specified name if it exists, otherwise returns null.
Parameters:
name - name of the marker to return
Returns:
the named marker or null if no marker by that name exists
Throws:
E4GraphException - if an error occurs

getMarker

public Marker getMarker(long id)
                 throws E4GraphException
Returns the marker with the specified unique ID if it exists, otherwise returns null.
Parameters:
id - a valid unique ID
Returns:
the marker identified by id or null if no such marker exists
Throws:
E4GraphException - if an error occurs

getMarkedNode

public Node getMarkedNode(java.lang.String name)
                   throws E4GraphException
Returns the node marked by the marker with the specified name. If no marker by that name exists, a new marker with the specified name will be created, and a new node marked by that marker will be created and returned.
Parameters:
name - name of the marker to return or create
Returns:
the node marked by the marker with the specified name
Throws:
E4GraphException - if an error occurs

getNode

public Node getNode(long id)
             throws E4GraphException
Returns the node with the specified unique ID if it exists, otherwise returns null.
Parameters:
id - a valid unique ID
Returns:
the node identified by id or null if no such node exists
Throws:
E4GraphException - if an error occurs

getVertex

public Vertex getVertex(long id)
                 throws E4GraphException
Returns the vertex with the specified unique ID if it exists, otherwise returns null.
Parameters:
id - a valid unique ID
Returns:
the vertex identified by id or null if no such vertex exists
Throws:
E4GraphException - if an error occurs

markers

public java.util.Iterator markers()
Returns an iterator over all the markers in this storage. The order in which markers are visited is implementation specific.
Returns:
an iterator over the markers in this storage

nodes

public java.util.Iterator nodes()
Returns an iterator over all the nodes in this storage. The order in which nodes are visited is implementation specific.
Returns:
an iterator over the nodes in this storage

vertices

public java.util.Iterator vertices()
Returns an iterator over all the vertices in this storage. The order in which vertices are visited is implementation specific.
Returns:
an iterator over the vertices in this storage

vertices

public java.util.Iterator vertices(VertexFilter filter)
Returns an iterator over vertices in this storage accepted by the specified filter. The order in which vertices are visited is implementation specific.
Parameters:
filter - visit only vertices accepted by this filter
Returns:
an iterator over filtered vertices in this storage

getName

public java.lang.String getName()
Returns the name of the storage, or null if the storage is closed.
Returns:
the name of the storage, or null if the storage is closed

getDriver

public java.lang.String getDriver()
Returns the name of the driver used to open this storage, or null if the storage is closed.
Returns:
the driver name, or null if the storage is closed

isEmpty

public boolean isEmpty()
Returns true if the storage is empty, that is, it contains no markers or other elements. Otherwise it returns false.
Returns:
true if the storage is empty, false otherwise

removeAll

public void removeAll()
               throws E4GraphException
Removes all markers and elements reachable from those markers from this storage.
Throws:
E4GraphException - if an error occurs

getStatistic

public int getStatistic(int space,
                        int stat)
                 throws E4GraphException
Retrieves statistics about the use of various allocation spaces within a storage.
Parameters:
space - the allocation space we are interested in
stat - the specific kind of statistic desired
Returns:
the desired statistic
Throws:
E4GraphException - if an error occurs

addMarkerAdditionListener

public void addMarkerAdditionListener(MarkerAdditionListener l)
Adds the specified marker addition listener to receive marker addition events from this storage. Marker addition events occur when markers are added to this storage. If l is null, no exception is thrown and no action is performed.
Parameters:
l - the marker addition listener
See Also:
MarkerAdditionListener, removeMarkerAdditionListener(net.sourceforge.e4graph.MarkerAdditionListener)

removeMarkerAdditionListener

public void removeMarkerAdditionListener(MarkerAdditionListener l)
Removes the specified marker addition listener so that it no longer receives marker addition events from this storage. Marker addition events occur when markers are added to this storage. If l is null/tt>, no exception is thrown and no action is performed.
Parameters:
l - the marker addition listener
See Also:
MarkerAdditionListener, addMarkerAdditionListener(net.sourceforge.e4graph.MarkerAdditionListener)

addMarkerDeletionListener

public void addMarkerDeletionListener(MarkerDeletionListener l)
Adds the specified marker deletion listener to receive marker deletion events from this storage. Marker deletion events occur when markers are added to this storage. If l is null/tt>, no exception is thrown and no action is performed.
Parameters:
l - the marker deletion listener
See Also:
MarkerDeletionListener, removeMarkerDeletionListener(net.sourceforge.e4graph.MarkerDeletionListener)

removeMarkerDeletionListener

public void removeMarkerDeletionListener(MarkerDeletionListener l)
Removes the specified marker deletion listener so that it no longer receives marker deletion events from this storage. Marker deletion events occur when markers are added to this storage. If l is null/tt>, no exception is thrown and no action is performed.
Parameters:
l - the marker deletion listener
See Also:
MarkerDeletionListener, addMarkerDeletionListener(net.sourceforge.e4graph.MarkerDeletionListener)

addNodeAdditionListener

public void addNodeAdditionListener(NodeAdditionListener l)
Adds the specified node addition listener to receive node addition events from this storage. Node addition events occur when nodes are added to this storage. If l is null/tt>, no exception is thrown and no action is performed.
Parameters:
l - the node addition listener
See Also:
NodeAdditionListener, removeNodeAdditionListener(net.sourceforge.e4graph.NodeAdditionListener)

removeNodeAdditionListener

public void removeNodeAdditionListener(NodeAdditionListener l)
Removes the specified node addition listener so that it no longer receives node addition events from this storage. Node addition events occur when nodes are added to this storage. If l is null/tt>, no exception is thrown and no action is performed.
Parameters:
l - the node addition listener
See Also:
NodeAdditionListener, addNodeAdditionListener(net.sourceforge.e4graph.NodeAdditionListener)

addNodeDeletionListener

public void addNodeDeletionListener(NodeDeletionListener l)
Adds the specified node deletion listener to receive node deletion events from this storage. Node deletion events occur when nodes are added to this storage. If l is null/tt>, no exception is thrown and no action is performed.
Parameters:
l - the node deletion listener
See Also:
NodeDeletionListener, removeNodeDeletionListener(net.sourceforge.e4graph.NodeDeletionListener)

removeNodeDeletionListener

public void removeNodeDeletionListener(NodeDeletionListener l)
Removes the specified node deletion listener so that it no longer receives node deletion events from this storage. Node deletion events occur when nodes are added to this storage. If l is null/tt>, no exception is thrown and no action is performed.
Parameters:
l - the node deletion listener
See Also:
NodeDeletionListener, addNodeDeletionListener(net.sourceforge.e4graph.NodeDeletionListener)

addVertexAdditionListener

public void addVertexAdditionListener(VertexAdditionListener l)
Adds the specified vertex addition listener to receive vertex addition events from this storage. Vertex addition events occur when vertices are added to this storage. If l is null/tt>, no exception is thrown and no action is performed.
Parameters:
l - the vertex addition listener
See Also:
VertexAdditionListener, removeVertexAdditionListener(net.sourceforge.e4graph.VertexAdditionListener)

removeVertexAdditionListener

public void removeVertexAdditionListener(VertexAdditionListener l)
Removes the specified vertex addition listener so that it no longer receives vertex addition events from this storage. Vertex addition events occur when vertices are added to this storage. If l is null/tt>, no exception is thrown and no action is performed.
Parameters:
l - the vertex addition listener
See Also:
VertexAdditionListener, addVertexAdditionListener(net.sourceforge.e4graph.VertexAdditionListener)

addVertexModificationListener

public void addVertexModificationListener(VertexModificationListener l)
Adds the specified vertex modification listener to receive vertex modification events from this storage. Vertex modification events occur when vertices in this storage are changed. If l is null/tt>, no exception is thrown and no action is performed.
Parameters:
l - the vertex modification listener
See Also:
VertexModificationListener, removeVertexModificationListener(net.sourceforge.e4graph.VertexModificationListener)

removeVertexModificationListener

public void removeVertexModificationListener(VertexModificationListener l)
Removes the specified vertex modification listener so that it no longer receives vertex modification events from this storage. Vertex modification events occur when vertices in this storage are changed. If l is null/tt>, no exception is thrown and no action is performed.
Parameters:
l - the vertex modification listener
See Also:
VertexModificationListener, addVertexModificationListener(net.sourceforge.e4graph.VertexModificationListener)

addVertexDeletionListener

public void addVertexDeletionListener(VertexDeletionListener l)
Adds the specified vertex deletion listener to receive vertex deletion events from this storage. Vertex deletion events occur when vertices are added to this storage. If l is null/tt>, no exception is thrown and no action is performed.
Parameters:
l - the vertex deletion listener
See Also:
VertexDeletionListener, removeVertexDeletionListener(net.sourceforge.e4graph.VertexDeletionListener)

removeVertexDeletionListener

public void removeVertexDeletionListener(VertexDeletionListener l)
Removes the specified vertex deletion listener so that it no longer receives vertex deletion events from this storage. Vertex deletion events occur when vertices are added to this storage. If l is null/tt>, no exception is thrown and no action is performed.
Parameters:
l - the vertex deletion listener
See Also:
VertexDeletionListener, addVertexDeletionListener(net.sourceforge.e4graph.VertexDeletionListener)


Copyright (c) 2001, Silver Egg Technology Co., Ltd.