private TableColumn<FuelRow, Integer> colCapacity;
@FXML
private TableColumn<FuelRow, Float> colPrice;
+ @FXML
+ private TableColumn<FuelRow, String> colSpecial;
private FuelStationUIController parentController;
colAmount.setCellValueFactory(data -> new SimpleDoubleProperty(data.getValue().amount()).asObject());
colCapacity.setCellValueFactory(data -> new SimpleIntegerProperty(data.getValue().capacity()).asObject());
colPrice.setCellValueFactory(data -> new SimpleFloatProperty(data.getValue().price()).asObject());
+ colSpecial.setCellValueFactory(data -> new SimpleStringProperty(data.getValue().special()));
}
/**
f.FUEL_TYPE.toString(),
f.getStored_amount(),
f.CAPACITY,
- f.getPrice()));
+ f.getPrice(),
+ station.getSpecialAsString()));
}
}
}
* @return a simplified name for the a {@link FuelStation fuel station}
*/
public abstract String getSimpleName();
+
+ /**
+ * For display reasons, the special attribute must be returned by this function
+ * as a {@link String}
+ *
+ * @return the special attribute as a {@link String}
+ */
+ public abstract String getSpecialAsString();
}
\ No newline at end of file
public String getSimpleName() {
return "large fuel station";
}
+
+ /**
+ * See {@link FuelStation#getSpecialAsString()}
+ */
+ public String getSpecialAsString() {
+ return supermarket_company;
+ }
}
*/
static FuelStation[] initialFuelStations = { new SmallFuelStation((short) 0), new SmallFuelStation((short) 0),
new MediumFuelStation(0), new MediumFuelStation(0), new MediumFuelStation(0),
- new LargeFuelStation("PlatzhalterFirma1"), new LargeFuelStation("PlatzhalterFirma2"),
- new LargeFuelStation("PlatzhalterFirma3") };
+ new LargeFuelStation("PlaceholderCompany1"), new LargeFuelStation("PlaceholderCompany2"),
+ new LargeFuelStation("PlaceholderCompany3") };
/**
* create an array list to store the fuel stations while the program is running
public String getSimpleName() {
return "medium fuel station";
}
+
+ /**
+ * See {@link FuelStation#getSpecialAsString()}
+ */
+ public String getSpecialAsString() {
+ return Float.toString(retail_space);
+ }
}
public String getSimpleName() {
return "small fuel station";
}
+
+ /**
+ * See {@link FuelStation#getSpecialAsString()}
+ */
+ public String getSpecialAsString() {
+ return Short.toString(number_of_vending_machines);
+ }
}
*
* @author Robin Cheney
*/
-public record FuelRow(String station, String type, String fuel, double amount, int capacity, float price) {
+public record FuelRow(String station, String type, String fuel, double amount, int capacity, float price,
+ String special) {
}
\ No newline at end of file
<TableColumn fx:id="colAmount" text="Amount (L)" />
<TableColumn fx:id="colCapacity" text="Capacity (L)" />
<TableColumn fx:id="colPrice" text="Price (€/L)" />
+ <TableColumn fx:id="colSpecial" text="Special Attribute" />
</columns>
</TableView>
</VBox>