(ChronoDisplay context)
| 1149 | //~ Methoden ------------------------------------------------------ |
| 1150 | |
| 1151 | @Override |
| 1152 | public String apply(ChronoDisplay context) { |
| 1153 | |
| 1154 | PlainTime time = context.get(PlainTime.COMPONENT); |
| 1155 | DayPeriod dp = DayPeriod.this; |
| 1156 | Locale locale = dp.locale; |
| 1157 | |
| 1158 | if (this.fixed) { |
| 1159 | String code = getFixedCode(time); |
| 1160 | |
| 1161 | if (dp.isPredefined()) { |
| 1162 | Map<String, String> textForms = loadTextForms(locale, dp.calendarType); |
| 1163 | String key = createKey(textForms, this.width, this.outputContext, code); |
| 1164 | if (!textForms.containsKey(key)) { |
| 1165 | if (code.equals("midnight")) { |
| 1166 | key = createKey(textForms, this.width, this.outputContext, "am"); |
| 1167 | } else if (code.equals("noon")) { |
| 1168 | key = createKey(textForms, this.width, this.outputContext, "pm"); |
| 1169 | } |
| 1170 | } |
| 1171 | if (textForms.containsKey(key)) { |
| 1172 | return textForms.get(key); |
| 1173 | } |
| 1174 | } else { |
| 1175 | return code; |
| 1176 | } |
| 1177 | } else { |
| 1178 | if (dp.isPredefined()) { |
| 1179 | Map<String, String> textForms = loadTextForms(locale, dp.calendarType); |
| 1180 | if (time.isMidnight()) { |
| 1181 | String key = createKey(textForms, this.width, this.outputContext, "midnight"); |
| 1182 | if (textForms.containsKey(key)) { |
| 1183 | return textForms.get(key); |
| 1184 | } |
| 1185 | } else if (time.isSimultaneous(PlainTime.of(12))) { |
| 1186 | String key = createKey(textForms, this.width, this.outputContext, "noon"); |
| 1187 | if (textForms.containsKey(key)) { |
| 1188 | return textForms.get(key); |
| 1189 | } |
| 1190 | } |
| 1191 | String code = dp.codeMap.get(dp.getStart(time)); |
| 1192 | String key = createKey(textForms, this.width, this.outputContext, code); |
| 1193 | if (textForms.containsKey(key)) { |
| 1194 | return textForms.get(key); |
| 1195 | } |
| 1196 | } else { |
| 1197 | return dp.codeMap.get(dp.getStart(time)); |
| 1198 | } |
| 1199 | } |
| 1200 | |
| 1201 | return time.get(PlainTime.AM_PM_OF_DAY).getDisplayName((locale == null) ? Locale.ROOT : locale); // fallback |
| 1202 | |
| 1203 | } |
| 1204 | |
| 1205 | } |
| 1206 |
nothing calls this directly
no test coverage detected