public String getResultMsg() { List<Point> dotsAcopy = new LinkedList<Point>(dotsA); List<Point> dotsB1 = new LinkedList<Point>(); List<Point> dotsB2 = new LinkedList<Point>(); boolean correct = false; for (Connection con : connections) { dotsAcopy.remove(getPointIndex(dotsAcopy, con.src)); if (!correct) { boolean inDotsB1 = getPointIndex(dotsB1, con.dst) >= 0; boolean inDotsB2 = getPointIndex(dotsB2, con.dst) >= 0; if (oval1a.isInside(con.src)) { if (inDotsB2) correct = true; else dotsB1.add(con.dst); } else { // in oval1b if (inDotsB1) correct = true; else dotsB2.add(con.dst); } } } if (!dotsAcopy.isEmpty()) return "alle Punkte in X müssen zugewiesen werden"; else if (correct) return "das ist korrekt!"; else return "leider ist das nicht korrekt"; }
public boolean isCorrect() { List<Point> dotsAcopy = new LinkedList<Point>(dotsA); List<Point> dotsB1 = new LinkedList<Point>(); List<Point> dotsB2 = new LinkedList<Point>(); boolean correct = false; for (Connection con : connections) { dotsAcopy.remove(getPointIndex(dotsAcopy, con.src)); if (!correct) { boolean inDotsB1 = getPointIndex(dotsB1, con.dst) >= 0; boolean inDotsB2 = getPointIndex(dotsB2, con.dst) >= 0; if (oval1a.isInside(con.src)) { if (inDotsB2) correct = true; else dotsB1.add(con.dst); } else { // in oval1b if (inDotsB1) correct = true; else dotsB2.add(con.dst); } } } return dotsAcopy.isEmpty() && correct; }