EOS 2
1.1.0
Einfache Objektbasierte Sprache
EosBaseLib
src
de
lathanda
eos
base
util
Direction.java
gehe zur Dokumentation dieser Datei
1
package
de.lathanda.eos.base.util;
8
public
enum
Direction
{
9
SOUTH
( 0,-1, 0),
10
WEST
(-1, 0, 1),
11
NORTH
( 0, 1, 2),
12
EAST
( 1, 0, 3);
13
static
{
14
WEST.left = SOUTH;
15
WEST.right = NORTH;
16
EAST.left = NORTH;
17
EAST.right = SOUTH;
18
NORTH.left = WEST;
19
NORTH.right = EAST;
20
SOUTH.left = EAST;
21
SOUTH.right = WEST;
22
}
23
public
final
int
dx
;
24
public
final
int
dy
;
25
public
final
int
index
;
26
private
Direction
left;
27
private
Direction
right;
28
private
Direction
(
int
dx,
int
dy,
int
index) {
29
this.dx = dx;
30
this.dy = dy;
31
this.index = index;
32
}
33
public
final
Direction
getLeft
() {
34
return
left;
35
}
36
public
final
Direction
getRight
() {
37
return
right;
38
}
39
public
Direction
getBack
() {
40
return
left.left;
41
}
42
public
static
Direction
getDirection
(
int
index) {
43
switch
(index) {
44
case
0:
return
SOUTH;
45
case
1:
return
WEST;
46
case
2:
return
NORTH;
47
case
3:
return
EAST;
48
default
:
49
return
EAST;
50
}
51
}
52
public
float
getAngle
() {
53
switch
(index) {
54
case
0:
return
180f;
55
case
1:
return
90f;
56
case
2:
return
0f;
57
case
3:
return
270f;
58
default
:
59
return
270;
60
}
61
}
62
@Override
63
public
String
toString
() {
64
switch
(
this
) {
65
case
EAST:
66
return
"E"
;
67
case
SOUTH:
68
return
"S"
;
69
case
NORTH:
70
return
"N"
;
71
case
WEST:
72
return
"W"
;
73
}
74
return
""
;
75
}
76
77
}
de.lathanda.eos.base.util.Direction
Definition:
Direction.java:8
de.lathanda.eos.base.util.Direction.toString
String toString()
Definition:
Direction.java:63
de.lathanda.eos.base.util.Direction.getBack
Direction getBack()
Definition:
Direction.java:39
de.lathanda.eos.base.util.Direction.EAST
EAST
Definition:
Direction.java:12
de.lathanda.eos.base.util.Direction.getDirection
static Direction getDirection(int index)
Definition:
Direction.java:42
de.lathanda.eos.base.util.Direction.dx
final int dx
Definition:
Direction.java:23
de.lathanda.eos.base.util.Direction.SOUTH
SOUTH
Definition:
Direction.java:9
de.lathanda.eos.base.util.Direction.getAngle
float getAngle()
Definition:
Direction.java:52
de.lathanda.eos.base.util.Direction.dy
final int dy
Definition:
Direction.java:24
de.lathanda.eos.base.util.Direction.getRight
final Direction getRight()
Definition:
Direction.java:36
de.lathanda.eos.base.util.Direction.index
final int index
Definition:
Direction.java:25
de.lathanda.eos.base.util.Direction.NORTH
NORTH
Definition:
Direction.java:11
de.lathanda.eos.base.util.Direction.getLeft
final Direction getLeft()
Definition:
Direction.java:33
de.lathanda.eos.base.util.Direction.WEST
WEST
Definition:
Direction.java:10
Impressum