edu.rice.cs.drjava.model
Class ClipboardHistoryModel

java.lang.Object
  extended by edu.rice.cs.drjava.model.ClipboardHistoryModel

public class ClipboardHistoryModel
extends java.lang.Object

Model class for clipboard history.


Field Summary
private  java.util.LinkedList<java.lang.String> _history
          The history of strings.
private  int _maxSize
          Maximum size of the history.
private static ClipboardHistoryModel ONLY
          Singleton instance.
 
Constructor Summary
private ClipboardHistoryModel(int maxSize)
          Create a new clipboard history model.
 
Method Summary
 java.lang.String getMostRecent()
          Return the most recent string, or null if nothing is in the history.
 java.util.List<java.lang.String> getStrings()
          Return a copy of the history of strings.
 void put(java.lang.String s)
          Add a string to the history.
 void resize(int maxSize)
          Sets the maximum size.
static ClipboardHistoryModel singleton()
          Singleton accessor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_maxSize

private int _maxSize
Maximum size of the history.


_history

private java.util.LinkedList<java.lang.String> _history
The history of strings. The most recent string will be the last.


ONLY

private static ClipboardHistoryModel ONLY
Singleton instance.

Constructor Detail

ClipboardHistoryModel

private ClipboardHistoryModel(int maxSize)
Create a new clipboard history model.

Parameters:
maxSize - maximum size of history
Method Detail

singleton

public static ClipboardHistoryModel singleton()
Singleton accessor.


resize

public void resize(int maxSize)
Sets the maximum size. May kick old strings out.


put

public void put(java.lang.String s)
Add a string to the history. If it is already in the history, it will get moved to the end, making it the most recent string.


getStrings

public java.util.List<java.lang.String> getStrings()
Return a copy of the history of strings.


getMostRecent

public java.lang.String getMostRecent()
Return the most recent string, or null if nothing is in the history.