@SuppressWarnings("unchecked") public String printEdges(String type) { String s = ""; Edge<E, V> eg = (Edge<E, V>) edges.getHeader(); while (eg != null) { if (eg.getType().equals(type)) s += eg.getSource().getInfo() + " -> " + eg.getDestination().getInfo() + "\n"; try { eg = (Edge<E, V>) edges.next((Pointer<E>) eg.getPosition()).element(); } catch (Exception exc) { eg = null; } } return s; }
@SuppressWarnings("unchecked") @Override public Iterator<Edge<E, V>> edges(String type) { List<Edge<E, V>> coll = new ArrayList<Edge<E, V>>(); Edge<E, V> head_edg = (Edge<E, V>) edges.getHeader(); while (head_edg != null) { if (head_edg.getType().equals(type)) coll.add(head_edg); try { head_edg = (Edge<E, V>) edges.next((Pointer<E>) head_edg.getPosition()).element(); } catch (Exception exc) { head_edg = null; } } return coll.iterator(); }