Package sk.tuke.kpi.gamelib
Interface ActorContainer<A extends Actor>
-
- Type Parameters:
A
- type of actors to be stored in container
- All Superinterfaces:
java.lang.Iterable<A>
public interface ActorContainer<A extends Actor> extends java.lang.Iterable<A>
ActorContainer represents an iterable collection of actors that can be rendered at the bottom if the game window usingGame.pushActorContainer(sk.tuke.kpi.gamelib.ActorContainer<?>)
method.The container should have fixed
capacity
and should behave similarly to a stack: - methodadd(Actor)
adds actor to the top of the container - methodpeek()
gets the actor from the top - methodshift()
rotates the container's actors by moving the topmost one to the bottom
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(A actor)
Adds actor to the top of the container.int
getCapacity()
@NotNull java.util.List<A>
getContent()
Container's content.@NotNull java.lang.String
getName()
int
getSize()
A
peek()
void
remove(A actor)
Removes actor from te container.void
shift()
Moves the actor from the top of the container to the bottom.
-
-
-
Method Detail
-
getContent
@NotNull @NotNull java.util.List<A> getContent()
Container's content. Modifications to the returned list should not reflect in the container.
-
getCapacity
int getCapacity()
- Returns:
- maximum capacity of the container.
-
getSize
int getSize()
- Returns:
- current size of the container's content.
-
getName
@NotNull @NotNull java.lang.String getName()
- Returns:
- name of the container.
-
add
void add(@NotNull A actor)
Adds actor to the top of the container.- Throws:
java.lang.IllegalStateException
- if the container is already full
-
remove
void remove(@NotNull A actor)
Removes actor from te container.
-
peek
@Nullable A peek()
- Returns:
- actor at the top of the container.
-
shift
void shift()
Moves the actor from the top of the container to the bottom.
-
-