Package org.progettoedids.rooms
Class Room
java.lang.Object
org.progettoedids.rooms.Room
- Direct Known Subclasses:
BlockedRoom,DoorlessRoom,RoomWithDoors,TeleportRoom,VictoryRoom
A Room a container of Entity(ies) that is characterized by a character symbol.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an Entity to the Room.charReturns the character symbol characterizing the type of this instance of Room.Entity[]Returns all the Entity(ies) held in the Room<T> Entity[]getEntities(Class<T> entityClass) Returns an Entity matching the supplied UUID held in the Room.abstract booleanisLocked()Returns whether the Room is locked or not.removeEntity(UUID entityUUID) Removes the Entity matching the specified UUID.
-
Constructor Details
-
Room
protected Room(char charSymbol)
-
-
Method Details
-
isLocked
public abstract boolean isLocked()Returns whether the Room is locked or not.A locked Room cannot be crossed by other Entity(ies). Depending on subtype implementation it might be possible the Room can be unlocked in some way.
- Returns:
- true if the Room is locked, false otherwise
-
getEntity
-
getEntities
-
getEntities
Returns all the Entity(ies) held in the Room- Returns:
- an array holding all the Entities in the Room, can be empty
-
addEntity
Adds an Entity to the Room.- Parameters:
entity- the Entity to add
-
removeEntity
Removes the Entity matching the specified UUID.- Parameters:
entityUUID- the UUID identifying an Entity- Returns:
- the Entity that has been removed
- Throws:
IllegalArgumentException- if an Entity corresponding to the UUID couldn't be found
-
getCharSymbol
public char getCharSymbol()Returns the character symbol characterizing the type of this instance of Room.- Returns:
- a character symbol
-