Gephi Toolkit Javadoc

org.gephi.io.importer.impl
Class ImportContainerImpl

java.lang.Object
  extended by org.gephi.io.importer.impl.ImportContainerImpl
All Implemented Interfaces:
Container, ContainerLoader, ContainerUnloader

public class ImportContainerImpl
extends java.lang.Object
implements Container, ContainerLoader, ContainerUnloader

Author:
Mathieu Bastian

Nested Class Summary
 class ImportContainerImpl.FactoryImpl
          Factory for draft objects
 
Nested classes/interfaces inherited from interface org.gephi.io.importer.api.ContainerLoader
ContainerLoader.DraftFactory
 
Constructor Summary
ImportContainerImpl()
           
 
Method Summary
 void addEdge(EdgeDraft edgeDraft)
          Adds an edge to the container.
 void addNode(NodeDraft nodeDraft)
          Adds a node to the container.
 boolean allowAutoNode()
           
 boolean allowParallelEdges()
           
 boolean allowSelfLoop()
           
 void closeLoader()
          Close the current loading and clean content before unloading.
 boolean edgeExists(NodeDraft source, NodeDraft target)
          Returns true if an edge exists from source to target.
 boolean edgeExists(java.lang.String id)
          Returns true if an edge exists with the given id.
 ContainerLoader.DraftFactory factory()
          Returns the factory for building nodes and edges instances.
 AttributeModel getAttributeModel()
          Returns the attribute model for this container.
 EdgeDraftGetter getEdge(NodeDraftGetter source, NodeDraftGetter target)
           
 EdgeDraft getEdge(NodeDraft source, NodeDraft target)
          Returns the edge with the given source and target or null if not found.
 EdgeDraft getEdge(java.lang.String id)
          Returns the edge with the given id, or null if not found.
 EdgeDefault getEdgeDefault()
           
 java.util.Collection<? extends EdgeDraftGetter> getEdges()
           
 AttributeValueFactory getFactory()
           
 ContainerLoader getLoader()
          Get containers loading interface.
 NodeDraftImpl getNode(java.lang.String id)
          Returns the node with the given id, or create a new node with this id if not found.
 java.util.Collection<? extends NodeDraftGetter> getNodes()
           
 Report getReport()
          Returns the report associated to this container, if exists.
 java.lang.String getSource()
          If exists, returns the source of the data.
 DynamicModel.TimeFormat getTimeFormat()
           
 java.lang.Double getTimeIntervalMax()
           
 java.lang.Double getTimeIntervalMin()
           
 ContainerUnloader getUnloader()
          Get containers unloading interface.
 boolean isAutoScale()
           
 boolean isDynamicGraph()
           
 boolean isHierarchicalGraph()
           
 boolean nodeExists(java.lang.String id)
          Returns true if a node exists with the given id.
 void removeEdge(EdgeDraft edgeDraft)
          Removes an edge from the container.
 void setAllowAutoNode(boolean value)
           
 void setAllowParallelEdge(boolean value)
           
 void setAllowSelfLoop(boolean value)
           
 void setAutoScale(boolean autoscale)
           
 void setDynamicGraph(boolean dynamicGraph)
           
 void setEdgeDefault(EdgeDefault edgeDefault)
          Set edge default type: DIRECTED, UNDIRECTED or MIXED.
 void setHierarchicalGraph(boolean hierarchicalGraph)
           
 void setReport(Report report)
          Set a report this container can use to report issues detected when loading the container.
 void setSource(java.lang.String source)
          Set the source of the data put in the container.
 void setTimeFormat(DynamicModel.TimeFormat timeFormat)
          Sets the current Time Format for dynamic data, either DATE of DOUBLE.
 void setTimeIntervalMax(java.lang.String timeIntervalMax)
          Sets the time value where the interval ends.
 void setTimeIntervalMin(java.lang.String timeIntervalMin)
          Sets the time value where the interval starts.
 void setUndirectedSumDirectedEdgesWeight(boolean value)
           
 boolean verify()
          This method must be called after the loading is complete and before unloading.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImportContainerImpl

public ImportContainerImpl()
Method Detail

getLoader

public ContainerLoader getLoader()
Description copied from interface: Container
Get containers loading interface. The loader is used by modules which put data in the container, whereas the unloader interface is used by modules which read containers content.

Specified by:
getLoader in interface Container
Returns:
the containers loading interface

getUnloader

