Package xyz.calcugames.levelz.coord
Class CoordinateMatrix2D
java.lang.Object
xyz.calcugames.levelz.coord.CoordinateMatrix
xyz.calcugames.levelz.coord.CoordinateMatrix2D
- All Implemented Interfaces:
Iterable<Coordinate>
Represents a 2D matrix of coordinates.
-
Constructor Summary
ConstructorsConstructorDescriptionCoordinateMatrix2D(int minX, int maxX, int minY, int maxY, @NotNull Coordinate2D start) Creates a new 2D matrix of coordinates.CoordinateMatrix2D(int x, int y, @NotNull Coordinate2D start) Creates a new 2D matrix of coordinates with minimum values of 0. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull CoordinateMatrix2DfromString(@NotNull String string) Parses a 2D matrix of coordinates from a string.@NotNull Set<Coordinate2D>Gets the coordinates in the matrix.@NotNull Coordinate2DgetStart()Gets the starting coordinate of the matrix.toString()Gets the string version of this coordinate matrix.Methods inherited from class xyz.calcugames.levelz.coord.CoordinateMatrix
equals, getDimension, hashCode, iteratorMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
CoordinateMatrix2D
Creates a new 2D matrix of coordinates with minimum values of 0.- Parameters:
x- The x value.y- The y value.start- The starting coordinate.
-
CoordinateMatrix2D
public CoordinateMatrix2D(int minX, int maxX, int minY, int maxY, @NotNull @NotNull Coordinate2D start) Creates a new 2D matrix of coordinates.- Parameters:
minX- The minimum x value.maxX- The maximum x value.minY- The minimum y value.maxY- The maximum y value.start- The starting coordinate.
-
-
Method Details
-
getCoordinates
Description copied from class:CoordinateMatrixGets the coordinates in the matrix.- Specified by:
getCoordinatesin classCoordinateMatrix- Returns:
- The coordinates in the matrix.
-
getStart
Description copied from class:CoordinateMatrixGets the starting coordinate of the matrix.- Specified by:
getStartin classCoordinateMatrix- Returns:
- The starting coordinate of the matrix.
-
toString
Description copied from class:CoordinateMatrixGets the string version of this coordinate matrix.- Specified by:
toStringin classCoordinateMatrix- Returns:
- This Coordinate Matrix as a string, represented in LevelZ format.
-
fromString
@NotNull public static @NotNull CoordinateMatrix2D fromString(@NotNull @NotNull String string) throws IllegalArgumentException Parses a 2D matrix of coordinates from a string.- Parameters:
string- The string to parse.- Returns:
- The parsed 2D matrix of coordinates.
- Throws:
IllegalArgumentException- if the string is invalid
-