Class CleanerAgent.AchieveCleanup
- java.lang.Object
-
- jadex.bdiv3.examples.cleanerworld.cleaner.CleanerAgent.AchieveCleanup
-
- Enclosing class:
- CleanerAgent
public class CleanerAgent.AchieveCleanup extends java.lang.ObjectAchieve 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.
-
-
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 booleancheckContext()Suspend the goal when night.booleancheckDrop()Drop the goal when waste is not seen anymore and the agent agent does not carry it.booleancheckTarget()Check if the waste is contained in a wastebin.booleanequals(java.lang.Object obj)Test if equal to other goal.WastegetWaste()Get the waste.inthashCode()Get the hashcode.protected booleaninhibitAchieveCleanUp(CleanerAgent.AchieveCleanup other)Inhibit other achieve cleanup goals that are farer away from the cleaner.java.lang.StringtoString()Get the string representation.
-
-
-
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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Test if equal to other goal.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- The other object.- Returns:
- True, if equal.
-
toString
public java.lang.String toString()
Get the string representation.- Overrides:
toStringin classjava.lang.Object- Returns:
- The string representation.
-
-