public class CharVector
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
This class implements a simple char vector with access to the underlying array.
This work was authored by Carlos Villegas (cav@uniscope.co.jp).
| Constructor and Description |
|---|
CharVector()
Construct char vector instance with default block size.
|
CharVector(char[] a)
Construct char vector instance.
|
CharVector(char[] a,
int capacity)
Construct char vector instance.
|
CharVector(int capacity)
Construct char vector instance.
|
| Modifier and Type | Method and Description |
|---|---|
int |
alloc(int size)
This is to implement memory allocation in the array.
|
int |
capacity()
Obtain capacity of array.
|
void |
clear()
Reset length of vector, but don't clear contents.
|
java.lang.Object |
clone() |
char |
get(int index)
Get char at index.
|
char[] |
getArray()
Obtain char vector array.
|
int |
length()
Obtain number of items in array.
|
void |
put(int index,
char val)
Pet char at index.
|
void |
trimToSize()
Trim char vector to current length.
|
public CharVector()
public CharVector(int capacity)
capacity - initial block sizepublic CharVector(char[] a)
a - char array to usepublic CharVector(char[] a,
int capacity)
a - char array to usecapacity - initial block sizepublic void clear()
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic char[] getArray()
public int length()
public int capacity()
public void put(int index,
char val)
index - the indexval - a charpublic char get(int index)
index - the indexpublic int alloc(int size)
size - to allocatepublic void trimToSize()
Copyright 1999-2022 The Apache Software Foundation. All Rights Reserved.