com.atlassian.jira.util
Class CollectionReorderer

java.lang.Object
  extended bycom.atlassian.jira.util.CollectionReorderer

public class CollectionReorderer
extends Object


Constructor Summary
CollectionReorderer()
           
 
Method Summary
 void decreasePosition(List objects, Object toMove)
           
 void increasePosition(List objects, Object toMove)
           
 void moveToEnd(List objects, Object toMove)
           
 void moveToPosition(List objects, int initialPosition, int targetPosition)
          If moving more than one object at the same time please use moveToPosition(java.util.List, java.util.Map)
 void moveToPosition(List objects, Map positionToObjects)
          Moves multiple objects in the objects list to given destination indexes
 void moveToStart(List objects, Object toMove)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionReorderer

public CollectionReorderer()
Method Detail

moveToStart

public void moveToStart(List objects,
                        Object toMove)

moveToEnd

public void moveToEnd(List objects,
                      Object toMove)

decreasePosition

public void decreasePosition(List objects,
                             Object toMove)

increasePosition

public void increasePosition(List objects,
                             Object toMove)

moveToPosition

public void moveToPosition(List objects,
                           Map positionToObjects)
Moves multiple objects in the objects list to given destination indexes

Parameters:
objects - the list of objects
positionToObjects - a naturally sorted map with destination indexes as keys and the objects to move as values

moveToPosition

public void moveToPosition(List objects,
                           int initialPosition,
                           int targetPosition)
If moving more than one object at the same time please use moveToPosition(java.util.List, java.util.Map)

Moves an object at initialPosition index in the objects list to the targetPosition index

Parameters:
objects - the list of objects to modify
initialPosition - the current index of the object that should be moved in the objects list
targetPosition - the destination index


Copyright © 2002-2006 Atlassian. All Rights Reserved.