39 lines
815 B
Java
39 lines
815 B
Java
|
package inf101.v18.rogue101.items;
|
||
|
|
||
|
import inf101.v18.rogue101.objects.IItem;
|
||
|
|
||
|
import java.util.List;
|
||
|
|
||
|
/**
|
||
|
* A container for storing anything extending IItem.
|
||
|
*
|
||
|
* @param <T> The item type to store
|
||
|
*/
|
||
|
public interface IContainer<T extends IItem> extends IItem {
|
||
|
/**
|
||
|
* Retrieves an item from a container in index i
|
||
|
*
|
||
|
* @param i The index of an element
|
||
|
* @return An IItem
|
||
|
* @throws IndexOutOfBoundsException If the index is out of range.
|
||
|
*/
|
||
|
IItem get(int i);
|
||
|
|
||
|
/**
|
||
|
* Gets a list with everything inside a container.
|
||
|
*
|
||
|
* @return A list of Objects extending IItem
|
||
|
*/
|
||
|
List<T> getContent();
|
||
|
|
||
|
/**
|
||
|
* Checks if we can add anything at all to the container.
|
||
|
*
|
||
|
* @return True if it has no space left
|
||
|
*/
|
||
|
boolean isFull();
|
||
|
|
||
|
|
||
|
|
||
|
}
|