2020-09-15 03:16:26 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
|
|
|
*
|
|
|
|
* This file is part of StatoolInfos, simple service statistics tool.
|
|
|
|
*
|
|
|
|
* StatoolInfos 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.
|
|
|
|
*
|
|
|
|
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
package fr.devinsy.statoolinfos.core;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
2020-09-25 04:36:38 +02:00
|
|
|
import java.util.Collections;
|
2020-09-15 03:16:26 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The Class Organizations.
|
|
|
|
*/
|
|
|
|
public class Organizations extends ArrayList<Organization>
|
|
|
|
{
|
|
|
|
private static final long serialVersionUID = 2092235357983955170L;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instantiates a new organizations.
|
|
|
|
*/
|
|
|
|
public Organizations()
|
|
|
|
{
|
|
|
|
super();
|
|
|
|
}
|
2020-09-25 04:36:38 +02:00
|
|
|
|
2020-10-11 06:57:21 +02:00
|
|
|
/**
|
|
|
|
* Filter by social network.
|
|
|
|
*
|
|
|
|
* @return the organizations
|
|
|
|
*/
|
|
|
|
public Organizations filterBySocialNetworks()
|
|
|
|
{
|
|
|
|
Organizations result;
|
|
|
|
|
|
|
|
result = new Organizations();
|
|
|
|
|
|
|
|
for (Organization organization : this)
|
|
|
|
{
|
|
|
|
if (organization.hasSocialNetwork())
|
|
|
|
{
|
|
|
|
result.add(organization);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Filter by social network.
|
|
|
|
*
|
|
|
|
* @param value
|
|
|
|
* the value
|
|
|
|
* @return the organizations
|
|
|
|
*/
|
|
|
|
public Organizations filterBySocialNetwork(final SocialNetworks value)
|
|
|
|
{
|
|
|
|
Organizations result;
|
|
|
|
|
|
|
|
result = new Organizations();
|
|
|
|
|
|
|
|
for (Organization organization : this)
|
|
|
|
{
|
|
|
|
if (organization.hasSocialNetwork(value))
|
|
|
|
{
|
|
|
|
result.add(organization);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-09-25 04:36:38 +02:00
|
|
|
/**
|
|
|
|
* Reverse.
|
|
|
|
*
|
|
|
|
* @return the services
|
|
|
|
*/
|
|
|
|
public Organizations reverse()
|
|
|
|
{
|
|
|
|
Organizations result;
|
|
|
|
|
|
|
|
Collections.reverse(this);
|
|
|
|
|
|
|
|
result = this;
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sort.
|
|
|
|
*
|
|
|
|
* @param sorting
|
|
|
|
* the sorting
|
|
|
|
* @return the issues
|
|
|
|
*/
|
|
|
|
public Organizations sort(final OrganizationComparator.Sorting sorting)
|
|
|
|
{
|
|
|
|
Organizations result;
|
|
|
|
|
|
|
|
sort(new OrganizationComparator(sorting));
|
|
|
|
|
|
|
|
result = this;
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sort by name.
|
|
|
|
*
|
|
|
|
* @return the services
|
|
|
|
*/
|
|
|
|
public Organizations sortByName()
|
|
|
|
{
|
|
|
|
Organizations result;
|
|
|
|
|
|
|
|
result = sort(OrganizationComparator.Sorting.NAME);
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-10-01 16:04:34 +02:00
|
|
|
/**
|
|
|
|
* Sort by reverse service count.
|
|
|
|
*
|
|
|
|
* @return the organizations
|
|
|
|
*/
|
|
|
|
public Organizations sortByReverseServiceCount()
|
|
|
|
{
|
|
|
|
Organizations result;
|
|
|
|
|
|
|
|
result = sort(OrganizationComparator.Sorting.REVERSE_SERVICE_COUNT);
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-09-25 04:36:38 +02:00
|
|
|
/**
|
|
|
|
* Sort by service count.
|
|
|
|
*
|
|
|
|
* @return the organizations
|
|
|
|
*/
|
|
|
|
public Organizations sortByServiceCount()
|
|
|
|
{
|
|
|
|
Organizations result;
|
|
|
|
|
2020-09-26 03:18:11 +02:00
|
|
|
result = sort(OrganizationComparator.Sorting.SERVICE_COUNT);
|
2020-09-25 04:36:38 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
2020-09-15 03:16:26 +02:00
|
|
|
}
|