public int getInitialWidth() { return initialWidth.get(); } public Font getFont() {
@Override protected int computeValue() { return transferUtil.calculateAvailableAmount(movableAmount, maxAmount.get()); } };
@Override protected int computeValue() { return Math.max(0, needed.get() - stored.get()); } }
public int getVisibleLineCount() { return scroller.visibleLineCountProperty().get(); }
@Override protected String computeValue() { switch (type) { case PORT_CITY_TO_SHIP: case PORT_CITY_TO_STORAGE: if (availableAmount.get() > 0){ return String.valueOf(computablePrice.buyPrice(ware, availableAmount, amountToBuy)); } else { return "0"; // cannot buy anything if nothing is there } default: return "<"; } } };
/** * Retrieve the amount of weapons available in the armory. */ protected int getWeaponAmount(IArmory armory, EWeapon weapon) { switch (weapon) { case HAND_WEAPON: return armory.cutlassAmountProperty().get(); case BALLISTA_BIG: return armory.ballistaBigAmountProperty().get(); case BALLISTA_SMALL: return armory.ballistaSmallAmountProperty().get(); case TREBUCHET_BIG: return armory.trebuchetBigAmountProperty().get(); case TREBUCHET_SMALL: return armory.trebuchetSmallAmountProperty().get(); case BOMBARD: return armory.bombardAmountProperty().get(); case CANNON: return armory.canonAmountProperty().get(); default: throw new IllegalArgumentException("Unhandled weapon type: "+weapon); } }
private int getAmount(EWeapon weapon) { switch (weapon) { case SWORD: return armory.swordAmountProperty().get(); case BALLISTA_BIG: return armory.ballistaBigAmountProperty().get(); case BALLISTA_SMALL: return armory.ballistaSmallAmountProperty().get(); case BOMBARD: return armory.bombardAmountProperty().get(); case BOW: return armory.bowAmountProperty().get(); case CANNON: return armory.canonAmountProperty().get(); case CROSSBOW: return armory.crossbowAmountProperty().get(); case HAND_WEAPON: return armory.cutlassAmountProperty().get(); case MUSKET: return armory.musketAmountProperty().get(); case TREBUCHET_BIG: return armory.trebuchetBigAmountProperty().get(); case TREBUCHET_SMALL: return armory.trebuchetSmallAmountProperty().get(); default: return 0; } } }
switch (proxyType.getSelectionModel().selectedIndexProperty().get()) { case 0: Arrays.stream(properties).forEach(System.getProperties()::remove);
@Nonnull public static TextField textFieldIntegerReadonly(@Nonnull ReadOnlyIntegerProperty integerProperty, @Nonnull NumberStringConverterForIntegers integerConverter) { TextField textField = new TextField(); integerProperty.addListener((observable, oldValue, newValue) -> textField.setText(integerConverter.toString(newValue))); textField.setText(integerConverter.toString(integerProperty.get())); textField.setEditable(false); return textField; }
@Override protected int computeValue() { int availableAmount = getAmountInArmory(weapon).get(); int buyAmount = transferUtil.calculateAvailableAmount(ETransferAmount.ONE, availableAmount); if (buyAmount>0) { return computablePrice.sellPrice(weapon, new SimpleIntegerProperty(availableAmount), new StaticIntegerBinding(buyAmount)) * 2; } else { return 0; } } };
@Override protected int computeValue() { int availableAmount = getAmountInArmory(weapon).get(); int buyAmount = transferUtil.calculateAvailableAmount(ETransferAmount.ONE, availableAmount); if (buyAmount>0) { return computablePrice.buyPrice(weapon, new SimpleIntegerProperty(availableAmount), new StaticIntegerBinding(buyAmount)) * 2; } else { return 0; } } };
@Override protected int computeValue() { int availableAmount = getAmountInArmory(weapon).get(); int buyAmount = transferUtil.calculateAvailableAmount(ETransferAmount.ONE, availableAmount); if (buyAmount>0) { return computablePrice.buyPrice(weapon, new SimpleIntegerProperty(availableAmount), new StaticIntegerBinding(buyAmount)) * 2; } else { return 0; } } };
@Override protected int computeValue() { int availableAmount = weaponsDealer.amountAvailableProperty(weapon).get(); int buyAmount = transferUtil.calculateAvailableAmount(amount, availableAmount); int affordableAmount = computablePrice.calculateAffordableAmount(weapon, availableAmount, buyAmount, city.getPlayer().getCompany().getCash()); if (affordableAmount>0) { return computablePrice.buyPrice(weapon, new SimpleIntegerProperty(availableAmount), new StaticIntegerBinding(affordableAmount)); } else { return 0; } } };
switch (whatIndex) { case 0: if (armory.bowAmountProperty().get() > 0) { armory.updateBowAmount(-1); treasury.subtractCityGuardCosts(5); if (armory.swordAmountProperty().get() > 0) { armory.updateSwordAmount(-1); treasury.subtractCityGuardCosts(5); if (armory.crossbowAmountProperty().get() > 0) { armory.updateCrossbowAmount(-1); treasury.subtractCityGuardCosts(10); if (armory.musketAmountProperty().get() > 0) { armory.updateMusketAmount(-1); treasury.subtractCityGuardCosts(20);
final int len = Integer.parseInt(maxLength); if (StringUtils.isNotBlank(textField.getText())) { if (textField.lengthProperty().get() > len) { textField.setText(oldValue);
if (storage != null) { try { if (dealerOwnedAmount.get() > 0) { int amountToBuy = transferUtil.calculateAvailableAmount(movableAmount, dealerOwnedAmount.get()); int affordableAmount = computablePrice.calculateAffordableAmount(weapon, dealerOwnedAmount.get(), amountToBuy, city.getPlayer().getCompany().getCash());