import java.util.Observable; /** * Wrapper to call the sorting algorithm on a line * * @author Alexander Schaap * * @param type of the words */ public class Alphabetizer> implements AlphabetizerInterface { // lineNumber is forced to be Object because of Observer's interface @Override public void update(Observable o, Object sortingAlgorithm) { // two SupressWarnings for casting types that are restricted by Observer @SuppressWarnings("unchecked") LineStorageInterface[][]> sls = (LineStorageInterface[][]>) o; @SuppressWarnings("unchecked") SortInterface algorithm = (SortInterface) sortingAlgorithm; WordInterface[][] line = sls.getLine(sls.length()-1); algorithm.sort(line); sls.setLine(sls.length()-1, line); } }