Package jme3utilities
Class NameGenerator
java.lang.Object
jme3utilities.NameGenerator
- All Implemented Interfaces:
com.jme3.export.Savable
A namespace used to generate unique text strings for names.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringGiven a name, recreate its prefix.static booleanTest whether a name could plausibly have been generated from a specified prefix.voidread(com.jme3.export.JmeImporter importer) De-serialize this name generator, for example when loading from a J3O file.voidreset()Restart name generation from scratch, forgetting about any previously used sequence numbers.toString()Represent this name generator as a text string.Generate a new unique name consisting of a prefix string followed by the separator followed by a decimal sequence number.voidwrite(com.jme3.export.JmeExporter exporter) Serialize this name generator, for example when saving to a J3O file.
-
Constructor Details
-
NameGenerator
public NameGenerator()A no-arg constructor to avoid javadoc warnings from JDK 18.
-
-
Method Details
-
getPrefix
Given a name, recreate its prefix.- Parameters:
name- (not null)- Returns:
- prefix (or null if the name was not generated here)
-
isFrom
Test whether a name could plausibly have been generated from a specified prefix.- Parameters:
name- name to test (not null)prefix- (not null)- Returns:
- true if the name is plausible, otherwise false
-
reset
public void reset()Restart name generation from scratch, forgetting about any previously used sequence numbers. -
unique
Generate a new unique name consisting of a prefix string followed by the separator followed by a decimal sequence number.- Parameters:
prefix- the prefix string (not null, doesn't contain separator)- Returns:
- unique String which begins with the specified prefix
-
read
De-serialize this name generator, for example when loading from a J3O file.- Specified by:
readin interfacecom.jme3.export.Savable- Parameters:
importer- (not null)- Throws:
IOException- from importer
-
write
Serialize this name generator, for example when saving to a J3O file.- Specified by:
writein interfacecom.jme3.export.Savable- Parameters:
exporter- (not null)- Throws:
IOException- from exporter
-
toString
Represent this name generator as a text string.
-