Class Environment
- java.lang.Object
- 
- jadex.bdi.examples.cleanerworld_classic.Environment
 
- 
- All Implemented Interfaces:
- IEnvironment
 
 public class Environment extends java.lang.Object implements IEnvironment The environment object for non distributed applications.
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.util.MapagesThe cleaner ages.protected java.util.ListcleanersThe cleaners.protected booleandaytimeThe daytime.protected static EnvironmentinstanceThe singleton.SimplePropertyChangeSupportpcsThe helper object for bean events.protected java.util.ListstationsThe charging stations.protected java.util.ListwastebinsThe waste bins.protected java.util.ListwastesThe wastes.
 - 
Constructor SummaryConstructors Constructor Description Environment()Create a new environment.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChargingStation(Chargingstation station)Add a charging station.voidaddCleaner(Cleaner cleaner)Add a cleaner.voidaddPropertyChangeListener(PropertyChangeListener listener)Add a PropertyChangeListener to the listener list.voidaddWaste(Waste waste)Add a piece of waste.voidaddWastebin(Wastebin wastebin)Add a wastebin.voidclear()Clear the environment.static voidclearInstance()Clear the singleton instance.booleandropWasteInWastebin(Waste waste, Wastebin wastebin)Drop a piece of waste.intgetAge(Cleaner cleaner)Get the age of a cleaner.Chargingstation[]getChargingstations()Get all charging stations.Cleaner[]getCleaners()Get all cleaners.VisiongetCompleteVision()Get the complete vision.booleangetDaytime()Get the daytime.static EnvironmentgetInstance()Get the singleton.VisiongetVision(Cleaner cleaner)Get the current vision.protected WastebingetWastebin(Wastebin wb)Get a wastebin for a template.WastebingetWastebin(java.lang.String name)Get a wastebin for a name.Wastebin[]getWastebins()Get all wastebins.Waste[]getWastes()Get all wastes.booleanpickUpWaste(Waste waste)Try to pick up some piece of waste.voidremoveCleaner(Cleaner cleaner)Remove a cleaner.voidremovePropertyChangeListener(PropertyChangeListener listener)Remove a PropertyChangeListener from the listener list.voidremoveWaste(Waste waste)Remove a piece of waste.voidsetDaytime(boolean daytime)Set the daytime.
 
- 
- 
- 
Field Detail- 
instanceprotected static Environment instance The singleton.
 - 
daytimeprotected boolean daytime The daytime.
 - 
cleanersprotected java.util.List cleaners The cleaners.
 - 
wastesprotected java.util.List wastes The wastes.
 - 
wastebinsprotected java.util.List wastebins The waste bins.
 - 
stationsprotected java.util.List stations The charging stations.
 - 
agesprotected java.util.Map ages The cleaner ages.
 - 
pcspublic SimplePropertyChangeSupport pcs The helper object for bean events.
 
- 
 - 
Method Detail- 
getInstancepublic static Environment getInstance() Get the singleton.- Returns:
- The environment.
 
 - 
clearInstancepublic static void clearInstance() Clear the singleton instance.
 - 
getVisionpublic Vision getVision(Cleaner cleaner) Get the current vision.- Specified by:
- getVisionin interface- IEnvironment
- Parameters:
- cleaner- The cleaner.
- Returns:
- The current vision, null if failure.
 
 - 
pickUpWastepublic boolean pickUpWaste(Waste waste) Try to pick up some piece of waste.- Specified by:
- pickUpWastein interface- IEnvironment
- Parameters:
- waste- The waste.
- Returns:
- True if the waste could be picked up.
 
 - 
dropWasteInWastebinpublic boolean dropWasteInWastebin(Waste waste, Wastebin wastebin) Drop a piece of waste.- Specified by:
- dropWasteInWastebinin interface- IEnvironment
- Parameters:
- waste- The piece of waste.
- wastebin- The waste bin.
 
 - 
getWastebinprotected Wastebin getWastebin(Wastebin wb) Get a wastebin for a template.- Returns:
- The wastebin.
 
 - 
getCompleteVisionpublic Vision getCompleteVision() Get the complete vision.- Returns:
- The current vision, null if failure.
 
 - 
getDaytimepublic boolean getDaytime() Get the daytime.- Returns:
- The current vision.
 
 - 
setDaytimepublic void setDaytime(boolean daytime) Set the daytime.- Parameters:
- daytime- The daytime.
 
 - 
addCleanerpublic void addCleaner(Cleaner cleaner) Add a cleaner.- Parameters:
- cleaner- The cleaner.
 
 - 
removeCleanerpublic void removeCleaner(Cleaner cleaner) Remove a cleaner.- Parameters:
- cleaner- The cleaner.
 
 - 
addWastepublic void addWaste(Waste waste) Add a piece of waste.- Parameters:
- waste- The new piece of waste.
 
 - 
removeWastepublic void removeWaste(Waste waste) Remove a piece of waste.- Parameters:
- waste- The piece of waste.
 
 - 
addWastebinpublic void addWastebin(Wastebin wastebin) Add a wastebin.- Parameters:
- wastebin- The new waste bin.
 
 - 
addChargingStationpublic void addChargingStation(Chargingstation station) Add a charging station.- Parameters:
- station- The new charging station.
 
 - 
getWastespublic Waste[] getWastes() Get all wastes.- Returns:
- All wastes.
 
 - 
getWastebinspublic Wastebin[] getWastebins() Get all wastebins.- Returns:
- All wastebins.
 
 - 
getChargingstationspublic Chargingstation[] getChargingstations() Get all charging stations.- Returns:
- All stations.
 
 - 
getCleanerspublic Cleaner[] getCleaners() Get all cleaners.- Returns:
- All cleaners.
 
 - 
getWastebinpublic Wastebin getWastebin(java.lang.String name) Get a wastebin for a name.- Returns:
- The wastebin.
 
 - 
clearpublic void clear() Clear the environment.
 - 
getAgepublic int getAge(Cleaner cleaner) Get the age of a cleaner.- Returns:
- The age.
 
 - 
addPropertyChangeListenerpublic void addPropertyChangeListener(PropertyChangeListener listener) Add a PropertyChangeListener to the listener list. The listener is registered for all properties.- Parameters:
- listener- The PropertyChangeListener to be added.
 
 - 
removePropertyChangeListenerpublic void removePropertyChangeListener(PropertyChangeListener listener) Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.- Parameters:
- listener- The PropertyChangeListener to be removed.
 
 
- 
 
-