public class Environment extends java.lang.Object implements IEnvironment
Modifier and Type | Field and Description |
---|---|
protected java.util.Map |
ages
The cleaner ages.
|
protected java.util.List |
cleaners
The cleaners.
|
protected boolean |
daytime
The daytime.
|
protected static Environment |
instance
The singleton.
|
jadex.commons.SimplePropertyChangeSupport |
pcs
The helper object for bean events.
|
protected java.util.List |
stations
The charging stations.
|
protected java.util.List |
wastebins
The waste bins.
|
protected java.util.List |
wastes
The wastes.
|
Constructor and Description |
---|
Environment()
Create a new environment.
|
Modifier and Type | Method and Description |
---|---|
void |
addChargingStation(Chargingstation station)
Add a charging station.
|
void |
addCleaner(Cleaner cleaner)
Add a cleaner.
|
void |
addPropertyChangeListener(jadex.commons.beans.PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list.
|
void |
addWaste(Waste waste)
Add a piece of waste.
|
void |
addWastebin(Wastebin wastebin)
Add a wastebin.
|
void |
clear()
Clear the environment.
|
static void |
clearInstance()
Clear the singleton instance.
|
boolean |
dropWasteInWastebin(Waste waste,
Wastebin wastebin)
Drop a piece of waste.
|
int |
getAge(Cleaner cleaner)
Get the age of a cleaner.
|
Chargingstation[] |
getChargingstations()
Get all charging stations.
|
Cleaner[] |
getCleaners()
Get all cleaners.
|
Vision |
getCompleteVision()
Get the complete vision.
|
boolean |
getDaytime()
Get the daytime.
|
static Environment |
getInstance()
Get the singleton.
|
Vision |
getVision(Cleaner cleaner)
Get the current vision.
|
Wastebin |
getWastebin(java.lang.String name)
Get a wastebin for a name.
|
protected Wastebin |
getWastebin(Wastebin wb)
Get a wastebin for a template.
|
Wastebin[] |
getWastebins()
Get all wastebins.
|
Waste[] |
getWastes()
Get all wastes.
|
boolean |
pickUpWaste(Waste waste)
Try to pick up some piece of waste.
|
void |
removeCleaner(Cleaner cleaner)
Remove a cleaner.
|
void |
removePropertyChangeListener(jadex.commons.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list.
|
void |
removeWaste(Waste waste)
Remove a piece of waste.
|
void |
setDaytime(boolean daytime)
Set the daytime.
|
protected static Environment instance
protected boolean daytime
protected java.util.List cleaners
protected java.util.List wastes
protected java.util.List wastebins
protected java.util.List stations
protected java.util.Map ages
public jadex.commons.SimplePropertyChangeSupport pcs
public static Environment getInstance()
public static void clearInstance()
public Vision getVision(Cleaner cleaner)
getVision
in interface IEnvironment
cleaner
- The cleaner.public boolean pickUpWaste(Waste waste)
pickUpWaste
in interface IEnvironment
waste
- The waste.public boolean dropWasteInWastebin(Waste waste, Wastebin wastebin)
dropWasteInWastebin
in interface IEnvironment
waste
- The piece of waste.wastebin
- The waste bin.protected Wastebin getWastebin(Wastebin wb)
public Vision getCompleteVision()
public boolean getDaytime()
public void setDaytime(boolean daytime)
daytime
- The daytime.public void addCleaner(Cleaner cleaner)
cleaner
- The cleaner.public void removeCleaner(Cleaner cleaner)
cleaner
- The cleaner.public void addWaste(Waste waste)
waste
- The new piece of waste.public void removeWaste(Waste waste)
waste
- The piece of waste.public void addWastebin(Wastebin wastebin)
wastebin
- The new waste bin.public void addChargingStation(Chargingstation station)
station
- The new charging station.public Waste[] getWastes()
public Wastebin[] getWastebins()
public Chargingstation[] getChargingstations()
public Cleaner[] getCleaners()
public Wastebin getWastebin(java.lang.String name)
public void clear()
public int getAge(Cleaner cleaner)
public void addPropertyChangeListener(jadex.commons.beans.PropertyChangeListener listener)
listener
- The PropertyChangeListener to be added.public void removePropertyChangeListener(jadex.commons.beans.PropertyChangeListener listener)
listener
- The PropertyChangeListener to be removed.