public ContainerUnloader getUnloader()
Description copied from interface: Container
Get containers unloading interface. The unloader interface is used by modules which read containers content, whereas the loader is used for pushing data in the container.

Specified by:
getUnloader in interface Container
Returns:
the container unloading interface

factory

public ContainerLoader.DraftFactory factory()
Description copied from interface: ContainerLoader
Returns the factory for building nodes and edges instances.

Specified by:
factory in interface ContainerLoader
Returns:
the draft factory

setSource

public void setSource(java.lang.String source)
Description copied from interface: Container
Set the source of the data put in the container. Could be a file name.

Specified by:
setSource in interface Container
Parameters:
source - the original source of data.

getSource

public java.lang.String getSource()
Description copied from interface: Container
If exists, returns the source of the data.

Specified by:
getSource in interface Container
Specified by:
getSource in interface ContainerUnloader
Returns:
the source of the data, or null if source is not defined.

addNode

public void addNode(NodeDraft nodeDraft)
Description copied from interface: ContainerLoader
Adds a node to the container. Identified by its id. If no id is present, a unique identifier is generated.

Specified by:
addNode in interface ContainerLoader
Parameters:
nodeDraft - the node that is to be pushed to the container

getNode

public NodeDraftImpl getNode(java.lang.String id)
Description copied from interface: ContainerLoader
Returns the node with the given id, or create a new node with this id if not found.

Specified by:
getNode in interface ContainerLoader
Parameters:
id - a node identifier
Returns:
the found node, or a new default node

nodeExists

public boolean nodeExists(java.lang.String id)
Description copied from interface: ContainerLoader
Returns true if a node exists with the given id.

Specified by:
nodeExists in interface ContainerLoader
Parameters:
id - a node identifier
Returns:
true if node exists, false otherwise

addEdge

public void addEdge(EdgeDraft edgeDraft)
Description copied from interface: ContainerLoader
Adds an edge to the container. The edge must have source and target defined. If the edge already exist, it is ignored. Source and target nodes must be added to the container before pushing edgeDraft.

Specified by:
addEdge in interface ContainerLoader
Parameters:
edgeDraft - the edge that is to be pushed to the container

removeEdge

public void removeEdge(EdgeDraft edgeDraft)
Description copied from interface: ContainerLoader
Removes an edge from the container. Do nothing if the edge is not in the container.

Specified by:
removeEdge in interface ContainerLoader
Parameters:
edgeDraft - the edge that is to be removed from the container

edgeExists

public boolean edgeExists(java.lang.String id)
Description copied from interface: ContainerLoader
Returns true if an edge exists with the given id.

Specified by:
edgeExists in interface ContainerLoader
Parameters:
id - an edge identifier
Returns:
true if edge exists, false otherwise

edgeExists

public boolean edgeExists(NodeDraft source,
                          NodeDraft target)
Description copied from interface: ContainerLoader
Returns true if an edge exists from source to target.

Specified by:
edgeExists in interface ContainerLoader
Parameters:
source - the edge source node
target - the edge target node
Returns:
true if edges exists, false otherwise

getEdge

public EdgeDraft getEdge(java.lang.String id)
Description copied from interface: ContainerLoader
Returns the edge with the given id, or null if not found.

Specified by:
getEdge in interface ContainerLoader
Parameters:
id - an edge identifier
Returns:
the edge with id as an identifier, or null if not found

getEdge

public EdgeDraft getEdge(NodeDraft source,
                         NodeDraft target)
Description copied from interface: ContainerLoader
Returns the edge with the given source and target or null if not found.

Specified by:
getEdge in interface ContainerLoader
Parameters:
source - the edge source node
target - the edge target node
Returns:
the edge from source to target or null if not found

getEdge

public EdgeDraftGetter getEdge(NodeDraftGetter source,
                               NodeDraftGetter target)
Specified by:
getEdge in interface ContainerUnloader

getNodes

public java.util.Collection<? extends NodeDraftGetter> getNodes()
Specified by:
getNodes in interface ContainerUnloader

getEdges

public java.util.Collection<? extends EdgeDraftGetter> getEdges()
Specified by:
getEdges in interface ContainerUnloader

getAttributeModel

public AttributeModel getAttributeModel()
Description copied from interface: ContainerLoader
Returns the attribute model for this container. Columns can be manipulated from this model.

Specified by:
getAttributeModel in interface ContainerLoader
Specified by:
getAttributeModel in interface ContainerUnloader
Returns:
the attribute model

getFactory

public AttributeValueFactory getFactory()

getTimeIntervalMin

