Map<String, DetectorNode> nodeMap = new HashMap<String, DetectorNode>(); ConstraintGraph constraintGraph = buildConstraintGraph( nodeMap, factoryMap, passConstraintList);   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!");
	private void sortPass(			List<DetectorOrderingConstraint> constraintList,			Map<String, DetectorFactory> factoryMap,			AnalysisPass pass)		throws OrderingConstraintException {		// Build set of all detectors in pass		Set<String> detectorSet = new HashSet<String>();		for (Iterator<DetectorFactory> i = pass.detectorFactoryIterator();			i.hasNext(); ) {			DetectorFactory factory = i.next();			detectorSet.add(factory.getFullName());		}		// 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();			if (detectorSet.contains(constraint.getEarlierDetector()) ||				detectorSet.contains(constraint.getLaterDetector())) {				// Make sure that both detectors are in this pass				if (!(detectorSet.contains(constraint.getEarlierDetector()) &&						detectorSet.contains(constraint.getLaterDetector()))) {					throw new OrderingConstraintException("Intra-pass constraint " +						constraint.getEarlierDetector() + " earlier than " +						constraint.getLaterDetector() + " involves detectors in " +						"different passes");				}				passConstraintList.add(constraint);			}		}	}