Reformat code

This commit is contained in:
Phillip Webb
2018-05-24 16:13:51 -07:00
parent 625f428aad
commit 4853477081
95 changed files with 321 additions and 130 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,4 +30,5 @@ public class ReverseWebSocketEndpoint {
session.getBasicRemote()
.sendText("Reversed: " + new StringBuilder(message).reverse());
}
}

View File

@@ -18,5 +18,7 @@
package samples.websocket.undertow.snake;
public enum Direction {
NONE, NORTH, SOUTH, EAST, WEST
}

View File

@@ -20,9 +20,13 @@ package samples.websocket.undertow.snake;
public class Location {
public int x;
public int y;
public static final int GRID_SIZE = 10;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int PLAYFIELD_WIDTH = 640;
public Location(int x, int y) {
@@ -74,4 +78,5 @@ public class Location {
result = 31 * result + this.y;
return result;
}
}

View File

@@ -157,4 +157,5 @@ public class Snake {
public String getHexColor() {
return this.hexColor;
}
}

View File

@@ -112,4 +112,5 @@ public class SnakeTimer {
gameTimer.cancel();
}
}
}

View File

@@ -23,7 +23,9 @@ import java.util.Random;
public class SnakeUtils {
public static final int PLAYFIELD_WIDTH = 640;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int GRID_SIZE = 10;
private static final Random random = new Random();

View File

@@ -30,13 +30,17 @@ import org.springframework.web.socket.handler.TextWebSocketHandler;
public class SnakeWebSocketHandler extends TextWebSocketHandler {
public static final int PLAYFIELD_WIDTH = 640;
public static final int PLAYFIELD_HEIGHT = 480;
public static final int GRID_SIZE = 10;
private static final AtomicInteger snakeIds = new AtomicInteger(0);
private static final Random random = new Random();
private final int id;
private Snake snake;
public static String getRandomHexColor() {
@@ -109,4 +113,5 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler {
SnakeTimer.broadcast(
String.format("{'type': 'leave', 'id': %d}", Integer.valueOf(this.id)));
}
}