APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xml.internal.utils

public Class StringToStringTable

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.

Field Summary

Modifier and TypeField and Description
private int
m_blocksize

Size of blocks to allocate

private int
m_firstFree

Number of strings this contains

private String[]
m_map

Array of strings this contains

private int
m_mapSize

Size of this table

Constructor Summary

AccessConstructor and Description
public
StringToStringTable()

Default constructor.

public
StringToStringTable(int
Size of blocks to allocate
blocksize
)

Construct a StringToStringTable, using the given block size.

Method Summary

Modifier and TypeMethod and Description
public final boolean

Returns:

True if the given string is in this table
contains
(String
String to look up
key
)

Tell if the table contains the given string.

public final boolean

Returns:

True if the given value is in the table.
containsValue
(String
value to look up
val
)

Tell if the table contains the given string.

public final String

Returns:

The string at the given index.
elementAt
(int
index of the string to look up.
i
)

Get the nth element.

public final String

Returns:

return the value of the string or null if not found.
get
(String
String to look up
key
)

Tell if the table contains the given string.

public final String

Returns:

the string associated with the given value or null if not found
getByValue
(String
Value of the string to look up
val
)

Tell if the table contains the given string in the value.

public final String

Returns:

The value of the string or null if not found
getIgnoreCase
(String
String to look up
key
)

Tell if the table contains the given string.

public final int

Returns:

Number of strings in the list
getLength
()

Get the length of the list.

public final void
put(String
String to add to the list
key
,
String
Value of the string
value
)

Append a string onto the vector.

public final void
remove(String
String to remove from the table
key
)

Remove the given string and its value from this table.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

m_blocksizeback to summary
private int m_blocksize

Size of blocks to allocate

m_firstFreeback to summary
private int m_firstFree

Number of strings this contains

m_mapback to summary
private String[] m_map

Array of strings this contains

m_mapSizeback to summary
private int m_mapSize

Size of this table

Constructor Detail

StringToStringTableback to summary
public StringToStringTable()

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

StringToStringTableback to summary
public StringToStringTable(int blocksize)

Construct a StringToStringTable, using the given block size.

Parameters
blocksize:int

Size of blocks 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 up

Returns:boolean

True if the given string is in this table

containsValueback to summary
public final boolean containsValue(String val)

Tell if the table contains the given string.

Parameters
val:String

value to look up

Returns:boolean

True if the given value is in the table.

elementAtback to summary
public final String elementAt(int i)

Get the nth element.

Parameters
i:int

index of the string to look up.

Returns:String

The string at the given index.

getback to summary
public final String get(String key)

Tell if the table contains the given string.

Parameters
key:String

String to look up

Returns:String

return the value of the string or null if not found.

getByValueback to summary
public final String getByValue(String val)

Tell if the table contains the given string in the value.

Parameters
val:String

Value of the string to look up

Returns:String

the string associated with the given value or null if not found

getIgnoreCaseback to summary
public final String getIgnoreCase(String key)

Tell if the table contains the given string. Ignore case

Parameters
key:String

String to look up

Returns:String

The value of the string or null if not found

getLengthback to summary
public final int getLength()

Get the length of the list.

Returns:int

Number of strings in the list

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

Append a string onto the vector. The strings go to the even locations in the array and the values in the odd.

Parameters
key:String

String to add to the list

value:String

Value of the string

removeback to summary
public final void remove(String key)

Remove the given string and its value from this table.

Parameters
key:String

String to remove from the table