scratch.danyel.lazy
Class LazySparseVertexFactory

java.lang.Object
  extended by scratch.danyel.lazy.LazySparseVertexFactory
Direct Known Subclasses:
LazyWebCrawler.WebCrawlerFactory

public abstract class LazySparseVertexFactory
extends Object

To override this class,

Author:
danyelf

Field Summary
protected  HashMap idPairToEdge
           
protected  HashMap idToVertex
           
 
Constructor Summary
LazySparseVertexFactory(Graph g)
           
 
Method Summary
abstract  void annotateVertex(LazySparseVertex vertex)
          Ok, here'a a Vertex.
 Edge getEdge(Object id1, Object id2)
          Returns an edge running between these two vertices.
protected  Edge getLazyEdge(Vertex v1, Vertex v2)
          Returns the (unqiue) edge connected vertices 1 and 2.
protected  LazySparseVertex getLazySparseVertex(Object identifier)
          Creates a new LazySparseVertex tied to this identifier.
abstract  Object[] getNeighborsIds(Object o)
          Returns an array of IDs of successors.
 Vertex getVertex(Object identifier)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

idToVertex

protected HashMap idToVertex

idPairToEdge

protected HashMap idPairToEdge
Constructor Detail

LazySparseVertexFactory

public LazySparseVertexFactory(Graph g)
Method Detail

getVertex

public Vertex getVertex(Object identifier)

getLazySparseVertex

protected LazySparseVertex getLazySparseVertex(Object identifier)
Creates a new LazySparseVertex tied to this identifier. The user should override this to provide the appropriate construction. The LazySparseVertex should be in either STATUS_NAME_KNOWN_BUT_EMPTY or STATUS_COMPLETE. The user may be safely guaranteed that this method will be run only once, and so the ID may be a unique ID. It is the user's responsibility to ensure that this is the only entry point to create new Vertices. (In particular, creating vertices through other methods will make getEdge not work.) The default implementation creates an instance of LazySparseVertex with the field "UniqueID" tied to the identifier.

Returns:

getEdge

public Edge getEdge(Object id1,
                    Object id2)
Returns an edge running between these two vertices. By default, this is a DirectedSparseEdge; override for other types.

Parameters:
id1 -
id2 -
Returns:

getLazyEdge

protected Edge getLazyEdge(Vertex v1,
                           Vertex v2)
Returns the (unqiue) edge connected vertices 1 and 2. By default, merely creates a DirectedSparseEdge and returns that.

Parameters:
v1 -
v2 -
Returns:

annotateVertex

public abstract void annotateVertex(LazySparseVertex vertex)
Ok, here'a a Vertex. Do we have any information this vertex needs in order to be a complete and fully-realized vertex?

Parameters:
vertex -

getNeighborsIds

public abstract Object[] getNeighborsIds(Object o)
Returns an array of IDs of successors.

Returns: