use of com.alexstyl.specialdates.events.namedays.NamedayBundle in project Memento-Calendar by alexstyl.
the class NamedayJSONParserTest method davidNamedayIsReturnedCorrectly.
@Test
public void davidNamedayIsReturnedCorrectly() {
NamedayBundle namedayBundle = NamedayJSONParser.getNamedaysFrom(namedayJSON);
NameCelebrations dates = namedayBundle.getDatesFor("Δαβίδ");
assertThatContainsDate(dates, Date.Companion.on(26, JUNE));
}
use of com.alexstyl.specialdates.events.namedays.NamedayBundle in project Memento-Calendar by alexstyl.
the class GreeklishParserTest method davidNamedayIsReturnedCorrectly.
@Test
public void davidNamedayIsReturnedCorrectly() {
NamedayBundle namedayBundle = NamedayJSONParser.getNamedaysFromJSONasSounds(namedayJSON);
NameCelebrations dates = namedayBundle.getDatesFor("Δαβίδ");
NameCelebrations datesGreeklish = namedayBundle.getDatesFor("David");
assertThatContainsSamedate(dates, datesGreeklish);
}
use of com.alexstyl.specialdates.events.namedays.NamedayBundle in project Memento-Calendar by alexstyl.
the class NamedayCalendarProvider method loadNamedayCalendarForLocale.
public NamedayCalendar loadNamedayCalendarForLocale(NamedayLocale locale, int year) {
if (hasRequestedSameCalendar(locale, year)) {
return cachedCalendar;
}
NamedayJSON namedayJSON = getNamedayJSONFor(locale);
SpecialNamedays specialCaseHandler = getSpecialnamedaysHandler(locale, namedayJSON);
NamedayBundle namedaysBundle = getNamedayBundle(locale, namedayJSON);
NamedayCalendar namedayCalendar = new NamedayCalendar(locale, namedaysBundle, specialCaseHandler, year);
cacheCalendar(namedayCalendar);
return namedayCalendar;
}
use of com.alexstyl.specialdates.events.namedays.NamedayBundle in project Memento-Calendar by alexstyl.
the class NamedayJSONParser method createBundleWith.
private static NamedayBundle createBundleWith(NamedayJSON locale, Node namesToDate) {
NamedaysList dateToNames = new NamedaysList();
JSONArray data = locale.getData();
int size = data.length();
for (int i = 0; i < size; i++) {
try {
JSONObject nameday;
nameday = (JSONObject) data.get(i);
String dateString = nameday.getString("date");
Date theDate = getNamedaysFrom(dateString);
JSONArray variations = nameday.getJSONArray("names");
int numberOfVariations = variations.length();
for (int varCount = 0; varCount < numberOfVariations; varCount++) {
String variation = variations.getString(varCount);
namesToDate.addDate(variation, theDate);
dateToNames.addNameday(theDate, variation);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
return new NamedayBundle(namesToDate, dateToNames);
}
use of com.alexstyl.specialdates.events.namedays.NamedayBundle in project Memento-Calendar by alexstyl.
the class GreeklishParserTest method magdoulaNamedayIsReturnedCorrectly.
@Test
public void magdoulaNamedayIsReturnedCorrectly() {
NamedayBundle namedayBundle = NamedayJSONParser.getNamedaysFromJSONasSounds(namedayJSON);
NameCelebrations dates = namedayBundle.getDatesFor("Αμαλία");
NameCelebrations datesGreeklish = namedayBundle.getDatesFor("Amalia");
assertThatContainsSamedate(dates, datesGreeklish);
}
Aggregations