Class ShipModelForShipList


  • public class ShipModelForShipList
    extends java.lang.Object
    UI model for an entry in the ship list dialog.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2018 Created on Jul 12, 2018
    • Constructor Summary

      Constructors 
      Constructor Description
      ShipModelForShipList​(ch.sahits.game.openpatrician.model.ship.IShip ship)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javafx.beans.binding.StringBinding destination()
      Destination city name of the travel.
      int getHealth()
      Retrieve the ships health.
      java.util.Optional<ShipModelForShipList> getParent()
      If the ship belongs to a convoy retrieve the parent ship.
      java.lang.String getShipName()
      Retrieve the name of the ship.
      ch.sahits.game.openpatrician.model.ship.EShipType getShipType()
      Retrieve the ship type.
      int getValue()
      Get the ship's value.
      boolean isAutotrading()
      Check if the ship is on an auto trade route.
      boolean isPlayersShip​(ch.sahits.game.openpatrician.model.IHumanPlayer player)
      Check if the represented ship belongs to the current player.
      javafx.beans.binding.IntegerBinding loadedWares()
      Binding of the loaded amount of wares in barrels.
      javafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.ship.EShipTravelState> travelingState()
      Property of the travel state.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ShipModelForShipList

        public ShipModelForShipList​(ch.sahits.game.openpatrician.model.ship.IShip ship)
    • Method Detail

      • getParent

        public java.util.Optional<ShipModelForShipList> getParent()
        If the ship belongs to a convoy retrieve the parent ship.
        Returns:
        Optional parent reference, not present when a vessel has no parent (i.e. not a convoy member)
      • getShipName

        public java.lang.String getShipName()
        Retrieve the name of the ship.
        Returns:
        ship name.
      • getShipType

        public ch.sahits.game.openpatrician.model.ship.EShipType getShipType()
        Retrieve the ship type.
        Returns:
        ship type.
      • travelingState

        public javafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.ship.EShipTravelState> travelingState()
        Property of the travel state.
        Returns:
        observable of the travel state
      • destination

        public javafx.beans.binding.StringBinding destination()
        Destination city name of the travel. This may be an empty string.
        Returns:
        string binding representing the destination
      • getHealth

        public int getHealth()
        Retrieve the ships health.
        Returns:
        ship health.
      • loadedWares

        public javafx.beans.binding.IntegerBinding loadedWares()
        Binding of the loaded amount of wares in barrels.
        Returns:
        loaded ware binding.
      • getValue

        public int getValue()
        Get the ship's value.
        Returns:
        ship value.
      • isPlayersShip

        public boolean isPlayersShip​(ch.sahits.game.openpatrician.model.IHumanPlayer player)
        Check if the represented ship belongs to the current player.
        Parameters:
        player - to check against owner
        Returns:
        true if player and ship owner match
      • isAutotrading

        public boolean isAutotrading()
        Check if the ship is on an auto trade route.
        Returns:
        true if the ship is on a trade route.