Skip to content

Commit f15d42a

Browse files
author
Hattinger04
committed
clean up 1
1 parent cc2ff39 commit f15d42a

File tree

4 files changed

+5
-31
lines changed

4 files changed

+5
-31
lines changed

src/main/java/io/github/Hattinger04/configuration/AuthController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class AuthController {
2424

2525

2626
@PostMapping("/login")
27-
public ResponseEntity<?> login(@RequestBody User user) throws Exception {
27+
public ResponseEntity<?> login(@RequestBody User user) throws Exception {
2828
try {
2929
SecurityContextHolder.getContext().setAuthentication(authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(user.getUsername(), user.getPassword())));
3030
} catch (BadCredentialsException e) {
@@ -35,7 +35,7 @@ public ResponseEntity<?> login(@RequestBody User user) throws Exception {
3535

3636
// TODO: is checking data with constraints working?
3737
@PostMapping("/register")
38-
public ResponseEntity<?> register(@RequestBody User user) throws Exception {
38+
public ResponseEntity<?> register(@RequestBody User user) throws Exception {
3939
User userExists = userService.findUserByUsername(user.getUsername());
4040
if (userExists != null) {
4141
return new ResponseEntity<>("Es gibt bereits einen User mit diesem Namen",HttpStatus.BAD_REQUEST);

src/main/java/io/github/Hattinger04/hamster/HamsterController.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ public ResponseEntity<?> defaultTerrain(@RequestBody JsonNode node) {
7272
return new ResponseEntity<>(wb.startProgram(path), HttpStatus.OK);
7373
}
7474

75-
// not tested!
7675
@PreAuthorize("hasAuthority('USER')")
7776
@PostMapping("/existingTerrain")
7877
@ResponseBody
@@ -86,7 +85,6 @@ public ResponseEntity<?> exisitingTerrain(@RequestBody JsonNode node) {
8685
return new ResponseEntity<>(wb.startProgram(hamsterPath, terrainPath), HttpStatus.OK);
8786
}
8887

89-
// not tested!
9088
@PreAuthorize("hasAuthority('USER')")
9189
@PostMapping("/newTerrain")
9290
@ResponseBody
@@ -98,6 +96,6 @@ public ResponseEntity<?> newTerrain(@RequestBody JsonNode node) {
9896
writeTextToFile(new File(hamsterPath), hamster.getProgram());
9997
wb.getJsonObject().clear();
10098
return new ResponseEntity<>(wb.startProgram(hamsterPath, terrainPath,
101-
wb.new TerrainForm(hamster.getLaenge(), hamster.getBreite(), hamster.getCorn(), hamster.getCornAnzahl(), hamster.getWall(), hamster.getX(), hamster.getY(), hamster.getBlickrichtung())), HttpStatus.OK);
99+
wb.new TerrainForm(hamster.getLaenge(), hamster.getBreite(), hamster.getX(), hamster.getY(), hamster.getBlickrichtung(), hamster.getCornAnzahl(), hamster.getCorn(), hamster.getWall())), HttpStatus.OK);
102100
}
103101
}

src/main/java/io/github/Hattinger04/hamsterEvaluation/compiler/controller/CompilerController.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
package io.github.Hattinger04.hamsterEvaluation.compiler.controller;
22

3-
import java.awt.event.ActionEvent;
4-
import java.awt.event.ActionListener;
53
import java.io.File;
64
import java.io.IOException;
75

86
import io.github.Hattinger04.hamsterEvaluation.compiler.model.CompilerModel;
9-
import io.github.Hattinger04.hamsterEvaluation.compiler.model.JavaError;
107
import io.github.Hattinger04.hamsterEvaluation.model.HamsterFile;
11-
import io.github.Hattinger04.hamsterEvaluation.workbench.Utils;
128
import io.github.Hattinger04.hamsterEvaluation.workbench.Workbench;
139

1410
/**

src/main/java/io/github/Hattinger04/hamsterEvaluation/workbench/Workbench.java

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import io.github.Hattinger04.hamsterEvaluation.simulation.controller.SimulationController;
1717
import io.github.Hattinger04.hamsterEvaluation.simulation.model.SimulationModel;
1818
import io.github.Hattinger04.hamsterEvaluation.simulation.model.Terrain;
19+
import lombok.AllArgsConstructor;
1920
import lombok.Getter;
2021
import lombok.Setter;
2122

@@ -88,34 +89,13 @@ protected Workbench(boolean simulatorOnly, SimulationModel simModel) {
8889
// startProgram("Programme/data.ham", "Programme/test.ter", new TerrainForm(10,10,new int[][] {{1,2}, {2,3}}, new int[] {1,1}, new int[][] {{0,0}, {1,0}, 1}, 0, 1));
8990
}
9091

91-
@Getter @Setter
92+
@Getter @Setter @AllArgsConstructor
9293
public class TerrainForm {
9394

9495
private int laenge, breite, x, y, blickrichtung;
9596
private int[] cornAnzahl;
9697
private int[][] corn, wall;
9798

98-
/**
99-
* Create a terrain:
100-
*
101-
* @param laenge
102-
* @param breite
103-
* @param corn
104-
* @param cornAnzahl
105-
* @param wall
106-
* @param x
107-
* @param y
108-
*/
109-
public TerrainForm(int laenge, int breite, int[][] corn, int[] cornAnzahl, int[][] wall, int x, int y, int blickrichtung) {
110-
this.laenge = laenge;
111-
this.breite = breite;
112-
this.corn = corn;
113-
this.cornAnzahl = cornAnzahl;
114-
this.wall = wall;
115-
this.x = x;
116-
this.y = y;
117-
this.blickrichtung = blickrichtung;
118-
}
11999
}
120100

121101
/**

0 commit comments

Comments
 (0)