set deprecated landing pads services, uses station type
This commit is contained in:
@@ -62,10 +62,6 @@ public class OffersController {
|
|||||||
@FXML
|
@FXML
|
||||||
private CheckBox cbShipyard;
|
private CheckBox cbShipyard;
|
||||||
@FXML
|
@FXML
|
||||||
private CheckBox cbMediumLandpad;
|
|
||||||
@FXML
|
|
||||||
private CheckBox cbLargeLandpad;
|
|
||||||
@FXML
|
|
||||||
private TitledPane stationPane;
|
private TitledPane stationPane;
|
||||||
@FXML
|
@FXML
|
||||||
private Node warningIcon;
|
private Node warningIcon;
|
||||||
@@ -153,8 +149,6 @@ public class OffersController {
|
|||||||
cbRepair.setSelected(false);
|
cbRepair.setSelected(false);
|
||||||
cbOutfit.setSelected(false);
|
cbOutfit.setSelected(false);
|
||||||
cbShipyard.setSelected(false);
|
cbShipyard.setSelected(false);
|
||||||
cbMediumLandpad.setSelected(false);
|
|
||||||
cbLargeLandpad.setSelected(false);
|
|
||||||
if (!ModelFabric.isFake(station)){
|
if (!ModelFabric.isFake(station)){
|
||||||
type.setText(StationTypeStringConverter.toLocalizationString(station.getType()));
|
type.setText(StationTypeStringConverter.toLocalizationString(station.getType()));
|
||||||
faction.setText(FactionStringConverter.toLocalizationString(station.getFaction()));
|
faction.setText(FactionStringConverter.toLocalizationString(station.getFaction()));
|
||||||
@@ -169,8 +163,6 @@ public class OffersController {
|
|||||||
cbRepair.setSelected(station.hasService(SERVICE_TYPE.REPAIR));
|
cbRepair.setSelected(station.hasService(SERVICE_TYPE.REPAIR));
|
||||||
cbOutfit.setSelected(station.hasService(SERVICE_TYPE.OUTFIT));
|
cbOutfit.setSelected(station.hasService(SERVICE_TYPE.OUTFIT));
|
||||||
cbShipyard.setSelected(station.hasService(SERVICE_TYPE.SHIPYARD));
|
cbShipyard.setSelected(station.hasService(SERVICE_TYPE.SHIPYARD));
|
||||||
cbMediumLandpad.setSelected(station.hasService(SERVICE_TYPE.MEDIUM_LANDPAD));
|
|
||||||
cbLargeLandpad.setSelected(station.hasService(SERVICE_TYPE.LARGE_LANDPAD));
|
|
||||||
sells.addAll(station.getSells());
|
sells.addAll(station.getSells());
|
||||||
buys.addAll(station.getBuys());
|
buys.addAll(station.getBuys());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,15 +6,19 @@ import javafx.collections.ObservableList;
|
|||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.util.StringConverter;
|
import javafx.util.StringConverter;
|
||||||
|
import org.controlsfx.control.CheckComboBox;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import ru.trader.core.MarketFilter;
|
import ru.trader.core.MarketFilter;
|
||||||
import ru.trader.core.OFFER_TYPE;
|
import ru.trader.core.OFFER_TYPE;
|
||||||
import ru.trader.core.SERVICE_TYPE;
|
import ru.trader.core.SERVICE_TYPE;
|
||||||
|
import ru.trader.core.STATION_TYPE;
|
||||||
import ru.trader.model.*;
|
import ru.trader.model.*;
|
||||||
import ru.trader.model.support.BindingsHelper;
|
import ru.trader.model.support.BindingsHelper;
|
||||||
import ru.trader.model.support.ChangeMarketListener;
|
import ru.trader.model.support.ChangeMarketListener;
|
||||||
import ru.trader.view.support.NumberField;
|
import ru.trader.view.support.NumberField;
|
||||||
|
import ru.trader.view.support.ServiceTypeStringConverter;
|
||||||
|
import ru.trader.view.support.StationTypeStringConverter;
|
||||||
import ru.trader.view.support.autocomplete.AutoCompletion;
|
import ru.trader.view.support.autocomplete.AutoCompletion;
|
||||||
import ru.trader.view.support.autocomplete.CachedSuggestionProvider;
|
import ru.trader.view.support.autocomplete.CachedSuggestionProvider;
|
||||||
import ru.trader.view.support.autocomplete.SystemsProvider;
|
import ru.trader.view.support.autocomplete.SystemsProvider;
|
||||||
@@ -39,23 +43,9 @@ public class SearchController {
|
|||||||
@FXML
|
@FXML
|
||||||
private NumberField distance;
|
private NumberField distance;
|
||||||
@FXML
|
@FXML
|
||||||
private CheckBox cbMarket;
|
private CheckComboBox<STATION_TYPE> stationTypes;
|
||||||
@FXML
|
@FXML
|
||||||
private CheckBox cbBlackMarket;
|
private CheckComboBox<SERVICE_TYPE> services;
|
||||||
@FXML
|
|
||||||
private CheckBox cbRefuel;
|
|
||||||
@FXML
|
|
||||||
private CheckBox cbRepair;
|
|
||||||
@FXML
|
|
||||||
private CheckBox cbMunition;
|
|
||||||
@FXML
|
|
||||||
private CheckBox cbOutfit;
|
|
||||||
@FXML
|
|
||||||
private CheckBox cbShipyard;
|
|
||||||
@FXML
|
|
||||||
private CheckBox cbMediumLandpad;
|
|
||||||
@FXML
|
|
||||||
private CheckBox cbLargeLandpad;
|
|
||||||
@FXML
|
@FXML
|
||||||
private TableView<ResultEntry> tblResults;
|
private TableView<ResultEntry> tblResults;
|
||||||
|
|
||||||
@@ -68,6 +58,10 @@ public class SearchController {
|
|||||||
@FXML
|
@FXML
|
||||||
private void initialize() {
|
private void initialize() {
|
||||||
init();
|
init();
|
||||||
|
stationTypes.setConverter(new StationTypeStringConverter());
|
||||||
|
stationTypes.getItems().setAll(STATION_TYPE.values());
|
||||||
|
services.setConverter(new ServiceTypeStringConverter());
|
||||||
|
services.getItems().setAll(SERVICE_TYPE.values());
|
||||||
rbBuyer.setToggleGroup(offerType);
|
rbBuyer.setToggleGroup(offerType);
|
||||||
rbBuyer.setUserData(OFFER_TYPE.BUY);
|
rbBuyer.setUserData(OFFER_TYPE.BUY);
|
||||||
rbSeller.setToggleGroup(offerType);
|
rbSeller.setToggleGroup(offerType);
|
||||||
@@ -114,15 +108,8 @@ public class SearchController {
|
|||||||
private void searchStations(){
|
private void searchStations(){
|
||||||
MarketFilter filter = new MarketFilter();
|
MarketFilter filter = new MarketFilter();
|
||||||
filter.setDistance(distance.getValue().doubleValue());
|
filter.setDistance(distance.getValue().doubleValue());
|
||||||
if (cbMarket.isSelected()) filter.add(SERVICE_TYPE.MARKET); else filter.remove(SERVICE_TYPE.MARKET);
|
stationTypes.getCheckModel().getCheckedItems().forEach(filter::add);
|
||||||
if (cbBlackMarket.isSelected()) filter.add(SERVICE_TYPE.BLACK_MARKET); else filter.remove(SERVICE_TYPE.BLACK_MARKET);
|
services.getCheckModel().getCheckedItems().forEach(filter::add);
|
||||||
if (cbRefuel.isSelected()) filter.add(SERVICE_TYPE.REFUEL); else filter.remove(SERVICE_TYPE.REFUEL);
|
|
||||||
if (cbMunition.isSelected()) filter.add(SERVICE_TYPE.MUNITION); else filter.remove(SERVICE_TYPE.MUNITION);
|
|
||||||
if (cbRepair.isSelected()) filter.add(SERVICE_TYPE.REPAIR); else filter.remove(SERVICE_TYPE.REPAIR);
|
|
||||||
if (cbOutfit.isSelected()) filter.add(SERVICE_TYPE.OUTFIT); else filter.remove(SERVICE_TYPE.OUTFIT);
|
|
||||||
if (cbShipyard.isSelected()) filter.add(SERVICE_TYPE.SHIPYARD); else filter.remove(SERVICE_TYPE.SHIPYARD);
|
|
||||||
if (cbMediumLandpad.isSelected()) filter.add(SERVICE_TYPE.MEDIUM_LANDPAD); else filter.remove(SERVICE_TYPE.MEDIUM_LANDPAD);
|
|
||||||
if (cbLargeLandpad.isSelected()) filter.add(SERVICE_TYPE.LARGE_LANDPAD); else filter.remove(SERVICE_TYPE.LARGE_LANDPAD);
|
|
||||||
ItemModel item = items.getValue();
|
ItemModel item = items.getValue();
|
||||||
if (ModelFabric.isFake(item)){
|
if (ModelFabric.isFake(item)){
|
||||||
Collection<StationModel> stations = market.getStations(filter);
|
Collection<StationModel> stations = market.getStations(filter);
|
||||||
|
|||||||
@@ -66,10 +66,6 @@ public class StationEditorController {
|
|||||||
private CheckBox cbOutfit;
|
private CheckBox cbOutfit;
|
||||||
@FXML
|
@FXML
|
||||||
private CheckBox cbShipyard;
|
private CheckBox cbShipyard;
|
||||||
@FXML
|
|
||||||
private CheckBox cbMediumLandpad;
|
|
||||||
@FXML
|
|
||||||
private CheckBox cbLargeLandpad;
|
|
||||||
|
|
||||||
private StationUpdater updater;
|
private StationUpdater updater;
|
||||||
|
|
||||||
@@ -128,8 +124,6 @@ public class StationEditorController {
|
|||||||
cbRepair.selectedProperty().bindBidirectional(updater.serviceProperty(SERVICE_TYPE.REPAIR));
|
cbRepair.selectedProperty().bindBidirectional(updater.serviceProperty(SERVICE_TYPE.REPAIR));
|
||||||
cbOutfit.selectedProperty().bindBidirectional(updater.serviceProperty(SERVICE_TYPE.OUTFIT));
|
cbOutfit.selectedProperty().bindBidirectional(updater.serviceProperty(SERVICE_TYPE.OUTFIT));
|
||||||
cbShipyard.selectedProperty().bindBidirectional(updater.serviceProperty(SERVICE_TYPE.SHIPYARD));
|
cbShipyard.selectedProperty().bindBidirectional(updater.serviceProperty(SERVICE_TYPE.SHIPYARD));
|
||||||
cbMediumLandpad.selectedProperty().bindBidirectional(updater.serviceProperty(SERVICE_TYPE.MEDIUM_LANDPAD));
|
|
||||||
cbLargeLandpad.selectedProperty().bindBidirectional(updater.serviceProperty(SERVICE_TYPE.LARGE_LANDPAD));
|
|
||||||
items.setItems(updater.getOffers());
|
items.setItems(updater.getOffers());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,10 +54,10 @@
|
|||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<Label text="%label.station.type" />
|
<Label text="%label.station.type" />
|
||||||
<Label fx:id="type" GridPane.columnIndex="1"/>
|
<Label fx:id="type" GridPane.columnIndex="1"/>
|
||||||
<Label text="%label.government" GridPane.columnIndex="4" />
|
<Label text="%label.government" GridPane.columnIndex="2" />
|
||||||
<Label fx:id="government" GridPane.columnIndex="5" />
|
<Label fx:id="government" GridPane.columnIndex="3" />
|
||||||
<Label text="%label.allegiance" GridPane.columnIndex="2"/>
|
<Label text="%label.allegiance" GridPane.columnIndex="4"/>
|
||||||
<Label fx:id="faction" GridPane.columnIndex="3" />
|
<Label fx:id="faction" GridPane.columnIndex="5" />
|
||||||
<HBox GridPane.columnIndex="6" GridPane.rowSpan="2" alignment="TOP_RIGHT">
|
<HBox GridPane.columnIndex="6" GridPane.rowSpan="2" alignment="TOP_RIGHT">
|
||||||
<Label fx:id="warningIcon" styleClass="icon-warning" prefWidth="30" prefHeight="30" visible="false">
|
<Label fx:id="warningIcon" styleClass="icon-warning" prefWidth="30" prefHeight="30" visible="false">
|
||||||
<graphic><Glyph text="FontAwesome|WARNING" /></graphic>
|
<graphic><Glyph text="FontAwesome|WARNING" /></graphic>
|
||||||
@@ -80,8 +80,6 @@
|
|||||||
<CheckBox fx:id="cbMunition" text="%services.MUNITION"/>
|
<CheckBox fx:id="cbMunition" text="%services.MUNITION"/>
|
||||||
<CheckBox fx:id="cbOutfit" text="%services.OUTFIT"/>
|
<CheckBox fx:id="cbOutfit" text="%services.OUTFIT"/>
|
||||||
<CheckBox fx:id="cbShipyard" text="%services.SHIPYARD"/>
|
<CheckBox fx:id="cbShipyard" text="%services.SHIPYARD"/>
|
||||||
<CheckBox fx:id="cbMediumLandpad" text="%services.MEDIUM_LANDPAD"/>
|
|
||||||
<CheckBox fx:id="cbLargeLandpad" text="%services.LARGE_LANDPAD"/>
|
|
||||||
</TilePane>
|
</TilePane>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
<contextMenu><fx:reference source="editMenu"/></contextMenu>
|
<contextMenu><fx:reference source="editMenu"/></contextMenu>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.control.cell.*?>
|
<?import javafx.scene.control.cell.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import org.controlsfx.control.CheckComboBox?>
|
||||||
<?import ru.trader.view.support.cells.DistanceCell?>
|
<?import ru.trader.view.support.cells.DistanceCell?>
|
||||||
<?import ru.trader.view.support.NumberField?>
|
<?import ru.trader.view.support.NumberField?>
|
||||||
<GridPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
|
<GridPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
|
||||||
@@ -32,18 +33,10 @@
|
|||||||
<ComboBox fx:id="items" prefWidth="150" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
|
<ComboBox fx:id="items" prefWidth="150" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
|
||||||
<Label text="%search.text.distance" GridPane.rowIndex="3" />
|
<Label text="%search.text.distance" GridPane.rowIndex="3" />
|
||||||
<NumberField fx:id="distance" GridPane.columnIndex="1" GridPane.rowIndex="3" />
|
<NumberField fx:id="distance" GridPane.columnIndex="1" GridPane.rowIndex="3" />
|
||||||
<Label text="%filter.services" GridPane.rowIndex="4" />
|
<Label text="%label.station.type" GridPane.rowIndex="4"/>
|
||||||
<TilePane hgap="5" vgap="5" tileAlignment="BASELINE_LEFT" prefColumns="2" GridPane.columnSpan="2" GridPane.rowIndex="5" >
|
<CheckComboBox fx:id="stationTypes" prefWidth="150" GridPane.columnIndex="1" GridPane.rowIndex="4" />
|
||||||
<CheckBox fx:id="cbMarket" text="%services.MARKET"/>
|
<Label text="%label.station.services" GridPane.rowIndex="5"/>
|
||||||
<CheckBox fx:id="cbBlackMarket" text="%services.BLACK_MARKET"/>
|
<CheckComboBox fx:id="services" prefWidth="150" GridPane.columnIndex="1" GridPane.rowIndex="5"/>
|
||||||
<CheckBox fx:id="cbRefuel" text="%services.REFUEL"/>
|
|
||||||
<CheckBox fx:id="cbRepair" text="%services.REPAIR"/>
|
|
||||||
<CheckBox fx:id="cbMunition" text="%services.MUNITION"/>
|
|
||||||
<CheckBox fx:id="cbOutfit" text="%services.OUTFIT"/>
|
|
||||||
<CheckBox fx:id="cbShipyard" text="%services.SHIPYARD"/>
|
|
||||||
<CheckBox fx:id="cbMediumLandpad" text="%services.MEDIUM_LANDPAD"/>
|
|
||||||
<CheckBox fx:id="cbLargeLandpad" text="%services.LARGE_LANDPAD"/>
|
|
||||||
</TilePane>
|
|
||||||
<Separator GridPane.columnSpan="2" GridPane.rowIndex="6" GridPane.margin="$separator_margin"/>
|
<Separator GridPane.columnSpan="2" GridPane.rowIndex="6" GridPane.margin="$separator_margin"/>
|
||||||
<HBox GridPane.columnSpan="2" GridPane.rowIndex="7" spacing="10" alignment="CENTER">
|
<HBox GridPane.columnSpan="2" GridPane.rowIndex="7" spacing="10" alignment="CENTER">
|
||||||
<Button text="%search.button.find" onAction="#searchStations" />
|
<Button text="%search.button.find" onAction="#searchStations" />
|
||||||
|
|||||||
@@ -56,8 +56,6 @@
|
|||||||
</VBox>
|
</VBox>
|
||||||
<VBox spacing="5">
|
<VBox spacing="5">
|
||||||
<CheckBox fx:id="cbShipyard" text="%services.SHIPYARD"/>
|
<CheckBox fx:id="cbShipyard" text="%services.SHIPYARD"/>
|
||||||
<CheckBox fx:id="cbMediumLandpad" text="%services.MEDIUM_LANDPAD"/>
|
|
||||||
<CheckBox fx:id="cbLargeLandpad" text="%services.LARGE_LANDPAD"/>
|
|
||||||
</VBox>
|
</VBox>
|
||||||
</HBox>
|
</HBox>
|
||||||
</VBox>
|
</VBox>
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
package ru.trader.core;
|
package ru.trader.core;
|
||||||
|
|
||||||
public enum SERVICE_TYPE {
|
public enum SERVICE_TYPE {
|
||||||
MARKET, BLACK_MARKET, REPAIR, MUNITION, OUTFIT, SHIPYARD, REFUEL, MEDIUM_LANDPAD, LARGE_LANDPAD
|
MARKET, BLACK_MARKET, REPAIR, MUNITION, OUTFIT, SHIPYARD, REFUEL,
|
||||||
|
@Deprecated
|
||||||
|
MEDIUM_LANDPAD,
|
||||||
|
@Deprecated
|
||||||
|
LARGE_LANDPAD
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,9 +161,9 @@ public class MarketTest extends Assert {
|
|||||||
|
|
||||||
Vendor vendor3 = place2.addVendor("Vendor 3");
|
Vendor vendor3 = place2.addVendor("Vendor 3");
|
||||||
vendor3.add(SERVICE_TYPE.OUTFIT);
|
vendor3.add(SERVICE_TYPE.OUTFIT);
|
||||||
vendor3.add(SERVICE_TYPE.LARGE_LANDPAD);
|
vendor3.add(SERVICE_TYPE.SHIPYARD);
|
||||||
vendor3.add(SERVICE_TYPE.MEDIUM_LANDPAD);
|
vendor3.add(SERVICE_TYPE.REFUEL);
|
||||||
vendor3.remove(SERVICE_TYPE.LARGE_LANDPAD);
|
vendor3.remove(SERVICE_TYPE.SHIPYARD);
|
||||||
|
|
||||||
int c = 3;
|
int c = 3;
|
||||||
for (Vendor vendor : market.getVendors()) {
|
for (Vendor vendor : market.getVendors()) {
|
||||||
@@ -173,9 +173,9 @@ public class MarketTest extends Assert {
|
|||||||
assertEquals(100, vendor.getDistance(), 0.001);
|
assertEquals(100, vendor.getDistance(), 0.001);
|
||||||
assertTrue(vendor.has(SERVICE_TYPE.MARKET));
|
assertTrue(vendor.has(SERVICE_TYPE.MARKET));
|
||||||
assertTrue(vendor.has(SERVICE_TYPE.OUTFIT));
|
assertTrue(vendor.has(SERVICE_TYPE.OUTFIT));
|
||||||
assertFalse(vendor.has(SERVICE_TYPE.LARGE_LANDPAD));
|
assertFalse(vendor.has(SERVICE_TYPE.SHIPYARD));
|
||||||
assertFalse(vendor.has(SERVICE_TYPE.BLACK_MARKET));
|
assertFalse(vendor.has(SERVICE_TYPE.BLACK_MARKET));
|
||||||
assertFalse(vendor.has(SERVICE_TYPE.MEDIUM_LANDPAD));
|
assertFalse(vendor.has(SERVICE_TYPE.REFUEL));
|
||||||
c--;
|
c--;
|
||||||
} else
|
} else
|
||||||
if ("Vendor 2".equals(vendor.getName())){
|
if ("Vendor 2".equals(vendor.getName())){
|
||||||
@@ -184,9 +184,9 @@ public class MarketTest extends Assert {
|
|||||||
assertEquals(40, vendor.getDistance(), 0.001);
|
assertEquals(40, vendor.getDistance(), 0.001);
|
||||||
assertFalse(vendor.has(SERVICE_TYPE.MARKET));
|
assertFalse(vendor.has(SERVICE_TYPE.MARKET));
|
||||||
assertFalse(vendor.has(SERVICE_TYPE.OUTFIT));
|
assertFalse(vendor.has(SERVICE_TYPE.OUTFIT));
|
||||||
assertFalse(vendor.has(SERVICE_TYPE.LARGE_LANDPAD));
|
assertFalse(vendor.has(SERVICE_TYPE.SHIPYARD));
|
||||||
assertFalse(vendor.has(SERVICE_TYPE.BLACK_MARKET));
|
assertFalse(vendor.has(SERVICE_TYPE.BLACK_MARKET));
|
||||||
assertFalse(vendor.has(SERVICE_TYPE.MEDIUM_LANDPAD));
|
assertFalse(vendor.has(SERVICE_TYPE.REFUEL));
|
||||||
c--;
|
c--;
|
||||||
} else
|
} else
|
||||||
if ("Vendor 3".equals(vendor.getName())){
|
if ("Vendor 3".equals(vendor.getName())){
|
||||||
@@ -195,9 +195,9 @@ public class MarketTest extends Assert {
|
|||||||
assertEquals(0, vendor.getDistance(), 0.001);
|
assertEquals(0, vendor.getDistance(), 0.001);
|
||||||
assertFalse(vendor.has(SERVICE_TYPE.MARKET));
|
assertFalse(vendor.has(SERVICE_TYPE.MARKET));
|
||||||
assertTrue(vendor.has(SERVICE_TYPE.OUTFIT));
|
assertTrue(vendor.has(SERVICE_TYPE.OUTFIT));
|
||||||
assertFalse(vendor.has(SERVICE_TYPE.LARGE_LANDPAD));
|
assertFalse(vendor.has(SERVICE_TYPE.SHIPYARD));
|
||||||
assertFalse(vendor.has(SERVICE_TYPE.BLACK_MARKET));
|
assertFalse(vendor.has(SERVICE_TYPE.BLACK_MARKET));
|
||||||
assertTrue(vendor.has(SERVICE_TYPE.MEDIUM_LANDPAD));
|
assertTrue(vendor.has(SERVICE_TYPE.REFUEL));
|
||||||
c--;
|
c--;
|
||||||
} else c = -1;
|
} else c = -1;
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,7 @@ package ru.trader.maddavo;
|
|||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import ru.trader.core.Market;
|
import ru.trader.core.*;
|
||||||
import ru.trader.core.Place;
|
|
||||||
import ru.trader.core.SERVICE_TYPE;
|
|
||||||
import ru.trader.core.Vendor;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -38,24 +35,26 @@ public class StationHandler extends CSVParseHandler {
|
|||||||
if ("Y".equals(values[3])) adding.add(SERVICE_TYPE.BLACK_MARKET);
|
if ("Y".equals(values[3])) adding.add(SERVICE_TYPE.BLACK_MARKET);
|
||||||
if ("N".equals(values[3])) removing.add(SERVICE_TYPE.BLACK_MARKET);
|
if ("N".equals(values[3])) removing.add(SERVICE_TYPE.BLACK_MARKET);
|
||||||
|
|
||||||
if ("M".equals(values[4])) {adding.add(SERVICE_TYPE.MEDIUM_LANDPAD); removing.add(SERVICE_TYPE.LARGE_LANDPAD);}
|
|
||||||
if ("L".equals(values[4])) {adding.add(SERVICE_TYPE.MEDIUM_LANDPAD); adding.add(SERVICE_TYPE.LARGE_LANDPAD);}
|
|
||||||
|
|
||||||
if ("Y".equals(values[5])) adding.add(SERVICE_TYPE.MARKET);
|
if ("Y".equals(values[5])) adding.add(SERVICE_TYPE.MARKET);
|
||||||
if ("N".equals(values[5])) removing.add(SERVICE_TYPE.MARKET);
|
if ("N".equals(values[5])) removing.add(SERVICE_TYPE.MARKET);
|
||||||
|
|
||||||
if ("Y".equals(values[6])) adding.add(SERVICE_TYPE.SHIPYARD);
|
if ("Y".equals(values[6])) adding.add(SERVICE_TYPE.SHIPYARD);
|
||||||
if ("N".equals(values[6])) removing.add(SERVICE_TYPE.SHIPYARD);
|
if ("N".equals(values[6])) removing.add(SERVICE_TYPE.SHIPYARD);
|
||||||
|
|
||||||
updateStation(system, values[1], distance, adding, removing);
|
STATION_TYPE type = null;
|
||||||
|
if ("M".equals(values[4])) {type = STATION_TYPE.OUTPOST;}
|
||||||
|
if ("L".equals(values[4])) {type = STATION_TYPE.STARPORT;}
|
||||||
|
|
||||||
|
updateStation(system, values[1], type, distance, adding, removing);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateStation(Place system, String name, double distance, Collection<SERVICE_TYPE> addServices, Collection<SERVICE_TYPE> removeServices){
|
private void updateStation(Place system, String name, STATION_TYPE type, double distance, Collection<SERVICE_TYPE> addServices, Collection<SERVICE_TYPE> removeServices){
|
||||||
Vendor station = system.get(name);
|
Vendor station = system.get(name);
|
||||||
if (station == null){
|
if (station == null){
|
||||||
LOG.debug("{} - is new station, adding", name);
|
LOG.debug("{} - is new station, adding", name);
|
||||||
station = system.addVendor(name);
|
station = system.addVendor(name);
|
||||||
}
|
}
|
||||||
|
station.setType(type);
|
||||||
if (distance > 0 && distance != station.getDistance()) {
|
if (distance > 0 && distance != station.getDistance()) {
|
||||||
station.setDistance(distance);
|
station.setDistance(distance);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,18 +38,19 @@ public class StationImportTest extends Assert {
|
|||||||
|
|
||||||
private Market createMarket(){
|
private Market createMarket(){
|
||||||
Market market = new SimpleMarket();
|
Market market = new SimpleMarket();
|
||||||
market.addPlace("1 Hydrae",0,0,0);
|
market.addPlace("1 Hydrae", 0, 0, 0);
|
||||||
market.addPlace("1 Kappa Cygni", 0, 0, 0);
|
market.addPlace("1 Kappa Cygni", 0, 0, 0);
|
||||||
Place system = market.addPlace("10 CANUM VENATICORUM", 0, 0, 0);
|
Place system = market.addPlace("10 CANUM VENATICORUM", 0, 0, 0);
|
||||||
system.setFaction(FACTION.FEDERATION);
|
system.setFaction(FACTION.FEDERATION);
|
||||||
system.setGovernment(GOVERNMENT.PRISON_COLONY);
|
system.setGovernment(GOVERNMENT.PRISON_COLONY);
|
||||||
|
|
||||||
Vendor station = system.addVendor("Trevithick Hub");
|
Vendor station = system.addVendor("Trevithick Hub");
|
||||||
|
station.setType(STATION_TYPE.OUTPOST);
|
||||||
station.setDistance(2000);
|
station.setDistance(2000);
|
||||||
station.add(SERVICE_TYPE.MARKET);
|
station.add(SERVICE_TYPE.MARKET);
|
||||||
station.add(SERVICE_TYPE.BLACK_MARKET);
|
station.add(SERVICE_TYPE.BLACK_MARKET);
|
||||||
station.add(SERVICE_TYPE.OUTFIT);
|
station.add(SERVICE_TYPE.OUTFIT);
|
||||||
station.add(SERVICE_TYPE.MEDIUM_LANDPAD);
|
|
||||||
station.setFaction(FACTION.ALLIANCE);
|
station.setFaction(FACTION.ALLIANCE);
|
||||||
station.setGovernment(GOVERNMENT.COMMUNISM);
|
station.setGovernment(GOVERNMENT.COMMUNISM);
|
||||||
|
|
||||||
@@ -81,10 +82,9 @@ public class StationImportTest extends Assert {
|
|||||||
|
|
||||||
Vendor station = market.get("1 Hydrae").get("Hieb Orbital");
|
Vendor station = market.get("1 Hydrae").get("Hieb Orbital");
|
||||||
assertNotNull(station);
|
assertNotNull(station);
|
||||||
|
assertEquals(STATION_TYPE.OUTPOST, station.getType());
|
||||||
assertEquals(160, station.getDistance(), 0.00001);
|
assertEquals(160, station.getDistance(), 0.00001);
|
||||||
assertFalse(station.has(SERVICE_TYPE.BLACK_MARKET));
|
assertFalse(station.has(SERVICE_TYPE.BLACK_MARKET));
|
||||||
assertTrue(station.has(SERVICE_TYPE.MEDIUM_LANDPAD));
|
|
||||||
assertFalse(station.has(SERVICE_TYPE.LARGE_LANDPAD));
|
|
||||||
assertTrue(station.has(SERVICE_TYPE.MARKET));
|
assertTrue(station.has(SERVICE_TYPE.MARKET));
|
||||||
assertFalse(station.has(SERVICE_TYPE.SHIPYARD));
|
assertFalse(station.has(SERVICE_TYPE.SHIPYARD));
|
||||||
assertFalse(station.has(SERVICE_TYPE.OUTFIT));
|
assertFalse(station.has(SERVICE_TYPE.OUTFIT));
|
||||||
@@ -92,12 +92,11 @@ public class StationImportTest extends Assert {
|
|||||||
|
|
||||||
station = market.get("1 Hydrae").get("Voss Hub");
|
station = market.get("1 Hydrae").get("Voss Hub");
|
||||||
assertNotNull(station);
|
assertNotNull(station);
|
||||||
|
assertEquals(STATION_TYPE.STARPORT, station.getType());
|
||||||
assertNull(station.getFaction());
|
assertNull(station.getFaction());
|
||||||
assertNull(station.getGovernment());
|
assertNull(station.getGovernment());
|
||||||
assertEquals(823, station.getDistance(), 0.00001);
|
assertEquals(823, station.getDistance(), 0.00001);
|
||||||
assertTrue(station.has(SERVICE_TYPE.BLACK_MARKET));
|
assertTrue(station.has(SERVICE_TYPE.BLACK_MARKET));
|
||||||
assertTrue(station.has(SERVICE_TYPE.MEDIUM_LANDPAD));
|
|
||||||
assertTrue(station.has(SERVICE_TYPE.LARGE_LANDPAD));
|
|
||||||
assertTrue(station.has(SERVICE_TYPE.MARKET));
|
assertTrue(station.has(SERVICE_TYPE.MARKET));
|
||||||
assertTrue(station.has(SERVICE_TYPE.SHIPYARD));
|
assertTrue(station.has(SERVICE_TYPE.SHIPYARD));
|
||||||
assertFalse(station.has(SERVICE_TYPE.OUTFIT));
|
assertFalse(station.has(SERVICE_TYPE.OUTFIT));
|
||||||
@@ -107,8 +106,6 @@ public class StationImportTest extends Assert {
|
|||||||
assertNotNull(station);
|
assertNotNull(station);
|
||||||
assertEquals(0, station.getDistance(), 0.00001);
|
assertEquals(0, station.getDistance(), 0.00001);
|
||||||
assertFalse(station.has(SERVICE_TYPE.BLACK_MARKET));
|
assertFalse(station.has(SERVICE_TYPE.BLACK_MARKET));
|
||||||
assertFalse(station.has(SERVICE_TYPE.MEDIUM_LANDPAD));
|
|
||||||
assertFalse(station.has(SERVICE_TYPE.LARGE_LANDPAD));
|
|
||||||
assertFalse(station.has(SERVICE_TYPE.MARKET));
|
assertFalse(station.has(SERVICE_TYPE.MARKET));
|
||||||
assertTrue(station.has(SERVICE_TYPE.SHIPYARD));
|
assertTrue(station.has(SERVICE_TYPE.SHIPYARD));
|
||||||
assertFalse(station.has(SERVICE_TYPE.OUTFIT));
|
assertFalse(station.has(SERVICE_TYPE.OUTFIT));
|
||||||
@@ -121,12 +118,11 @@ public class StationImportTest extends Assert {
|
|||||||
|
|
||||||
station = place.get("Trevithick Hub");
|
station = place.get("Trevithick Hub");
|
||||||
assertNotNull(station);
|
assertNotNull(station);
|
||||||
|
assertEquals(STATION_TYPE.STARPORT, station.getType());
|
||||||
assertEquals(FACTION.ALLIANCE, station.getFaction());
|
assertEquals(FACTION.ALLIANCE, station.getFaction());
|
||||||
assertEquals(GOVERNMENT.COMMUNISM, station.getGovernment());
|
assertEquals(GOVERNMENT.COMMUNISM, station.getGovernment());
|
||||||
assertEquals(957, station.getDistance(), 0.00001);
|
assertEquals(957, station.getDistance(), 0.00001);
|
||||||
assertFalse(station.has(SERVICE_TYPE.BLACK_MARKET));
|
assertFalse(station.has(SERVICE_TYPE.BLACK_MARKET));
|
||||||
assertTrue(station.has(SERVICE_TYPE.MEDIUM_LANDPAD));
|
|
||||||
assertTrue(station.has(SERVICE_TYPE.LARGE_LANDPAD));
|
|
||||||
assertFalse(station.has(SERVICE_TYPE.MARKET));
|
assertFalse(station.has(SERVICE_TYPE.MARKET));
|
||||||
assertFalse(station.has(SERVICE_TYPE.SHIPYARD));
|
assertFalse(station.has(SERVICE_TYPE.SHIPYARD));
|
||||||
assertTrue(station.has(SERVICE_TYPE.OUTFIT));
|
assertTrue(station.has(SERVICE_TYPE.OUTFIT));
|
||||||
@@ -134,12 +130,11 @@ public class StationImportTest extends Assert {
|
|||||||
|
|
||||||
station = market.get("10 CANUM VENATICORUM").get("Litke Port");
|
station = market.get("10 CANUM VENATICORUM").get("Litke Port");
|
||||||
assertNotNull(station);
|
assertNotNull(station);
|
||||||
|
assertEquals(STATION_TYPE.OUTPOST, station.getType());
|
||||||
assertEquals(FACTION.EMPIRE, station.getFaction());
|
assertEquals(FACTION.EMPIRE, station.getFaction());
|
||||||
assertEquals(GOVERNMENT.CONFEDERACY, station.getGovernment());
|
assertEquals(GOVERNMENT.CONFEDERACY, station.getGovernment());
|
||||||
assertEquals(2000, station.getDistance(), 0.00001);
|
assertEquals(2000, station.getDistance(), 0.00001);
|
||||||
assertTrue(station.has(SERVICE_TYPE.BLACK_MARKET));
|
assertTrue(station.has(SERVICE_TYPE.BLACK_MARKET));
|
||||||
assertTrue(station.has(SERVICE_TYPE.MEDIUM_LANDPAD));
|
|
||||||
assertFalse(station.has(SERVICE_TYPE.LARGE_LANDPAD));
|
|
||||||
assertTrue(station.has(SERVICE_TYPE.MARKET));
|
assertTrue(station.has(SERVICE_TYPE.MARKET));
|
||||||
assertTrue(station.has(SERVICE_TYPE.SHIPYARD));
|
assertTrue(station.has(SERVICE_TYPE.SHIPYARD));
|
||||||
assertTrue(station.has(SERVICE_TYPE.OUTFIT));
|
assertTrue(station.has(SERVICE_TYPE.OUTFIT));
|
||||||
|
|||||||
Reference in New Issue
Block a user