Package xyz.calcugames.levelz.parser
Class LevelParser
java.lang.Object
xyz.calcugames.levelz.parser.LevelParser
Represents a LevelZ level parser.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classRepresents a Level Parser Builder. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLevelParser(@NotNull Random seed) Creates a new Level Parser. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull LevelParser.Builderbuilder()Creates a new Level Parser Builder.abstract @NotNull InputStreamGets the input stream for this parser.final @NotNull RandomgetSeed()Gets the randomizer seed for this parser.abstract @NotNull Levelparse()Parses the level from the input stream.static @Nullable ObjectConverts a string to an object value.
-
Constructor Details
-
LevelParser
Creates a new Level Parser.- Parameters:
seed- Seed
-
-
Method Details
-
getSeed
Gets the randomizer seed for this parser.- Returns:
- Randomizer
-
getInputStream
Gets the input stream for this parser.- Returns:
- Input Stream
-
parse
Parses the level from the input stream. This will close the input stream.- Returns:
- Level
-
builder
Creates a new Level Parser Builder.- Returns:
- Level Parser Builder
-
value
Converts a string to an object value.
This will do the following:
- Convert
trueandfalseto a boolean primitive - Attempt to convert integers into a integer primitive
- Attempt to convert doubles into a double primitive
- Otherwise, return the raw string
- Parameters:
str- String to convert- Returns:
- Object value
- Convert
-