void clear() { pending_entries.clear(); output_set.clear(); object_tasks.clear(); active_threads.clear(); time_marks.clear(); thread_entries = null; next_time = 0; end_time = 0; current_thread = null; thread_map.clear(); cpu_time = null; thread_counter = 0; task_counter = 0; max_delta = 1; }
// Called by the UI when it wants to start over. // public void reset() { prn.setSeed(sd); minx = Integer.MAX_VALUE; miny = Integer.MAX_VALUE; maxx = Integer.MIN_VALUE; maxy = Integer.MIN_VALUE; pointHash.clear(); // empty out the set of points for (int i = 0; i < n; i++) { point p; int x; int y; do { x = prn.nextInt(); y = prn.nextInt(); p = new point(x, y); } while (pointHash.contains(p)); pointHash.add(p); if (x < minx) minx = x; if (y < miny) miny = y; if (x > maxx) maxx = x; if (y > maxy) maxy = y; points[i] = p; } edges.clear(); // empty out the set of edges }
@Override public void clearWebsite() { LOG.trace("Clear list of websites"); TreeSet<Website> oldValue = new TreeSet<>(websites); websites.clear(); changes.firePropertyChange(ModelProperties.WEBSITES.getPropertyName(), oldValue, websites); }
@Override public void clearChapters() { LOG.trace("Clear list of chapters"); TreeSet<Chapter> oldValue = new TreeSet<>(loadedChapters); loadedChapters.clear(); changes.firePropertyChange( ModelProperties.CHAPTER_LOADED.getPropertyName(), oldValue, loadedChapters); }
@Override public void launchDownload() { LOG.trace("Launch download of chapters [ToDownloadChapters =" + toDownloadChapters + "]"); List<Chapter> toDownload = new LinkedList<>(toDownloadChapters); Services.getDownloadServices().download(toDownload); toDownloadChapters.clear(); changes.firePropertyChange( ModelProperties.CHAPTER_TO_DOWNLOAD.getPropertyName(), toDownload, toDownloadChapters); }
public void clear() { if (taskMap != null) { taskMap.clear(); } if (timeTriggers != null) { timeTriggers.clear(); } if (triggerMap != null) { triggerMap.clear(); } }
private void initializeArrowsBackward(Graph graph) { sortedArrows.clear(); lookupArrows.clear(); for (Edge edge : graph.getEdges()) { Node x = edge.getNode1(); Node y = edge.getNode2(); if (!knowledgeEmpty()) { if (!getKnowledge().noEdgeRequired(x.getName(), y.getName())) { continue; } } if (Edges.isDirectedEdge(edge)) { calculateArrowsBackward(x, y, graph); } else { calculateArrowsBackward(x, y, graph); calculateArrowsBackward(y, x, graph); } } }
public Graph search(List<Node> nodes) { long startTime = System.currentTimeMillis(); localScoreCache.clear(); if (!dataSet().getVariables().containsAll(nodes)) { throw new IllegalArgumentException("All of the nodes must be in " + "the supplied data set."); } Graph graph; if (initialGraph == null) { graph = new EdgeListGraphSingleConnections(nodes); } else { initialGraph = GraphUtils.replaceNodes(initialGraph, variables); graph = new EdgeListGraphSingleConnections(initialGraph); } topGraphs.clear(); buildIndexing(graph); addRequiredEdges(graph); score = 0.0; // Do forward search. fes(graph, nodes); // Do backward search. bes(graph); long endTime = System.currentTimeMillis(); this.elapsedTime = endTime - startTime; this.logger.log("graph", "\nReturning this graph: " + graph); this.logger.log("info", "Elapsed time = " + (elapsedTime) / 1000. + " s"); this.logger.flush(); return graph; }
/** * Greedy equivalence search: Start from the empty graph, add edges till model is significant. * Then start deleting edges till a minimum is achieved. * * @return the resulting Pattern. */ public Graph search() { Graph graph; if (initialGraph == null) { graph = new EdgeListGraphSingleConnections(getVariables()); } else { graph = new EdgeListGraphSingleConnections(initialGraph); } fireGraphChange(graph); buildIndexing(graph); addRequiredEdges(graph); topGraphs.clear(); storeGraph(graph); List<Node> nodes = graph.getNodes(); long start = System.currentTimeMillis(); score = 0.0; // Do forward search. fes(graph, nodes); // Do backward search. bes(graph); long endTime = System.currentTimeMillis(); this.elapsedTime = endTime - start; this.logger.log("graph", "\nReturning this graph: " + graph); this.logger.log("info", "Elapsed time = " + (elapsedTime) / 1000. + " s"); this.logger.flush(); return graph; }
@Override public void clearAllTabStops() { myTabStops.clear(); }
public static void main(String[] args) { UnsortedSet<Integer> s1 = new UnsortedSet<Integer>(); for (int i = 1; i <= 10; i++) { s1.add(i); } UnsortedSet<Integer> s2 = new UnsortedSet<Integer>(); for (int i = 5; i < 15; i++) { s2.add(i); } // Test 1: size method System.out.print("Test 1, UnsortedSet size method: "); if (s1.size() == 10) System.out.println("passed"); else System.out.println("failed"); // Test 2: add method System.out.print("Test 2, UnsortedSet add method: "); s1.add(11); if (s1.contains(11)) { System.out.println("passed"); } else { System.out.println("failed"); } // Test 3: toString method System.out.print("Test 3, UnsortedSet toString method: "); if (s1.toString().equals("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)")) { System.out.println("passed"); } else { System.out.println("failed"); } // Test 4: add all method System.out.print("Test 4, UnsortedSet add all method: "); s1.addAll(s2); if (s1.toString().equals("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)")) { System.out.println("passed"); } else { System.out.println("failed"); } // Test 5: remove method System.out.print("Test 5, UnsortedSet remove method: "); for (int i = 11; i < 15; i++) { s1.remove(i); } if (s1.toString().equals("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)")) { System.out.println("passed"); } else { System.out.println("failed"); } // Test 6: clear method System.out.print("Test 6, UnsortedSet clear method: "); s1.clear(); if (s1.size() == 0) { System.out.println("passed"); } else { System.out.println("failed"); } for (int i = 1; i <= 10; i++) { s1.add(i); } // Test 7: contains method System.out.print("Test 7, UnsortedSet contains method: "); if (!s1.contains(999)) { System.out.println("passed"); } else { System.out.println("failed"); } // Test 8: contains all method System.out.print("Test 8, UnsortedSet contains all method: "); if (!s1.containsAll(s2)) System.out.println("passed"); else System.out.println("failed"); // Test 9: union method System.out.print("Test 9, UnsortedSet union method: "); ISet<Integer> s3 = s1.union(s2); if (s3.toString().equals("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)")) System.out.println("passed"); else System.out.println("failed"); // Test 10: difference method System.out.print("Test 10, UnsortedSet difference method: "); s3 = s1.difference(s2); if (s3.toString().equals("(1, 2, 3, 4)")) System.out.println("passed"); else System.out.println("failed"); // Test 11: intersection method System.out.print("Test 11, UnsortedSet intersection method: "); s3 = s2.intersection(s1); if (s3.toString().equals("(5, 6, 7, 8, 9, 10)")) System.out.println("passed"); else System.out.println("failed"); // The following test cases are for sorted set // Test 12: Create a sorted set with unsorted set UnsortedSet<Integer> list1 = new UnsortedSet<Integer>(); list1.add(9); list1.add(3); list1.add(1); list1.add(5); SortedSet<Integer> list2 = new SortedSet<Integer>(list1); System.out.print("Test 12, SortedSet constructor method: "); if (list2.toString().equals("(1, 3, 5, 9)")) System.out.println("passed"); else System.out.println("failed"); // Test 13: add method System.out.print("Test 13, SortedSet add method: "); list2.add(7); if (list2.toString().equals("(1, 3, 5, 7, 9)")) System.out.println("passed"); else System.out.println("failed"); // Test 14: add all method System.out.print("Test 14, SortedSet add all method: "); list1.clear(); list1.add(1); list1.add(3); list1.add(6); list1.add(4); list2.addAll(list1); if (list2.toString().equals("(1, 3, 4, 5, 6, 7, 9)")) System.out.println("passed"); else System.out.println("failed"); // Test 15: remove method System.out.print("Test 15, SortedSet remove method: "); list2.remove(4); list2.remove(6); if (list2.toString().equals("(1, 3, 5, 7, 9)")) System.out.println("passed"); else System.out.println("failed"); // Test 16: clear and size method System.out.print("Test 16, SortedSet clear and size method: "); list2.clear(); if (list2.size() == 0) System.out.println("passed"); else System.out.println("failed"); // Test 17: contains method System.out.print("Test 17, SortedSet contains method: "); list2.add(4); list2.add(2); list2.add(3); list2.add(23); list2.add(9999); if (list2.contains(9999)) System.out.println("passed"); else System.out.println("failed"); // Test 18: contains all method System.out.print("Test 18, SortedSet contains all method: "); if (!list2.containsAll(list1)) System.out.println("passed"); else System.out.println("failed"); // Test 19: union method System.out.print("Test 19, SortedSet union method: "); ISet<Integer> resultList = list2.union(list1); if (resultList.toString().equals("(1, 2, 3, 4, 6, 23, 9999)")) System.out.println("passed"); else System.out.println("failed"); // Test 20: difference method System.out.print("Test 20, SortedSet difference method: "); resultList = list1.difference(list2); if (resultList.toString().equals("(1, 6)")) System.out.println("passed"); else System.out.println("failed"); // Test 21: intersection method System.out.print("Test 21, SortedSet intersection method: "); resultList = list2.intersection(list1); if (resultList.toString().equals("(3, 4)")) System.out.println("passed"); else System.out.println("failed"); // Test 22: minimum method System.out.print("Test 22, SortedSet min method: "); if (list2.min() == 2) System.out.println("passed"); else System.out.println(false); // Test 23: maximum method System.out.print("Test 23, SortedSet max method: "); if (list2.max() == 9999) System.out.println("passed"); else System.out.println("failed"); // Test 24: SortedSet size method System.out.print("Test 24, SortedSet size method: "); if (list2.size() == 5) System.out.println("passed"); else System.out.println("failed"); // Test 25: UnsortedSet size method System.out.print("Test 25, UnsortedSet size method"); if (list1.size() == 4) System.out.println("passed"); else System.out.println("failed"); // CS314 Students. Uncomment this section when ready to // run your experiments try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.out.println("Unable to change look and feel"); } Scanner sc = new Scanner(System.in); String response = ""; do { largeTest(); System.out.print("Another file? Enter y to do another file: "); response = sc.next(); } while (response != null && response.length() > 0 && response.substring(0, 1).equalsIgnoreCase("y")); }
public void clear() { m_Models.clear(); fireContentsChanged(this, 0, getSize()); }
/** @tests java.util.TreeSet#clear() */ public void test_clear() { // Test for method void java.util.TreeSet.clear() ts.clear(); assertEquals("Returned non-zero size after clear", 0, ts.size()); assertTrue("Found element in cleared set", !ts.contains(objArray[0])); }