|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.drjava.model.EventNotifier<RegionManagerListener<BrowserDocumentRegion>>
edu.rice.cs.drjava.model.BrowserHistoryManager
public class BrowserHistoryManager
Browser history manager for the entire model. Follows readers/writers locking protocol of EventNotifier.
| Field Summary | |
|---|---|
private java.util.Stack<BrowserDocumentRegion> |
_futureRegions
|
private int |
_maxSize
|
private java.util.Stack<BrowserDocumentRegion> |
_pastRegions
List of regions. |
static int |
DIFF_THRESHOLD
Two regions are similar if they are in the same document and not more than DIFF_THRESHOLD lines apart. |
| Fields inherited from class edu.rice.cs.drjava.model.EventNotifier |
|---|
_listeners, _lock |
| Constructor Summary | |
|---|---|
BrowserHistoryManager()
Create a new ConcreteRegionManager without maximum size. |
|
BrowserHistoryManager(int size)
Create a new ConcreteRegionManager with the specified maximum size. |
|
| Method Summary | |
|---|---|
void |
addBrowserRegion(BrowserDocumentRegion r,
GlobalEventNotifier notifier)
Add the supplied DocumentRegion r to the manager as current region. |
void |
addBrowserRegionBefore(BrowserDocumentRegion r,
GlobalEventNotifier notifier)
Add the supplied DocumentRegion r to the manager before the current region. |
void |
changeRegion(BrowserDocumentRegion region,
Lambda<BrowserDocumentRegion,java.lang.Object> cmd)
Apply the given command to the specified region to change it. |
void |
clearBrowserRegions()
Tells the manager to remove all regions. |
BrowserDocumentRegion |
getCurrentRegion()
|
int |
getMaximumSize()
|
java.util.SortedSet<BrowserDocumentRegion> |
getRegions()
|
boolean |
isCurrentRegionFirst()
|
boolean |
isCurrentRegionLast()
|
BrowserDocumentRegion |
nextCurrentRegion(GlobalEventNotifier notifier)
Make the region that is more recent the current region. |
BrowserDocumentRegion |
prevCurrentRegion(GlobalEventNotifier notifier)
Make the region that is less recent the current region. |
void |
remove(BrowserDocumentRegion r)
Remove the given DocumentRegion from the manager. |
void |
setMaximumSize(int size)
Set the maximum number of regions that can be stored in this manager. |
private void |
shrinkManager()
Remove regions if there are more than the maximum number allowed. |
static boolean |
similarRegions(BrowserDocumentRegion r1,
BrowserDocumentRegion r2)
Return true if the two regions are similar. |
java.lang.String |
toString()
|
| Methods inherited from class edu.rice.cs.drjava.model.EventNotifier |
|---|
addListener, removeAllListeners, removeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DIFF_THRESHOLD
private volatile java.util.Stack<BrowserDocumentRegion> _pastRegions
private volatile java.util.Stack<BrowserDocumentRegion> _futureRegions
private volatile int _maxSize
| Constructor Detail |
|---|
public BrowserHistoryManager(int size)
size - maximum number of regions that can be stored in this manager.public BrowserHistoryManager()
| Method Detail |
|---|
public void addBrowserRegion(BrowserDocumentRegion r,
GlobalEventNotifier notifier)
r - the DocumentRegion to be inserted into the manager
public void addBrowserRegionBefore(BrowserDocumentRegion r,
GlobalEventNotifier notifier)
r - the DocumentRegion to be inserted into the managerprivate void shrinkManager()
public void remove(BrowserDocumentRegion r)
r - the DocumentRegion to be removed.public java.util.SortedSet<BrowserDocumentRegion> getRegions()
public void clearBrowserRegions()
public BrowserDocumentRegion getCurrentRegion()
public boolean isCurrentRegionFirst()
public boolean isCurrentRegionLast()
public BrowserDocumentRegion nextCurrentRegion(GlobalEventNotifier notifier)
public BrowserDocumentRegion prevCurrentRegion(GlobalEventNotifier notifier)
public void setMaximumSize(int size)
size - maximum number of regions, or 0 if no maximumpublic int getMaximumSize()
public void changeRegion(BrowserDocumentRegion region,
Lambda<BrowserDocumentRegion,java.lang.Object> cmd)
region - the region to find and changecmd - command that mutates the region.
public static boolean similarRegions(BrowserDocumentRegion r1,
BrowserDocumentRegion r2)
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||