Drag[en]gine Script Module DragonScript  1.21
Dragengine.StringID Class Reference

String identifier for efficient comparison. More...

Inheritance diagram for Dragengine.StringID:

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...
 

Detailed Description

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.

Warning

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.

Member Function Documentation

◆ equals()

bool Dragengine.StringID.equals ( Object  other)

String identifier is equal to another object.

Implements Object.equals(Object).

Returns
true if other is of type StringID and their table position matches or other is of type String and matches the string at the table position.

◆ getString()

String Dragengine.StringID.getString ( )

String this string identifier represents.

◆ hashCode()

int Dragengine.StringID.hashCode ( )

Hash code for use as dictionary keys.

Implements Object.hashCode().

◆ new() [1/2]

StringID Dragengine.StringID.new ( )

Create string identifier for the empty string.

◆ new() [2/2]

StringID Dragengine.StringID.new ( String  identifier)

Create string identifier for string.

◆ readFromFile()

static StringID Dragengine.StringID.readFromFile ( FileReader  reader)
static

Read string identifier from a file reader.

◆ toString()

String Dragengine.StringID.toString ( )

String this string identifier represents.

Same as getString() but overwriting Object.toString().

◆ writeToFile()

void Dragengine.StringID.writeToFile ( FileWriter  writer)

Write string identifier to a file writer.


The documentation for this class was generated from the following file: