Statistics:Posted by wicky10 — 26 Nov 2014 07:19
CODE:
graph.writeLock(); //Writing the new edges for( Edge e : edges){ graph.addEdge(e); } graph.writeUnlock();
Statistics:Posted by mbastian — 21 Dec 2010 08:24
CODE:
public void execute(GraphModel graphModel, AttributeModel attributeModel) { Graph graph = graphModel.getGraphVisible(); graph.readLock(); try { Progress.start(progressTicket, graph.getNodeCount()); // For edges that will be removed Vector<Edge> edges=new Vector<Edge>(); int i=0; for (Node m : graph.getNodes()) { int m_inf_n=1; for (Node n : graph.getNodes()) { if(m_inf_n==1){// in order to test only one time each couple of nodes if(!m.equals(n)) m_inf_n=0; continue; } if(TEST){ Edge e=graphModel.factory().new Edge(m, n); edges.add(e); } } Progress.progress(progressTicket); if (cancel) { break; } } graph.readUnlockAll(); graph.writeLock(); //Writing the new edges for( Edge e : edges){ graph.addEdge(e); } graph.readUnlockAll(); } catch (Exception e) { // print stack trace as report StringWriter sw=new StringWriter(); PrintWriter pw=new PrintWriter(sw, true); e.printStackTrace(pw); pw.flush(); sw.flush(); res+= sw.toString(); } finally { //Unlock graph graph.readUnlockAll(); } }
Statistics:Posted by dcombe — 20 Dec 2010 16:20