Top Description Fields Constructors Methods
com.sun.org.apache.xml.internal.serializer.utils

public final Class StringToIntTable

extends Object
Class Inheritance

A very simple lookup table that stores a list of strings, the even number strings being keys, and the odd number strings being values. This class is a copy of the one in com.sun.org.apache.xml.internal.utils. It exists to cut the serializers dependancy on that package. This class is not a public API, it is only public so it can be used in com.sun.org.apache.xml.internal.serializer.

Field Summary

Modifier and TypeField and Description
public static final int
private int
m_blocksize

Block size to allocate

private int
m_firstFree

Number of ints in the table

private String[]
m_map

Array of strings this table points to.

private int
m_mapSize

Size of this table

private int[]
m_values

Array of ints this table points.

Constructor Summary

AccessConstructor and Description
public
StringToIntTable()

Default constructor.

public
StringToIntTable(int
Size of block to allocate
blocksize
)

Construct a StringToIntTable, using the given block size.

Method Summary

Modifier and TypeMethod and Description
public final boolean

Returns:

True if the string is in the table
contains
(String
String to look for
key
)

Tell if the table contains the given string.

public final int

Returns:

The String's int value
get
(String
String to look for
key
)

Tell if the table contains the given string.

public final int

Returns:

The string's int value
getIgnoreCase
(String
String to look for
key
)

Tell if the table contains the given string.

public final int

Returns:

the length of the list
getLength
()

Get the length of the list.

public final String[]

Returns:

Array of strings
keys
()

Return array of keys in the table.

public final void
put(String
String to append
key
,
int
The int value of the string
value
)

Append a string onto the vector.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INVALID_KEYback to summary
public static final int INVALID_KEY
m_blocksizeback to summary
private int m_blocksize

Block size to allocate

m_firstFreeback to summary
private int m_firstFree

Number of ints in the table

m_mapback to summary
private String[] m_map

Array of strings this table points to. Associated with ints in m_values

m_mapSizeback to summary
private int m_mapSize

Size of this table

m_valuesback to summary
private int[] m_values

Array of ints this table points. Associated with strings from m_map.

Constructor Detail

StringToIntTableback to summary
public StringToIntTable()

Default constructor. Note that the default block size is very small, for small lists.

StringToIntTableback to summary
public StringToIntTable(int blocksize)

Construct a StringToIntTable, using the given block size.

Parameters
blocksize:int

Size of block to allocate

Method Detail

containsback to summary
public final boolean contains(String key)

Tell if the table contains the given string.

Parameters
key:String

String to look for

Returns:boolean

True if the string is in the table

getback to summary
public final int get(String key)

Tell if the table contains the given string.

Parameters
key:String

String to look for

Returns:int

The String's int value

getIgnoreCaseback to summary
public final int getIgnoreCase(String key)

Tell if the table contains the given string. Ignore case.

Parameters
key:String

String to look for

Returns:int

The string's int value

getLengthback to summary
public final int getLength()

Get the length of the list.

Returns:int

the length of the list

keysback to summary
public final String[] keys()

Return array of keys in the table.

Returns:String[]

Array of strings

putback to summary
public final void put(String key, int value)

Append a string onto the vector.

Parameters
key:String

String to append

value:int

The int value of the string