} else {   if (!omit) {  detectors = new Detector[detectorNames.size()]; Iterator i = detectorNames.iterator(); int count = 0; while (i.hasNext()) { String name = (String) i.next(); DetectorFactory factory = (DetectorFactory) factoriesByName.get(name); if (factory == null) throw new IllegalArgumentException("No such detector: " + name); detectors[count++] = makeDetector(factory); } } else {  int numDetectors = factories.size() - detectorNames.size(); detectors = new Detector[numDetectors]; Iterator i = factories.iterator(); int count = 0; while (i.hasNext()) { DetectorFactory factory = (DetectorFactory) i.next(); String name = (String) namesByFactory.get(factory); if (!detectorNames.contains(name)) {  if (count == detectors.length) throw new IllegalArgumentException("bad omit list - nonexistent or duplicate detector specified?"); detectors[count++] = makeDetector(factory); } } if (count != numDetectors) throw new IllegalStateException(); } }
  private void createDetectors() {    if (detectorNames == null) {	// Detectors were not named explicitly on command line,	// so create all of them (except those that are disabled).	ArrayList<Detector> result = new ArrayList<Detector>();	Iterator<DetectorFactory> i = factories.iterator();	int count = 0;	while (i.hasNext()) {		DetectorFactory factory = i.next();		if (factory.isEnabled())			result.add(makeDetector(factory));	}	detectors = result.toArray(new Detector[0]);    } else {	// Detectors were named explicitly on command line.	if (!omit) {		// Create only named detectors.		detectors = new Detector[detectorNames.size()];		Iterator i = detectorNames.iterator();		int count = 0;		while (i.hasNext()) {			String name = (String) i.next();			DetectorFactory factory = (DetectorFactory) factoriesByName.get(name);			if (factory == null)				throw new IllegalArgumentException("No such detector: " + name);			detectors[count++] = makeDetector(factory);		}	} else {		// Create all detectors EXCEPT named detectors.		int numDetectors = factories.size() - detectorNames.size();		detectors = new Detector[numDetectors];		Iterator i = factories.iterator();		int count = 0;		while (i.hasNext()) {			DetectorFactory factory = (DetectorFactory) i.next();			String name = (String) namesByFactory.get(factory);			if (!detectorNames.contains(name)) {				// Add the detector.				if (count == detectors.length)					throw new IllegalArgumentException("bad omit list - nonexistent or duplicate detector specified?");				detectors[count++] = makeDetector(factory);			}		}		if (count != numDetectors) throw new IllegalStateException();	}    }  }