*
* @param filePath
* The document that describes all the site's properties.
*/
private void formatSite(final String filePath) {
final LineReader lineReader =
new LineReader(getClass().getResourceAsStream(filePath));
byte[] line;
try {
for (;;) {
line = lineReader.readLine();
// Check for end of file.
if (MapFieldDemoTokenizer.getString(line).equals("EOF")) {
break;
} else {
if (MapFieldDemoTokenizer.getString(line).equals(
"Site Name:")) {
if (MapFieldDemoTokenizer.getString(
lineReader.readLine()).equals(_siteName)) {
if (MapFieldDemoTokenizer.getString(
lineReader.readLine()).equals(
"Is Stand-alone Site:")) {
_standAloneSite =
MapFieldDemoTokenizer.getString(
lineReader.readLine()).equals(
"true");
}
if (MapFieldDemoTokenizer.getString(
lineReader.readLine()).equals(
"Campus Display Name:")) {
_campus =
MapFieldDemoTokenizer
.getString(lineReader
.readLine());
}
if (MapFieldDemoTokenizer.getString(
lineReader.readLine()).equals(
"Default Campus Location:")) {
lineReader.readLine();
}
if (MapFieldDemoTokenizer.getString(
lineReader.readLine()).equals(
"Street Number:")) {
_streetNumber =
MapFieldDemoTokenizer.getInt(lineReader
.readLine());
}
if (MapFieldDemoTokenizer.getString(
lineReader.readLine()).equals(
"Street Name:")) {
_streetName =
MapFieldDemoTokenizer
.getString(lineReader
.readLine());
}
if (MapFieldDemoTokenizer.getString(
lineReader.readLine()).equals("City:")) {
_city =
MapFieldDemoTokenizer
.getString(lineReader
.readLine());
}
if (MapFieldDemoTokenizer.getString(
lineReader.readLine()).equals("Province:")) {
_province =
MapFieldDemoTokenizer
.getString(lineReader
.readLine());
}
if (MapFieldDemoTokenizer.getString(
lineReader.readLine()).equals("Country:")) {
_country =
MapFieldDemoTokenizer
.getString(lineReader
.readLine());
}
if (MapFieldDemoTokenizer.getString(
lineReader.readLine()).equals(
"Site Number:")) { // N\A if not applicable.
line = lineReader.readLine();
if (!MapFieldDemoTokenizer.getString(line)
.equals("N\\A")) {
_siteNumber =
MapFieldDemoTokenizer.getInt(line);
}
}
if (MapFieldDemoTokenizer.getString(
lineReader.readLine()).equals(
"Site Number Placement:")) {
// N\A if not applicable.
line = lineReader.readLine();
if (!MapFieldDemoTokenizer.getString(line)
.equals("N\\A")) {
_siteNumberPlacement =
MapFieldDemoTokenizer
.getCoordinates(line);
}
}
if (MapFieldDemoTokenizer.getString(
lineReader.readLine()).equals(
"Number of Points:")) {
_numberOfPoints =
MapFieldDemoTokenizer.getInt(lineReader
.readLine());
}
if (MapFieldDemoTokenizer.getString(
lineReader.readLine()).equals("Shape:")) {
_shape = new Coordinates[_numberOfPoints];
for (int pointsCount = 0; pointsCount < _numberOfPoints; pointsCount++) {
_shape[pointsCount] =
MapFieldDemoTokenizer
.getCoordinates(lineReader
.readLine());
}
}
if (MapFieldDemoTokenizer.getString(
lineReader.readLine()).equals(
"Highlightable Area:")) {
_highlightableArea = new Coordinates[4];
for (int pointsCount = 0; pointsCount < 4; pointsCount++) {
_highlightableArea[pointsCount] =
MapFieldDemoTokenizer
.getCoordinates(lineReader
.readLine());
}
}
break;