Map<String, DetectorFactory> factoryMap = buildFactoryMap();   List<DetectorOrderingConstraint> interPassConstraintList = new LinkedList<DetectorOrderingConstraint>(); for (Iterator<Plugin> i = pluginList.iterator(); i.hasNext(); ) { Plugin plugin = i.next(); copyTo(plugin.interPassConstraintIterator(), interPassConstraintList); }
	public void build() throws OrderingConstraintException {		// Build map of detector class names to their factories		Map<String, DetectorFactory> factoryMap = buildFactoryMap();		// Get inter-pass ordering constraints		List<DetectorOrderingConstraint> interPassConstraintList =			new LinkedList<DetectorOrderingConstraint>();		for (Iterator<Plugin> i = pluginList.iterator(); i.hasNext(); ) {			Plugin plugin = i.next();			copyTo(plugin.interPassConstraintIterator(), interPassConstraintList);		}		// Build inter-pass constraint graph		Map<String, DetectorNode> nodeMap = new HashMap<String, DetectorNode>();		ConstraintGraph interPassConstraintGraph = buildConstraintGraph(			nodeMap, factoryMap, interPassConstraintList);		if (DEBUG) System.out.println(interPassConstraintGraph.getNumVertices() +			" nodes in inter-pass constraint graph");		// Build list of analysis passes.		buildPassList(interPassConstraintGraph);		// Make sure there is at least one pass		if (passList.isEmpty())			passList.add(new AnalysisPass());		AnalysisPass finalPass = passList.getLast();		// All detectors not involved in inter-pass constraints are		// added to the final pass.		Set<String> remainingDetectorSet = new HashSet<String>();		remainingDetectorSet.addAll(factoryMap.keySet());		remainingDetectorSet.removeAll(nodeMap.keySet());		for (Iterator<String> i = remainingDetectorSet.iterator(); i.hasNext(); ) {			String detectorClass = i.next();			DetectorFactory factory = factoryMap.get(detectorClass);			finalPass.addDetectorFactory(factory);		}		// Get intra-pass ordering constraints		List<DetectorOrderingConstraint> intraPassConstraintList =			new LinkedList<DetectorOrderingConstraint>();		for (Iterator<Plugin> i = pluginList.iterator(); i.hasNext(); ) {			Plugin plugin = i.next();			copyTo(plugin.intraPassConstraintIterator(), intraPassConstraintList);		}		// Sort detectors in each pass to satisfy intra-pass ordering constraints		for (Iterator<AnalysisPass> i = passList.iterator(); i.hasNext(); ) {			AnalysisPass pass = i.next();			sortPass(intraPassConstraintList, factoryMap, pass);		}	}