/** * Checks, if p_item item is part of a cycle and remuve it together with its connection in this * case. */ public boolean remove_if_cycle(Trace p_trace) { if (!p_trace.is_on_the_board()) { return false; } if (!p_trace.is_cycle()) { return false; } // Remove tails at the endpoints after removing the cycle, // if there was no tail before. boolean[] tail_at_endpoint_before = null; Point[] end_corners = null; int curr_layer = p_trace.get_layer(); int[] curr_net_no_arr = p_trace.net_no_arr; end_corners = new Point[2]; end_corners[0] = p_trace.first_corner(); end_corners[1] = p_trace.last_corner(); tail_at_endpoint_before = new boolean[2]; for (int i = 0; i < 2; ++i) { Trace tail = get_trace_tail(end_corners[i], curr_layer, curr_net_no_arr); tail_at_endpoint_before[i] = (tail != null); } Set<Item> connection_items = p_trace.get_connection_items(); this.remove_items(connection_items, false); for (int i = 0; i < 2; ++i) { if (!tail_at_endpoint_before[i]) { Trace tail = get_trace_tail(end_corners[i], curr_layer, curr_net_no_arr); if (tail != null) { remove_items(tail.get_connection_items(), false); } } } return true; }