RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.util.parser.GenericParser Class Referenceabstract

Represents an abstract parser. More...

Inheritance diagram for com.runehive.util.parser.GenericParser:
Collaboration diagram for com.runehive.util.parser.GenericParser:

Public Member Functions

abstract void deserialize ()
 The method that deserializes the file information.
 GenericParser (String path, String extension, boolean log)
 Creates a new GenericParser.
final int getIndex ()
 Gets the current index of the line being parsed.
void onRead ()
 The method called after all the data has been parsed.
void run ()
String toString ()

Protected Attributes

int index
 The index of the current line being parsed.
final Path path
 The path of the file to parse.

Private Attributes

final String extension
 The file name extension to parse.
final boolean log

Static Private Attributes

static final Logger logger = LogManager.getLogger(GenericParser.class)

Detailed Description

Represents an abstract parser.

Author
Seven

Definition at line 14 of file GenericParser.java.

Constructor & Destructor Documentation

◆ GenericParser()

com.runehive.util.parser.GenericParser.GenericParser ( String path,
String extension,
boolean log )

Creates a new GenericParser.

Parameters
pathThe path of the file to parse.
extensionThe file name extension.
logThe flag that denotes to log messages.

Definition at line 47 of file GenericParser.java.

47 {
48 this.path = Paths.get("./data/", path + extension);
49 this.extension = extension;
50 this.log = log;
51 }

References extension, log, and path.

Member Function Documentation

◆ deserialize()

abstract void com.runehive.util.parser.GenericParser.deserialize ( )
abstract

The method that deserializes the file information.

Reimplemented in com.runehive.util.parser.GsonParser, and com.runehive.util.parser.TextFileParser.

Referenced by run().

Here is the caller graph for this function:

◆ getIndex()

final int com.runehive.util.parser.GenericParser.getIndex ( )

Gets the current index of the line being parsed.

Returns
The index of this line.

Definition at line 79 of file GenericParser.java.

79 {
80 return index;
81 }
val index

References index.

◆ onRead()

void com.runehive.util.parser.GenericParser.onRead ( )

The method called after all the data has been parsed.

Definition at line 70 of file GenericParser.java.

70 {
71
72 }

Referenced by run().

Here is the caller graph for this function:

◆ run()

void com.runehive.util.parser.GenericParser.run ( )

Definition at line 59 of file GenericParser.java.

59 {
60 deserialize();
61 onRead();
62 if (log) {
63 logger.info(toString());
64 }
65 }

References deserialize(), log, logger, onRead(), and toString().

Referenced by com.runehive.game.world.items.ItemDefinition.create(), com.runehive.util.tools.wiki.impl.BonusParser.finish(), com.runehive.util.tools.wiki.impl.NpcDropsParser.generateTables(), com.runehive.util.parser.old.EquipmentDefinitionParser.initialize(), com.runehive.game.world.entity.mob.npc.drop.NpcDropTable.main(), com.runehive.util.tools.DropDefinitionDumper.main(), com.runehive.util.tools.ItemDBdefUpdate.main(), and com.runehive.RuneHive.processSequentialStartupTasks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString()

String com.runehive.util.parser.GenericParser.toString ( )

Definition at line 84 of file GenericParser.java.

84 {
85 return String.format("Loaded: %d %s.", index, path.getFileName().toString().replace("_", " ").replace(extension, ""));
86 }

References extension, index, and path.

Referenced by run().

Here is the caller graph for this function:

Member Data Documentation

◆ extension

final String com.runehive.util.parser.GenericParser.extension
private

The file name extension to parse.

Definition at line 31 of file GenericParser.java.

Referenced by GenericParser(), and toString().

◆ index

int com.runehive.util.parser.GenericParser.index
protected

The index of the current line being parsed.

Definition at line 26 of file GenericParser.java.

Referenced by com.runehive.util.parser.GsonParser.deserialize(), com.runehive.util.parser.TextFileParser.deserialize(), getIndex(), and toString().

◆ log

final boolean com.runehive.util.parser.GenericParser.log
private

◆ logger

final Logger com.runehive.util.parser.GenericParser.logger = LogManager.getLogger(GenericParser.class)
staticprivate

Definition at line 16 of file GenericParser.java.

Referenced by run().

◆ path


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