Class TreasureHunterEnvironment
- java.lang.Object
- 
- jadex.bdiv3.quickstart.treasureisland.environment.TreasureHunterEnvironment
 
- 
- All Implemented Interfaces:
- java.io.Closeable,- java.lang.AutoCloseable
 
 public class TreasureHunterEnvironment extends java.lang.Object implements java.io.CloseableThe treasure hunter world representation.
- 
- 
Field SummaryFields Modifier and Type Field Description static doubleHEIGHTThe environment width.protected java.util.Set<Treasure>islandsThe collected treasures (just for painting).protected java.awt.geom.Point2D.DoublelocationThe treasure hunter location.protected jadex.bdiv3.quickstart.treasureisland.environment.EnvironmentPanelpanelThe gui.protected java.util.RandomrndThe random number generator.protected java.util.Set<Treasure>treasuresThe treasures.static doubleWIDTHThe environment width.
 - 
Constructor SummaryConstructors Constructor Description TreasureHunterEnvironment()Create a treasure hunter world of given size.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Auto close the gui when the agent is killed.java.awt.geom.Point2DgetHunterLocation()Get the treasure hunter location.java.util.Set<Treasure>getTreasures()Get the current treasures.booleanisAtLocation(java.awt.geom.Point2D location)Check if the hunter is at (i.e.IFuture<java.lang.Void>move(double dx, double dy)Try to move a given distance.IFuture<java.lang.Void>pickUp(Treasure treasure)Pickup a treasure.
 
- 
- 
- 
Field Detail- 
WIDTHpublic static final double WIDTH The environment width.- See Also:
- Constant Field Values
 
 - 
HEIGHTpublic static final double HEIGHT The environment width.- See Also:
- Constant Field Values
 
 - 
rndprotected java.util.Random rnd The random number generator.
 - 
locationprotected java.awt.geom.Point2D.Double location The treasure hunter location.
 - 
treasuresprotected java.util.Set<Treasure> treasures The treasures.
 - 
islandsprotected java.util.Set<Treasure> islands The collected treasures (just for painting).
 - 
panelprotected jadex.bdiv3.quickstart.treasureisland.environment.EnvironmentPanel panel The gui.
 
- 
 - 
Method Detail- 
getHunterLocationpublic java.awt.geom.Point2D getHunterLocation() Get the treasure hunter location.
 - 
getTreasurespublic java.util.Set<Treasure> getTreasures() Get the current treasures.- Returns:
- A copy of the current treasures.
 
 - 
movepublic IFuture<java.lang.Void> move(double dx, double dy) Try to move a given distance. Due to slip or terrain properties the end location might differ from the desired location.- Parameters:
- dx- The intended horizontal movement, i.e. delta-x.
- dy- The intended vertical movement, i.e. delta-y.
- Returns:
- A future that is finished, when the movement operation is completed.
 
 - 
pickUppublic IFuture<java.lang.Void> pickUp(Treasure treasure) Pickup a treasure. Only works, when at the location.- Parameters:
- treasure- The treasure to be picked up.
- Returns:
- A future that is finished, when the pick up operation is completed, i.e. failed or succeeded.
 
 - 
isAtLocationpublic boolean isAtLocation(java.awt.geom.Point2D location) Check if the hunter is at (i.e. close enough to) a given location.
 - 
closepublic void close() Auto close the gui when the agent is killed.- Specified by:
- closein interface- java.lang.AutoCloseable
- Specified by:
- closein interface- java.io.Closeable
 
 
- 
 
-