Skip to content
Snippets Groups Projects
Commit 7b738cb7 authored by Magnus Eik's avatar Magnus Eik
Browse files

Make ChaosGameDescription fields final and add validation.

parent 4386eed7
No related branches found
No related tags found
No related merge requests found
......@@ -6,9 +6,9 @@ import edu.ntnu.stud.chaosgame.transformations.Transform2D;
import java.util.List;
public class ChaosGameDescription {
private Vector2D minCoords;
private Vector2D maxCoords;
private List<Transform2D> transforms;
private final Vector2D minCoords;
private final Vector2D maxCoords;
private final List<Transform2D> transforms;
/**
* Constructor for ChaosGameDescription
......@@ -17,6 +17,9 @@ public class ChaosGameDescription {
* @param transforms Inputs a list of transformations {@link Transform2D} used in the chaos game.
*/
public ChaosGameDescription(Vector2D minCoords, Vector2D maxCoords, List<Transform2D> transforms) {
if (minCoords == null || maxCoords == null || transforms == null){
throw new IllegalArgumentException("Coordinates and transforms must not be null.");
}
this.minCoords = minCoords;
this.maxCoords = maxCoords;
this.transforms = transforms;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment