Class Target

  • All Implemented Interfaces:
    java.io.Serializable

    public class Target
    extends LocationObject
    The target is a map position
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int capacity
      The actual available capacity.
      protected static int cnt
      A static instance count.
      protected int initialcapacity
      The max.
      protected boolean marked
      Was the target visited.
      protected int ore
      The currently available ore amount.
    • Constructor Summary

      Constructors 
      Constructor Description
      Target()
      Create a new target.
      Target​(Location loc, int initialcapacity)
      Create a new target.
    • Field Detail

      • ore

        protected int ore
        The currently available ore amount.
      • initialcapacity

        protected int initialcapacity
        The max. produceable ore amount.
      • capacity

        protected int capacity
        The actual available capacity.
      • marked

        protected boolean marked
        Was the target visited.
      • cnt

        protected static int cnt
        A static instance count.
    • Constructor Detail

      • Target

        public Target()
        Create a new target. Empty bean constructor.
      • Target

        public Target​(Location loc,
                      int initialcapacity)
        Create a new target.
    • Method Detail

      • produceOre

        public void produceOre​(int ore)
        Change the amount of ore at the Location
        Parameters:
        ore - The produced ore.
      • retrieveOre

        public int retrieveOre​(int amount)
        Retrieve some ore amount.
        Parameters:
        amount - The amount.
      • getOreCapacity

        public int getOreCapacity()
        Get the capacity of ore.
        Returns:
        The amount of Ore
      • getOre

        public int getOre()
        Get the amount of ore.
        Returns:
        The amount of Ore
      • setMarked

        public void setMarked()
        Mark this target as visited.
      • isMarked

        public boolean isMarked()
        Test if target was visited.
        Returns:
        True if already visited.
      • isOre

        public boolean isOre()
        Test if target can produce some ore.
        Returns:
        true if target can produce some ore
      • getCapacity

        public int getCapacity()
        Getter for capacity
        Returns:
        Returns capacity.
      • setCapacity

        public void setCapacity​(int capacity)
        Setter for capacity.
        Parameters:
        capacity - The Target.java value to set
      • getInitialcapacity

        public int getInitialcapacity()
        Getter for initialcapacity
        Returns:
        Returns initialcapacity.
      • setInitialcapacity

        public void setInitialcapacity​(int initialcapacity)
        Setter for initialcapacity.
        Parameters:
        initialcapacity - The Target.java value to set
      • setMarked

        public void setMarked​(boolean marked)
        Setter for marked.
        Parameters:
        marked - The Target.java value to set
      • setOre

        public void setOre​(int ore)
        Setter for ore.
        Parameters:
        ore - The Target.java value to set
      • toString

        public java.lang.String toString()
        Convert the Location to a string representation.
        Overrides:
        toString in class LocationObject
        Returns:
        The string representation.