// check if next destination is a MidPoint
checkArgument(
nextHop instanceof Loc,
"Illegal path for this object, from a position on an edge we can not jump to another edge or go back. From %s, to %s.",
objLoc, nextHop);
final Loc dest = (Loc) nextHop;
// check for same edge
checkArgument(
objLoc.isOnSameConnection(dest),
"Illegal path for this object, first point is not on the same edge as the object.");
// check for relative position
checkArgument(objLoc.relativePos <= dest.relativePos,
"Illegal path for this object, can not move backward over an edge.");
}
// in case we start from a node and we are not going to another node
else if (!objLoc.isOnConnection() && !nextHop.equals(objLoc)
&& !graph.hasConnection(objLoc, nextHop)) {
checkArgument(nextHop instanceof Loc,
"Illegal path, first point should be directly connected to object location.");
final Loc dest = (Loc) nextHop;
checkArgument(graph.hasConnection(objLoc, dest.conn.to),
"Illegal path, first point is on an edge not connected to object location. ");
checkArgument(objLoc.equals(dest.conn.from),
"Illegal path, first point is on a different edge.");
}