HashSet<DetectorFactory> availableSet = new HashSet<DetectorFactory>(factoryMap.values()); availableSet.removeAll(assignedToPassSet);
HashSet<DetectorFactory> availableSet = new HashSet<DetectorFactory>(); availableSet.addAll(detectorSet); availableSet.addAll(getUnassignedSet());
	private void sortPass(			List<DetectorOrderingConstraint> constraintList,			Map<String, DetectorFactory> factoryMap,			AnalysisPass pass)		throws OrderingConstraintException {		// Build set of all (initial) detectors in pass		Set<DetectorFactory> detectorSet = new HashSet<DetectorFactory>();		copyTo(pass.detectorFactoryIterator(), detectorSet);				// Build list of ordering constraints in this pass only		List<DetectorOrderingConstraint> passConstraintList =			new LinkedList<DetectorOrderingConstraint>();		for (Iterator<DetectorOrderingConstraint> i = constraintList.iterator(); i.hasNext(); ) {			DetectorOrderingConstraint constraint = i.next();						// Does this constraint specify any detectors initially made part of the pass?			// If so, add it to the pass constraints			if (selectDetectors(constraint.getEarlier(), detectorSet).size() > 0					|| selectDetectors(constraint.getLater(), detectorSet).size() > 0) {				passConstraintList.add(constraint);			}		}				// Build set of all detectors available to be added to this pass		HashSet<DetectorFactory> availableSet = new HashSet<DetectorFactory>(factoryMap.values());		availableSet.removeAll(assignedToPassSet);		// Build intra-pass constraint graph		Map<String, DetectorNode> nodeMap = new HashMap<String, DetectorNode>();		ConstraintGraph constraintGraph = buildConstraintGraph(			nodeMap, availableSet, passConstraintList);		if (DEBUG) {			System.out.println("Pass constraint graph:");			dumpGraph(constraintGraph);		}		// Perform DFS, check for cycles		DepthFirstSearch<ConstraintGraph, ConstraintEdge, DetectorNode> dfs =			new DepthFirstSearch<ConstraintGraph, ConstraintEdge, DetectorNode>(constraintGraph);		dfs.search();		if (dfs.containsCycle())			throw new OrderingConstraintException("Cycle in intra-pass ordering constraints!");		// Do a topological sort to put the detectors in the pass		// in the right order.		pass.clear();		for (Iterator<DetectorNode> i = dfs.topologicalSortIterator(); i.hasNext(); ) {			DetectorNode node = i.next();			pass.addDetectorFactory(node.getFactory());			assignedToPassSet.add(node.getFactory());		}	}