Java Code Examples for java.math.BigDecimal#add()

The following examples show how to use java.math.BigDecimal#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OrderReadHelper.java    From scipio-erp with Apache License 2.0 6 votes vote down vote up
/** Get the quantity of order items that have been invoiced */
public static BigDecimal getOrderItemInvoicedQuantity(GenericValue orderItem) {
    BigDecimal invoiced = BigDecimal.ZERO;
    try {
        // this is simply the sum of quantity billed in all related OrderItemBillings
        List<GenericValue> billings = orderItem.getRelated("OrderItemBilling", null, null, false);
        for (GenericValue billing : billings) {
            BigDecimal quantity = billing.getBigDecimal("quantity");
            if (quantity != null) {
                invoiced = invoiced.add(quantity);
            }
        }
    } catch (GenericEntityException e) {
        Debug.logError(e, e.getMessage(), module);
    }
    return invoiced;
}
 
Example 2
Source File: CostSheetServiceImpl.java    From axelor-open-suite with GNU Affero General Public License v3.0 6 votes vote down vote up
protected BigDecimal getTotalToProduceQty(ManufOrder manufOrder) throws AxelorException {

    BigDecimal totalProducedQty = BigDecimal.ZERO;

    for (StockMoveLine stockMoveLine : manufOrder.getProducedStockMoveLineList()) {

      if (stockMoveLine.getUnit().equals(manufOrder.getUnit())
          && (stockMoveLine.getStockMove().getStatusSelect() == StockMoveRepository.STATUS_PLANNED
              || stockMoveLine.getStockMove().getStatusSelect()
                  == StockMoveRepository.STATUS_REALIZED)) {
        Product product = stockMoveLine.getProduct();
        totalProducedQty =
            totalProducedQty.add(
                unitConversionService.convert(
                    stockMoveLine.getUnit(),
                    costSheet.getManufOrder().getUnit(),
                    stockMoveLine.getQty(),
                    stockMoveLine.getQty().scale(),
                    product));
      }
    }

    return totalProducedQty;
  }
 
Example 3
Source File: ClosureJavaIntegrationTest.java    From groovy with Apache License 2.0 5 votes vote down vote up
public void testInject() {
    Collection<Integer> c = Arrays.asList(2, 4, 5, 20);
    Number initial = BigDecimal.ZERO;
    Closure<? extends Number> closure = new Closure<BigDecimal>(c) {
        BigDecimal doCall(BigDecimal total, Integer next) {
            return total.add(BigDecimal.ONE.divide(new BigDecimal(next)));
        }
    };
    assertTrue(DefaultTypeTransformation.compareEqual(BigDecimal.ONE, inject(c, initial, closure)));
}
 
Example 4
Source File: BigDecimalArithmeticTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Add two numbers of equal negative scales
 */
public void testAddEqualScaleNegNeg() {
    String a = "1231212478987482988429808779810457634781384756794987";
    int aScale = -10;
    String b = "747233429293018787918347987234564568";
    int bScale = -10;
    String c = "1.231212478987483735663238072829245553129371991359555E+61";
    int cScale = -10;
    BigDecimal aNumber = new BigDecimal(new BigInteger(a), aScale);
    BigDecimal bNumber = new BigDecimal(new BigInteger(b), bScale);
    BigDecimal result = aNumber.add(bNumber);
    assertEquals("incorrect value", c, result.toString());
    assertEquals("incorrect scale", cScale, result.scale());
}
 
Example 5
Source File: 1_BigMatrixImpl.java    From SimFix with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the <a href="http://mathworld.wolfram.com/MatrixTrace.html">
 * trace</a> of the matrix (the sum of the elements on the main diagonal).
 *
 * @return trace
 * 
 * @throws IllegalArgumentException if this matrix is not square.
 */
public BigDecimal getTrace() throws IllegalArgumentException {
    if (!isSquare()) {
        throw new IllegalArgumentException("matrix is not square");
    }
    BigDecimal trace = data[0][0];
    for (int i = 1; i < this.getRowDimension(); i++) {
        trace = trace.add(data[i][i]);
    }
    return trace;
}
 
