/*
- * Copyright (c) 2017. Developed by Hedgecode.
+ * Copyright (c) 2017-2020. Developed by Hedgecode.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.hedgecode.snooker.api;
+import java.io.Serializable;
import java.util.Calendar;
import java.util.LinkedHashMap;
import java.util.Map;
*
* @author Dmitry Samoshin aka gotty
*/
-public class Season {
+public class Season implements Serializable {
+
+ private static final long serialVersionUID = -4233073149675278053L;
private static final Calendar CURRENT_CALENDAR = Calendar.getInstance();
+ private static final int NEW_SEASON_MONTH = 5; /* June */
+
public static final int BEGIN_YEAR = 2005;
+
public static final int CURRENT_YEAR =
- CURRENT_CALENDAR.get(Calendar.MONTH) >= 6
+ CURRENT_CALENDAR.get(Calendar.MONTH) >= NEW_SEASON_MONTH
? CURRENT_CALENDAR.get(Calendar.YEAR)
: CURRENT_CALENDAR.get(Calendar.YEAR) - 1;
- private static final int ALL_SEASONS = -1;
+ public static final int ALL_SEASONS = -1;
public static final Season ALL = new Season(ALL_SEASONS);
public static final Season CURRENT_SEASON = new Season(CURRENT_YEAR);
- public static Map<Integer, Season> SEASONS = new LinkedHashMap<>();
+ private static final Map<Integer, Season> SEASONS = new LinkedHashMap<>();
static {
for (int year = BEGIN_YEAR; year < CURRENT_YEAR; ++year) {