Package adams.core
Class ListHelper
- java.lang.Object
-
- adams.core.ListHelper
-
public class ListHelper extends Object
Helper class for lists.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description ListHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
canMoveDown(List list, int[] indices)
checks whether the selected items can be moved down.static boolean
canMoveUp(List list, int[] indices)
checks whether the selected items can be moved up.static int[]
moveBottom(List list, int[] indices)
moves the selected items to the end.static int[]
moveDown(List list, int[] indices)
moves the selected items down by 1.protected static int[]
moveItems(List list, int[] indices, int moveby, boolean up)
moves the selected items by a certain amount of items in a given direction.static int[]
moveTop(List list, int[] indices)
moves the selected items to the top.static int[]
moveUp(List list, int[] indices)
moves the selected items up by 1.protected static void
swap(List list, int firstIndex, int secondIndex)
Swaps the two rows.
-
-
-
Method Detail
-
swap
protected static void swap(List list, int firstIndex, int secondIndex)
Swaps the two rows.- Parameters:
firstIndex
- the index of the first rowsecondIndex
- the index of the second row
-
moveItems
protected static int[] moveItems(List list, int[] indices, int moveby, boolean up)
moves the selected items by a certain amount of items in a given direction.- Parameters:
indices
- the indices to movemoveby
- the number of items to move byup
- if true then items are moved up, otherwise down- Returns:
- the updated selected indices
-
moveUp
public static int[] moveUp(List list, int[] indices)
moves the selected items up by 1.- Parameters:
indices
- the indices of the rows to move- Returns:
- the updated indices of the selected rows
-
moveDown
public static int[] moveDown(List list, int[] indices)
moves the selected items down by 1.- Parameters:
indices
- the indices of the rows to move- Returns:
- the updated indices of the selected rows
-
moveTop
public static int[] moveTop(List list, int[] indices)
moves the selected items to the top.- Parameters:
indices
- the indices of the rows to move- Returns:
- the updated indices of the selected rows
-
moveBottom
public static int[] moveBottom(List list, int[] indices)
moves the selected items to the end.- Parameters:
indices
- the indices of the rows to move- Returns:
- the updated indices of the selected rows
-
canMoveUp
public static boolean canMoveUp(List list, int[] indices)
checks whether the selected items can be moved up.- Parameters:
indices
- the indices of the rows to move- Returns:
- true if the selected items can be moved
-
canMoveDown
public static boolean canMoveDown(List list, int[] indices)
checks whether the selected items can be moved down.- Parameters:
indices
- the indices of the rows to move- Returns:
- true if the selected items can be moved
-
-