Package net.mtrop.doom.text
Class HexenMapInfo
java.lang.Object
net.mtrop.doom.text.HexenMapInfo
- All Implemented Interfaces:
TextObject
Parser for Hexen-style MAPINFO data (also called "old MAPINFO" in ZDoom).
This parser provides a means for scanning through a MAPINFO definition, line by line, tokenized, as its data
is procedural and not serializable.
All data is buffered into memory on read through
readText(Reader)
.- Since:
- 2.19.0
- Author:
- Matthew Tropiano
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.mtrop.doom.object.TextObject
TextObject.ParseException, TextObject.Reflect, TextObject.Transformer<TO extends TextObject>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a blank Hexen MAPINFO parser that reads from a blank definition.HexenMapInfo
(CharSequence sequence) Creates a Hexen MAPINFO parser that reads from text. -
Method Summary
Modifier and TypeMethodDescriptionGets the underlying StringBuilder for this info parser.String[]
Parses the next significant line in the MAPINFO and returns it as a set of tokens.void
Reads from anReader
and sets this object's fields.void
Refreshes the internal parser if changes were made to the internal text.String[]
Scans the MAPINFO to the next property and returns its line, tokenized.void
Writes this object to aWriter
.
-
Field Details
-
SETTYPE_CLEAREPISODES
- See Also:
-
SETTYPE_EPISODE
- See Also:
-
SETTYPE_MAP
- See Also:
-
SETTYPE_DEFAULTMAP
- See Also:
-
SETTYPE_ADDDEFAULTMAP
- See Also:
-
SETTYPE_GAMEDEFAULTS
- See Also:
-
SETTYPE_CLUSTERDEF
- See Also:
-
SETTYPE_CLEARSKILLS
- See Also:
-
SETTYPE_SKILL
- See Also:
-
-
Constructor Details
-
HexenMapInfo
public HexenMapInfo()Creates a blank Hexen MAPINFO parser that reads from a blank definition. You should probably usereadText(Reader)
orTextObject.readFile(java.io.File)
to construct this. -
HexenMapInfo
Creates a Hexen MAPINFO parser that reads from text.- Parameters:
sequence
- the MAPINFO data to read.
-
-
Method Details
-
getBuilder
Gets the underlying StringBuilder for this info parser. If the data is changed, callrefreshParser()
to reset the parser.- Returns:
- a reference to the underlying builder.
-
refreshParser
public void refreshParser()Refreshes the internal parser if changes were made to the internal text. -
nextTokens
Parses the next significant line in the MAPINFO and returns it as a set of tokens.- Returns:
- the set of tokens as a string array, or null if end of MAPINFO.
- Throws:
TextObject.ParseException
- if a parse error occurs during read.
-
scanTo
Scans the MAPINFO to the next property and returns its line, tokenized.- Parameters:
property
- the property to scan to, case-insensitive check.- Returns:
- the set of tokens as a string array, or null if end of MAPINFO.
- Throws:
TextObject.ParseException
- if a parse error occurs during read.
-
readText
Description copied from interface:TextObject
Reads from anReader
and sets this object's fields.- Specified by:
readText
in interfaceTextObject
- Parameters:
reader
- theReader
to read from.- Throws:
IOException
- if a read error occurs.
-
writeText
Description copied from interface:TextObject
Writes this object to aWriter
.- Specified by:
writeText
in interfaceTextObject
- Parameters:
writer
- theWriter
to write to.- Throws:
IOException
- if a write error occurs.
-