summaryrefslogtreecommitdiffstats
path: root/src/se
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2021-02-02 11:47:22 +0100
committerGustav Sörnäs <gustav@sornas.net>2021-02-02 11:47:22 +0100
commit8315b8c28a176f8d54cd05ee0a58813d00bbeabb (patch)
tree36fd3ba2a51222803f2fc75eb11d4a1f29545eb4 /src/se
parentfa59d34410e0e915a5fc7e428a4586c153983431 (diff)
downloadtdde30-8315b8c28a176f8d54cd05ee0a58813d00bbeabb.tar.gz
tabs -> spaces
Diffstat (limited to 'src/se')
-rw-r--r--src/se/liu/gusso230/calendar/Appointment.java12
-rw-r--r--src/se/liu/gusso230/calendar/Cal.java3
-rw-r--r--src/se/liu/gusso230/calendar/Month.java12
-rw-r--r--src/se/liu/gusso230/calendar/SimpleDate.java12
-rw-r--r--src/se/liu/gusso230/calendar/TimePoint.java2
-rw-r--r--src/se/liu/gusso230/lab1/Exercise10.java76
-rw-r--r--src/se/liu/gusso230/lab1/Exercise2.java2
-rw-r--r--src/se/liu/gusso230/lab1/Exercise5.java18
-rw-r--r--src/se/liu/gusso230/lab1/Exercise7.java2
-rw-r--r--src/se/liu/gusso230/lab1/Exercise9.java2
-rw-r--r--src/se/liu/gusso230/lab1/Person.java3
-rw-r--r--src/se/liu/gusso230/lab3/ListManipulator.java17
-rw-r--r--src/se/liu/gusso230/lab3/ListTest.java38
-rw-r--r--src/se/liu/gusso230/shapes/Circle.java2
-rw-r--r--src/se/liu/gusso230/shapes/CircleTest.java14
-rw-r--r--src/se/liu/gusso230/shapes/DiagramComponent.java2
-rw-r--r--src/se/liu/gusso230/shapes/DiagramViewer.java21
-rw-r--r--src/se/liu/gusso230/shapes/Rectangle.java6
-rw-r--r--src/se/liu/gusso230/tetris/BoardTester.java26
-rw-r--r--src/se/liu/gusso230/tetris/BoardToTextConverter.java6
-rw-r--r--src/se/liu/gusso230/tetris/Point.java3
-rw-r--r--src/se/liu/gusso230/tetris/Poly.java9
-rw-r--r--src/se/liu/gusso230/tetris/TetrominoMaker.java49
23 files changed, 149 insertions, 188 deletions
diff --git a/src/se/liu/gusso230/calendar/Appointment.java b/src/se/liu/gusso230/calendar/Appointment.java
index c0551ca..f511856 100644
--- a/src/se/liu/gusso230/calendar/Appointment.java
+++ b/src/se/liu/gusso230/calendar/Appointment.java
@@ -6,21 +6,21 @@ public class Appointment {
private TimeSpan timeSpan;
public Appointment(final String subject, final SimpleDate date, final TimeSpan timeSpan) {
- this.subject = subject;
- this.date = date;
- this.timeSpan = timeSpan;
+ this.subject = subject;
+ this.date = date;
+ this.timeSpan = timeSpan;
}
public String getSubject() {
- return subject;
+ return subject;
}
public SimpleDate getDate() {
- return date;
+ return date;
}
public TimeSpan getTimeSpan() {
- return timeSpan;
+ return timeSpan;
}
@Override public String toString() {
diff --git a/src/se/liu/gusso230/calendar/Cal.java b/src/se/liu/gusso230/calendar/Cal.java
index 9de6008..6f54456 100644
--- a/src/se/liu/gusso230/calendar/Cal.java
+++ b/src/se/liu/gusso230/calendar/Cal.java
@@ -32,8 +32,7 @@ public class Cal {
/**
* Books an appointment.
*/
- public void book(int year, String monthString, int day, int startHour, int startMinute,
- int endHour, int endMinute, String subject) {
+ public void book(int year, String monthString, int day, int startHour, int startMinute, int endHour, int endMinute, String subject) {
if (year <= 1970) {
throw new IllegalArgumentException("Invalid year. Needs to be after 1970.");
}
diff --git a/src/se/liu/gusso230/calendar/Month.java b/src/se/liu/gusso230/calendar/Month.java
index 8f863c6..582e87b 100644
--- a/src/se/liu/gusso230/calendar/Month.java
+++ b/src/se/liu/gusso230/calendar/Month.java
@@ -25,8 +25,10 @@ public class Month {
/**
* Returns the number of the month with a specific name.
- * @param name the name of the month
- * @return the index, starting at 1. -1 if the name is unknown
+ *
+ * @param name the name of the month
+ *
+ * @return the index, starting at 1. -1 if the name is unknown
*/
public static int getMonthNumber(String name) {
switch (name) {
@@ -61,8 +63,10 @@ public class Month {
/**
* Returns the amount of days in the month with a specific name.
- * @param name the name of the month
- * @return the amount of days. -1 if the name is unknown
+ *
+ * @param name the name of the month
+ *
+ * @return the amount of days. -1 if the name is unknown
*/
public static int getMonthDays(String name) {
switch (name) {
diff --git a/src/se/liu/gusso230/calendar/SimpleDate.java b/src/se/liu/gusso230/calendar/SimpleDate.java
index f769096..cc6230b 100644
--- a/src/se/liu/gusso230/calendar/SimpleDate.java
+++ b/src/se/liu/gusso230/calendar/SimpleDate.java
@@ -6,21 +6,21 @@ public class SimpleDate {
private int day;
public SimpleDate(final int year, final Month month, final int day) {
- this.year = year;
- this.month = month;
- this.day = day;
+ this.year = year;
+ this.month = month;
+ this.day = day;
}
public int getYear() {
- return year;
+ return year;
}
public Month getMonth() {
- return month;
+ return month;
}
public int getDay() {
- return day;
+ return day;
}
@Override public String toString() {
diff --git a/src/se/liu/gusso230/calendar/TimePoint.java b/src/se/liu/gusso230/calendar/TimePoint.java
index 76e24c2..c908b2f 100644
--- a/src/se/liu/gusso230/calendar/TimePoint.java
+++ b/src/se/liu/gusso230/calendar/TimePoint.java
@@ -4,7 +4,7 @@ public class TimePoint {
private int hour;
private int minute;
- public TimePoint(int hour, int minute) {
+ public TimePoint(int hour, int minute) {
this.hour = hour;
this.minute = minute;
}
diff --git a/src/se/liu/gusso230/lab1/Exercise10.java b/src/se/liu/gusso230/lab1/Exercise10.java
index 55331c6..66cefc7 100644
--- a/src/se/liu/gusso230/lab1/Exercise10.java
+++ b/src/se/liu/gusso230/lab1/Exercise10.java
@@ -2,43 +2,43 @@ package se.liu.gusso230.lab1;
public class Exercise10 {
public static void main(String[] args) {
- {
- int number = 16777216;
- float decimal = number;
- int integerAgain = (int) decimal;
- System.out.println(number + " => " + decimal + " => " + integerAgain);
- }
- {
- int number = 16777217;
- float decimal = number;
- int integerAgain = (int) decimal;
- System.out.println(number + " => " + decimal + " => " + integerAgain);
- }
- {
- int number = 16777217;
- double decimal = number;
- int integerAgain = (int) decimal;
- System.out.println(number + " => " + decimal + " => " + integerAgain);
- }
- {
- int big = 2147483647;
- int bigger = big + 1;
- System.out.println(big + ", " + bigger);
- }
- {
- int big = 2147483647;
- long bigger = big + 1;
- System.out.println(big + ", " + bigger);
- }
- {
- int big = 2147483647;
- long bigger = big + 1L;
- System.out.println(big + ", " + bigger);
- }
- {
- int big = 2147483647;
- long bigger = (long) big + 1;
- System.out.println(big + ", " + bigger);
- }
+ {
+ int number = 16777216;
+ float decimal = number;
+ int integerAgain = (int) decimal;
+ System.out.println(number + " => " + decimal + " => " + integerAgain);
+ }
+ {
+ int number = 16777217;
+ float decimal = number;
+ int integerAgain = (int) decimal;
+ System.out.println(number + " => " + decimal + " => " + integerAgain);
+ }
+ {
+ int number = 16777217;
+ double decimal = number;
+ int integerAgain = (int) decimal;
+ System.out.println(number + " => " + decimal + " => " + integerAgain);
+ }
+ {
+ int big = 2147483647;
+ int bigger = big + 1;
+ System.out.println(big + ", " + bigger);
+ }
+ {
+ int big = 2147483647;
+ long bigger = big + 1;
+ System.out.println(big + ", " + bigger);
+ }
+ {
+ int big = 2147483647;
+ long bigger = big + 1L;
+ System.out.println(big + ", " + bigger);
+ }
+ {
+ int big = 2147483647;
+ long bigger = (long) big + 1;
+ System.out.println(big + ", " + bigger);
+ }
}
}
diff --git a/src/se/liu/gusso230/lab1/Exercise2.java b/src/se/liu/gusso230/lab1/Exercise2.java
index 1af92a4..e1fd70f 100644
--- a/src/se/liu/gusso230/lab1/Exercise2.java
+++ b/src/se/liu/gusso230/lab1/Exercise2.java
@@ -17,7 +17,7 @@ public class Exercise2 {
return res;
}
- public static int sumWhile (int min, int max) {
+ public static int sumWhile(int min, int max) {
int res = 0;
int i = min;
while (i <= max) {
diff --git a/src/se/liu/gusso230/lab1/Exercise5.java b/src/se/liu/gusso230/lab1/Exercise5.java
index 6507039..45654b7 100644
--- a/src/se/liu/gusso230/lab1/Exercise5.java
+++ b/src/se/liu/gusso230/lab1/Exercise5.java
@@ -2,22 +2,24 @@ package se.liu.gusso230.lab1;
public class Exercise5 {
public static void main(String[] args) {
- for (int i = 0; i <= 10; i++) {
- System.out.println(i + "-fakultet: " + factorial(i));
- }
+ for (int i = 0; i <= 10; i++) {
+ System.out.println(i + "-fakultet: " + factorial(i));
+ }
}
/**
* Calculates f! given f.
+ *
* @param f
+ *
* @return f!
*/
private static int factorial(int f) {
- int result = 1;
- for (int i = 1; i <= f; i++) {
- result *= i;
- }
+ int result = 1;
+ for (int i = 1; i <= f; i++) {
+ result *= i;
+ }
- return result;
+ return result;
}
}
diff --git a/src/se/liu/gusso230/lab1/Exercise7.java b/src/se/liu/gusso230/lab1/Exercise7.java
index d90bb89..a7a9a04 100644
--- a/src/se/liu/gusso230/lab1/Exercise7.java
+++ b/src/se/liu/gusso230/lab1/Exercise7.java
@@ -30,7 +30,7 @@ public class Exercise7 {
return res;
}
- public static int sumWhile (int min, int max) {
+ public static int sumWhile(int min, int max) {
int res = 0;
int i = min;
while (i <= max) {
diff --git a/src/se/liu/gusso230/lab1/Exercise9.java b/src/se/liu/gusso230/lab1/Exercise9.java
index a8809a8..7dbf1ab 100644
--- a/src/se/liu/gusso230/lab1/Exercise9.java
+++ b/src/se/liu/gusso230/lab1/Exercise9.java
@@ -5,7 +5,7 @@ import javax.swing.*;
public class Exercise9 {
public static void main(String[] args) {
String input = JOptionPane.showInputDialog("Please input a value");
- System.out.println("sqrt (" + input + ") ~= " + findRoot(Double.parseDouble(input)));
+ System.out.println("sqrt (" + input + ") ~= " + findRoot(Double.parseDouble(input)));
}
public static double findRoot(double d) {
diff --git a/src/se/liu/gusso230/lab1/Person.java b/src/se/liu/gusso230/lab1/Person.java
index e8bbb79..f737ddd 100644
--- a/src/se/liu/gusso230/lab1/Person.java
+++ b/src/se/liu/gusso230/lab1/Person.java
@@ -16,8 +16,7 @@ public class Person {
return Period.between(birthDay, LocalDate.now()).getYears();
}
- @Override
- public String toString() {
+ @Override public String toString() {
return name + " " + getAge();
}
diff --git a/src/se/liu/gusso230/lab3/ListManipulator.java b/src/se/liu/gusso230/lab3/ListManipulator.java
index 9a75049..7aae8e6 100644
--- a/src/se/liu/gusso230/lab3/ListManipulator.java
+++ b/src/se/liu/gusso230/lab3/ListManipulator.java
@@ -6,35 +6,34 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-public class ListManipulator
-{
+public class ListManipulator {
protected List<Person> elements = new ArrayList<>();
public int size() {
- return elements.size();
+ return elements.size();
}
public boolean isEmpty() {
- return elements.isEmpty();
+ return elements.isEmpty();
}
public boolean contains(final Object o) {
- return elements.contains(o);
+ return elements.contains(o);
}
public Iterator<Person> iterator() {
- return elements.iterator();
+ return elements.iterator();
}
public boolean add(final Person person) {
- return elements.add(person);
+ return elements.add(person);
}
public boolean remove(final Object o) {
- return elements.remove(o);
+ return elements.remove(o);
}
public void clear() {
- elements.clear();
+ elements.clear();
}
}
diff --git a/src/se/liu/gusso230/lab3/ListTest.java b/src/se/liu/gusso230/lab3/ListTest.java
index 565791f..1c9bee9 100644
--- a/src/se/liu/gusso230/lab3/ListTest.java
+++ b/src/se/liu/gusso230/lab3/ListTest.java
@@ -6,28 +6,28 @@ import java.time.LocalDate;
public class ListTest {
public static void main(String[] args) {
- Queue q = new Queue();
- q.enqueue(new Person("1", LocalDate.of(2020, 1, 1)));
- q.enqueue(new Person("2", LocalDate.of(2019, 1, 1)));
- q.enqueue(new Person("3", LocalDate.of(2018, 1, 1)));
- q.enqueue(new Person("4", LocalDate.of(2017, 1, 1)));
- q.enqueue(new Person("5", LocalDate.of(2016, 1, 1)));
+ Queue q = new Queue();
+ q.enqueue(new Person("1", LocalDate.of(2020, 1, 1)));
+ q.enqueue(new Person("2", LocalDate.of(2019, 1, 1)));
+ q.enqueue(new Person("3", LocalDate.of(2018, 1, 1)));
+ q.enqueue(new Person("4", LocalDate.of(2017, 1, 1)));
+ q.enqueue(new Person("5", LocalDate.of(2016, 1, 1)));
- while (!q.isEmpty()) {
- System.out.println(q.dequeue());
- }
+ while (!q.isEmpty()) {
+ System.out.println(q.dequeue());
+ }
- System.out.println();
+ System.out.println();
- Stack s = new Stack();
- s.push(new Person("1", LocalDate.of(2020, 1, 1)));
- s.push(new Person("2", LocalDate.of(2019, 1, 1)));
- s.push(new Person("3", LocalDate.of(2018, 1, 1)));
- s.push(new Person("4", LocalDate.of(2017, 1, 1)));
- s.push(new Person("5", LocalDate.of(2016, 1, 1)));
+ Stack s = new Stack();
+ s.push(new Person("1", LocalDate.of(2020, 1, 1)));
+ s.push(new Person("2", LocalDate.of(2019, 1, 1)));
+ s.push(new Person("3", LocalDate.of(2018, 1, 1)));
+ s.push(new Person("4", LocalDate.of(2017, 1, 1)));
+ s.push(new Person("5", LocalDate.of(2016, 1, 1)));
- while (!s.isEmpty()) {
- System.out.println(s.pop());
- }
+ while (!s.isEmpty()) {
+ System.out.println(s.pop());
+ }
}
}
diff --git a/src/se/liu/gusso230/shapes/Circle.java b/src/se/liu/gusso230/shapes/Circle.java
index 1d70499..63f580b 100644
--- a/src/se/liu/gusso230/shapes/Circle.java
+++ b/src/se/liu/gusso230/shapes/Circle.java
@@ -7,7 +7,7 @@ public class Circle extends AbstractShape {
public Circle(int x, int y, int radius, Color color) {
super(x, y, color);
- if (radius < 0) {
+ if (radius < 0) {
throw new IllegalArgumentException("Negative radius");
}
diff --git a/src/se/liu/gusso230/shapes/CircleTest.java b/src/se/liu/gusso230/shapes/CircleTest.java
index 84d912b..3890ddf 100644
--- a/src/se/liu/gusso230/shapes/CircleTest.java
+++ b/src/se/liu/gusso230/shapes/CircleTest.java
@@ -6,14 +6,14 @@ import java.util.List;
public class CircleTest {
public static void main(String[] args) {
- final List<Circle> circles = new ArrayList<>();
+ final List<Circle> circles = new ArrayList<>();
- circles.add(new Circle(0, 0, 1, Color.BLACK));
- circles.add(new Circle(1, 1, 1, Color.RED));
- circles.add(new Circle(5, 0, 3, Color.BLUE));
+ circles.add(new Circle(0, 0, 1, Color.BLACK));
+ circles.add(new Circle(1, 1, 1, Color.RED));
+ circles.add(new Circle(5, 0, 3, Color.BLUE));
- for (Circle circle : circles) {
- System.out.println(circle.getX() + " " + circle.getY());
- }
+ for (Circle circle : circles) {
+ System.out.println(circle.getX() + " " + circle.getY());
+ }
}
}
diff --git a/src/se/liu/gusso230/shapes/DiagramComponent.java b/src/se/liu/gusso230/shapes/DiagramComponent.java
index 5730e0d..b505ffe 100644
--- a/src/se/liu/gusso230/shapes/DiagramComponent.java
+++ b/src/se/liu/gusso230/shapes/DiagramComponent.java
@@ -10,7 +10,7 @@ public class DiagramComponent extends JComponent {
@Override protected void paintComponent(final Graphics g) {
super.paintComponent(g);
- for (Shape shape: shapes) {
+ for (Shape shape : shapes) {
shape.draw(g);
}
}
diff --git a/src/se/liu/gusso230/shapes/DiagramViewer.java b/src/se/liu/gusso230/shapes/DiagramViewer.java
index 56a63d0..b6f33bd 100644
--- a/src/se/liu/gusso230/shapes/DiagramViewer.java
+++ b/src/se/liu/gusso230/shapes/DiagramViewer.java
@@ -6,15 +6,8 @@ import java.util.List;
import java.util.Random;
public class DiagramViewer {
- private final static List<Color> COLORS = List.of(
- Color.BLACK,
- Color.RED,
- Color.GREEN,
- Color.BLUE,
- Color.CYAN,
- Color.YELLOW,
- Color.MAGENTA
- );
+ private final static List<Color> COLORS =
+ List.of(Color.BLACK, Color.RED, Color.GREEN, Color.BLUE, Color.CYAN, Color.YELLOW, Color.MAGENTA);
private final static Random rnd = new Random(0);
@@ -23,19 +16,15 @@ public class DiagramViewer {
}
private static Circle getRandomCircle() {
- return new Circle(rnd.nextInt(400), rnd.nextInt(400),
- rnd.nextInt(200), getRandomColor());
+ return new Circle(rnd.nextInt(400), rnd.nextInt(400), rnd.nextInt(200), getRandomColor());
}
private static Rectangle getRandomRectangle() {
- return new Rectangle(rnd.nextInt(400), rnd.nextInt(400),
- rnd.nextInt(200), rnd.nextInt(200),
- getRandomColor());
+ return new Rectangle(rnd.nextInt(400), rnd.nextInt(400), rnd.nextInt(200), rnd.nextInt(200), getRandomColor());
}
private static Text getRandomText() {
- return new Text(rnd.nextInt(400), rnd.nextInt(400),
- 16, getRandomColor(), "hello");
+ return new Text(rnd.nextInt(400), rnd.nextInt(400), 16, getRandomColor(), "hello");
}
public static void main(String[] args) {
diff --git a/src/se/liu/gusso230/shapes/Rectangle.java b/src/se/liu/gusso230/shapes/Rectangle.java
index 0d16655..a9ba9d5 100644
--- a/src/se/liu/gusso230/shapes/Rectangle.java
+++ b/src/se/liu/gusso230/shapes/Rectangle.java
@@ -8,8 +8,8 @@ public class Rectangle extends AbstractShape {
public Rectangle(final int x, final int y, final int width, final int height, final Color color) {
super(x, y, color);
- this.width = width;
- this.height = height;
+ this.width = width;
+ this.height = height;
}
@Override public void draw(final Graphics g) {
@@ -18,6 +18,6 @@ public class Rectangle extends AbstractShape {
}
@Override public String toString() {
- return "Rectangle{" + "x=" + x + ", y=" + y + ", width=" + width + ", height=" + height + ", color=" + color + '}';
+ return "Rectangle{" + "x=" + x + ", y=" + y + ", width=" + width + ", height=" + height + ", color=" + color + '}';
}
}
diff --git a/src/se/liu/gusso230/tetris/BoardTester.java b/src/se/liu/gusso230/tetris/BoardTester.java
index 1f8c975..5f37036 100644
--- a/src/se/liu/gusso230/tetris/BoardTester.java
+++ b/src/se/liu/gusso230/tetris/BoardTester.java
@@ -2,23 +2,23 @@ package se.liu.gusso230.tetris;
public class BoardTester {
public static void main(String[] args) {
- Board board = new Board(5, 5);
+ Board board = new Board(5, 5);
- board.randomize();
+ board.randomize();
- board.setFalling(new TetrominoMaker().getPoly(0));
- board.setFallingX(0);
- board.setFallingY(0);
+ board.setFalling(new TetrominoMaker().getPoly(0));
+ board.setFallingX(0);
+ board.setFallingY(0);
- BoardToTextConverter converter = new BoardToTextConverter();
+ BoardToTextConverter converter = new BoardToTextConverter();
- System.out.println(converter.toText(board));
- System.out.println("-".repeat(board.getWidth()));
- board.getFalling().rotateClockwise();
- System.out.println(converter.toText(board));
- System.out.println("-".repeat(board.getWidth()));
+ System.out.println(converter.toText(board));
+ System.out.println("-".repeat(board.getWidth()));
+ board.getFalling().rotateClockwise();
+ System.out.println(converter.toText(board));
+ System.out.println("-".repeat(board.getWidth()));
- TetrisViewer viewer = new TetrisViewer(board);
- viewer.show();
+ TetrisViewer viewer = new TetrisViewer(board);
+ viewer.show();
}
}
diff --git a/src/se/liu/gusso230/tetris/BoardToTextConverter.java b/src/se/liu/gusso230/tetris/BoardToTextConverter.java
index ab8914c..3dca3b9 100644
--- a/src/se/liu/gusso230/tetris/BoardToTextConverter.java
+++ b/src/se/liu/gusso230/tetris/BoardToTextConverter.java
@@ -1,7 +1,8 @@
package se.liu.gusso230.tetris;
public class BoardToTextConverter {
- public BoardToTextConverter() {}
+ public BoardToTextConverter() {
+ }
private char fromSquareType(SquareType squareType) {
switch (squareType) {
@@ -25,7 +26,8 @@ public class BoardToTextConverter {
/**
* Converts a board to a text representation.
- * @param board the board to convert.
+ *
+ * @param board the board to convert.
*/
public String toText(Board board) {
StringBuilder s = new StringBuilder();
diff --git a/src/se/liu/gusso230/tetris/Point.java b/src/se/liu/gusso230/tetris/Point.java
index 9121399..577ef74 100644
--- a/src/se/liu/gusso230/tetris/Point.java
+++ b/src/se/liu/gusso230/tetris/Point.java
@@ -19,7 +19,8 @@ public class Point {
/**
* Rotates this point one step clockwise.
- * @param boundingBoxSize the size of the bounding box this point should be rotated with respect to.
+ *
+ * @param boundingBoxSize the size of the bounding box this point should be rotated with respect to.
*/
public void rotateClockwise(int boundingBoxSize) {
int prevX = x;
diff --git a/src/se/liu/gusso230/tetris/Poly.java b/src/se/liu/gusso230/tetris/Poly.java
index bedcd77..a337d15 100644
--- a/src/se/liu/gusso230/tetris/Poly.java
+++ b/src/se/liu/gusso230/tetris/Poly.java
@@ -23,10 +23,11 @@ public class Poly {
/**
* Returns wether this poly covers a position (x, y) if the top left corner of the poly is at (posX, posY).
- * @param x The x position of the coordinate to test.
- * @param y The y position of the coordinate to test.
- * @param posX The x position of the top left corner of the poly's bounding box.
- * @param posY The y position of the top left corner of the poly's bounding box.
+ *
+ * @param x The x position of the coordinate to test.
+ * @param y The y position of the coordinate to test.
+ * @param posX The x position of the top left corner of the poly's bounding box.
+ * @param posY The y position of the top left corner of the poly's bounding box.
*/
public boolean covers(int x, int y, int posX, int posY) {
for (Point point : points) {
diff --git a/src/se/liu/gusso230/tetris/TetrominoMaker.java b/src/se/liu/gusso230/tetris/TetrominoMaker.java
index 33e709c..ee5ce1a 100644
--- a/src/se/liu/gusso230/tetris/TetrominoMaker.java
+++ b/src/se/liu/gusso230/tetris/TetrominoMaker.java
@@ -9,54 +9,19 @@ public class TetrominoMaker {
public TetrominoMaker() {
polys = new ArrayList<>();
- polys.add(new Poly(SquareType.I, new Point[] {
- new Point(0, 1),
- new Point(1, 1),
- new Point(2, 1),
- new Point(3, 1),
- }));
+ polys.add(new Poly(SquareType.I, new Point[] { new Point(0, 1), new Point(1, 1), new Point(2, 1), new Point(3, 1), }));
- polys.add(new Poly(SquareType.J, new Point[] {
- new Point(0, 0),
- new Point(0, 1),
- new Point(1, 1),
- new Point(2, 1),
- }));
+ polys.add(new Poly(SquareType.J, new Point[] { new Point(0, 0), new Point(0, 1), new Point(1, 1), new Point(2, 1), }));
- polys.add(new Poly(SquareType.L, new Point[] {
- new Point(0, 1),
- new Point(1, 1),
- new Point(2, 1),
- new Point(2, 0),
- }));
+ polys.add(new Poly(SquareType.L, new Point[] { new Point(0, 1), new Point(1, 1), new Point(2, 1), new Point(2, 0), }));
- polys.add(new Poly(SquareType.O, new Point[] {
- new Point(0, 0),
- new Point(0, 1),
- new Point(1, 0),
- new Point(1, 1),
- }));
+ polys.add(new Poly(SquareType.O, new Point[] { new Point(0, 0), new Point(0, 1), new Point(1, 0), new Point(1, 1), }));
- polys.add(new Poly(SquareType.S, new Point[] {
- new Point(0, 0),
- new Point(0, 1),
- new Point(1, 0),
- new Point(1, 1),
- }));
+ polys.add(new Poly(SquareType.S, new Point[] { new Point(0, 0), new Point(0, 1), new Point(1, 0), new Point(1, 1), }));
- polys.add(new Poly(SquareType.T, new Point[] {
- new Point(0, 1),
- new Point(1, 1),
- new Point(2, 1),
- new Point(1, 0),
- }));
+ polys.add(new Poly(SquareType.T, new Point[] { new Point(0, 1), new Point(1, 1), new Point(2, 1), new Point(1, 0), }));
- polys.add(new Poly(SquareType.Z, new Point[] {
- new Point(0, 0),
- new Point(1, 0),
- new Point(1, 1),
- new Point(2, 1),
- }));
+ polys.add(new Poly(SquareType.Z, new Point[] { new Point(0, 0), new Point(1, 0), new Point(1, 1), new Point(2, 1), }));
}
public int getNumberOfTypes() {