Class Structure
java.lang.Object
com.cotani.gui.layout.Structure
Parsed matrix layout that maps symbols to inventory slots.
Each row is a whitespace-separated list of single-character tokens, at most 9 tokens per row and
6 rows per structure. The slot of a token at row r and column c is r * 9 + c.
The character '.' is reserved for intentionally empty slots and is never recorded.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charReserved symbol for intentionally empty slots. -
Method Summary
Modifier and TypeMethodDescriptionstatic StructureParses row patterns such as"# # #"and"# F #"into a structure.introws()Returns the number of rows declared by this structure.intsize()Returns the total inventory size required by this structure (rows * 9).slots(char symbol) Returns the slots assigned to the given symbol, in reading order.symbols()Returns all symbols declared by this structure.
-
Field Details
-
EMPTY
public static final char EMPTYReserved symbol for intentionally empty slots.- See Also:
-
-
Method Details
-
parse
Parses row patterns such as"# # #"and"# F #"into a structure.- Parameters:
rows- the row patterns, between 1 and 6 entries- Returns:
- the parsed structure
- Throws:
IllegalArgumentException- when a row has more than 9 tokens, a token is not a single character, or the row count is outside1..6
-
rows
public int rows()Returns the number of rows declared by this structure.- Returns:
- the row count, between 1 and 6
-
size
public int size()Returns the total inventory size required by this structure (rows * 9).- Returns:
- the slot count
-
slots
-
symbols
-