// https://docs.oracle.com/javase/7/docs/api/java/util/List.html#subList(int,%20int) public List <T> subList(int fromIndex, int toIndex) { var newList = new LinkedList <T>(); for (int i = fromIndex; i < toIndex; i++) { newList.add(this.get(i)); } return(newList); }
/** * Report the facets of this Simplex. * Each facet is a set of vertices. * @return an Iterable for the facets of this Simplex */ public List facets() { List theFacets = new java.util.LinkedList(); for (Iterator it = this.iterator(); it.hasNext();) { Object v = it.next(); Set facet = new HashSet(this); facet.remove(v); theFacets.add(facet); } return(theFacets); }
public virtual void run() { if (Loader.loadedLibraries.isEmpty()) return; IOException ioException; try { LinkedList linkedList = new LinkedList(); linkedList.add((object) new StringBuilder().append(System.getProperty("java.home")).append("/bin/java").toString()); linkedList.add((object) "-classpath"); linkedList.add((object) System.getProperty("java.class.path")); linkedList.add((object) ((Class) ClassLiteral<Loader>.Value).getName()); linkedList.addAll(Loader.loadedLibraries.values()); new ProcessBuilder((List) linkedList).start(); return; } catch (IOException ex) { int num = 1; ioException = (IOException) ByteCodeHelper.MapException<IOException>((Exception) ex, (ByteCodeHelper.MapFlags) num); } Throwable.instancehelper_printStackTrace((Exception) ioException); }
/** * Place a new point site into the DT. * @param site the new Pnt * @return set of all new triangles created */ public Set delaunayPlace(Pnt site) { Set newTriangles = new HashSet(); Set oldTriangles = new HashSet(); Set doneSet = new HashSet(); LinkedList waitingQ = new LinkedList(); // Locate containing triangle if (debug) Console.WriteLine("Locate"); Simplex triangle = locate(site); // Give up if no containing triangle or if site is already in DT var triangle_null = triangle == null; if (triangle_null || triangle.contains(site)) return newTriangles; // Find Delaunay cavity (those triangles with site in their circumcircles) if (debug) Console.WriteLine("Cavity"); waitingQ.add(triangle); while (!waitingQ.isEmpty()) { triangle = (Simplex) waitingQ.removeFirst(); if (site.vsCircumcircle((Pnt[]) triangle.toArray(new Pnt[0])) == 1) continue; oldTriangles.add(triangle); Iterator it = this.neighbors(triangle).iterator(); for (; it.hasNext();) { Simplex tri = (Simplex) it.next(); if (doneSet.contains(tri)) continue; doneSet.add(tri); waitingQ.add(tri); } } // Create the new triangles if (debug) Console.WriteLine("Create"); for (Iterator it = Simplex.boundary(oldTriangles).iterator(); it.hasNext();) { Set facet = (Set) it.next(); facet.add(site); newTriangles.add(new Simplex(facet)); } // Replace old triangles with new triangles if (debug) Console.WriteLine("Update"); this.update(oldTriangles, newTriangles); // Update mostRecent triangle if (!newTriangles.isEmpty()) mostRecent = (Simplex) newTriangles.iterator().next(); return newTriangles; }
/** * Report the facets of this Simplex. * Each facet is a set of vertices. * @return an Iterable for the facets of this Simplex */ public List facets() { List theFacets = new java.util.LinkedList(); for (Iterator it = this.iterator(); it.hasNext(); ) { Object v = it.next(); Set facet = new HashSet(this); facet.remove(v); theFacets.add(facet); } return theFacets; }