@Test public final void testFindCommonLineInPaths() { assertEquals(PathUtils.findCommonLineInPaths(path, elem4), l4); assertEquals(PathUtils.findCommonLineInPaths(path, elem6), l4); assertNull(PathUtils.findCommonLineInPaths(path, null)); assertNull(PathUtils.findCommonLineInPaths(null, elem6)); assertNull(PathUtils.findCommonLineInPaths(path, new LineLinkedListElement() { @Override public LineLinkedListElement getPrevious() { return null; } @Override public Line getLine() { return null; } })); assertNull(PathUtils.findCommonLineInPaths(emptyPath, elem4)); }
public static Line findCommonLineInPaths(final List<? extends Line> location, final LineLinkedListElement el) { Line line = null; LineLinkedListElement current = el; if (location != null && current != null && current.getLine() != null) { if (location.contains(current.getLine())) { line = current.getLine(); } else { while (current.getPrevious() != null) { current = current.getPrevious(); if (location.contains(current.getLine())) { line = current.getLine(); break; } } } } return line; }
PathUtils { public static Line findCommonLineInPaths(final List<? extends Line> location, final LineLinkedListElement el) { Line line = null; LineLinkedListElement current = el; if (location != null && current != null && current.getLine() != null) { if (location.contains(current.getLine())) { line = current.getLine(); } else { while (current.getPrevious() != null) { current = current.getPrevious(); if (location.contains(current.getLine())) { line = current.getLine(); break; } } } } return line; } }
PathUtils { public static Line findCommonLineInPaths(final List<? extends Line> location, final LineLinkedListElement el) { Line line = null; LineLinkedListElement current = el; if (location != null && current != null && current.getLine() != null) { if (location.contains(current.getLine())) { line = current.getLine(); } else { while (current.getPrevious() != null) { current = current.getPrevious(); if (location.contains(current.getLine())) { line = current.getLine(); break; } } } } return line; } private  PathUtils(); }
PathUtils { public static Line findCommonLineInPaths(final List<? extends Line> location, final LineLinkedListElement el) { Line line = null; LineLinkedListElement current = el; if (location != null && current != null && current.getLine() != null) { if (location.contains(current.getLine())) { line = current.getLine(); } else { while (current.getPrevious() != null) { current = current.getPrevious(); if (location.contains(current.getLine())) { line = current.getLine(); break; } } } } return line; } private  PathUtils(); static int getLength(final List<Line> path, final Line start,
                                final Line end); static int getLength(final List<Line> path); static boolean checkPathConnection(final List<Line> path); static List<Line> constructPath(final LineLinkedListElement dest); static LineLinkedListElement findElementInQueue(
            final Queue<? extends LineLinkedListElement> pq, final Line line); static Line findCommonLineInPaths(final List<? extends Line> location,
                                             final LineLinkedListElement el); }
PathUtils { public static Line findCommonLineInPaths(final List<? extends Line> location, final LineLinkedListElement el) { Line line = null; LineLinkedListElement current = el; if (location != null && current != null && current.getLine() != null) { if (location.contains(current.getLine())) { line = current.getLine(); } else { while (current.getPrevious() != null) { current = current.getPrevious(); if (location.contains(current.getLine())) { line = current.getLine(); break; } } } } return line; } private  PathUtils(); static int getLength(final List<Line> path, final Line start,
                                final Line end); static int getLength(final List<Line> path); static boolean checkPathConnection(final List<Line> path); static List<Line> constructPath(final LineLinkedListElement dest); static LineLinkedListElement findElementInQueue(
            final Queue<? extends LineLinkedListElement> pq, final Line line); static Line findCommonLineInPaths(final List<? extends Line> location,
                                             final LineLinkedListElement el);  }