示例#1
0
文件: Graph.java 项目: nopanic/DNA
 public void switchDataStructure(
     ListType type, Class<? extends IDataStructure> newDatastructureType) {
   IDataStructure newDatastructure;
   switch (type) {
     case GlobalEdgeList:
       newDatastructure = gds.newList(type, newDatastructureType);
       this.edges =
           (IEdgeListDatastructure)
               ((IEdgeListDatastructureReadable) this.edges).switchTo(newDatastructure);
       break;
     case GlobalNodeList:
       newDatastructure = gds.newList(type, newDatastructureType);
       this.nodes =
           (INodeListDatastructure)
               ((INodeListDatastructureReadable) this.nodes).switchTo(newDatastructure);
       break;
     case LocalEdgeList:
     case LocalInEdgeList:
     case LocalOutEdgeList:
     case LocalNodeList:
       for (IElement n : this.getNodes()) {
         newDatastructure = gds.newList(type, newDatastructureType);
         ((Node) n).switchDataStructure(type, newDatastructure);
       }
   }
 }
示例#2
0
文件: Graph.java 项目: nopanic/DNA
 public Graph(String name, long timestamp, GraphDataStructure gds) {
   this.name = name;
   this.timestamp = timestamp;
   this.nodes = (INodeListDatastructure) gds.newList(ListType.GlobalNodeList);
   this.edges = (IEdgeListDatastructure) gds.newList(ListType.GlobalEdgeList);
   this.gds = gds;
 }