MCPcopy Create free account
hub / github.com/MenoData/Time4J / UnitPatterns

Method UnitPatterns

base/src/main/java/net/time4j/UnitPatterns.java:105–222  ·  view source on GitHub ↗
(Locale language)

Source from the content-addressed store, hash-verified

103 //~ Konstruktoren -----------------------------------------------------
104
105 private UnitPatterns(Locale language) {
106 super();
107
108 this.locale = language;
109
110 Map<IsoUnit, Map<TextWidth, Map<PluralCategory, String>>> map = new HashMap<>(10);
111 Map<IsoUnit, Map<PluralCategory, String>> mapPast = new HashMap<>(10);
112 Map<IsoUnit, Map<PluralCategory, String>> mapFuture = new HashMap<>(10);
113 Map<Integer, Map<TextWidth, String>> mapList = new HashMap<>(10);
114 Map<IsoUnit, Map<PluralCategory, String>> mapShortPast = new HashMap<>(10);
115 Map<IsoUnit, Map<PluralCategory, String>> mapShortFuture = new HashMap<>(10);
116
117 for (IsoUnit unit : UNIT_IDS) {
118 // Standard-Muster
119 Map<TextWidth, Map<PluralCategory, String>> tmp1 = new EnumMap<>(TextWidth.class);
120 for (TextWidth width : TextWidth.values()) {
121 Map<PluralCategory, String> tmp2 = new EnumMap<>(PluralCategory.class);
122 for (PluralCategory cat : PluralCategory.values()) {
123 tmp2.put(cat, lookup(language, unit, width, cat));
124 }
125 tmp1.put(width, Collections.unmodifiableMap(tmp2));
126 }
127 map.put(
128 unit,
129 Collections.unmodifiableMap(tmp1));
130
131 if (!Character.isDigit(unit.getSymbol())) { // no subseconds
132 // Vergangenheit
133 Map<PluralCategory, String> tmp3 = new EnumMap<>(PluralCategory.class);
134 for (PluralCategory cat : PluralCategory.values()) {
135 tmp3.put(cat, lookup(language, unit, false, false, cat));
136 }
137 mapPast.put(
138 unit,
139 Collections.unmodifiableMap(tmp3));
140 Map<PluralCategory, String> tmp3a = new EnumMap<>(PluralCategory.class);
141 for (PluralCategory cat : PluralCategory.values()) {
142 tmp3a.put(cat, lookup(language, unit, false, true, cat));
143 }
144 mapShortPast.put(
145 unit,
146 Collections.unmodifiableMap(tmp3a));
147
148 // Zukunft
149 Map<PluralCategory, String> tmp4 = new EnumMap<>(PluralCategory.class);
150 for (PluralCategory cat : PluralCategory.values()) {
151 tmp4.put(cat, lookup(language, unit, true, false, cat));
152 }
153 mapFuture.put(
154 unit,
155 Collections.unmodifiableMap(tmp4));
156 Map<PluralCategory, String> tmp4a = new EnumMap<>(PluralCategory.class);
157 for (PluralCategory cat : PluralCategory.values()) {
158 tmp4a.put(cat, lookup(language, unit, true, true, cat));
159 }
160 mapShortFuture.put(
161 unit,
162 Collections.unmodifiableMap(tmp4a));

Callers

nothing calls this directly

Calls 12

valuesMethod · 0.95
lookupMethod · 0.95
getYesterdayWordMethod · 0.95
getTodayWordMethod · 0.95
getTomorrowWordMethod · 0.95
labelForLastMethod · 0.95
labelForNextMethod · 0.95
getSymbolMethod · 0.65
getNowWordMethod · 0.65
putMethod · 0.45
valueOfMethod · 0.45
castMethod · 0.45

Tested by

no test coverage detected