Package org.internna.ossmoney.model.support

Examples of org.internna.ossmoney.model.support.IncomeExpense


    private void fillModel(Date[] dates, Map<Currency, Map<Date, IncomeExpense>> data, ModelMap modelMap) {
      Map<Currency, BigDecimal> totalMax = new HashMap<Currency, BigDecimal>();
      Map<Currency, IncomeExpense> maxValues = new HashMap<Currency, IncomeExpense>();
      Map<Currency, List<NameValuePair<Date, IncomeExpense>>> dataAsSet = new HashMap<Currency, List<NameValuePair<Date, IncomeExpense>>>();
      for (Currency currency : data.keySet()) {
        IncomeExpense max = maxValues.containsKey(currency) ? maxValues.get(currency) : new IncomeExpense();
            List<NameValuePair<Date, IncomeExpense>> orderedData = new ArrayList<NameValuePair<Date, IncomeExpense>>();
            for (Date date : dates) {
              IncomeExpense value = data.get(currency).get(date);
                max.setKey(max.getKey().doubleValue() > value.getKey().doubleValue() ? max.getKey() : value.getKey());
                max.setValue(max.getValue().doubleValue() > value.getValue().doubleValue() ? max.getValue() : value.getValue());
                orderedData.add(new NameValuePair<Date, IncomeExpense>(date, value));
            }
            maxValues.put(currency, max);
            dataAsSet.put(currency, orderedData);
      }
View Full Code Here


                    wealthOverTimeAndCurrency.put(currency, new HashMap<Date, IncomeExpense>());
                }
                Map<Date, IncomeExpense> wealthOverTime = wealthOverTimeAndCurrency.get(currency);
                for (Date month : dates) {
                    if (!wealthOverTime.containsKey(month)) {
                        wealthOverTime.put(month, new IncomeExpense());
                    }
                    IncomeExpense data = wealthOverTime.get(month);
                    data.setKey(data.getKey().add(account.calculateBalance(month)));
                    wealthOverTime.put(month, data);
                }
            }
        }
      return wealthOverTimeAndCurrency;
View Full Code Here

                    expensesOverTimeAndCurrency.put(currency, new HashMap<Date, IncomeExpense>());
                }
                Map<Date, IncomeExpense> incomeExpensesOverTime = expensesOverTimeAndCurrency.get(currency);
                for (Date month : dates) {
                    if (!incomeExpensesOverTime.containsKey(month)) {
                      incomeExpensesOverTime.put(month, new IncomeExpense());
                    }
                    IncomeExpense monthIncomeExpenses = incomeExpensesOverTime.get(month);
                    List<AccountTransaction> transactions = account.getTransactionsInPeriod(new Interval(DateUtils.getMonthStartDate(month), month), null, true);
                    if (!CollectionUtils.isEmpty(transactions)) {
                        for (AccountTransaction transaction : transactions) {
                            BigDecimal amount = transaction.getAmount();
                            if (amount.doubleValue() >= 0) {
                              monthIncomeExpenses.setKey(monthIncomeExpenses.getKey().add(amount.abs()));
                            } else {
                              monthIncomeExpenses.setValue(monthIncomeExpenses.getValue().add(amount.abs()));
                            }
                        }
                    }
                    incomeExpensesOverTime.put(month, monthIncomeExpenses);
                }
View Full Code Here

TOP

Related Classes of org.internna.ossmoney.model.support.IncomeExpense

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.