use of plugin.overland.util.PairList in project pcgen by PCGen.
the class RoomBoardFactory method load.
public static RoomBoard load(File dataDir) {
//Create a new list for the room and board
PairList<RBCost> inns = new PairList<>();
PairList<RBCost> foods = new PairList<>();
PairList<RBCost> animals = new PairList<>();
File path = new File(dataDir, DIR_RNBPRICE);
if (path.isDirectory()) {
File[] dataFiles = path.listFiles(new XMLFilter());
SAXBuilder builder = new SAXBuilder();
for (int i = 0; i < dataFiles.length; i++) {
try {
Document methodSet = builder.build(dataFiles[i]);
DocType dt = methodSet.getDocType();
if (//$NON-NLS-1$
dt.getElementName().equals("RNBPRICE")) {
//Do work here
loadRBData(methodSet, inns, foods, animals);
}
methodSet = null;
dt = null;
} catch (Exception e) {
Logging.errorPrintLocalised("XML Error with file {0}", dataFiles[i].getName());
Logging.errorPrint(e.getMessage(), e);
}
}
} else {
//$NON-NLS-1$
Logging.errorPrintLocalised("in_plugin_overland_noDatafile", path.getPath());
}
return new RoomBoardImplementation(inns, foods, animals);
}
Aggregations