/** * Create an instance of {@link GraphType} using the specified * {@link IdMapper} to generate unique object identifiers. * @param g the associated Graph * @param ids the id mapper */ public GraphType(Graph g, IdMapper<String> ids) { if (ids == null) { ids = new GraphType.Mapper(); } ArrayList<VertexType<?,?>> vertices = new ArrayList<VertexType<?,?>>(); ArrayList<EdgeType> edges = new ArrayList<EdgeType>(); for (Vertex<? extends Oplet<?,?>, ?, ?> v : g.getVertices()) { @SuppressWarnings({ "rawtypes", "unchecked" }) VertexType<?,?> vertex = new VertexType(v, ids); vertices.add(vertex); } for (Edge e : g.getEdges()) { edges.add(new EdgeType(e, ids)); } this.vertices = vertices; this.edges = edges; }
/** * Create an instance of {@link GraphType} using the specified * {@link IdMapper} to generate unique object identifiers. * @param g the associated Graph * @param ids the id mapper */ public GraphType(Graph g, IdMapper<String> ids) { if (ids == null) { ids = new GraphType.Mapper(); } ArrayList<VertexType<?,?>> vertices = new ArrayList<VertexType<?,?>>(); ArrayList<EdgeType> edges = new ArrayList<EdgeType>(); for (Vertex<? extends Oplet<?,?>, ?, ?> v : g.getVertices()) { @SuppressWarnings({ "rawtypes", "unchecked" }) VertexType<?,?> vertex = new VertexType(v, ids); vertices.add(vertex); } for (Edge e : g.getEdges()) { edges.add(new EdgeType(e, ids)); } this.vertices = vertices; this.edges = edges; }