com.dynamide.util
Class StringList

java.lang.Object
  extended by com.dynamide.util.StringList
All Implemented Interfaces:
ICompare

public class StringList
extends java.lang.Object
implements ICompare

A Delphi-style StringList: internally keeps space for an object associated with every string on the list. If you don't use it, the object will just be null. You can use the object functions or the non-object functions. For example, add(String) or addObject(String, Object).

The list will behave like a hashtable if you keep the allowDuplicates property as its default value of 'false'.

There is no public 'sorted' property -- just call sort() whenever you wish to look at the list sorted.


Field Summary
static java.lang.String DUMPHTML_ELEMSEP
           
static java.lang.String DUMPHTML_END
           
static java.lang.String DUMPHTML_LINESEP
           
static java.lang.String DUMPHTML_OBJPLACEHOLDER
           
static java.lang.String DUMPHTML_START
           
 
Constructor Summary
StringList()
           
StringList(boolean caseSensitive)
           
StringList(java.util.Collection col)
           
StringList(java.util.Enumeration enumObj)
           
StringList(int initialSize)
           
StringList(java.util.Vector v)
           
 
Method Summary
 void add(java.util.Enumeration elems)
           
 int add(java.lang.String newstr)
          Warning: if the item to be added is already on the list, and allowDuplicates has been set to false, the index of the existing item is returned.
 void add(StringList other)
           
 void add(java.util.Vector other)
           
 void addAll(java.util.Set set)
           
 int addObject(java.lang.String newstr, java.lang.Object obj)
           
 void clear()
           
 boolean containsKey(java.lang.String key)
           
 void delete(int index)
           
 java.lang.String dump()
           
 java.lang.String dump(java.lang.String lineBreak)
           
 java.lang.String dump(java.lang.String lineBreak, boolean sorted)
           
 java.lang.String dump(java.lang.String start, java.lang.String lineSeparator, java.lang.String elementSeparator, java.lang.String objectPlaceholder, java.lang.String end, boolean dumphtml, boolean sorted, boolean dumpDynamideObjects)
          See also: com.dynamide.util.Tools.dump(Map.....)
 java.lang.String dumpHTML()
           
 java.lang.String dumpHTML(boolean sorted, boolean dumpDynamideObjects)
           
 java.util.Enumeration elements()
           
 java.lang.String first()
           
 java.lang.Object get(java.lang.Object key)
           
 java.lang.Object get(java.lang.String key, boolean ignoreCase)
           
 boolean getAllowDuplicates()
           
 boolean getAscendingSort()
           
 boolean getCaseSensitive()
           
 java.util.Vector getCopyAsVector()
           
 java.util.Map getMap()
           
 java.lang.Object getObject(java.lang.String key)
           
 java.lang.Object getObject(java.lang.String key, boolean ignoreCase)
           
 java.lang.Object getObjectAt(int i)
           
 java.util.Vector getObjectCopyAsVector()
           
 java.lang.String getString(int i)
           
 int indexOf(java.lang.String which)
           
 int indexOf(java.lang.String which, boolean ignoreCase)
           
 boolean insert(java.lang.String newstr, int index)
           
 boolean insertObject(java.lang.String newstr, java.lang.Object obj, int index)
           
 java.util.Enumeration keys()
           
 java.util.List keysList()
           
 java.lang.String last()
           
 boolean lessThan(java.lang.Object l, java.lang.Object r)
           
 boolean lessThanOrEqual(java.lang.Object l, java.lang.Object r)
           
 java.util.Enumeration objects()
           
 java.util.Collection objectsCollection()
           
 int put(java.lang.Object key, java.lang.Object obj)
           
 java.lang.Object remove(java.lang.Object which)
           
 java.lang.Object remove(java.lang.String which)
           
 void remove(java.lang.String which, boolean ignoreCase)
           
 void setAllowDuplicates(boolean new_value)
           
 void setAscendingSort(boolean ascending)
           
 void setCaseSensitive(boolean caseSensitive)
           
 void setObjectAt(int i, java.lang.Object obj)
           
 void setString(int i, java.lang.String newstr)
           
 void setString(int i, java.lang.String newstr, java.lang.Object obj)
           
 int size()
           
 void sort()
           
 java.util.Hashtable toHashtable()
           
 java.util.List toSortedList()
           
 java.lang.String toString()
           
 java.lang.String[] toStringArray()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DUMPHTML_START

public static final java.lang.String DUMPHTML_START
See Also:
Constant Field Values

DUMPHTML_LINESEP

public static final java.lang.String DUMPHTML_LINESEP
See Also:
Constant Field Values

DUMPHTML_ELEMSEP

public static final java.lang.String DUMPHTML_ELEMSEP
See Also:
Constant Field Values