Example 6
Source File: XMLGregorianCalendarImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @return result of adding second and fractional second field
 */
private BigDecimal getSeconds() {
    if (second == DatatypeConstants.FIELD_UNDEFINED) {
        return DECIMAL_ZERO;
    }
    BigDecimal result = BigDecimal.valueOf((long) second);
    if (fractionalSecond != null) {
        return result.add(fractionalSecond);
    } else {
        return result;
    }
}
 
Example 7
Source File: Project_OrderedAmount.java    From estatio with Apache License 2.0 5 votes vote down vote up
private BigDecimal amountWhenParentProject(){
    BigDecimal result = BigDecimal.ZERO;
    for (Project child : project.getChildren()){
        result = result.add(wrapperFactory.wrap(new Project_OrderedAmount(child)).orderedAmount());
    }
    return result;
}
 
Example 8
Source File: AuftragsStatistik.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
private BigDecimal add(BigDecimal sum, final BigDecimal amount)
{
  if (amount == null) {
    return sum;
  }
  if (sum == null) {
    sum = BigDecimal.ZERO;
  }
  sum = sum.add(amount);
  sum.setScale(2, RoundingMode.HALF_UP);
  return sum;
}
 
Example 9
Source File: TestFBIntegerField.java    From jaybird with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Test at maximum allowed value (Integer.MAX_VALUE) plus fraction
 */
@Test
public void setBigDecimal_MAX_plus_fraction() throws SQLException {
    expectedException.expect(TypeConversionException.class);
    BigDecimal testValue = new BigDecimal(Integer.MAX_VALUE);
    testValue = testValue.add(testValue.ulp());

    field.setBigDecimal(testValue);
}
 
Example 10
Source File: CircleTest.java    From spring-boot-cookbook with Apache License 2.0 5 votes vote down vote up
/**
 * 虽然是一个变更名,但指针地址已经发生变化
 */
@Test
public void testParameterValue() {
    BigDecimal totalFee = BigDecimal.ZERO;
    BigDecimal discount = new BigDecimal("20.2");
    totalFee = totalFee.add(discount);
    OrderItem orderItem = new OrderItem();
    orderItem.setDiscount(totalFee);
    BigDecimal orderInquiry = new BigDecimal("99.9");
    totalFee = totalFee.add(orderInquiry);
    orderItem.setTotalFee(totalFee);
    System.out.println(JSON.toJSONString(orderItem));
    assertThat(orderItem.getDiscount().compareTo(discount)).isEqualTo(0);
    assertThat(orderItem.getTotalFee().compareTo(discount.add(orderInquiry))).isEqualTo(0);
}
 
Example 11
Source File: BigDecimalMathTest.java    From big-math with MIT License 5 votes vote down vote up
@Test
public void testLog10WithPositivePowersOfTen() {
	MathContext mathContext = new MathContext(50);		
	BigDecimal x = new BigDecimal("1");
	BigDecimal expectedLog10 = new BigDecimal(0);
	for (int i = 0; i < 20; i++) {
		BigDecimal actualLog10 = BigDecimalMath.log10(x, mathContext);
		assertEquals(true, expectedLog10.compareTo(actualLog10) == 0);

		x = x.multiply(BigDecimal.TEN, mathContext);
		expectedLog10 = expectedLog10.add(BigDecimal.ONE, mathContext);
	}
}
 
Example 12
Source File: EscapeAnalysis.java    From antsdb with GNU Lesser General Public License v3.0 4 votes vote down vote up
BigDecimal add(BigDecimal x, BigDecimal y) {
    BigDecimal z = x.add(y);
    return z;
}
 
