Search in sources :

Example 1 with NamedayBundle

use of com.alexstyl.specialdates.events.namedays.NamedayBundle in project Memento-Calendar by alexstyl.

the class RomanianNamedays method calculateEasterIfNecessary.

private void calculateEasterIfNecessary(int year) {
    if (romanianDate == null || romanianDate.getYear() != year) {
        romanianDate = calculator.calculateSpecialRomanianDayForYear(year);
        NamedaysList dateToNames = new NamedaysList();
        CharacterNode namesToDate = new CharacterNode();
        for (String name : names) {
            dateToNames.addNameday(romanianDate, name);
            namesToDate.addDate(name, romanianDate);
        }
        namedays = new NamedayBundle(namesToDate, dateToNames);
    }
}
Also used : NamedaysList(com.alexstyl.specialdates.events.namedays.NamedaysList) NamedayBundle(com.alexstyl.specialdates.events.namedays.NamedayBundle)

Example 2 with NamedayBundle

use of com.alexstyl.specialdates.events.namedays.NamedayBundle in project Memento-Calendar by alexstyl.

the class SpecialGreekNamedaysCalculator method calculateForEasterDate.

NamedayBundle calculateForEasterDate(Date easter) {
    Node node = new SoundNode();
    NamedaysList namedaysList = new NamedaysList();
    for (EasternNameday easternNameday : easternNamedays) {
        int daysUntilEaster = easternNameday.getDateToEaster();
        Date date = easter.addDay(daysUntilEaster);
        for (String name : easternNameday.getNamesCelebrating()) {
            node.addDate(name, date);
            namedaysList.addNameday(date, name);
        }
    }
    appendSpecialScenarios(easter, node, namedaysList);
    return new NamedayBundle(node, namedaysList);
}
Also used : NamedaysList(com.alexstyl.specialdates.events.namedays.NamedaysList) EasternNameday(com.alexstyl.specialdates.events.namedays.calendar.EasternNameday) NamedayBundle(com.alexstyl.specialdates.events.namedays.NamedayBundle) Date(com.alexstyl.specialdates.date.Date)

Example 3 with NamedayBundle

use of com.alexstyl.specialdates.events.namedays.NamedayBundle in project Memento-Calendar by alexstyl.

the class GreeklishParserTest method alexandrosNamedayIsReturnedCorrectly.

@Test
public void alexandrosNamedayIsReturnedCorrectly() {
    NamedayBundle namedayBundle = NamedayJSONParser.getNamedaysFromJSONasSounds(namedayJSON);
    NameCelebrations dates = namedayBundle.getDatesFor("Αλέξανδρος");
    NameCelebrations datesGreeklish = namedayBundle.getDatesFor("Aleksandros");
    assertThatContainsSamedate(dates, datesGreeklish);
}
Also used : NameCelebrations(com.alexstyl.specialdates.events.namedays.NameCelebrations) NamedayBundle(com.alexstyl.specialdates.events.namedays.NamedayBundle) Test(org.junit.Test)

Example 4 with NamedayBundle

use of com.alexstyl.specialdates.events.namedays.NamedayBundle in project Memento-Calendar by alexstyl.

the class NamedayJSONParserTest method returningBundleHasNames.

@Test
public void returningBundleHasNames() {
    NamedayBundle namedayBundle = NamedayJSONParser.getNamedaysFrom(namedayJSON);
    assertThat(namedayBundle.getNames()).isNotEmpty();
}
Also used : NamedayBundle(com.alexstyl.specialdates.events.namedays.NamedayBundle) Test(org.junit.Test)

Example 5 with NamedayBundle

use of com.alexstyl.specialdates.events.namedays.NamedayBundle in project Memento-Calendar by alexstyl.

the class NamedayJSONParserTest method amaliaNamedayIsReturnedCorrectly.

@Test
public void amaliaNamedayIsReturnedCorrectly() {
    NamedayBundle namedayBundle = NamedayJSONParser.getNamedaysFrom(namedayJSON);
    NameCelebrations dates = namedayBundle.getDatesFor("Αμαλία");
    assertThatContainsDate(dates, Date.Companion.on(10, JULY));
}
Also used : NameCelebrations(com.alexstyl.specialdates.events.namedays.NameCelebrations) NamedayBundle(com.alexstyl.specialdates.events.namedays.NamedayBundle) Test(org.junit.Test)

Aggregations

NamedayBundle (com.alexstyl.specialdates.events.namedays.NamedayBundle)11 Test (org.junit.Test)7 NameCelebrations (com.alexstyl.specialdates.events.namedays.NameCelebrations)6 NamedaysList (com.alexstyl.specialdates.events.namedays.NamedaysList)3 Date (com.alexstyl.specialdates.date.Date)2 EasternNameday (com.alexstyl.specialdates.events.namedays.calendar.EasternNameday)1 NamedayCalendar (com.alexstyl.specialdates.events.namedays.calendar.NamedayCalendar)1 JSONArray (org.json.JSONArray)1 JSONException (org.json.JSONException)1 JSONObject (org.json.JSONObject)1