AbstractVFState extends State { @Override final void remove(int n, int m) { m1[n] = m2[m] = UNMAPPED; size = size - 1; for (int w : g1[n]) if (t1[w] > size) t1[w] = 0; for (int w : g2[m]) if (t2[w] > size) t2[w] = 0; } AbstractVFState(final int[][] g1, final int[][] g2);   }
@Test public void remove() { int[][] g1 = new int[][]{{1}, {0, 2}, {1, 3}, {2}}; int[][] g2 = new int[][]{{1}, {0, 2}, {1, 3}, {2, 4}, {3, 5}, {4}}; AbstractVFState state = create(g1, g2); state.size = 2; state.m1[0] = 1; state.m1[1] = 2; state.m2[1] = 0; state.m2[2] = 1; state.t1[0] = 2; state.t1[1] = 1; state.t1[2] = 2; state.t2[0] = 1; state.t2[1] = 2; state.t2[2] = 1; state.t2[3] = 2; assertThat(state.size, is(2)); assertThat(state.m1, is(new int[]{1, 2, UNMAPPED, UNMAPPED})); assertThat(state.m2, is(new int[]{UNMAPPED, 0, 1, UNMAPPED, UNMAPPED, UNMAPPED})); assertThat(state.t1, is(new int[]{2, 1, 2, 0})); assertThat(state.t2, is(new int[]{1, 2, 1, 2, 0, 0})); state.remove(1, 2); assertThat(state.size, is(1)); assertThat(state.m1, is(new int[]{1, UNMAPPED, UNMAPPED, UNMAPPED})); assertThat(state.m2, is(new int[]{UNMAPPED, 0, UNMAPPED, UNMAPPED, UNMAPPED, UNMAPPED})); assertThat(state.t1, is(new int[]{0, 1, 0, 0})); assertThat(state.t2, is(new int[]{1, 0, 1, 0, 0, 0})); state.remove(0, 1); assertThat(state.size, is(0)); assertThat(state.m1, is(new int[]{UNMAPPED, UNMAPPED, UNMAPPED, UNMAPPED})); assertThat(state.m2, is(new int[]{UNMAPPED, UNMAPPED, UNMAPPED, UNMAPPED, UNMAPPED, UNMAPPED})); assertThat(state.t1, is(new int[]{0, 0, 0, 0})); assertThat(state.t2, is(new int[]{0, 0, 0, 0, 0, 0})); }