Example 13
Source File: LineString.java    From osiris with Apache License 2.0 4 votes vote down vote up
private BigDecimal computeArea(LinearRing2D ring)
{
  BigDecimal area = new BigDecimal(0.0D);

  int n = ring.vertexNumber();

  math.geom2d.Point2D prev = ring.vertex(n - 1);

  for (math.geom2d.Point2D point : ring.vertices()) {
  	
    BigDecimal prevx = new BigDecimal(prev.x());
    BigDecimal prevy = new BigDecimal(prev.y());
    BigDecimal pointx = new BigDecimal(point.x());
    BigDecimal pointy = new BigDecimal(point.y());
    	      	    	
    area = area.add(prevx.multiply(pointy).subtract(prevy.multiply(pointx)));		      
    prev = point;
  }

  return area.divide(new BigDecimal(2.0D), 4096, RoundingMode.HALF_UP);
  
}
 
Example 14
Source File: BigDecimalMath.java    From big-math with MIT License 4 votes vote down vote up
/**
	 * Rounds the specified {@link BigDecimal} to the precision of the specified {@link MathContext} including trailing zeroes.
	 *
	 * <p>This method is similar to {@link BigDecimal#round(MathContext)} but does <strong>not</strong> remove the trailing zeroes.</p>
	 *
	 * <p>Example:</p>
<pre>
MathContext mc = new MathContext(5);
System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("1.234567"), mc));    // 1.2346
System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("123.4567"), mc));    // 123.46
System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("0.001234567"), mc)); // 0.0012346
System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("1.23"), mc));        // 1.2300
System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("1.230000"), mc));    // 1.2300
System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("0.00123"), mc));     // 0.0012300
System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("0"), mc));           // 0.0000
System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("0.00000000"), mc));  // 0.0000
</pre>
	 *
	 * @param value the {@link BigDecimal} to round
	 * @param mathContext the {@link MathContext} used for the result
	 * @return the rounded {@link BigDecimal} value including trailing zeroes
	 * @see BigDecimal#round(MathContext)
     * @see BigDecimalMath#round(BigDecimal, MathContext)
	 */
	public static BigDecimal roundWithTrailingZeroes(BigDecimal value, MathContext mathContext) {
		if (value.precision() == mathContext.getPrecision()) {
			return value;
		}
		if (value.signum() == 0) {
			return BigDecimal.ZERO.setScale(mathContext.getPrecision() - 1);
		}

		try {
            BigDecimal stripped = value.stripTrailingZeros();
            int exponentStripped = exponent(stripped); // value.precision() - value.scale() - 1;

            BigDecimal zero;
            if (exponentStripped < -1) {
                zero = BigDecimal.ZERO.setScale(mathContext.getPrecision() - exponentStripped);
            } else {
                zero = BigDecimal.ZERO.setScale(mathContext.getPrecision() + exponentStripped + 1);
            }
            return stripped.add(zero, mathContext);
        } catch (ArithmeticException ex) {
		    return value.round(mathContext);
        }
	}
 
Example 15
Source File: ResellerShareResultAssembler.java    From development with Apache License 2.0 4 votes vote down vote up
private void setServiceRevenue(ServiceRevenue serviceRevenue) {
    BigDecimal totalAmount = serviceRevenue.getTotalAmount();
    totalAmount = totalAmount.add(currentBillingResult.getNetAmount());
    serviceRevenue.setTotalAmount(totalAmount);
}
 
Example 16
Source File: MarketSummarySingleton.java    From sample.daytrader7 with Apache License 2.0 4 votes vote down vote up
@Schedule(second = "*/20",minute = "*", hour = "*", persistent = false)
private void updateMarketSummary() { 
    
    if (Log.doTrace()) {
        Log.trace("MarketSummarySingleton:updateMarketSummary -- updating market summary");
    }
                    
    if (TradeConfig.getRunTimeMode() != TradeConfig.EJB3)
    {
        if (Log.doTrace()) {
            Log.trace("MarketSummarySingleton:updateMarketSummary -- Not EJB3 Mode, so not updating");
        }
        return; // Only do the actual work if in EJB3 Mode
    }
    
    List<QuoteDataBean> quotes;
    
    try {        
    	// Find Trade Stock Index Quotes (Top 100 quotes) ordered by their change in value
    	CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
    	CriteriaQuery<QuoteDataBean> criteriaQuery = criteriaBuilder.createQuery(QuoteDataBean.class);
    	Root<QuoteDataBean> quoteRoot = criteriaQuery.from(QuoteDataBean.class);
    	criteriaQuery.orderBy(criteriaBuilder.desc(quoteRoot.get("change1")));
    	criteriaQuery.select(quoteRoot);
    	TypedQuery<QuoteDataBean> q = entityManager.createQuery(criteriaQuery);
    	quotes = q.getResultList();
    } catch (Exception e) {
    	Log.debug("Warning: The database has not been configured. If this is the first time the application has been started, please create and populate the database tables. Then restart the server.");
    	return;
    }	
            
    /* TODO: Make this cleaner? */
    QuoteDataBean[] quoteArray = quotes.toArray(new QuoteDataBean[quotes.size()]);
    ArrayList<QuoteDataBean> topGainers = new ArrayList<QuoteDataBean>(5);
    ArrayList<QuoteDataBean> topLosers = new ArrayList<QuoteDataBean>(5);
    BigDecimal TSIA = FinancialUtils.ZERO;
    BigDecimal openTSIA = FinancialUtils.ZERO;
    double totalVolume = 0.0;

    if (quoteArray.length > 5) {
        for (int i = 0; i < 5; i++) {
            topGainers.add(quoteArray[i]);
        }
        for (int i = quoteArray.length - 1; i >= quoteArray.length - 5; i--) {
            topLosers.add(quoteArray[i]);
        }

        for (QuoteDataBean quote : quoteArray) {
            BigDecimal price = quote.getPrice();
            BigDecimal open = quote.getOpen();
            double volume = quote.getVolume();
            TSIA = TSIA.add(price);
            openTSIA = openTSIA.add(open);
            totalVolume += volume;
        }
        TSIA = TSIA.divide(new BigDecimal(quoteArray.length), FinancialUtils.ROUND);
        openTSIA = openTSIA.divide(new BigDecimal(quoteArray.length), FinancialUtils.ROUND);
    }
    
    setMarketSummaryDataBean(new MarketSummaryDataBean(TSIA, openTSIA, totalVolume, topGainers, topLosers));
}
 
Example 17
Source File: DistributionService_Test.java    From estatio with Apache License 2.0 4 votes vote down vote up
@Test
public void generateKeyValuesRoundingBy3DecimalsNegativeDeltaPromille() {

    //given
    DistributionService distributionService = new DistributionService();
    List<Distributable> input = new ArrayList<>();

    //10000.99
    KeyItem item1 = new KeyItem();
    item1.setSourceValue(BigDecimal.valueOf(10000.99));
    input.add(item1);

    //0.99
    KeyItem item2 = new KeyItem();
    item2.setSourceValue(BigDecimal.valueOf(0.99));
    input.add(item2);

    //1.99
    for (int i = 2; i < 14; i = i + 1) {
        KeyItem item = new KeyItem();
        item.setSourceValue(BigDecimal.valueOf(1.99));
        input.add(item);
    }

    //theoretical max rounding error: 14*0.0005 = +/- 0.007
    //in this example here we get to -0.006

    //when
    List<Distributable> output = distributionService.distribute(input, new BigDecimal(1000), 3);
    BigDecimal sumRoundedValues = BigDecimal.ZERO;
    for (Distributable object : output) {
        sumRoundedValues = sumRoundedValues.add(object.getValue());
    }

    //then
    assertThat(output).hasSize(14);
    assertThat(output.get(0).getValue()).isEqualTo(BigDecimal.valueOf(997.519).setScale(3, BigDecimal.ROUND_HALF_UP));
    assertThat(output.get(1).getValue()).isEqualTo(BigDecimal.valueOf(0.099).setScale(3, BigDecimal.ROUND_HALF_UP));

    for (int i = 2; i < 8; i = i + 1) {
        assertThat(output.get(i).getValue()).isEqualTo(BigDecimal.valueOf(0.198).setScale(3, BigDecimal.ROUND_HALF_UP));
    }

    for (int i = 8; i < 14; i = i + 1) {
        assertThat(output.get(i).getValue()).isEqualTo(BigDecimal.valueOf(0.199).setScale(3, BigDecimal.ROUND_HALF_UP));
    }

    assertThat(sumRoundedValues.setScale(3, BigDecimal.ROUND_HALF_UP)).isEqualTo(BigDecimal.valueOf(1000.000).setScale(3, BigDecimal.ROUND_HALF_UP));

}
 
