de.cau.cs.kieler.core.model.util
Class SortCommand<T>

java.lang.Object
  extended by org.eclipse.emf.common.command.AbstractCommand
      extended by de.cau.cs.kieler.core.model.util.SortCommand<T>
Type Parameters:
T - Type to sort.
All Implemented Interfaces:
Command

public class SortCommand<T>
extends AbstractCommand

Command to sort an EList using a given Comparator.

Rating red

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.command.AbstractCommand
AbstractCommand.NonDirtying
 
Field Summary
 
Fields inherited from class org.eclipse.emf.common.command.AbstractCommand
description, isExecutable, isPrepared, label
 
Constructor Summary
SortCommand(EList<T> theList, Comparator<T> theComparator)
          Constructor, taking the list to sort and the comparator to use for sorting.
 
Method Summary
 void execute()
          
protected  EList<T> getList()
          Get the list to sort.
protected  boolean prepare()
           
 void redo()
          
 void undo()
           
 
Methods inherited from class org.eclipse.emf.common.command.AbstractCommand
canExecute, canUndo, chain, dispose, getAffectedObjects, getDescription, getLabel, getResult, setDescription, setLabel, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SortCommand

public SortCommand(EList<T> theList,
                   Comparator<T> theComparator)
Constructor, taking the list to sort and the comparator to use for sorting.

Parameters:
theList - to sort
theComparator - to use for sorting
Method Detail

execute

public void execute()


redo

public void redo()


undo

public void undo()
Specified by:
undo in interface Command
Overrides:
undo in class AbstractCommand

getList

protected EList<T> getList()
Get the list to sort.

Returns:
list to sort.

prepare

protected boolean prepare()
Overrides:
prepare in class AbstractCommand