|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmr3d.collections.DynamicStringArray
The class DynamicStringArray is a wrapper for
java.lang.Vector providing an easy way to handle
a dynamic array of String-values.
The following short example demontrates the usage of
the dynamic String array wrapper.
DynamicStringArray myStrArray = new DynamicStringArray();
myStrArray.add("Hi");
System.out.println(myStrArray.get(0)); // "Hi"
myStrArray.replaceAt(0,"Hello");
System.out.println(myStrArray.get(0)); // "Hello"
myStrArray.add("World!");
System.out.println(myStrArray.size()); // 2
| Field Summary | |
private java.util.Vector |
elements
Vector containing the array data. |
| Fields inherited from interface mr3d.debug.Debugable |
ERROR_INT, ERROR_STRING |
| Constructor Summary | |
DynamicStringArray()
Creates a new dynamic String array. |
|
| Method Summary | |
void |
add(java.lang.String newValue)
Adds a new String-object with the specified
value to the array. |
void |
appendAt(int index,
java.lang.String appendix)
Appends the String-object at the specified
position with the given String-object. |
java.lang.String |
get(int index)
Returns a String representation of the
String object at the specified index.
|
int |
indexOf(java.lang.String compareString)
Returns the index of the first occurence. |
void |
removeAt(int index)
Removes the String-object at the specified position. |
void |
replaceAt(int index,
java.lang.String replacement)
Replaces the String-object at the specified
position with a new String-object. |
int |
size()
Returns the the number of elements stored in the code>elements vector. |
void |
toConsole()
Prints the contents of the object to the Java console. |
void |
toConsole(java.lang.String msgString)
Prints the contents of the object to the Java console together with an information string. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private java.util.Vector elements
Vector containing the array data.
| Constructor Detail |
public DynamicStringArray()
String array.
| Method Detail |
public void add(java.lang.String newValue)
String-object with the specified
value to the array.
newValue - value to be added to the array
public void appendAt(int index,
java.lang.String appendix)
String-object at the specified
position with the given String-object.
index - position of the String-object
to be extendedappendix - String-object that is to be
appended to the original Stringpublic java.lang.String get(int index)
String representation of the
String object at the specified index.
If the specefied index is invalid the method returns
ERROR_STRING.
index - index of the value
String representation
of the objects at the specified index
out of boundspublic int indexOf(java.lang.String compareString)
compareString - the String object of which the
index is to be returned
String object.public void removeAt(int index)
String-object at the specified position.
index - position of the String-
object to be removed
public void replaceAt(int index,
java.lang.String replacement)
String-object at the specified
position with a new String-object.
index - position of the String value
in the arrayreplacement - replacement Stringpublic int size()
public void toConsole()
Debugable
toConsole in interface Debugablepublic void toConsole(java.lang.String msgString)
Debugable
toConsole in interface Debugable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||