-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
135 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package coding.samguk; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class GeneralsMap { | ||
private Map<String, General> map = new HashMap<>(); | ||
private static GeneralsMap _instance; | ||
|
||
private GeneralsMap() { | ||
init(); | ||
} | ||
|
||
public static GeneralsMap getInstance() { | ||
if (_instance == null) { | ||
_instance = new GeneralsMap(); | ||
} | ||
return _instance; | ||
} | ||
|
||
public General find(String key) { | ||
assert map.containsKey(key); | ||
return map.get(key); | ||
} | ||
|
||
private void init() { | ||
General[] arr = { | ||
//이름, 연도, 무력, 지력, 매력, 정치력, 육지, 수지 | ||
new General("조조", (194-40-1), 89, 94, 98, 90, 93, 59), | ||
new General("곽가", (194-25-1), 36, 80, 82, 97, 32, 6), | ||
new General("하우연", (194-37-1), 90, 58, 55, 82, 32, 6), | ||
new General("하우은", (194-28-1), 60, 62, 75, 64, 58, 27), | ||
new General("하우모", (194-18-1), 54, 35, 27, 40, 37, 13), | ||
new General("순욱", (194-32-1), 37, 96, 85, 85, 62, 60), | ||
new General("순상", (194-40-1), 45, 70, 76, 77, 39, 16), | ||
new General("순유", (194-38-1), 40, 94, 85, 94, 60, 58), | ||
new General("조앙", (194-20-1), 60, 54, 67, 50, 58, 19), | ||
new General("조홍", (194-26-1), 74, 47, 75, 41, 74, 72), | ||
new General("조인", (194-27-1), 83, 62, 67, 57, 79, 72), | ||
new General("조순", (194-25-1), 60, 51, 43, 42, 54, 20), | ||
new General("진교", (194-45-1), 20, 68, 71, 79, 18, 9), | ||
new General("정욱", (194-54-1), 25, 90, 75, 71, 85, 75), | ||
new General("전위", (194-35-1), 96, 33, 54, 21, 84, 74), | ||
new General("이전", (194-34-1), 72, 47, 53, 36, 73, 70), | ||
new General("유연", (194-29-1), 45, 50, 32, 57, 40, 20), | ||
}; | ||
|
||
for (General gen : arr) { | ||
String key = gen.getName(); | ||
General value = gen; | ||
map.put(key, value); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters