Fixes a number of JavaDoc issues.
Sets functions to do nothing on null input, rather than throwing exceptions.
Removes the annotation.
package com.valkryst.VTerminal.printer;
import com.valkryst.VTerminal.TileGrid;
-import lombok.EqualsAndHashCode;
import lombok.Getter;
-import lombok.NonNull;
import lombok.ToString;
-import java.awt.Point;
+import java.awt.*;
-@EqualsAndHashCode
@ToString
public class TrianglePrinter {
/** The character to print the triangle with. */
@@ -28,21 +25,17 @@ public class TrianglePrinter {
* The algorithm requires exactly three points. If there are more than three
* points, the extra points are ignored.
*
+ * Does nothing if the grid or points array are null or if the points array doesn't have 3 elements.
+ *
* @param grid
* The grid.
*
* @param points
* The points.
- *
- * @throws IllegalArgumentException
- * If there are fewer than three points.
- *
- * @throws NullPointerException
- * If the grid or points array is null.
*/
- public void print(final @NonNull TileGrid grid, @NonNull Point[] points) {
- if (points.length < 3) {
- throw new IllegalArgumentException("A triangle requires three points to be drawn.");
+ public void print(final TileGrid grid, Point[] points) {
+ if (grid == null || points == null || points.length < 3) {
+ return;
}
points = new Point[]{points[0], points[1], points[2], points[0]};
