public class Wastebin extends LocationObject
Modifier and Type | Field and Description |
---|---|
protected int |
capacity
Attribute for slot capacity.
|
protected static int |
instancecnt
The instance counter.
|
protected java.lang.String |
name
Attribute for slot name.
|
protected java.util.List |
wastes
Attribute for slot wastes.
|
id, location, pcs
Constructor and Description |
---|
Wastebin()
Create a new Wastebin.
|
Wastebin(Location location,
int capacity)
Create a new wastebin.
|
Wastebin(java.lang.String name,
Location location,
int capacity)
Create a new Wastebin.
|
Modifier and Type | Method and Description |
---|---|
void |
addWaste(Waste waste)
Add a waste to this Wastebin.
|
java.lang.Object |
clone()
Clone the object.
|
boolean |
contains(Waste waste)
Test is the waste is in the waste bin.
|
void |
empty()
Empty the waste bin.
|
void |
fill()
Fill the waste bin.
|
int |
getCapacity()
Get the capacity of this Wastebin.
|
java.lang.String |
getName()
Get the name of this Wastebin.
|
protected static int |
getNumber()
Get an instance number.
|
Waste |
getWaste(int idx)
Get an wastes of this Wastebin.
|
Waste[] |
getWastes()
Get the wastes of this Wastebin.
|
boolean |
isFull()
Test is the wastebin is full.
|
boolean |
removeWaste(Waste waste)
Remove a waste from this Wastebin.
|
void |
setCapacity(int capacity)
Set the capacity of this Wastebin.
|
void |
setName(java.lang.String name)
Set the name of this Wastebin.
|
void |
setWaste(int idx,
Waste waste)
Set a waste to this Wastebin.
|
void |
setWastes(Waste[] wastes)
Set the wastes of this Wastebin.
|
java.lang.String |
toString()
Get a string representation of this Wastebin.
|
void |
update(Wastebin wb)
Update this wastebin.
|
addPropertyChangeListener, equals, getId, getLocation, hashCode, removePropertyChangeListener, setId, setLocation
protected static int instancecnt
protected java.util.List wastes
protected int capacity
protected java.lang.String name
public Wastebin()
public Wastebin(Location location, int capacity)
public Wastebin(java.lang.String name, Location location, int capacity)
protected static int getNumber()
public Waste[] getWastes()
public void setWastes(Waste[] wastes)
wastes
- the value to be setpublic Waste getWaste(int idx)
idx
- The index.public void setWaste(int idx, Waste waste)
idx
- The index.waste
- a value to be addedpublic void addWaste(Waste waste)
waste
- a value to be removedpublic boolean removeWaste(Waste waste)
waste
- a value to be removedpublic int getCapacity()
public void setCapacity(int capacity)
capacity
- the value to be setpublic java.lang.String getName()
public void setName(java.lang.String name)
name
- the value to be setpublic java.lang.String toString()
toString
in class LocationObject
public boolean isFull()
public void empty()
public void fill()
public boolean contains(Waste waste)
public java.lang.Object clone()
clone
in class LocationObject
public void update(Wastebin wb)