16
16
@ XmlTransient
17
17
public class Location extends IFMLObject implements Cloneable
18
18
{
19
- protected HashMap <ExitDirection , Location > exits = new HashMap <ExitDirection , Location >();
20
- protected List <Item > items = new ArrayList <Item >();
19
+ protected HashMap <ExitDirection , Location > exits = new HashMap <>();
20
+ protected List <Item > items = new ArrayList <>();
21
21
private HashMap <String , Callable <? extends Value >> LOCATION_SYMBOLS = new HashMap <String , Callable <? extends Value >>()
22
22
{
23
23
{
24
- put ("север" , new Callable <Value >()
25
- {
26
- @ Override
27
- public Value call () throws Exception
28
- {
29
- return getObjectValue (ExitDirection .NORTH );
30
- }
31
- });
32
- put ("северовосток" , new Callable <Value >()
33
- {
34
- @ Override
35
- public Value call () throws Exception
36
- {
37
- return getObjectValue (ExitDirection .NORTH_EAST );
38
- }
39
- });
40
- put ("восток" , new Callable <Value >()
41
- {
42
- @ Override
43
- public Value call () throws Exception
44
- {
45
- return getObjectValue (ExitDirection .EAST );
46
- }
47
- });
48
- put ("юговосток" , new Callable <Value >()
49
- {
50
- @ Override
51
- public Value call () throws Exception
52
- {
53
- return getObjectValue (ExitDirection .SOUTH_EAST );
54
- }
55
- });
56
- put ("юг" , new Callable <Value >()
57
- {
58
- @ Override
59
- public Value call () throws Exception
60
- {
61
- return getObjectValue (ExitDirection .SOUTH );
62
- }
63
- });
64
- put ("югозапад" , new Callable <Value >()
65
- {
66
- @ Override
67
- public Value call () throws Exception
68
- {
69
- return getObjectValue (ExitDirection .SOUTH_WEST );
70
- }
71
- });
72
- put ("запад" , new Callable <Value >()
73
- {
74
- @ Override
75
- public Value call () throws Exception
76
- {
77
- return getObjectValue (ExitDirection .WEST );
78
- }
79
- });
80
- put ("северозапад" , new Callable <Value >()
81
- {
82
- @ Override
83
- public Value call () throws Exception
84
- {
85
- return getObjectValue (ExitDirection .NORTH_WEST );
86
- }
87
- });
88
- put ("верх" , new Callable <Value >()
89
- {
90
- @ Override
91
- public Value call () throws Exception
92
- {
93
- return getObjectValue (ExitDirection .UP );
94
- }
95
- });
96
- put ("низ" , new Callable <Value >()
97
- {
98
- @ Override
99
- public Value call () throws Exception
100
- {
101
- return getObjectValue (ExitDirection .DOWN );
102
- }
103
- });
104
-
105
- put ("предметы" , new Callable <Value >()
106
- {
107
- @ Override
108
- public Value call () throws Exception
109
- {
110
- return new CollectionValue (items );
111
- }
112
- });
24
+ put ("север" , (Callable <Value >) () -> getObjectValue (ExitDirection .NORTH ));
25
+ put ("северовосток" , (Callable <Value >) () -> getObjectValue (ExitDirection .NORTH_EAST ));
26
+ put ("восток" , (Callable <Value >) () -> getObjectValue (ExitDirection .EAST ));
27
+ put ("юговосток" , (Callable <Value >) () -> getObjectValue (ExitDirection .SOUTH_EAST ));
28
+ put ("юг" , (Callable <Value >) () -> getObjectValue (ExitDirection .SOUTH ));
29
+ put ("югозапад" , (Callable <Value >) () -> getObjectValue (ExitDirection .SOUTH_WEST ));
30
+ put ("запад" , (Callable <Value >) () -> getObjectValue (ExitDirection .WEST ));
31
+ put ("северозапад" , (Callable <Value >) () -> getObjectValue (ExitDirection .NORTH_WEST ));
32
+ put ("верх" , (Callable <Value >) () -> getObjectValue (ExitDirection .UP ));
33
+ put ("низ" , (Callable <Value >) () -> getObjectValue (ExitDirection .DOWN ));
34
+
35
+ put ("предметы" , (Callable <Value >) () -> new CollectionValue (items ));
113
36
}
114
37
115
38
@ NotNull
@@ -134,8 +57,8 @@ public Location clone() throws CloneNotSupportedException
134
57
135
58
private void copyFieldsTo (Location location )
136
59
{
137
- location .exits = new HashMap <ExitDirection , Location >(exits );
138
- location .items = new ArrayList <Item >(items );
60
+ location .exits = new HashMap <>(exits );
61
+ location .items = new ArrayList <>(items );
139
62
}
140
63
141
64
public Location getExit (ExitDirection exitDirection )
0 commit comments