Example 18
Source File: PendenzeConverter.java    From govpay with GNU General Public License v3.0 4 votes vote down vote up
public static BigDecimal fillSingoliVersamentiFromVociPendenza(it.govpay.core.dao.commons.Versamento versamento, List<VocePendenza> voci) throws ServiceException {

		BigDecimal importoTotale = BigDecimal.ZERO;

		if(voci != null && voci.size() > 0) {
			for (VocePendenza vocePendenza : voci) {
				it.govpay.core.dao.commons.Versamento.SingoloVersamento sv = new it.govpay.core.dao.commons.Versamento.SingoloVersamento();

				//sv.setCodTributo(value); ??

				sv.setCodSingoloVersamentoEnte(vocePendenza.getIdVocePendenza());
				if(vocePendenza.getDatiAllegati() != null)
					sv.setDatiAllegati(ConverterUtils.toJSON(vocePendenza.getDatiAllegati(),null));
				sv.setDescrizione(vocePendenza.getDescrizione());
				sv.setDescrizioneCausaleRPT(vocePendenza.getDescrizioneCausaleRPT());
				sv.setImporto(vocePendenza.getImporto());

				importoTotale = importoTotale.add(vocePendenza.getImporto());

				// Definisce i dati di un bollo telematico
				if(vocePendenza.getHashDocumento() != null && vocePendenza.getTipoBollo() != null && vocePendenza.getProvinciaResidenza() != null) {
					it.govpay.core.dao.commons.Versamento.SingoloVersamento.BolloTelematico bollo = new it.govpay.core.dao.commons.Versamento.SingoloVersamento.BolloTelematico();
					bollo.setHash(vocePendenza.getHashDocumento());
					bollo.setProvincia(vocePendenza.getProvinciaResidenza());
					bollo.setTipo(vocePendenza.getTipoBollo());
					sv.setBolloTelematico(bollo);
				} else if(vocePendenza.getCodEntrata() != null) { // Definisce i dettagli di incasso tramite riferimento in anagrafica GovPay.
					sv.setCodTributo(vocePendenza.getCodEntrata());

				} else { // Definisce i dettagli di incasso della singola entrata.
					it.govpay.core.dao.commons.Versamento.SingoloVersamento.Tributo tributo = new it.govpay.core.dao.commons.Versamento.SingoloVersamento.Tributo();
					tributo.setCodContabilita(vocePendenza.getCodiceContabilita());
					tributo.setIbanAccredito(vocePendenza.getIbanAccredito());
					tributo.setIbanAppoggio(vocePendenza.getIbanAppoggio());
					tributo.setTipoContabilita(it.govpay.core.dao.commons.Versamento.SingoloVersamento.Tributo.TipoContabilita.valueOf(vocePendenza.getTipoContabilita().name()));
					sv.setTributo(tributo);
				}

				versamento.getSingoloVersamento().add(sv);
			}
		}

		return importoTotale;
	}
 
