/* * Copyright (C) 2020 Christian Pierre MOMON * * This file is part of AgirStatool, simple key value database. * * AgirStatool is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * AgirStatool is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with AgirStatool. If not, see . */ package org.april.agirstatool.core; import java.time.LocalDate; import java.util.ArrayList; /** * The Class IssueList. */ public class Issues extends ArrayList { private static final long serialVersionUID = -6241164269103539500L; /** * Instantiates a new issue list. */ public Issues() { super(); } /** * Instantiates a new issue list. * * @param capacity * the capacity */ public Issues(final int capacity) { super(capacity); } /** * Compute stat. * * @param date * the date * @return the stat */ public Stat computeStat() { Stat result; result = new Stat(); for (Issue issue : this) { int age = issue.getAgeInDays(); result.addValue(age); } // return result; } /** * Compute stat. * * @param date * the date * @return the stat */ public Stat computeStat(final LocalDate date) { Stat result; result = new Stat(); for (Issue issue : this) { int age = issue.getAgeInDays(date); result.addValue(age); } // return result; } /** * Extract aticved at. * * @param date * the date * @return the issue list */ public Issues extractActivedAt(final LocalDate date) { Issues result; result = new Issues(); for (Issue issue : this) { if (issue.isActiveAt(date)) { result.add(issue); } } // return result; } /** * Extract actived between. * * @param start * the start * @param end * the end * @return the issues */ public Issues extractActivedBetween(final LocalDate start, final LocalDate end) { Issues result; result = new Issues(); for (Issue issue : this) { if (issue.isActiveBetween(start, end)) { result.add(issue); } } // return result; } /** * Sort. * * @param sorting * the sorting * @return the issues */ public Issues sort(final IssueComparator.Sorting sorting) { Issues result; sort(new IssueComparator(sorting)); result = this; // return result; } /** * Sort by created on. * * @return the issues */ public Issues sortByCreatedOn() { Issues result; result = sort(IssueComparator.Sorting.CREATEDON); // return result; } /** * Sort by id. * * @return the issues */ public Issues sortById() { Issues result; result = sort(IssueComparator.Sorting.ID); // return result; } /** * Sort by identifier. * * @return the issues */ public Issues sortByProjectId() { Issues result; result = sort(IssueComparator.Sorting.PROJECTID); // return result; } }