/** * Returns the outgoing edges for cell. Cell should be a port or a vertex. */ public static Object[] getOutgoingEdges(GraphModel model, Object cell) { return getEdges(model, cell, false); }
/** * Returns the incoming or outgoing edges for cell. Cell should be a port or * a vertex. * * @param cell * the graph cell whose edges are to be obtained * @param incoming * whether or not to obtain incoming edges only */ public Object[] getEdges(Object cell, boolean incoming) { return DefaultGraphModel.getEdges(model, cell, incoming); }
/** * Returns the incoming edges for cell. Cell should be a port or a vertex. */ public static Object[] getIncomingEdges(GraphModel model, Object cell) { return getEdges(model, cell, true); }
/** * Returns the connected edges for a cell. Cell should be a port or a * vertex. * * @param cell * the cell whose edges are to be obtained * @return Returns the array of all connected edges */ public Object[] getEdges(Object cell) { return DefaultGraphModel.getEdges(model, new Object[] { cell }) .toArray(); }
protected Iterator getEdges(Object node) { return DefaultGraphModel.getEdges(model, new Object[] { node }).iterator(); }
/** * Returns the incoming or outgoing edges for cell. Cell should be a port or * a vertex. */ public static Object[] getEdges(GraphModel model, Object cell, boolean incoming) { Set edges = DefaultGraphModel.getEdges(model, new Object[] { cell }); // Base initial capacity on size of set, it can't be any larger ArrayList result = new ArrayList(edges.size()); Iterator it = edges.iterator(); while (it.hasNext()) { Object edge = it.next(); // TODO: Handle edge groups Object port = (incoming) ? model.getTarget(edge) : model .getSource(edge); Object parent = model.getParent(port); if (port == cell || parent == cell) result.add(edge); } return result.toArray(); }
/** * @param model * @param node * @return all the edges entering the given <code>node</code> */ public static Set getIncomingEdges(GraphModel model, Object node) { Set result = new HashSet(); Set edges = DefaultGraphModel.getEdges(model, new Object[] { node }); Iterator it = edges.iterator(); while (it.hasNext()) { Object edge = it.next(); if (!DefaultGraphModel.isGroup(model, edge)) { Object target = model.getTarget(edge); if (target == node || isParentOf(model, node, target)) result.add(edge); } } return result; }
/** * @param model * @param node * @return all the edges leaving the given <code>node</code> */ public static Set getOutgoingEdges(GraphModel model, Object node) { Set result = new HashSet(); Set edges = DefaultGraphModel.getEdges(model, new Object[] { node }); Iterator it = edges.iterator(); while (it.hasNext()) { Object edge = it.next(); if (!DefaultGraphModel.isGroup(model, edge)) { Object source = model.getSource(edge); Object parent = model.getParent(source); if (source == node || parent == node) result.add(edge); } } return result; } }
Object[] edges = DefaultGraphModel.getEdges(model, cell, false);
model, cell) : DefaultGraphModel.getEdges(model, new Object[] { cell }).toArray(); List connectedCells = new ArrayList(fanout.length);
Object[] edges = DefaultGraphModel.getEdges(model, cell, true);
/** * Removes cells from the model, including all children and connected edges * if <code>children</code> or <code>edges</code> is true, respectively. * * @param cells * The cells to remove. * @param descendants * Whether to remove all descendants as well. * @param edges * Whether to remove all connected edges as well. */ public void remove(Object[] cells, boolean descendants, boolean edges) { if (cells != null && cells.length > 0) { if (edges) { Object[] tmp = DefaultGraphModel.getEdges(getModel(), cells) .toArray(); Object[] newCells = new Object[cells.length + tmp.length]; System.arraycopy(cells, 0, newCells, 0, cells.length); System.arraycopy(tmp, 0, newCells, cells.length, tmp.length); cells = newCells; } if (descendants) cells = DefaultGraphModel.getDescendants(getModel(), cells) .toArray(); remove(cells); } }
boolean selfLoops, boolean incoming) { GraphModel model = getModel(); Object[] edges = DefaultGraphModel.getEdges(model, cell, incoming);
/** * Returns the edges between two specified ports or two specified vertices. * If directed is true then <code>cell1</code> must be the source of the * returned edges. This method never returns null. If there are no edges * between the specified cells, then an array of length 0 is returned. */ public static Object[] getEdgesBetween(GraphModel model, Object cell1, Object cell2, boolean directed) { boolean isPort1 = model.isPort(cell1); boolean isPort2 = model.isPort(cell2); ArrayList result = new ArrayList(); Set edges = DefaultGraphModel.getEdges(model, new Object[] { cell1 }); Iterator it = edges.iterator(); while (it.hasNext()) { Object edge = it.next(); // TODO: Handle edge groups Object source = (isPort1) ? model.getSource(edge) : getSourceVertex(model, edge); Object target = (isPort2) ? model.getTarget(edge) : getTargetVertex(model, edge); if ((source == cell1 && target == cell2) || (!directed && source == cell2 && target == cell1)) result.add(edge); } return result.toArray(); }
Iterator edges = DefaultGraphModel.getEdges(model, new Object[] { node }).iterator(); while (edges.hasNext())
model, cell) : DefaultGraphModel.getEdges(model, new Object[] { cell }).toArray(); List neighbours = new ArrayList(fanout.length);
Set ctx = getEdges(DefaultGraphModel.this, changed); context = ctx.toArray();
Set ctx = DefaultGraphModel.getEdges(getModel(), changedCells .toArray()); context = getMapping(ctx.toArray());
! (roots[i] instanceof DefaultEdge) && ! (roots[i] instanceof DefaultPort)) { Iterator itEdges = DefaultGraphModel.getEdges(this, new Object[] {roots[i]}).iterator(); while (itEdges.hasNext()) {