default:
errors.add(new TestError(this, Severity.WARNING, tr("Unknown role"), UNKNOWN_ROLE,
l, Collections.singletonList(m)));
}
} else if (m.isNode()) {
Node n = m.getNode();
if ("via".equals(m.getRole())) {
if (!via.isEmpty()) {
if (via.get(0) instanceof Node) {
morevia = true;
} else {
mixvia = true;
}
} else {
via.add(n);
}
} else {
errors.add(new TestError(this, Severity.WARNING, tr("Unknown role"), UNKNOWN_ROLE,
l, Collections.singletonList(m)));
}
} else {
errors.add(new TestError(this, Severity.WARNING, tr("Unknown member type"), UNKNOWN_TYPE,
l, Collections.singletonList(m)));
}
}
if (morefrom) {
errors.add(new TestError(this, Severity.ERROR, tr("More than one \"from\" way found"), MORE_FROM, r));
}
if (moreto) {
errors.add(new TestError(this, Severity.ERROR, tr("More than one \"to\" way found"), MORE_TO, r));
}
if (morevia) {
errors.add(new TestError(this, Severity.ERROR, tr("More than one \"via\" node found"), MORE_VIA, r));
}
if (mixvia) {
errors.add(new TestError(this, Severity.ERROR, tr("Cannot mix node and way for role \"via\""), MIX_VIA, r));
}
if (fromWay == null) {
errors.add(new TestError(this, Severity.ERROR, tr("No \"from\" way found"), NO_FROM, r));
return;
}
if (toWay == null) {
errors.add(new TestError(this, Severity.ERROR, tr("No \"to\" way found"), NO_TO, r));
return;
}
if (via.isEmpty()) {
errors.add(new TestError(this, Severity.ERROR, tr("No \"via\" node or way found"), NO_VIA, r));
return;
}
if (via.get(0) instanceof Node) {
final Node viaNode = (Node) via.get(0);
final Way viaPseudoWay = new Way();
viaPseudoWay.addNode(viaNode);
checkIfConnected(fromWay, viaPseudoWay,
tr("The \"from\" way does not start or end at a \"via\" node."), FROM_VIA_NODE);
if (toWay.isOneway() != 0 && viaNode.equals(toWay.lastNode(true))) {
errors.add(new TestError(this, Severity.WARNING, tr("Superfluous turnrestriction as \"to\" way is oneway"), SUPERFLUOUS, r));
return;
}
checkIfConnected(viaPseudoWay, toWay,
tr("The \"to\" way does not start or end at a \"via\" node."), TO_VIA_NODE);