From d5bb27a4ccbd402f3783af3d93bd7b6fad1374f5 Mon Sep 17 00:00:00 2001 From: yeom Date: Fri, 8 Apr 2011 18:41:25 +0000 Subject: [PATCH] having a verification routine. --- .../src/Benchmarks/oooJava/voronoi/Edge.java | 23 +++++++++---------- .../oooJava/voronoi/TestRunner.java | 8 +++---- .../src/Benchmarks/oooJava/voronoi/Vec2.java | 4 ++-- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Robust/src/Benchmarks/oooJava/voronoi/Edge.java b/Robust/src/Benchmarks/oooJava/voronoi/Edge.java index bd16aaad..fb892b2f 100644 --- a/Robust/src/Benchmarks/oooJava/voronoi/Edge.java +++ b/Robust/src/Benchmarks/oooJava/voronoi/Edge.java @@ -1,4 +1,3 @@ - /*import java.io.*; import java.util.Stack; import java.util.Hashtable;*/ @@ -370,7 +369,7 @@ class Edge * Print the voronoi diagram and its dual, the delaunay triangle for the * diagram. **/ - /*void outputVoronoiDiagram() + void outputVoronoiDiagram() { Edge nex = this; // Plot voronoi diagram edges with one endpoint at infinity. @@ -395,14 +394,14 @@ class Edge } while (nex != this); // plot delaunay triangle edges and finite VD edges. - Stack edges = new Stack(); + LinkedList edges = new LinkedList(); Hashtable seen = new Hashtable(); pushRing(edges, seen); System.out.println("no. of edges = " + edges.size()); - while (!edges.empty()) { + while (edges.size()!=0) { Edge edge = (Edge)edges.pop(); - Boolean b = (Boolean)seen.get(edge); - if (b != null && b.booleanValue()) { + Integer b = (Integer)seen.get(edge); + if (b != null && b.intValue()==1) { Edge prev = edge; nex = edge.oNext(); do { @@ -430,7 +429,7 @@ class Edge System.out.println("Vedge " + vv1.toString() + " " + vv2.toString()); } } - seen.put(prev, new Boolean(false)); + seen.put(prev, new Integer(0)); prev = nex; nex = nex.oNext(); } while (prev != edge); @@ -439,20 +438,20 @@ class Edge } } - /* - void pushRing(Stack stack, Hashtable seen) + + void pushRing(LinkedList stack, Hashtable seen) { Edge nex = oNext(); while (nex != this) { if (!seen.containsKey(nex)) { - seen.put(nex, new Boolean(true)); + seen.put(nex, new Integer(1)); stack.push(nex); } nex = nex.oNext(); } } - void pushNonezeroRing(Stack stack, Hashtable seen) + void pushNonezeroRing(LinkedList stack, Hashtable seen) { Edge nex = oNext(); while (nex != this) { @@ -462,7 +461,7 @@ class Edge } nex = nex.oNext(); } - }*/ + } } diff --git a/Robust/src/Benchmarks/oooJava/voronoi/TestRunner.java b/Robust/src/Benchmarks/oooJava/voronoi/TestRunner.java index 7bb621e6..7e7d6459 100644 --- a/Robust/src/Benchmarks/oooJava/voronoi/TestRunner.java +++ b/Robust/src/Benchmarks/oooJava/voronoi/TestRunner.java @@ -32,12 +32,12 @@ public class TestRunner //Voronoi * Set to true to print the voronoi diagram and its dual, * the delaunay diagram **/ - //private static boolean printResults; // = false; + private boolean printResults; // = false; public TestRunner(int npoints) { this.points = npoints; //this.printMsgs = false; - //this.printResults = false; + this.printResults = true; } public static void main(String[] args) { @@ -85,8 +85,8 @@ public class TestRunner //Voronoi System.out.println("Total time " + (end1-start0)/1000.0); System.out.println("Done!"); - /*if (printResults) - edge.outputVoronoiDiagram(); */ + if (printResults) + edge.outputVoronoiDiagram(); // if (printMsgs) { diff --git a/Robust/src/Benchmarks/oooJava/voronoi/Vec2.java b/Robust/src/Benchmarks/oooJava/voronoi/Vec2.java index 9802e69a..f137cc09 100644 --- a/Robust/src/Benchmarks/oooJava/voronoi/Vec2.java +++ b/Robust/src/Benchmarks/oooJava/voronoi/Vec2.java @@ -40,10 +40,10 @@ class Vec2 norm = d; } - /*public String toString() + public String toString() { return x + " " + y; - }*/ + } Vec2 circle_center(Vec2 b, Vec2 c) { -- 2.34.1