/* * 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.util.ArrayList; /** * The Class Projects. */ public class Projects extends ArrayList { private static final long serialVersionUID = 7376811538911198897L; /** * Instantiates a new projects. */ public Projects() { super(); } /** * Instantiates a new projects. * * @param initialCapacity * the initial capacity */ public Projects(final int initialCapacity) { super(initialCapacity); } /** * Gets the by parent. * * @param parentId * the parent id * @return the by parent */ public Projects getByParent(final long parentId) { Projects result; result = new Projects(); for (Project project : this) { if ((project.getParentId() != null) && (project.getParentId() == parentId)) { result.add(project); } } // return result; } /** * Sort. * * @param sorting * the sorting * @return the projects */ public Projects sort(final ProjectComparator.Sorting sorting) { Projects result; sort(new ProjectComparator(sorting)); result = this; // return result; } /** * Sort by id. * * @return the projects */ public Projects sortById() { Projects result; sort(ProjectComparator.Sorting.ID); result = this; // return result; } /** * Sort by identifier. * * @return the projects */ public Projects sortByIdentifier() { Projects result; sort(ProjectComparator.Sorting.IDENTIFIER); result = this; // return result; } /** * Sort by name. * * @return the projects */ public Projects sortByName() { Projects result; sort(ProjectComparator.Sorting.NAME); result = this; // return result; } }