com.netflix.nfgraph.build
Class NFBuildGraph

java.lang.Object
  extended by com.netflix.nfgraph.NFGraph
      extended by com.netflix.nfgraph.build.NFBuildGraph

public class NFBuildGraph
extends NFGraph

An NFBuildGraph is used to create a new graph. This representation of the graph data is not especially memory-efficient, and is intended to exist only for a short time while the NFGraph is being populated.

Once the graph is completely populated, it is expected that this NFBuildGraph will be exchanged for a memory-efficient, read-only NFCompressedGraph via the compress() method.

See NFGraph for an example of code which creates and populates an NFBuildGraph


Field Summary
 
Fields inherited from class com.netflix.nfgraph.NFGraph
graphSpec, modelHolder
 
Constructor Summary
NFBuildGraph(NFGraphSpec graphSpec)
           
 
Method Summary
 void addConnection(java.lang.String nodeType, int fromOrdinal, java.lang.String viaProperty, int toOrdinal)
          Add a connection to this graph.
 void addConnection(java.lang.String connectionModel, java.lang.String nodeType, int fromOrdinal, java.lang.String viaPropertyName, int toOrdinal)
          Add a connection to this graph.
 void addConnectionModel(java.lang.String connectionModel)
          Add a connection model, identified by the parameter connectionModel to this graph.

Building the graph may be much more efficient if each connection model is added to the graph with this method prior to adding any connections.

This operation is not necessary, but may make building the graph more efficient.

 NFCompressedGraph compress()
          Return a NFCompressedGraph containing all connections which have been added to this NFBuildGraph.
protected  int getConnection(int connectionModelIndex, java.lang.String nodeType, int ordinal, java.lang.String propertyName)
           
protected  OrdinalIterator getConnectionIterator(int connectionModelIndex, java.lang.String nodeType, int ordinal, java.lang.String propertyName)
           
protected  OrdinalSet getConnectionSet(int connectionModelIndex, java.lang.String nodeType, int ordinal, java.lang.String propertyName)
           
 
Methods inherited from class com.netflix.nfgraph.NFGraph
getConnection, getConnection, getConnectionIterator, getConnectionIterator, getConnectionSet, getConnectionSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NFBuildGraph

public NFBuildGraph(NFGraphSpec graphSpec)
Method Detail

getConnection

protected int getConnection(int connectionModelIndex,
                            java.lang.String nodeType,
                            int ordinal,
                            java.lang.String propertyName)
Specified by:
getConnection in class NFGraph

getConnectionIterator

protected OrdinalIterator getConnectionIterator(int connectionModelIndex,
                                                java.lang.String nodeType,
                                                int ordinal,
                                                java.lang.String propertyName)
Specified by:
getConnectionIterator in class NFGraph

getConnectionSet

protected OrdinalSet getConnectionSet(int connectionModelIndex,
                                      java.lang.String nodeType,
                                      int ordinal,
                                      java.lang.String propertyName)
Specified by:
getConnectionSet in class NFGraph

addConnection

public void addConnection(java.lang.String nodeType,
                          int fromOrdinal,
                          java.lang.String viaProperty,
                          int toOrdinal)
Add a connection to this graph. The connection will be from the node identified by the given nodeType and fromOrdinal. The connection will be via the specified viaProperty in the NFNodeSpec for the given nodeType. The connection will be to the node identified by the given toOrdinal. The type of the to node is implied by the viaProperty.


addConnection

public void addConnection(java.lang.String connectionModel,
                          java.lang.String nodeType,
                          int fromOrdinal,
                          java.lang.String viaPropertyName,
                          int toOrdinal)
Add a connection to this graph. The connection will be in the given connection model. The connection will be from the node identified by the given nodeType and fromOrdinal. The connection will be via the specified viaProperty in the NFNodeSpec for the given nodeType. The connection will be to the node identified by the given toOrdinal. The type of the to node is implied by the viaProperty.


addConnectionModel

public void addConnectionModel(java.lang.String connectionModel)
Add a connection model, identified by the parameter connectionModel to this graph.

Building the graph may be much more efficient if each connection model is added to the graph with this method prior to adding any connections.

This operation is not necessary, but may make building the graph more efficient.


compress

public NFCompressedGraph compress()
Return a NFCompressedGraph containing all connections which have been added to this NFBuildGraph.