Added openLC map
This commit is contained in:
parent
8b6b4dbc3a
commit
d5a9f9af6d
|
@ -52,6 +52,8 @@ public enum T20PartScore implements BasePart,BasePartAlt3 {
|
||||||
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v)));
|
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getIdentifierTone(), v -> v)));
|
||||||
private static final Map<String, T20PartScore> CHINA_MAP = Collections.unmodifiableMap(
|
private static final Map<String, T20PartScore> CHINA_MAP = Collections.unmodifiableMap(
|
||||||
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getChinaKey(), v -> v)));
|
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getChinaKey(), v -> v)));
|
||||||
|
private static final Map<String, T20PartScore> OPENLC_MAP = Collections.unmodifiableMap(
|
||||||
|
Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getAlt3Value(), v -> v)));
|
||||||
|
|
||||||
private T20PartScore(String idTone, String idLetter, String chinaKey, String chinaValue,
|
private T20PartScore(String idTone, String idLetter, String chinaKey, String chinaValue,
|
||||||
String alt1Value, String alt2Value, String alt3Value) {
|
String alt1Value, String alt2Value, String alt3Value) {
|
||||||
|
@ -88,4 +90,8 @@ public enum T20PartScore implements BasePart,BasePartAlt3 {
|
||||||
public static T20PartScore valueOfChina(String chinaKey) {
|
public static T20PartScore valueOfChina(String chinaKey) {
|
||||||
return CHINA_MAP.get(chinaKey);
|
return CHINA_MAP.get(chinaKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static T20PartScore valueOfOpenLC(String chinaKey) {
|
||||||
|
return OPENLC_MAP.get(chinaKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,4 +38,12 @@ public class T20PartScoreTest {
|
||||||
Assertions.assertEquals(T20PartScore.PART_19, T20PartScore.valueOfChina("仄"));
|
Assertions.assertEquals(T20PartScore.PART_19, T20PartScore.valueOfChina("仄"));
|
||||||
Assertions.assertEquals(T20PartScore.PART_20, T20PartScore.valueOfChina("幺"));
|
Assertions.assertEquals(T20PartScore.PART_20, T20PartScore.valueOfChina("幺"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testOpenLCMap() {
|
||||||
|
Assertions.assertEquals(T20PartScore.PART_1, T20PartScore.valueOfOpenLC("2"));
|
||||||
|
Assertions.assertEquals(T20PartScore.PART_2, T20PartScore.valueOfOpenLC("3"));
|
||||||
|
Assertions.assertEquals(T20PartScore.PART_19, T20PartScore.valueOfOpenLC("W"));
|
||||||
|
Assertions.assertEquals(T20PartScore.PART_20, T20PartScore.valueOfOpenLC("X"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue