@Test public void upWhenAlreadyTop() { final FieldConstraint[] fieldConstraints = new FieldConstraint[2]; final FieldConstraint top = mock(FieldConstraint.class); fieldConstraints[0] = top; fieldConstraints[1] = mock(FieldConstraint.class); FieldConstraintArrayUtil.moveUp(0, fieldConstraints); assertEquals(top, fieldConstraints[0]); }
public static void moveUp(int index, FieldConstraint[] fieldConstraints) { if (index > 0) { final FieldConstraint first = fieldConstraints[index - 1]; final FieldConstraint second = fieldConstraints[index]; if (blockSwap(first, second)) { return; } fieldConstraints[index - 1] = second; fieldConstraints[index] = first; } }
FieldConstraintArrayUtil { public static void moveUp(int index, FieldConstraint[] fieldConstraints) { if (index > 0) { final FieldConstraint first = fieldConstraints[index - 1]; final FieldConstraint second = fieldConstraints[index]; if (blockSwap(first, second)) { return; } fieldConstraints[index - 1] = second; fieldConstraints[index] = first; } } }
FieldConstraintArrayUtil { public static void moveUp(int index, FieldConstraint[] fieldConstraints) { if (index > 0) { final FieldConstraint first = fieldConstraints[index - 1]; final FieldConstraint second = fieldConstraints[index]; if (blockSwap(first, second)) { return; } fieldConstraints[index - 1] = second; fieldConstraints[index] = first; } } private  FieldConstraintArrayUtil(); }
FieldConstraintArrayUtil { public static void moveUp(int index, FieldConstraint[] fieldConstraints) { if (index > 0) { final FieldConstraint first = fieldConstraints[index - 1]; final FieldConstraint second = fieldConstraints[index]; if (blockSwap(first, second)) { return; } fieldConstraints[index - 1] = second; fieldConstraints[index] = first; } } private  FieldConstraintArrayUtil(); static void moveDown(int index, FieldConstraint[] fieldConstraints); static void moveUp(int index, FieldConstraint[] fieldConstraints); }
FieldConstraintArrayUtil { public static void moveUp(int index, FieldConstraint[] fieldConstraints) { if (index > 0) { final FieldConstraint first = fieldConstraints[index - 1]; final FieldConstraint second = fieldConstraints[index]; if (blockSwap(first, second)) { return; } fieldConstraints[index - 1] = second; fieldConstraints[index] = first; } } private  FieldConstraintArrayUtil(); static void moveDown(int index, FieldConstraint[] fieldConstraints); static void moveUp(int index, FieldConstraint[] fieldConstraints);  }