Package org.progettoedids.entities.items
Class Item
java.lang.Object
org.progettoedids.entities.Entity
org.progettoedids.entities.items.Item
- Direct Known Subclasses:
BrokenFountain,Food,Key,Weapon
An Item is a subclass of an Entity which is additionally characterized by a certain
weight.
There exist two types of an Item: those that can be collected and those that cannot be collected from a Room in the Labyrinth.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanReturns whether this item is supposed to be collected from a Room of the LabyrinthintReturns the weight of an Item as defined in a subclass.toString()Methods inherited from class org.progettoedids.entities.Entity
getName, getSystemName, getUUID, setName
-
Field Details
-
weight
protected int weight
-
-
Constructor Details
-
Item
Initializes an Item.- Parameters:
systemName- The system name is used to uniquely identify a certain type of Item. Must not be nullname- The name is displayed to the user and is used to identify an instance of an Item by the user. Must not be nullweight- The weight of the Item. It must be a positive or zero integer
-
-
Method Details
-
getWeight
public int getWeight()Returns the weight of an Item as defined in a subclass.- Returns:
- The weight of an Item
-
canBeCollected
public abstract boolean canBeCollected()Returns whether this item is supposed to be collected from a Room of the Labyrinth- Returns:
- true if this Item can be collected
-
toString
-