BrightSide Workbench Full Report + Source Code
Movement.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2012 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.product;
20 
21 import java.util.Date;
22 import org.turro.financials.entity.Contract;
23 
28 public class Movement {
29 
30  private Contract contract;
31  private Date date;
32  private double coefficient, quantity, price;
33  private String concept;
34 
35  public Movement(Contract contract, Date date, double coefficient, double quantity, double price, String concept) {
36  this.contract = contract;
37  this.date = date;
38  this.coefficient = coefficient;
39  this.quantity = quantity;
40  this.price = price;
41  this.concept = concept;
42  }
43 
44  public Movement(String concept, double quantity, double price) {
45  this.quantity = quantity;
46  this.price = price;
47  this.concept = concept;
48  }
49 
50  public double getCoefficient() {
51  return coefficient;
52  }
53 
54  public String getConcept() {
55  return concept;
56  }
57 
58  public Contract getContract() {
59  return contract;
60  }
61 
62  public Date getDate() {
63  return date;
64  }
65 
66  public double getPrice() {
67  return price;
68  }
69 
70  public double getQuantity() {
71  if(contract == null) {
72  return quantity;
73  } else {
74  return quantity * coefficient;
75  }
76  }
77 
78  public double getAmount() {
79  if(contract == null) {
80  return getPrice() * -1;
81  } else {
82  return getQuantity() * getPrice() * -1;
83  }
84  }
85 
86  public void setCoefficient(double coefficient) {
87  this.coefficient = coefficient;
88  }
89 
90  public void setConcept(String concept) {
91  this.concept = concept;
92  }
93 
94  public void setContract(Contract contract) {
95  this.contract = contract;
96  }
97 
98  public void setDate(Date date) {
99  this.date = date;
100  }
101 
102  public void setPrice(double price) {
103  this.price = price;
104  }
105 
106  public void setQuantity(double quantity) {
107  this.quantity = quantity;
108  }
109 
110 }
void setContract(Contract contract)
Definition: Movement.java:94
Movement(Contract contract, Date date, double coefficient, double quantity, double price, String concept)
Definition: Movement.java:35
void setConcept(String concept)
Definition: Movement.java:90
void setQuantity(double quantity)
Definition: Movement.java:106
Movement(String concept, double quantity, double price)
Definition: Movement.java:44
void setCoefficient(double coefficient)
Definition: Movement.java:86