edu.washington.cs.supple.customization.state
Class History

java.lang.Object
  extended byedu.washington.cs.supple.customization.state.History

public class History
extends java.lang.Object

The history maintains a list of HistoryRecords. It is a log of all modifications that were applied to the currently loaded part of the UI. Each HistoryRecord represents an action.

Author:
raphael

Constructor Summary
History()
          Creates a new History object which is initialized to an empty list of HistoryRecords.
 
Method Summary
 void addHistoryRecord(HistoryRecord r)
          Adds a new history record to the end of the list.
 java.util.List getHistoryRecords(Command command)
          Returns a list of all history records that were created by a defined customization command.
 int getNumberOfHistoryRecords()
          Returns the number of history records contained in this history.
 HistoryRecord popLastHistoryRecord()
          Pops the last (most recent) history record from the list and returns it.
 void printHistory()
          Prints the history to the screen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

History

public History()
Creates a new History object which is initialized to an empty list of HistoryRecords.

Method Detail

addHistoryRecord

public void addHistoryRecord(HistoryRecord r)
Adds a new history record to the end of the list.

Parameters:
r - new history record

getHistoryRecords

public java.util.List getHistoryRecords(Command command)
Returns a list of all history records that were created by a defined customization command. Note that a customization command might be automatically applied to multiple parts of the UI (generalization). In this case this method returns a list of modifications to the UI, that were made according to a single command.

Parameters:
command - a customization command
Returns:
a list of history records that are associated with a customization command

popLastHistoryRecord

public HistoryRecord popLastHistoryRecord()
Pops the last (most recent) history record from the list and returns it. Note that the record is deleted from the history.

Returns:
last history record

getNumberOfHistoryRecords

public int getNumberOfHistoryRecords()
Returns the number of history records contained in this history.

Returns:
size of history

printHistory

public void printHistory()
Prints the history to the screen. This method can be used for debugging.