@Override public void execute(GraphModel gm, AttributeModel am) { Graph graph = gm.getUndirectedGraphVisible(); graph.readLock(); // calculate all Euclidean distances between all nodes double[] distances = geometry.calculateManyEuclideanDistances(graph.getNodes().toArray()); // calculate the variation of coefficient over the distances result = String.valueOf(math.variationCoefficient(distances)); graph.readUnlockAll(); }
protected void refreshFunctions() { graph.readLock(); boolean graphHasChanged = graphObserver.isNew() || graphObserver.hasGraphChanged(); if (graphHasChanged) { if (graphObserver.isNew()) { graphObserver.hasGraphChanged(); } refreshGraphFunctions(); } refreshAttributeFunctions(graphHasChanged); graph.readUnlock(); }