Example 19
Source File: BudgetConstructionAccountObjectDetailReportServiceImpl.java    From kfs with GNU Affero General Public License v3.0 4 votes vote down vote up
protected List calculateAccountTotal(List<BudgetConstructionAccountBalance> bcabList, List<BudgetConstructionAccountBalance> simpleList) {
    BigDecimal accountPositionCsfLeaveFteQuantity = BigDecimal.ZERO;
    BigDecimal accountPositionFullTimeEquivalencyQuantity = BigDecimal.ZERO;
    BigDecimal accountAppointmentRequestedCsfFteQuantity = BigDecimal.ZERO;
    BigDecimal accountAppointmentRequestedFteQuantity = BigDecimal.ZERO;

    KualiInteger accountRevenueFinancialBeginningBalanceLineAmount = KualiInteger.ZERO;
    KualiInteger accountRevenueAccountLineAnnualBalanceAmount = KualiInteger.ZERO;
    KualiInteger accountTrnfrInFinancialBeginningBalanceLineAmount = KualiInteger.ZERO;
    KualiInteger accountTrnfrInAccountLineAnnualBalanceAmount = KualiInteger.ZERO;
    KualiInteger accountExpenditureFinancialBeginningBalanceLineAmount = KualiInteger.ZERO;
    KualiInteger accountExpenditureAccountLineAnnualBalanceAmount = KualiInteger.ZERO;

    List returnList = new ArrayList();

    for (BudgetConstructionAccountBalance simpleBcosEntry : simpleList) {
        BudgetConstructionOrgAccountObjectDetailReportTotal bcObjectTotal = new BudgetConstructionOrgAccountObjectDetailReportTotal();
        for (BudgetConstructionAccountBalance bcabListEntry : bcabList) {
            if (BudgetConstructionReportHelper.isSameEntry(simpleBcosEntry, bcabListEntry, fieldsForAccountTotal())) {

                accountPositionCsfLeaveFteQuantity = accountPositionCsfLeaveFteQuantity.add(bcabListEntry.getPositionCsfLeaveFteQuantity());
                accountPositionFullTimeEquivalencyQuantity = accountPositionFullTimeEquivalencyQuantity.add(bcabListEntry.getPositionFullTimeEquivalencyQuantity());
                accountAppointmentRequestedCsfFteQuantity = accountAppointmentRequestedCsfFteQuantity.add(bcabListEntry.getAppointmentRequestedCsfFteQuantity());
                accountAppointmentRequestedFteQuantity = accountAppointmentRequestedFteQuantity.add(bcabListEntry.getAppointmentRequestedFteQuantity());

                if (bcabListEntry.getIncomeExpenseCode().equals("A")) {
                    accountRevenueFinancialBeginningBalanceLineAmount = accountRevenueFinancialBeginningBalanceLineAmount.add(bcabListEntry.getFinancialBeginningBalanceLineAmount());
                    accountRevenueAccountLineAnnualBalanceAmount = accountRevenueAccountLineAnnualBalanceAmount.add(bcabListEntry.getAccountLineAnnualBalanceAmount());
                }
                else {
                    accountExpenditureFinancialBeginningBalanceLineAmount = accountExpenditureFinancialBeginningBalanceLineAmount.add(bcabListEntry.getFinancialBeginningBalanceLineAmount());
                    accountExpenditureAccountLineAnnualBalanceAmount = accountExpenditureAccountLineAnnualBalanceAmount.add(bcabListEntry.getAccountLineAnnualBalanceAmount());
                }

                if (bcabListEntry.getIncomeExpenseCode().equals("B")) {
                    if (bcabListEntry.getFinancialObjectLevelCode().equals("CORI") || bcabListEntry.getFinancialObjectLevelCode().equals("TRIN")) {
                        accountTrnfrInFinancialBeginningBalanceLineAmount = accountTrnfrInFinancialBeginningBalanceLineAmount.add(bcabListEntry.getFinancialBeginningBalanceLineAmount());
                        accountTrnfrInAccountLineAnnualBalanceAmount = accountTrnfrInAccountLineAnnualBalanceAmount.add(bcabListEntry.getAccountLineAnnualBalanceAmount());
                    }
                }
            }
        }

        bcObjectTotal.setBudgetConstructionAccountBalance(simpleBcosEntry);

        bcObjectTotal.setAccountPositionCsfLeaveFteQuantity(accountPositionCsfLeaveFteQuantity);
        bcObjectTotal.setAccountPositionFullTimeEquivalencyQuantity(accountPositionFullTimeEquivalencyQuantity);
        bcObjectTotal.setAccountAppointmentRequestedCsfFteQuantity(accountAppointmentRequestedCsfFteQuantity);
        bcObjectTotal.setAccountAppointmentRequestedFteQuantity(accountAppointmentRequestedFteQuantity);

        bcObjectTotal.setAccountRevenueFinancialBeginningBalanceLineAmount(accountRevenueFinancialBeginningBalanceLineAmount);
        bcObjectTotal.setAccountRevenueAccountLineAnnualBalanceAmount(accountRevenueAccountLineAnnualBalanceAmount);
        bcObjectTotal.setAccountTrnfrInFinancialBeginningBalanceLineAmount(accountTrnfrInFinancialBeginningBalanceLineAmount);
        bcObjectTotal.setAccountTrnfrInAccountLineAnnualBalanceAmount(accountTrnfrInAccountLineAnnualBalanceAmount);
        bcObjectTotal.setAccountExpenditureFinancialBeginningBalanceLineAmount(accountExpenditureFinancialBeginningBalanceLineAmount);
        bcObjectTotal.setAccountExpenditureAccountLineAnnualBalanceAmount(accountExpenditureAccountLineAnnualBalanceAmount);

        returnList.add(bcObjectTotal);

        accountPositionCsfLeaveFteQuantity = BigDecimal.ZERO;
        accountPositionFullTimeEquivalencyQuantity = BigDecimal.ZERO;
        accountAppointmentRequestedCsfFteQuantity = BigDecimal.ZERO;
        accountAppointmentRequestedFteQuantity = BigDecimal.ZERO;

        accountRevenueFinancialBeginningBalanceLineAmount = KualiInteger.ZERO;
        accountRevenueAccountLineAnnualBalanceAmount = KualiInteger.ZERO;
        accountTrnfrInFinancialBeginningBalanceLineAmount = KualiInteger.ZERO;
        accountTrnfrInAccountLineAnnualBalanceAmount = KualiInteger.ZERO;
        accountExpenditureFinancialBeginningBalanceLineAmount = KualiInteger.ZERO;
        accountExpenditureAccountLineAnnualBalanceAmount = KualiInteger.ZERO;
    }
    return returnList;
}
 
Example 20
Source File: CallableTest.java    From gemfirexd-oss with Apache License 2.0 3 votes vote down vote up
/**
 * External code for the BIGDECIMAL_IN_AND_OUT_PROC SQL procedure, which
 * tests INT and OUT parameters with the BigDecimal data type.
 *
 * @param bd1   input parameter
 * @param bdr1  output parameter set to bd1 * bd2
 * @param bd2   input parameter
 * @param bdr2  output parameter set to bd1 + bd2
 * @param bdr3  output parameter set to a fixed value
 * @param bdr4  output parameter set to a fixed value
 * @param bdr5  output parameter set to a fixed value
 * @param bdr6  output parameter set to a fixed value
 * @param bdr7  output parameter set to a fixed value
 *
 */
public static void bigDecimalInAndOutProc (BigDecimal bd1, 
    BigDecimal bdr1[], BigDecimal bd2, BigDecimal bdr2[], 
    BigDecimal bdr3[], BigDecimal bdr4[], BigDecimal bdr5[], 
    BigDecimal bdr6[], BigDecimal bdr7[])
{
    bdr1[0] = bd1;
    bdr2[0] = bd1.multiply(bd2);
    bdr3[0] = bd1.add(bd2);
    bdr4[0] = new BigDecimal(".00000");
    bdr5[0] = new BigDecimal("-.00000");
    bdr6[0] = new BigDecimal("99999999.");
    bdr7[0] = new BigDecimal("-99999999.");
}