Interface EntityCollector
-
- All Known Implementing Classes:
GreedyEntity
public interface EntityCollector
An entity which can collectCollectableEntity
.- Author:
- Tim Neumann
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canCarry(Class<? extends CollectableEntity> type)
Check if this can collect and drop the given collectable entity type.void
collect(CollectableEntity entity)
Collect the given entity.void
drop(CollectableEntity entity, Position pos)
Drop the given entity.
-
-
-
Method Detail
-
canCarry
boolean canCarry(Class<? extends CollectableEntity> type)
Check if this can collect and drop the given collectable entity type.- Parameters:
type
- The type to check; must not be null- Returns:
- true if this entity collector can collect or drop the given entity type
-
collect
void collect(CollectableEntity entity)
Collect the given entity.- Parameters:
entity
- The entity to collect; must not be null; must be collectable by this- Throws:
CannotCollectEntityException
- if the given entity cannot be collected right now for any reasonIllegalArgumentException
- if an argument is null
-
drop
void drop(CollectableEntity entity, Position pos)
Drop the given entity.- Parameters:
entity
- The entity to drop;must not be null; must be droppable by thispos
- The position to drop the entity at; must not be null- Throws:
CannotDropEntityException
- if the given entity cannot be dropped right now for any reasonIllegalArgumentException
- if an argument is null
-
-