DUMPHTML_OBJPLACEHOLDER

public static final java.lang.String DUMPHTML_OBJPLACEHOLDER
See Also:
Constant Field Values

DUMPHTML_END

public static final java.lang.String DUMPHTML_END
See Also:
Constant Field Values
Constructor Detail

StringList

public StringList()

StringList

public StringList(int initialSize)

StringList

public StringList(java.util.Vector v)

StringList

public StringList(java.util.Enumeration enumObj)

StringList

public StringList(java.util.Collection col)

StringList

public StringList(boolean caseSensitive)
Method Detail

getAscendingSort

public boolean getAscendingSort()

setAscendingSort

public void setAscendingSort(boolean ascending)

getCaseSensitive

public boolean getCaseSensitive()

setCaseSensitive

public void setCaseSensitive(boolean caseSensitive)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

dump

public java.lang.String dump()

dump

public java.lang.String dump(java.lang.String lineBreak)

dump

public java.lang.String dump(java.lang.String lineBreak,
                             boolean sorted)

dumpHTML

public java.lang.String dumpHTML()

dumpHTML

public java.lang.String dumpHTML(boolean sorted,
                                 boolean dumpDynamideObjects)

dump

public java.lang.String dump(java.lang.String start,
                             java.lang.String lineSeparator,
                             java.lang.String elementSeparator,
                             java.lang.String objectPlaceholder,
                             java.lang.String end,
                             boolean dumphtml,
                             boolean sorted,
                             boolean dumpDynamideObjects)
See also: com.dynamide.util.Tools.dump(Map.....)


toStringArray

public java.lang.String[] toStringArray()

elements

public java.util.Enumeration elements()

getMap

public java.util.Map getMap()
Returns:
a shallow clone of this StringList as a Map

keys

public java.util.Enumeration keys()

keysList

public java.util.List keysList()

objects

public java.util.Enumeration objects()

objectsCollection

public java.util.Collection objectsCollection()

getObjectCopyAsVector

public java.util.Vector getObjectCopyAsVector()

getCopyAsVector

public java.util.Vector getCopyAsVector()

getAllowDuplicates

public boolean getAllowDuplicates()

setAllowDuplicates

public void setAllowDuplicates(boolean new_value)

getString

public java.lang.String getString(int i)

setString

public void setString(int i,
                      java.lang.String newstr,
                      java.lang.Object obj)

setString

public void setString(int i,
                      java.lang.String newstr)

first

public java.lang.String first()

last

public java.lang.String last()

add

public int add(java.lang.String newstr)
Warning: if the item to be added is already on the list, and allowDuplicates has been set to false, the index of the existing item is returned. This does not mean that the index returned is the list size. Call size() to get the list size.


addAll

public void addAll(java.util.Set set)

addObject

public int addObject(java.lang.String newstr,
                     java.lang.Object obj)

put

public int put(java.lang.Object key,
               java.lang.Object obj)

get

public java.lang.Object get(java.lang.Object key)

get

public java.lang.Object get(java.lang.String key,
                            boolean ignoreCase)

getObject

public java.lang.Object getObject(java.lang.String key)

getObject

public java.lang.Object getObject(java.lang.String key,
                                  boolean ignoreCase)

getObjectAt

public java.lang.Object getObjectAt(int i)
Returns:
null if not found or out of bounds

setObjectAt

public void setObjectAt(int i,
                        java.lang.Object obj)

add

public void add(java.util.Vector other)

add

public void add(java.util.Enumeration elems)

add

public void add(StringList other)

clear

public void clear()

delete

public void delete(int index)

insertObject

public boolean insertObject(java.lang.String newstr,
                            java.lang.Object obj,
                            int index)

insert

public boolean insert(java.lang.String newstr,
                      int index)

indexOf

public int indexOf(java.lang.String which)

indexOf

public int indexOf(java.lang.String which,
                   boolean ignoreCase)

containsKey

public boolean containsKey(java.lang.String key)

remove

public java.lang.Object remove(java.lang.String which)

remove

public java.lang.Object remove(java.lang.Object which)
Returns:
null if not found

remove

public void remove(java.lang.String which,
                   boolean ignoreCase)

size

public int size()

sort

public void sort()

toSortedList

public java.util.List toSortedList()

toHashtable

public java.util.Hashtable toHashtable()

lessThan

public boolean lessThan(java.lang.Object l,
                        java.lang.Object r)
Specified by:
lessThan in interface ICompare

lessThanOrEqual

public boolean lessThanOrEqual(java.lang.Object l,
                               java.lang.Object r)
Specified by:
lessThanOrEqual in interface ICompare


Copyright 2001-2013 DYNAMIDE.COM. All Rights Reserved.