|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.rosuda.util.RecentList
public class RecentList
RecentList manages a list of unique String
entries. The list has a limited size and the "oldest" entries are removed if an overflow occurs. New entries are added to the top of the list and duplicates are always removed (effectively by moving the existing entry to the top). The typical use of the list is to hold the names of most recently accessed files. This list also supports 'short' form of the contents which is the file name. If two entries have the same file name, then unambigous form is created, using the full path.
Field Summary | |
---|---|
boolean |
autoSave
if set to true then modification operations such as addEntry(java.lang.String) or reset() call implicitly . |
Constructor Summary | |
---|---|
RecentList(java.lang.String appName,
java.lang.String key,
int maxEntries)
creates a new recent list and loads its content from the global config file (unless key== null ). |
Method Summary | |
---|---|
void |
addEntry(java.lang.String e)
adds a new entry to the list. |
int |
count()
retrieves the nr. of entries in the list |
java.lang.String[] |
getAllEntries()
returns the entire array of entries. |
int |
getSerial()
the serial ID is incremented whenever a change was made to the list. |
java.lang.String[] |
getShortEntries()
get the short form of the entries as an array. |
void |
reset()
resets/clears the list |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public boolean autoSave
true
then modification operations such as addEntry(java.lang.String)
or reset()
call implicitly .
Constructor Detail |
---|
public RecentList(java.lang.String appName, java.lang.String key, int maxEntries)
null
).
application
- name (to be used for global config file), if null
then the application name is set to "default".key
- key for the global config file (the config key is constructed as "appName."+app+"."+key). If null
then config file is not used.maxEntries
- the maximal number of entries. Any new entries added after the maximal number was reached will replace the oldest entries.Method Detail |
---|
public void reset()
public void addEntry(java.lang.String e)
e
- new list entrypublic int count()
public int getSerial()
public java.lang.String[] getAllEntries()
count()
to obtain the number of valid entries.
public java.lang.String[] getShortEntries()
getAllEntries()
the array length is always count()
. Assuming that the stored values are paths to files, the short form is generated by returing the file name only, except for duplicate file names which are returned in a form that is distinguishable.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |