@Test public void testGetCompWeek() { assertEquals(-1, EventHelper.competitionWeek(null)); Date preseason = new Date(115, 1, 5); assertEquals(0, EventHelper.competitionWeek(preseason)); Date week5 = new Date(115, 2, 28); assertEquals(5, EventHelper.competitionWeek(week5)); }
public static int competitionWeek(Date date) { if (date == null) return -1; Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DAY_OF_YEAR, -1); int week = getYearWeek(cal.getTime()) - Utilities.getFirstCompWeek(cal.get(Calendar.YEAR)); return week < 0 ? 0 : week; }
EventHelper { public static int competitionWeek(Date date) { if (date == null) return -1; Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DAY_OF_YEAR, -1); int week = getYearWeek(cal.getTime()) - Utilities.getFirstCompWeek(cal.get(Calendar.YEAR)); return week < 0 ? 0 : week; } }
EventHelper { public static int competitionWeek(Date date) { if (date == null) return -1; Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DAY_OF_YEAR, -1); int week = getYearWeek(cal.getTime()) - Utilities.getFirstCompWeek(cal.get(Calendar.YEAR)); return week < 0 ? 0 : week; } private  EventHelper(); }
EventHelper { public static int competitionWeek(Date date) { if (date == null) return -1; Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DAY_OF_YEAR, -1); int week = getYearWeek(cal.getTime()) - Utilities.getFirstCompWeek(cal.get(Calendar.YEAR)); return week < 0 ? 0 : week; } private  EventHelper(); static boolean validateEventKey(String key); static String shortName(String eventName); static int getYear(String eventKey); static int getYearWeek(Date date); static int competitionWeek(Date date); static String generateLabelForEvent(Event e); static String weekLabelFromNum(int year, @Nullable Integer weekNum); static int weekNumFromLabel(int year, String label); static void renderEventListForTeam(Context context,List<Event> events, List<Object> output); static void renderEventListForWeek(Context context, List<Event> events, List<Object> output); static void renderEventListForDistrict(
            Context context,
            List<Event> events,
            List<Object> output); static String getDateString(Date startDate, Date endDate); static String getShortCodeForEventKey(String eventKey); static String getEventCode(String matchOrEventOrDistrictKey); }
EventHelper { public static int competitionWeek(Date date) { if (date == null) return -1; Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DAY_OF_YEAR, -1); int week = getYearWeek(cal.getTime()) - Utilities.getFirstCompWeek(cal.get(Calendar.YEAR)); return week < 0 ? 0 : week; } private  EventHelper(); static boolean validateEventKey(String key); static String shortName(String eventName); static int getYear(String eventKey); static int getYearWeek(Date date); static int competitionWeek(Date date); static String generateLabelForEvent(Event e); static String weekLabelFromNum(int year, @Nullable Integer weekNum); static int weekNumFromLabel(int year, String label); static void renderEventListForTeam(Context context,List<Event> events, List<Object> output); static void renderEventListForWeek(Context context, List<Event> events, List<Object> output); static void renderEventListForDistrict(
            Context context,
            List<Event> events,
            List<Object> output); static String getDateString(Date startDate, Date endDate); static String getShortCodeForEventKey(String eventKey); static String getEventCode(String matchOrEventOrDistrictKey); static final String CHAMPIONSHIP_LABEL; static final String CITY_CHAMPIONSHIP_LABEL; static final String REGIONAL_LABEL; static final String FLOAT_REGIONAL_LABEL; static final String WEEKLESS_LABEL; static final String OFFSEASON_LABEL; static final String PRESEASON_LABEL; }