assert inputs != null;
assert outputs != null;
boolean valid = true;
TreeMap<String, InputDescription> inputPaths = new TreeMap<String, InputDescription>();
for (InputDescription input : inputs) {
DirectFileInputDescription desc = extract(input);
String path = normalizePath(desc.getBasePath());
inputPaths.put(path, input);
}
TreeMap<String, OutputDescription> outputPaths = new TreeMap<String, OutputDescription>();
for (OutputDescription output : outputs) {
DirectFileOutputDescription desc = extract(output);
String path = normalizePath(desc.getBasePath());
for (Map.Entry<String, InputDescription> entry : inputPaths.tailMap(path, true).entrySet()) {
if (entry.getKey().startsWith(path) == false) {
break;
}
DirectFileInputDescription other = extract(entry.getValue());
getEnvironment().error(
"入出力のベースパスが衝突しています: {0}[{1}] -> {2}[{3}]",
desc.getClass().getName(),
desc.getBasePath(),
other.getClass().getName(),
other.getBasePath());
valid = false;
}
if (outputPaths.containsKey(path)) {
DirectFileOutputDescription other = extract(outputPaths.get(path));
getEnvironment().error(
"2つの出力のベースパスが重複しています: {0}[{1}] <-> {2}[{3}]",
desc.getClass().getName(),
desc.getBasePath(),
other.getClass().getName(),
other.getBasePath());
valid = false;
} else {
outputPaths.put(path, output);
}
}
for (Map.Entry<String, OutputDescription> base : outputPaths.entrySet()) {
String path = base.getKey();
DirectFileOutputDescription desc = extract(base.getValue());
for (Map.Entry<String, OutputDescription> entry : outputPaths.tailMap(path, false).entrySet()) {
if (entry.getKey().startsWith(path) == false) {
break;
}
DirectFileOutputDescription other = extract(entry.getValue());
getEnvironment().error(
"2つの出力のベースパスが衝突しています: {0}[{1}] -> {2}[{3}]",
desc.getClass().getName(),
desc.getBasePath(),
other.getClass().getName(),
other.getBasePath());
valid = false;
}
}
return valid;
}