Ejemplo n.º 1
0
 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);
       }
   }
 }
Ejemplo n.º 2
0
 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;
 }