Package sunlabs.brazil.sunlabs
Class ListTemplate.MyList
- java.lang.Object
-
- java.util.Dictionary
-
- sunlabs.brazil.sunlabs.ListTemplate.MyList
-
- All Implemented Interfaces:
PropertiesCacheManager.Saveable
- Enclosing class:
- ListTemplate
public static class ListTemplate.MyList extends java.util.Dictionary implements PropertiesCacheManager.Saveable
Implement a list of strings. This uses a Vector for its internal implementation, and is a Dictionary to allow convenient access to portions of the list. By implementing Saveable, lists can participate in persistence.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
append(java.lang.String s, java.lang.String delim)
Append a list to the end of the named listint
chunks()
void
clear()
Clear a list.void
delete(int i)
Remove an element by index.java.util.Enumeration
elements()
Return the actual list items.java.lang.Object
get(java.lang.Object k)
void
insert(java.lang.String s, java.lang.String delim, int n)
Insert a list before position n.boolean
isEmpty()
The current object state is the "default"; "save" does not need to write out any state.java.util.Enumeration
keys()
Return an enumeration of the "special" keys for this list.void
load(java.io.InputStream in)
load a properties representation of the object, then create the object from it.void
max(int n)
Set the max list size.java.lang.Object
put(java.lang.Object key, java.lang.Object value)
This is never used; It's required by the interfacejava.lang.Object
remove(java.lang.Object o)
We should never call this; it's required by the interface.void
remove(java.lang.String s, java.lang.String delim)
Remove items from a list, by name.void
save(java.io.OutputStream out, java.lang.String header)
Create an ascii representation of this object in a Java Properties format.void
setDelim(java.lang.String delim)
Set the delimiter for returning ranges.int
size()
void
sort()
java.lang.String
toString()
void
unique()
Remove all non unique elements of the list.
-
-
-
Method Detail
-
size
public int size()
- Specified by:
size
in classjava.util.Dictionary
-
isEmpty
public boolean isEmpty()
Description copied from interface:PropertiesCacheManager.Saveable
The current object state is the "default"; "save" does not need to write out any state.- Specified by:
isEmpty
in interfacePropertiesCacheManager.Saveable
- Specified by:
isEmpty
in classjava.util.Dictionary
-
sort
public void sort()
-
insert
public void insert(java.lang.String s, java.lang.String delim, int n)
Insert a list before position n.- Parameters:
s
- The list to insertdelim
- The list delimiter (null for a single item(n
- The position to insert before
-
append
public void append(java.lang.String s, java.lang.String delim)
Append a list to the end of the named list
-
remove
public void remove(java.lang.String s, java.lang.String delim)
Remove items from a list, by name.
-
remove
public java.lang.Object remove(java.lang.Object o)
We should never call this; it's required by the interface.- Specified by:
remove
in classjava.util.Dictionary
-
delete
public void delete(int i)
Remove an element by index.
-
clear
public void clear()
Clear a list.
-
max
public void max(int n)
Set the max list size.
-
unique
public void unique()
Remove all non unique elements of the list. XXX: (cache stupid!)
-
setDelim
public void setDelim(java.lang.String delim)
Set the delimiter for returning ranges.
-
keys
public java.util.Enumeration keys()
Return an enumeration of the "special" keys for this list.- Specified by:
keys
in classjava.util.Dictionary
-
elements
public java.util.Enumeration elements()
Return the actual list items.- Specified by:
elements
in classjava.util.Dictionary
-
get
public java.lang.Object get(java.lang.Object k)
- Specified by:
get
in classjava.util.Dictionary
-
put
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
This is never used; It's required by the interface- Specified by:
put
in classjava.util.Dictionary
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
chunks
public int chunks()
-
save
public void save(java.io.OutputStream out, java.lang.String header) throws java.io.IOException
Description copied from interface:PropertiesCacheManager.Saveable
Create an ascii representation of this object in a Java Properties format.- Specified by:
save
in interfacePropertiesCacheManager.Saveable
- Throws:
java.io.IOException
-
load
public void load(java.io.InputStream in) throws java.io.IOException
load a properties representation of the object, then create the object from it.- Specified by:
load
in interfacePropertiesCacheManager.Saveable
- Throws:
java.io.IOException
-
-