com.partnersoft.data
Class DynamicCharArray

java.lang.Object
  extended by com.partnersoft.data.DynamicArray
      extended by com.partnersoft.data.DynamicCharArray
Direct Known Subclasses:
DemCharArray

public class DynamicCharArray
extends DynamicArray

A managed, dynamically-allocated array of chars.

Copyright 2001-2009 Partner Software, Inc.

Version:
$Id: DynamicCharArray.java 2114 2009-09-21 20:57:28Z paul $
Author:
Paul Reavis

Field Summary
 char[] array
           
 
Fields inherited from class com.partnersoft.data.DynamicArray
arrayObject, capacity, end, fastGrowthFactor, fastGrowthLimit, slowGrowthAmount, start
 
Constructor Summary
DynamicCharArray()
          Creates an empty char array, with size and capacity of 0.
DynamicCharArray(char... contents)
          Creates a char array with the given initial contents.
DynamicCharArray(int size)
          Creates a char array of the given size.
 
Method Summary
 void add(char nextChar)
          Appends the given char to the end of this array.
 void append(char... stuff)
          Appends the given chars or char[] onto the end of this array.
 void append(java.lang.String stuff)
          Appends the given String as chars onto the end of this array.
 java.lang.String contentsToString()
          Returns the contents as a String.
 void newArray(int size)
          Allocates a new, empty array of the given size and assign it to the arrayObject property.
 java.lang.String readStringAt(int start, int end)
           
 java.lang.String readTrimmedStringAt(int start, int end)
           
 
Methods inherited from class com.partnersoft.data.DynamicArray
append, clear, copy, copy, copyExactly, copyFrom, copyTo, insert, isEmpty, makeRoomFor, makeRoomFor, pack, remove, size, subsection, tidy, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

array

public char[] array
Constructor Detail

DynamicCharArray

public DynamicCharArray()
Creates an empty char array, with size and capacity of 0.


DynamicCharArray

public DynamicCharArray(int size)
Creates a char array of the given size.


DynamicCharArray

public DynamicCharArray(char... contents)
Creates a char array with the given initial contents.

Method Detail

append

public void append(char... stuff)
Appends the given chars or char[] onto the end of this array.


append

public void append(java.lang.String stuff)
Appends the given String as chars onto the end of this array.

Parameters:
stuff -

add

public void add(char nextChar)
Appends the given char to the end of this array.

Parameters:
nextChar -

contentsToString

public java.lang.String contentsToString()
Returns the contents as a String. toString() would have been a better name but is already taken.

Returns:

readTrimmedStringAt

public java.lang.String readTrimmedStringAt(int start,
                                            int end)

readStringAt

public java.lang.String readStringAt(int start,
                                     int end)

newArray

public void newArray(int size)
Description copied from class: DynamicArray
Allocates a new, empty array of the given size and assign it to the arrayObject property. It is assumed that subclasses will also set it to a variable of the correct class (e.g. char[]) for ease of access as well. Copying of existing contents is Dynamic by this superclass. Your code should look something like this:
 public abstract void newArray(int size) {
     arrayObject = array = new Foo[size];
 }
 

Specified by:
newArray in class DynamicArray