public java.lang.Double getTimeIntervalMin()
Specified by:
getTimeIntervalMin in interface ContainerUnloader

getTimeIntervalMax

public java.lang.Double getTimeIntervalMax()
Specified by:
getTimeIntervalMax in interface ContainerUnloader

getTimeFormat

public DynamicModel.TimeFormat getTimeFormat()
Specified by:
getTimeFormat in interface ContainerUnloader

setTimeIntervalMax

public void setTimeIntervalMax(java.lang.String timeIntervalMax)
Description copied from interface: ContainerLoader
Sets the time value where the interval ends. Nodes and edges can have time intervals that defines their lifetime, this method sets the time interval end. If not set by the user, default value is the oldest element.

Specified by:
setTimeIntervalMax in interface ContainerLoader
Parameters:
timeIntervalMax - the upper time interval bound

setTimeIntervalMin

public void setTimeIntervalMin(java.lang.String timeIntervalMin)
Description copied from interface: ContainerLoader
Sets the time value where the interval starts. Nodes and edges can have time intervals that defines their lifetime, this method sets the time interval start. If not set by the user, default value is the yougest element.

Specified by:
setTimeIntervalMin in interface ContainerLoader
Parameters:
timeIntervalMin - the lower time interval bound

setTimeFormat

public void setTimeFormat(DynamicModel.TimeFormat timeFormat)
Description copied from interface: ContainerLoader
Sets the current Time Format for dynamic data, either DATE of DOUBLE. Says how the dates are formatted.

Specified by:
setTimeFormat in interface ContainerLoader
Parameters:
timeFormat - the current time format

verify

public boolean verify()
Description copied from interface: Container
This method must be called after the loading is complete and before unloading. Its aim is to verify data consistency as a whole.

Specified by:
verify in interface Container
Returns:
true if container data is consistent, false otherwise

closeLoader

public void closeLoader()
Description copied from interface: Container
Close the current loading and clean content before unloading.

Specified by:
closeLoader in interface Container

isDynamicGraph

public boolean isDynamicGraph()
Specified by:
isDynamicGraph in interface Container

isHierarchicalGraph

public boolean isHierarchicalGraph()
Specified by:
isHierarchicalGraph in interface Container

setDynamicGraph

public void setDynamicGraph(boolean dynamicGraph)

setHierarchicalGraph

public void setHierarchicalGraph(boolean hierarchicalGraph)

getReport

public Report getReport()
Description copied from interface: Container
Returns the report associated to this container, if exists.

Specified by:
getReport in interface Container
Returns:
the report set for this container or null if no report is defined

setReport

public void setReport(Report report)
Description copied from interface: Container
Set a report this container can use to report issues detected when loading the container. Report are used to log info and issues during import process. Only one report can be associated to a container.

Specified by:
setReport in interface Container
Parameters:
report - set report as the default report for this container

setAllowAutoNode

public void setAllowAutoNode(boolean value)
Specified by:
setAllowAutoNode in interface Container

setAllowParallelEdge

public void setAllowParallelEdge(boolean value)
Specified by:
setAllowParallelEdge in interface Container

setAllowSelfLoop

public void setAllowSelfLoop(boolean value)
Specified by:
setAllowSelfLoop in interface Container

setEdgeDefault

public void setEdgeDefault(EdgeDefault edgeDefault)
Description copied from interface: ContainerLoader
Set edge default type: DIRECTED, UNDIRECTED or MIXED. Default value is directed.

Specified by:
setEdgeDefault in interface ContainerLoader
Parameters:
edgeDefault - the edge default type value

setUndirectedSumDirectedEdgesWeight

public void setUndirectedSumDirectedEdgesWeight(boolean value)
Specified by:
setUndirectedSumDirectedEdgesWeight in interface Container

allowAutoNode

public boolean allowAutoNode()
Specified by:
allowAutoNode in interface ContainerUnloader

allowParallelEdges

public boolean allowParallelEdges()
Specified by:
allowParallelEdges in interface ContainerUnloader

allowSelfLoop

public boolean allowSelfLoop()
Specified by:
allowSelfLoop in interface ContainerUnloader

getEdgeDefault

public EdgeDefault getEdgeDefault()
Specified by:
getEdgeDefault in interface ContainerUnloader

isAutoScale

public boolean isAutoScale()
Specified by:
isAutoScale in interface Container

setAutoScale

public void setAutoScale(boolean autoscale)
Specified by:
setAutoScale in interface Container

Gephi Toolkit Javadoc