BrightSide Workbench Full Report + Source Code
bsfinancials-core/src/main/java/org/turro/financials/operating/ParticipantSet.java
Go to the documentation of this file.
1
/*
2
* TurrĂ³ i Cutiller Foundation. License notice.
3
* Copyright (C) 2013 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU Affero General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU Affero General Public License for more details.
14
*
15
* You should have received a copy of the GNU Affero General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
package
org.turro.financials.operating;
20
21
import
java.util.TreeSet;
22
27
public
class
ParticipantSet
extends
TreeSet<ValueItem> {
28
29
public
ValueItem
getItem
(String major) {
30
ValueItem
vi = ceiling(
new
ValueItem
(major));
31
if
(vi !=
null
&& vi.
getMajor
().equals(major)) {
32
return
vi;
33
}
else
{
34
vi =
new
ValueItem
(major);
35
add(vi);
36
return
vi;
37
}
38
}
39
40
public
double
getAmount
() {
41
double
amount = 0;
42
for
(
ValueItem
vi :
this
) {
43
amount += vi.
getValue
();
44
}
45
return
amount;
46
}
47
48
public
TreeSet<ValueItem>
getProviders
() {
49
TreeSet<ValueItem> sub =
new
TreeSet<>();
50
for
(
ValueItem
vi :
this
) {
51
if
(vi.
getMajor
().startsWith(
"40"
) || vi.
getMajor
().startsWith(
"41"
)) {
52
sub.add(vi);
53
}
54
}
55
return
sub;
56
}
57
58
public
TreeSet<ValueItem>
getCustomers
() {
59
TreeSet<ValueItem> sub =
new
TreeSet<>();
60
for
(
ValueItem
vi :
this
) {
61
if
(vi.
getMajor
().startsWith(
"43"
) || vi.
getMajor
().startsWith(
"44"
)) {
62
sub.add(vi);
63
}
64
}
65
return
sub;
66
}
67
68
public
double
getProvidersAmount
() {
69
double
amount = 0;
70
for
(
ValueItem
vi :
getProviders
()) {
71
amount += vi.getValue();
72
}
73
return
amount;
74
}
75
76
public
double
getCustomersAmount
() {
77
double
amount = 0;
78
for
(
ValueItem
vi :
getCustomers
()) {
79
amount += vi.getValue();
80
}
81
return
amount;
82
}
83
84
}
org.turro.financials.operating.ParticipantSet
Definition:
bsfinancials-core/src/main/java/org/turro/financials/operating/ParticipantSet.java:27
org.turro.financials.operating.ParticipantSet.getCustomers
TreeSet< ValueItem > getCustomers()
Definition:
bsfinancials-core/src/main/java/org/turro/financials/operating/ParticipantSet.java:58
org.turro.financials.operating.ParticipantSet.getCustomersAmount
double getCustomersAmount()
Definition:
bsfinancials-core/src/main/java/org/turro/financials/operating/ParticipantSet.java:76
org.turro.financials.operating.ParticipantSet.getProviders
TreeSet< ValueItem > getProviders()
Definition:
bsfinancials-core/src/main/java/org/turro/financials/operating/ParticipantSet.java:48
org.turro.financials.operating.ParticipantSet.getProvidersAmount
double getProvidersAmount()
Definition:
bsfinancials-core/src/main/java/org/turro/financials/operating/ParticipantSet.java:68
org.turro.financials.operating.ParticipantSet.getAmount
double getAmount()
Definition:
bsfinancials-core/src/main/java/org/turro/financials/operating/ParticipantSet.java:40
org.turro.financials.operating.ParticipantSet.getItem
ValueItem getItem(String major)
Definition:
bsfinancials-core/src/main/java/org/turro/financials/operating/ParticipantSet.java:29
org.turro.financials.operating.ValueItem
Definition:
ValueItem.java:27
org.turro.financials.operating.ValueItem.getMajor
String getMajor()
Definition:
ValueItem.java:44
org.turro.financials.operating.ValueItem.getValue
double getValue()
Definition:
ValueItem.java:52
TurroProjects
Public
BrightSide
bsfinancials-core
src
main
java
org
turro
financials
operating
ParticipantSet.java
Generated on Tue Mar 12 2024 07:01:20 for BrightSide by
1.9.1