sunlabs.brazil.sunlabs
Class ListTemplate.MyList

java.lang.Object
  extended by java.util.Dictionary
      extended by 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.


Field Summary
 int chunk
           
 int chunksize
           
 int overlap
           
 
Constructor Summary
ListTemplate.MyList()
           
ListTemplate.MyList(java.lang.String name)
          Create a named list object.
 
Method Summary
 void append(java.lang.String s, java.lang.String delim)
          Append a list to the end of the named list
 int 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 interface
 java.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

chunk

public int chunk

chunksize

public int chunksize

overlap

public int overlap
Constructor Detail

ListTemplate.MyList

public ListTemplate.MyList(java.lang.String name)
Create a named list object.


ListTemplate.MyList

public ListTemplate.MyList()
Method Detail

size

public int size()
Specified by:
size in class java.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 interface PropertiesCacheManager.Saveable
Specified by:
isEmpty in class java.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 insert
delim - 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 class java.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 class java.util.Dictionary

elements

public java.util.Enumeration elements()
Return the actual list items.

Specified by:
elements in class java.util.Dictionary

get

public java.lang.Object get(java.lang.Object k)
Specified by:
get in class java.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 class java.util.Dictionary

toString

public java.lang.String toString()
Overrides:
toString in class java.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 interface PropertiesCacheManager.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 interface PropertiesCacheManager.Saveable
Throws:
java.io.IOException