Package adams.data
Class SharedStringsTable
- java.lang.Object
-
- adams.data.SharedStringsTable
-
- All Implemented Interfaces:
Serializable,Cloneable
public class SharedStringsTable extends Object implements Serializable, Cloneable
Common strings are represented by integers, conserving memory.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SharedStringsTable()Initializes the table.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassign(SharedStringsTable table)Retrieves all the values from the specified table, discards its own values.voidclear()Resets the table.SharedStringsTableclone()Returns a clone of itself.intgetIndex(String s)Returns the index for the given string.StringgetString(int index)Returns the string associated with the given index.intsize()Returns the number of stored mappings.StringtoString()Returns a short string description of the table.
-
-
-
Method Detail
-
clear
public void clear()
Resets the table.
-
assign
public void assign(SharedStringsTable table)
Retrieves all the values from the specified table, discards its own values.- Parameters:
table- the table to obtain the data from
-
getIndex
public int getIndex(String s)
Returns the index for the given string. If not already present, it will add the string to its internal- Parameters:
s- the string to get the index for- Returns:
- the index
-
getString
public String getString(int index)
Returns the string associated with the given index.- Parameters:
index- the index of the string to retrieve- Returns:
- the associated string, null if not found
-
size
public int size()
Returns the number of stored mappings.- Returns:
- the number of mappings
-
clone
public SharedStringsTable clone()
Returns a clone of itself.
-
-