Package org.apache.fop.hyphenation
Class CharVector
- java.lang.Object
-
- org.apache.fop.hyphenation.CharVector
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class CharVector extends java.lang.Object implements java.lang.Cloneable, java.io.SerializableThis class implements a simple char vector with access to the underlying array.
This work was authored by Carlos Villegas (cav@uniscope.co.jp).
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intalloc(int size)This is to implement memory allocation in the array.intcapacity()Obtain capacity of array.voidclear()Reset length of vector, but don't clear contents.java.lang.Objectclone()charget(int index)Get char at index.char[]getArray()Obtain char vector array.intlength()Obtain number of items in array.voidput(int index, char val)Pet char at index.voidtrimToSize()Trim char vector to current length.
-
-
-
Constructor Detail
-
CharVector
public CharVector()
Construct char vector instance with default block size.
-
CharVector
public CharVector(int capacity)
Construct char vector instance.- Parameters:
capacity- initial block size
-
CharVector
public CharVector(char[] a)
Construct char vector instance.- Parameters:
a- char array to use
-
CharVector
public CharVector(char[] a, int capacity)Construct char vector instance.- Parameters:
a- char array to usecapacity- initial block size
-
-
Method Detail
-
clear
public void clear()
Reset length of vector, but don't clear contents.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException- Overrides:
clonein classjava.lang.Object- Throws:
java.lang.CloneNotSupportedException
-
getArray
public char[] getArray()
Obtain char vector array.- Returns:
- char array
-
length
public int length()
Obtain number of items in array.- Returns:
- number of items
-
capacity
public int capacity()
Obtain capacity of array.- Returns:
- current capacity of array
-
put
public void put(int index, char val)Pet char at index.- Parameters:
index- the indexval- a char
-
get
public char get(int index)
Get char at index.- Parameters:
index- the index- Returns:
- a char
-
alloc
public int alloc(int size)
This is to implement memory allocation in the array. Like malloc().- Parameters:
size- to allocate- Returns:
- previous length
-
trimToSize
public void trimToSize()
Trim char vector to current length.
-
-