Drag[en]gine Script Module DragonScript
1.23
|
String identifier for efficient comparison. More...
Public Member Functions | |
Constructors | |
StringID | new () |
Create string identifier for the empty string. More... | |
StringID | new (String identifier) |
Create string identifier for string. More... | |
Management | |
String | getString () |
String this string identifier represents. More... | |
String | toString () |
String this string identifier represents. More... | |
bool | equals (Object other) |
String identifier is equal to another object. More... | |
int | hashCode () |
Hash code for use as dictionary keys. More... | |
File Handling | |
void | writeToFile (FileWriter writer) |
Write string identifier to a file writer. More... | |
static StringID | readFromFile (FileReader reader) |
Read string identifier from a file reader. More... | |
String identifier for efficient comparison.
String identifiers are entered into a global list of string identifiers and the position in the table stored. Comparison is efficiently done using the index instead of a full string comparison.
This is a native class.
The hash code of StringID is not compatible with the hash code of String. This has been done to improve performance and get optimal dictionary distribution.
In particular this means if you use StringID as keys in Dictionary using a String to find the key in the dictionary will fail because their hash codes are different.
bool Dragengine.StringID.equals | ( | Object | other | ) |
String identifier is equal to another object.
Implements Object.equals(Object).
String Dragengine.StringID.getString | ( | ) |
String this string identifier represents.
int Dragengine.StringID.hashCode | ( | ) |
Hash code for use as dictionary keys.
Implements Object.hashCode().
StringID Dragengine.StringID.new | ( | ) |
Create string identifier for the empty string.
StringID Dragengine.StringID.new | ( | String | identifier | ) |
Create string identifier for string.
|
static |
Read string identifier from a file reader.
String Dragengine.StringID.toString | ( | ) |
String this string identifier represents.
Same as getString() but overwriting Object.toString().
void Dragengine.StringID.writeToFile | ( | FileWriter | writer | ) |
Write string identifier to a file writer.