Class CleanerAgent.AchieveCleanup

  • Enclosing class:
    CleanerAgent

    public class CleanerAgent.AchieveCleanup
    extends java.lang.Object
    Achieve cleanup goals are created for every piece of waste the agent notices. Avoids having multiple goals for the same piece of waste by setting goal to unique. For this purpose the hashcode and equals method need to be implemented.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Waste waste
      The waste.
    • Constructor Summary

      Constructors 
      Constructor Description
      AchieveCleanup​(Waste waste)
      Create a new goal.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean checkContext()
      Suspend the goal when night.
      boolean checkDrop()
      Drop the goal when waste is not seen anymore and the agent agent does not carry it.
      boolean checkTarget()
      Check if the waste is contained in a wastebin.
      boolean equals​(java.lang.Object obj)
      Test if equal to other goal.
      Waste getWaste()
      Get the waste.
      int hashCode()
      Get the hashcode.
      protected boolean inhibitAchieveCleanUp​(CleanerAgent.AchieveCleanup other)
      Inhibit other achieve cleanup goals that are farer away from the cleaner.
      java.lang.String toString()
      Get the string representation.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • waste

        protected Waste waste
        The waste.
    • Constructor Detail

      • AchieveCleanup

        public AchieveCleanup​(Waste waste)
        Create a new goal.
    • Method Detail

      • checkContext

        public boolean checkContext()
        Suspend the goal when night.
      • checkDrop

        public boolean checkDrop()
        Drop the goal when waste is not seen anymore and the agent agent does not carry it.
      • checkTarget

        public boolean checkTarget()
        Check if the waste is contained in a wastebin.
      • inhibitAchieveCleanUp

        protected boolean inhibitAchieveCleanUp​(CleanerAgent.AchieveCleanup other)
        Inhibit other achieve cleanup goals that are farer away from the cleaner.
      • getWaste

        public Waste getWaste()
        Get the waste.
        Returns:
        The waste.
      • hashCode

        public int hashCode()
        Get the hashcode.
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Test if equal to other goal.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - The other object.
        Returns:
        True, if equal.
      • toString

        public java.lang.String toString()
        Get the string representation.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string representation.