com.webrenderer
Class History

java.lang.Object
  extended bycom.webrenderer.History

public class History
extends java.lang.Object

Represents a web browser history. Maintains a list of pages and associated dates at which they were accessed. The pages are sorted such that the newest pages appear at the start of the history collection.


Constructor Summary
History()
          Creates an empty History Object
 
Method Summary
 void addPage(java.lang.String URL)
          Adds a page with the given URL and the current date to the History.
 void addPage(java.lang.String URL, boolean overwrite)
          Adds a page with the given URL and the current date to the History.
 void clear()
          Removes all items from the history.
 HistoryPage getPageAt(int i)
          Returns the ith page in the History
 int length()
          Gets the history size.
 void removePage(java.lang.String URL)
          Removes the page with the given URL from the history list.
 java.lang.String toString()
          Gets the history as a String.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

History

public History()
Creates an empty History Object

Method Detail

addPage

public void addPage(java.lang.String URL)
Adds a page with the given URL and the current date to the History. Sorts the list of History pages afterwards

Parameters:
URL - A String containing the URL of the page to be added.

addPage

public void addPage(java.lang.String URL,
                    boolean overwrite)
Adds a page with the given URL and the current date to the History. Sorts the list of History pages afterwards.

Parameters:
URL - A String containing the URL of the page to be added.
overwrite - A boolean that determines whether the newer or older version of the url should be kept if the url already exists in the list.

removePage

public void removePage(java.lang.String URL)
Removes the page with the given URL from the history list.

Parameters:
URL - A string containing the URL of the page to be removed.

clear

public void clear()
Removes all items from the history.


toString

public java.lang.String toString()
Gets the history as a String.

Returns:
a String representation of the history The format of this string is a list of page strings in the following format. (PageURL)\t||\t(DateViewed)\n

length

public int length()
Gets the history size.

Returns:
the number of pages in the History.

getPageAt

public HistoryPage getPageAt(int i)
Returns the ith page in the History

Parameters:
i - the index of the page to return.