BrightSide Workbench Full Report + Source Code
DossierData.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2011 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 package org.turro.dossier.dossier;
19 
20 import org.turro.elephant.util.DecimalFormats;
21 
26 public class DossierData {
27 
28  private DossierValues prevision, reality;
29 
30  public DossierData(DossierValues prevision, DossierValues reality) {
31  this.prevision = prevision;
32  this.reality = reality;
33  }
34 
35  public boolean hasData() {
36  return isExpenses() || isHours() || isPrice();
37  }
38 
39  public boolean isExpenses() {
40  return prevision.expenses != 0 || reality.expenses != 0;
41  }
42 
43  public boolean isHours() {
44  return prevision.hours != 0 || reality.hours != 0;
45  }
46 
47  public boolean isPrice() {
48  return prevision.price != 0 || reality.price != 0;
49  }
50 
52  return prevision;
53  }
54 
56  return reality;
57  }
58 
59  public double getExpensesDifference() {
60  return prevision.expenses - reality.expenses;
61  }
62 
63  public double getHoursDifference() {
64  return prevision.hours - reality.hours;
65  }
66 
67  public double getPriceDifference() {
68  return prevision.price - reality.price;
69  }
70 
71  public String getExpensesString() {
72  return DecimalFormats.format(prevision.expenses) +
73  " - " +
74  DecimalFormats.format(reality.expenses) +
75  " = " +
77  }
78 
79  public String getHoursString() {
80  return DecimalFormats.format(prevision.hours) +
81  " - " +
82  DecimalFormats.format(reality.hours) +
83  " = " +
85  }
86 
87  public String getPriceString() {
88  return DecimalFormats.format(prevision.price) +
89  " - " +
90  DecimalFormats.format(reality.price) +
91  " = " +
93  }
94 
95 }
DossierData(DossierValues prevision, DossierValues reality)
static String format(Number value, String pattern)