public Category category() { if (currentCategory != null) { return Category.parse(currentCategory); } if (birthdate != null) { try { return Category.categoryForBirthDate(birthDateFormat.parse(birthdate)); } catch (ParseException e) { e.printStackTrace(); } } return null; }
public Set<Category> possibleCategories() { Set<Category> set = new HashSet<>(); if (currentCategory != null) { set.add(Category.parse(currentCategory)); } if (categories != null) { for (CategoryField field : categories) { Set<Category> cats = Category.advance(Category.parse(field.category), field.season, currentSeason()); if (set.isEmpty()) set.addAll(cats); else set.retainAll(cats); } } set.remove(new Category(Category.CategoryBase.UNDEFINED)); return set; }