private void process (File dir, String fileName, List<Pattern> matchingIncludes) {
		// Increment patterns that need to move to the next token.
		boolean isFinalMatch = false;
		List<Pattern> incrementedPatterns = new ArrayList();
		for (Iterator iter = matchingIncludes.iterator(); iter.hasNext();) {
			Pattern include = (Pattern)iter.next();
			if (include.incr(fileName)) {
				incrementedPatterns.add(include);
				if (include.isExhausted()) iter.remove();
			}
			if (include.wasFinalMatch()) isFinalMatch = true;
		}

		File file = new File(dir, fileName);
		if (isFinalMatch) {
			int length = rootDir.getPath().length();
			if (length > 1)
				matches.add(file.getPath().substring(length + 1));
			else
				matches.add(file.getPath());
		}
		if (!matchingIncludes.isEmpty() && file.isDirectory()) scanDir(file, matchingIncludes);

		// Decrement patterns.
		for (Pattern include : incrementedPatterns)
			include.decr();
	}