List of usage examples for java.math BigDecimal ZERO
BigDecimal ZERO
To view the source code for java.math BigDecimal ZERO.
Click Source Link
From source file:org.fineract.module.stellar.horizonadapter.HorizonServerUtilities.java
public BigDecimal adjustVaultIssuedAssets(final StellarAccountId stellarAccountId, final char[] stellarAccountPrivateKey, final StellarAccountId stellarVaultAccountId, final char[] stellarVaultAccountPrivateKey, final String assetCode, final BigDecimal amount) throws InvalidConfigurationException, StellarPaymentFailedException, StellarTrustlineAdjustmentFailedException { final BigDecimal currentVaultIssuedAssets = currencyTrustSize(stellarAccountId, assetCode, stellarVaultAccountId);//from w w w. j a va 2s. com final BigDecimal adjustmentRequired = amount.subtract(currentVaultIssuedAssets); if (adjustmentRequired.compareTo(BigDecimal.ZERO) < 0) { final BigDecimal currentVaultIssuedAssetsHeldByTenant = getBalanceByIssuer(stellarAccountId, assetCode, stellarVaultAccountId); final BigDecimal adjustmentPossible = currentVaultIssuedAssetsHeldByTenant .min(adjustmentRequired.abs()); final BigDecimal finalBalance = currentVaultIssuedAssets.subtract(adjustmentPossible); simplePay(stellarVaultAccountId, adjustmentPossible, assetCode, stellarVaultAccountId, stellarAccountPrivateKey); setTrustLineSize(stellarAccountPrivateKey, stellarVaultAccountId, assetCode, finalBalance); return finalBalance; } else if (adjustmentRequired.compareTo(BigDecimal.ZERO) > 0) { setTrustLineSize(stellarAccountPrivateKey, stellarVaultAccountId, assetCode, amount); simplePay(stellarAccountId, adjustmentRequired, assetCode, stellarVaultAccountId, stellarVaultAccountPrivateKey); return amount; } else { return currentVaultIssuedAssets; } }
From source file:com.tasktop.c2c.server.internal.tasks.domain.conversion.TaskConverter.java
protected void copyCommentsAndWorkLogs(Task target, List<com.tasktop.c2c.server.internal.tasks.domain.Comment> sourceComments, DomainConverter converter, DomainConversionContext context) { List<WorkLog> worklogs = new ArrayList<WorkLog>(); List<Comment> comments = new ArrayList<Comment>(); if (sourceComments.isEmpty()) { target.setDescription(""); target.setWikiRenderedDescription(""); } else {//w ww. j a v a2 s. com target.setDescription(sourceComments.get(0).getThetext()); target.setWikiRenderedDescription(renderer.render(target.getDescription(), context.getWikiMarkup())); DomainConversionContext subcontext = context.subcontext(); for (int i = 1; i < sourceComments.size(); i++) { com.tasktop.c2c.server.internal.tasks.domain.Comment sourceComment = sourceComments.get(i); if (sourceComment.getWorkTime() != null && sourceComment.getWorkTime().compareTo(BigDecimal.ZERO) > 0) { WorkLog worklog = new WorkLog(); worklog.setId(sourceComment.getId()); worklog.setProfile((TaskUserProfile) converter.convert(sourceComment.getProfile(), subcontext)); worklog.setDateWorked(sourceComment.getCreationTs()); worklog.setHoursWorked(sourceComment.getWorkTime()); worklog.setComment(sourceComment.getThetext()); worklogs.add(worklog); } else { comments.add((Comment) converter.convert(sourceComment, subcontext)); } } } target.setComments(comments); target.setWorkLogs(worklogs); }
From source file:com.streamsets.pipeline.stage.origin.jdbc.CommonSourceConfigBean.java
public static BigDecimal getQueriesPerSecondFromInterval(Object queryIntervalValue, int numThreads, String queriesPerSecondField, String queryIntervalField) { if (numThreads <= 0) { LOG.warn("numThreads was given as {} in query rate limit upgrade; switching to default value of 1", numThreads);/* ww w . java2 s . c o m*/ numThreads = 1; } BigDecimal queriesPerSecond = new BigDecimal(DEFAULT_QUERIES_PER_SECONDS); Long intervalSeconds = null; if (queryIntervalValue instanceof String) { final String queryIntervalExpr = (String) queryIntervalValue; // total hack, but we don't have access to a real EL evaluation within upgraders so we will only recognize // specific kinds of experssions (namely, the previous default value of ${10 * SECONDS}, or any similar // expression with a number other than 10 final String secondsElExpr = "^\\s*\\$\\{\\s*([0-9]*)\\s*\\*\\s*SECONDS\\s*\\}\\s*$"; final Matcher matcher = Pattern.compile(secondsElExpr).matcher(queryIntervalExpr); if (matcher.matches()) { final String secondsStr = matcher.group(1); intervalSeconds = Long.valueOf(secondsStr); } else if (StringUtils.isNumeric(queryIntervalExpr)) { intervalSeconds = Long.valueOf(queryIntervalExpr); } else { LOG.warn( "{} was a String, but was not a recognized format (either EL expression like '${N * SECONDS}' or simply" + " an integral number, so could not automatically convert it; will use a default value", queryIntervalValue); } } else if (queryIntervalValue instanceof Integer) { intervalSeconds = (long) ((Integer) queryIntervalValue).intValue(); } else if (queryIntervalValue instanceof Long) { intervalSeconds = (Long) queryIntervalValue; } if (intervalSeconds != null) { if (intervalSeconds > 0) { // Force a double operation to not lose precision. // Don't use BigDecimal#divide() to avoid hitting ArithmeticException if numThreads/intervalSeconds // is non-terminating. queriesPerSecond = BigDecimal.valueOf(((double) numThreads) / intervalSeconds); LOG.info("Calculated a {} value of {} from {} of {} and numThreads of {}", queriesPerSecondField, queriesPerSecond, queryIntervalField, queryIntervalValue, numThreads); } else { queriesPerSecond = BigDecimal.ZERO; LOG.warn( "{} value of {} was not positive, so had to use a value of {} for {}, which means unlimited", queryIntervalField, queryIntervalValue, queriesPerSecondField, queriesPerSecond); } } else { LOG.warn("Could not calculate a {} value, so using a default value of {}", queriesPerSecondField, queriesPerSecond); } return queriesPerSecond; }
From source file:au.org.ala.delta.editor.slotfile.directive.DirOutDefault.java
@Override public void writeDirectiveArguments(DirectiveInOutState state) { _deltaWriter.setIndent(2);//from w w w . ja va2 s .co m MutableDeltaDataSet dataSet = state.getDataSet(); Directive curDirective = state.getCurrentDirective().getDirective(); // Dir directive; DirectiveArguments directiveArgs = state.getCurrentDirective().getDirectiveArguments(); int argType = curDirective.getArgType(); String temp = ""; DirectiveType directiveType = state.getCurrentDirective().getType(); List<Integer> dataList = null; int prevNo, curNo; List<DirectiveArgument<?>> args = null; switch (argType) { case DirectiveArgType.DIRARG_NONE: case DirectiveArgType.DIRARG_TRANSLATION: case DirectiveArgType.DIRARG_INTKEY_INCOMPLETE: break; case DirectiveArgType.DIRARG_TEXT: // What about multiple lines of text? // Should line breaks ALWAYS be // preserved? case DirectiveArgType.DIRARG_COMMENT: // Will actually be handled within // DirComment _deltaWriter.setIndent(0); case DirectiveArgType.DIRARG_FILE: case DirectiveArgType.DIRARG_OTHER: case DirectiveArgType.DIRARG_INTERNAL: writeText(directiveArgs, argType); break; case DirectiveArgType.DIRARG_INTEGER: case DirectiveArgType.DIRARG_REAL: if (directiveArgs.size() > 0) { _textBuffer.append(' '); _textBuffer.append(directiveArgs.getFirstArgumentValueAsString()); } break; case DirectiveArgType.DIRARG_CHAR: case DirectiveArgType.DIRARG_ITEM: if (directiveArgs.size() > 0) { _textBuffer.append(' '); curNo = directiveArgs.getFirstArgumentIdAsInt(); _textBuffer.append(curNo); } break; case DirectiveArgType.DIRARG_CHARLIST: case DirectiveArgType.DIRARG_ITEMLIST: if (directiveArgs.size() > 0) { dataList = new ArrayList<Integer>(); for (DirectiveArgument<?> vectIter : directiveArgs.getDirectiveArguments()) dataList.add((Integer) vectIter.getId()); _textBuffer.append(' '); appendRange(dataList, ' ', true, _textBuffer); } break; case DirectiveArgType.DIRARG_TEXTLIST: // Special handling for "legacy" data, when this was stored as a // simple, large // text block... if (directiveArgs.size() == 1 && directiveArgs.getFirstArgumentIdAsInt() <= 0 && directiveArgs.getFirstArgumentText().length() > 1) { writeText(directiveArgs, DirectiveArgType.DIRARG_TEXT); break; } // Otherwise drop through... case DirectiveArgType.DIRARG_CHARTEXTLIST: case DirectiveArgType.DIRARG_ITEMTEXTLIST: case DirectiveArgType.DIRARG_ITEMFILELIST: { writeTextList(dataSet, directiveArgs, argType, temp); break; } case DirectiveArgType.DIRARG_CHARINTEGERLIST: case DirectiveArgType.DIRARG_CHARREALLIST: case DirectiveArgType.DIRARG_ITEMREALLIST: writeNumberList(directiveArgs); break; case DirectiveArgType.DIRARG_CHARGROUPS: for (DirectiveArgument<?> vectIter : directiveArgs.getDirectiveArguments()) { dataList = new ArrayList<Integer>(vectIter.getDataList()); _textBuffer.append(' '); appendRange(dataList, ':', true, _textBuffer); } break; case DirectiveArgType.DIRARG_ITEMCHARLIST: writeItemCharacterList(dataSet, directiveArgs, directiveType); break; case DirectiveArgType.DIRARG_ALLOWED: args = directiveArgs.getDirectiveArguments(); Collections.sort(args); for (DirectiveArgument<?> vectIter : directiveArgs.getDirectiveArguments()) { curNo = (Integer) vectIter.getId(); _textBuffer.append(' '); _textBuffer.append(curNo); _textBuffer.append(','); List<Integer> tmpData = vectIter.getDataList(); if (tmpData.size() < 3) throw new RuntimeException("ED_INTERNAL_ERROR"); temp = Integer.toString(tmpData.get(0)); _textBuffer.append(temp + ':'); temp = Integer.toString(tmpData.get(1)); _textBuffer.append(temp + ':'); temp = Integer.toString(tmpData.get(2)); _textBuffer.append(temp); } break; case DirectiveArgType.DIRARG_KEYSTATE: writeKeyStates(dataSet, directiveArgs); break; case DirectiveArgType.DIRARG_PRESET: for (DirectiveArgument<?> vectIter : directiveArgs.getDirectiveArguments()) { curNo = (Integer) vectIter.getId(); _textBuffer.append(' '); _textBuffer.append(curNo); _textBuffer.append(','); if (vectIter.getData().size() < 2) throw new RuntimeException("ED_INTERNAL_ERROR"); _textBuffer.append(vectIter.getDataList().get(0)); _textBuffer.append(':'); _textBuffer.append(vectIter.getDataList().get(1)); } break; case DirectiveArgType.DIRARG_INTKEY_ONOFF: if (directiveArgs.size() > 0 && directiveArgs.getFirstArgumentValue() != 0.0) { _textBuffer.append(' '); if (directiveArgs.getFirstArgumentValue() < 0.0) _textBuffer.append("Off"); else if (directiveArgs.getFirstArgumentValue() > 0.0) _textBuffer.append("On"); } break; case DirectiveArgType.DIRARG_INTKEY_ITEM: if (directiveArgs.size() > 0) { if (directiveArgs.getFirstArgumentIdAsInt() > 0) { _textBuffer.append(' '); curNo = directiveArgs.getFirstArgumentIdAsInt(); _textBuffer.append(curNo); } else appendKeyword(_textBuffer, directiveArgs.getFirstArgumentText()); } break; case DirectiveArgType.DIRARG_KEYWORD_CHARLIST: case DirectiveArgType.DIRARG_KEYWORD_ITEMLIST: case DirectiveArgType.DIRARG_INTKEY_CHARLIST: case DirectiveArgType.DIRARG_INTKEY_ITEMLIST: dataList = new ArrayList<Integer>(); for (DirectiveArgument<?> vectIter : directiveArgs.getDirectiveArguments()) { if ((Integer) vectIter.getId() > 0) dataList.add((Integer) vectIter.getId()); else appendKeyword(_textBuffer, vectIter.getText(), (argType == DirectiveArgType.DIRARG_KEYWORD_CHARLIST || argType == DirectiveArgType.DIRARG_KEYWORD_ITEMLIST) && vectIter == directiveArgs.get(0)); } if (dataList.size() > 0) { _textBuffer.append(' '); appendRange(dataList, ' ', true, _textBuffer); } break; case DirectiveArgType.DIRARG_INTKEY_CHARREALLIST: if (directiveArgs.size() > 0) { // Will sort all keywords to appear before actual character // numbers, and group characters appropriately args = directiveArgs.getDirectiveArguments(); Collections.sort(args); curNo = Integer.MAX_VALUE; prevNo = Integer.MAX_VALUE; dataList = new ArrayList<Integer>(); BigDecimal curVal = BigDecimal.ZERO; BigDecimal prevVal = BigDecimal.ZERO; boolean firstChar = true; for (int i = 0; i <= args.size(); i++) // Note that vectIter is allowed to equal .end() // This allows the last value to be handled correctly within the // loop. // Be careful not to de-reference vectIter when this happens. { if (i != args.size()) { DirectiveArgument<?> vectIter = args.get(i); curVal = vectIter.getValue(); if ((Integer) vectIter.getId() <= 0) { appendKeyword(_textBuffer, vectIter.getText()); if (!(curVal.compareTo(BigDecimal.ZERO) < 0.0)) { _textBuffer.append(','); _textBuffer.append(curVal.toPlainString()); } continue; } curNo = (Integer) vectIter.getId(); } if (firstChar || (prevNo == curNo - 1 && prevVal.equals(curVal))) { dataList.add(curNo); firstChar = false; } else if (dataList.size() > 0) { _textBuffer.append(' '); appendRange(dataList, ' ', false, _textBuffer); if (!(prevVal.compareTo(BigDecimal.ZERO) < 0.0)) { _textBuffer.append(','); _textBuffer.append(prevVal.toPlainString()); } dataList = new ArrayList<Integer>(); dataList.add(curNo); } prevNo = curNo; prevVal = curVal; } } break; case DirectiveArgType.DIRARG_INTKEY_ITEMCHARSET: writeIntItemCharSetArgs(argType, directiveArgs, _textBuffer); break; case DirectiveArgType.DIRARG_INTKEY_ATTRIBUTES: writeIntkeyAttributesArgs(directiveArgs, _textBuffer, dataSet); break; default: break; } outputTextBuffer(0, 2, false); }
From source file:com.vsthost.rnd.commons.math.ext.linear.DMatrixUtils.java
/** * Returns the DOWN rounded value of the given value for the given steps. * * @param value The original value to be rounded. * @param steps The steps./*from ww w . j a va2 s. c om*/ * @return The DOWN rounded value of the given value for the given steps. */ public static BigDecimal roundDownTo(double value, double steps) { final BigDecimal bValue = BigDecimal.valueOf(value); final BigDecimal bSteps = BigDecimal.valueOf(steps); if (Objects.equals(bSteps, BigDecimal.ZERO)) { return bValue; } else { return bValue.divide(bSteps, 0, RoundingMode.FLOOR).multiply(bSteps); } }
From source file:it.av.es.service.impl.OrderServiceHibernate.java
/** * {@inheritDoc}/*from w w w . ja v a 2 s . c om*/ */ @Override public Order calculatesCostsAndDiscount(Order o) { //ArrayList<ProductOrdered> newList = new ArrayList<ProductOrdered>(o.getProductsOrdered().size()); for (ProductOrdered p : o.getProductsOrdered()) { BigDecimal amount = new BigDecimal(0); Currency currency; int percentDiscount = 0; List<Price> prices = p.getProduct().getPrices(); //calculates the price and apply discount // per il cacolo somma tutti i prodotti dello stesso tipo int productAllOrder = o.getTotalProductforGivenProduct(p.getProduct()); // se il prodoptto appartiene ad una famigliam considera anche i prodotti di quella famiglia if (p.getProduct().getProductFamily() != null) { productAllOrder = o.getTotalProductforGivenProductFamily(p.getProduct().getProductFamily()); } for (Price price : prices) { if (productAllOrder >= price.getFromNumber() && productAllOrder <= price.getToNumber()) { amount = price.getAmount(); currency = price.getCurrency(); percentDiscount = price.getPercentDiscount(); } } if (amount == BigDecimal.ZERO) { throw new EasySendException("Price not available"); } p.setAmount(amount.multiply(BigDecimal.valueOf(p.getNumber()))); //apply discount if applicable if (o.getPaymentTypeP().getDiscount() > 0) { BigDecimal discount = ((p.getAmount().divide(BigDecimal.valueOf(100))) .multiply(BigDecimal.valueOf(o.getPaymentTypeP().getDiscount()))); p.setAmount(p.getAmount().subtract(discount)); percentDiscount = percentDiscount + o.getPaymentTypeP().getDiscount(); } p.setDiscount(percentDiscount); //add the productOrdered to the order // o.getProductsOrdered().add(p); //apply Discounts If Applicable //applyDiscountIfApplicable(order); //apply FreeShippingCost If Applicable } //o.setProductsOrdered(newList); //applyFreeShippingCostIfApplicable(o); return o; }
From source file:edu.byu.softwareDistribution.web.controller.shopper.ShoppingCartController.java
@RequestMapping(value = "/shop/shoppingCart/updateLinePrice") public @ResponseBody BigDecimal updateLinePrice(@RequestParam(value = "key") int key) { final LineItem item = cart.getItem(key); if (item == null) return BigDecimal.ZERO; return item.getTotalPrice(); }
From source file:com.aoindustries.creditcards.TransactionRequest.java
/** * Sets the tax amount of the transaction. * * The amount is normalized to the proper number of decimal places for the selected currency. * * @throws IllegalArgumentException if taxAmount < 0 or is incorrectly formatted for the currency. *//*from ww w . jav a 2 s .c om*/ public void setTaxAmount(BigDecimal taxAmount) { if (taxAmount == null) { this.taxAmount = null; } else { if (taxAmount.compareTo(BigDecimal.ZERO) < 0) throw new LocalizedIllegalArgumentException(accessor, "TransactionRequest.setTaxAmount.taxAmount.lessThanZero"); try { this.taxAmount = taxAmount.setScale(currency.getDefaultFractionDigits()); } catch (ArithmeticException err) { throw new LocalizedIllegalArgumentException(err, accessor, "TransactionRequest.setTaxAmount.taxAmount.cannotNormalize"); } } }
From source file:org.kuali.coeus.s2sgen.impl.generate.support.RRBudgetV1_3Generator.java
/** * This method gets BudgetSummary details such as * CumulativeTotalFundsRequestedSeniorKeyPerson,CumulativeTotalFundsRequestedOtherPersonnel * CumulativeTotalNoOtherPersonnel,CumulativeTotalFundsRequestedPersonnel,CumulativeEquipments,CumulativeTravels * CumulativeTrainee,CumulativeOtherDirect,CumulativeTotalFundsRequestedDirectCosts,CumulativeTotalFundsRequestedIndirectCost * CumulativeTotalFundsRequestedDirectIndirectCosts and CumulativeFee based * on BudgetSummaryInfo for the RRBudget13. * /* ww w . j av a2 s. c om*/ * @param budgetSummaryData * (BudgetSummaryInfo) budget summary entry. * @return BudgetSummary details corresponding to the BudgetSummaryInfo * object. */ private gov.grants.apply.forms.rrBudget13V13.RRBudget13Document.RRBudget13.BudgetSummary getBudgetSummary( BudgetSummaryDto budgetSummaryData) { BudgetSummary budgetSummary = BudgetSummary.Factory.newInstance(); OtherDirectCostInfoDto otherDirectCosts = null; if (budgetSummaryData != null) { if (budgetSummaryData.getOtherDirectCosts() != null && budgetSummaryData.getOtherDirectCosts().size() > 0) { otherDirectCosts = budgetSummaryData.getOtherDirectCosts().get(0); } if (otherDirectCosts != null) { budgetSummary.setCumulativeTotalFundsRequestedSeniorKeyPerson(BigDecimal.ZERO); budgetSummary.setCumulativeTotalFundsRequestedPersonnel(BigDecimal.ZERO); if (budgetSummaryData.getCumTotalFundsForSrPersonnel() != null) { budgetSummary.setCumulativeTotalFundsRequestedSeniorKeyPerson( budgetSummaryData.getCumTotalFundsForSrPersonnel().bigDecimalValue()); } if (budgetSummaryData.getCumTotalFundsForOtherPersonnel() != null && budgetSummaryData .getCumTotalFundsForOtherPersonnel().isGreaterThan(ScaleTwoDecimal.ZERO)) { budgetSummary.setCumulativeTotalFundsRequestedOtherPersonnel( budgetSummaryData.getCumTotalFundsForOtherPersonnel().bigDecimalValue()); } if (budgetSummaryData.getCumNumOtherPersonnel() != null) { budgetSummary.setCumulativeTotalNoOtherPersonnel( budgetSummaryData.getCumNumOtherPersonnel().intValue()); } if (budgetSummaryData.getCumTotalFundsForPersonnel() != null) { budgetSummary.setCumulativeTotalFundsRequestedPersonnel( budgetSummaryData.getCumTotalFundsForPersonnel().bigDecimalValue()); } budgetSummary.setCumulativeTotalFundsRequestedEquipment( budgetSummaryData.getCumEquipmentFunds().bigDecimalValue()); budgetSummary .setCumulativeTotalFundsRequestedTravel(budgetSummaryData.getCumTravel().bigDecimalValue()); budgetSummary.setCumulativeDomesticTravelCosts( budgetSummaryData.getCumDomesticTravel().bigDecimalValue()); budgetSummary .setCumulativeForeignTravelCosts(budgetSummaryData.getCumForeignTravel().bigDecimalValue()); budgetSummary.setCumulativeTotalFundsRequestedTraineeCosts(budgetSummaryData.getpartOtherCost() .add(budgetSummaryData.getpartStipendCost().add(budgetSummaryData.getpartTravelCost().add( budgetSummaryData.getPartTuition().add(budgetSummaryData.getPartSubsistence())))) .bigDecimalValue()); budgetSummary.setCumulativeTraineeStipends(otherDirectCosts.getPartStipends().bigDecimalValue()); budgetSummary .setCumulativeTraineeSubsistence(otherDirectCosts.getPartSubsistence().bigDecimalValue()); budgetSummary.setCumulativeTraineeTravel(otherDirectCosts.getPartTravel().bigDecimalValue()); budgetSummary.setCumulativeTraineeTuitionFeesHealthInsurance( otherDirectCosts.getPartTuition().bigDecimalValue()); budgetSummary.setCumulativeOtherTraineeCost(budgetSummaryData.getpartOtherCost().bigDecimalValue()); budgetSummary.setCumulativeNoofTrainees(budgetSummaryData.getparticipantCount()); budgetSummary.setCumulativeTotalFundsRequestedOtherDirectCosts( otherDirectCosts.gettotalOtherDirect().bigDecimalValue()); budgetSummary.setCumulativeMaterialAndSupplies(otherDirectCosts.getmaterials().bigDecimalValue()); budgetSummary.setCumulativePublicationCosts(otherDirectCosts.getpublications().bigDecimalValue()); budgetSummary.setCumulativeConsultantServices(otherDirectCosts.getConsultants().bigDecimalValue()); budgetSummary.setCumulativeADPComputerServices(otherDirectCosts.getcomputer().bigDecimalValue()); budgetSummary.setCumulativeSubawardConsortiumContractualCosts( otherDirectCosts.getsubAwards().bigDecimalValue()); budgetSummary.setCumulativeEquipmentFacilityRentalFees( otherDirectCosts.getEquipRental().bigDecimalValue()); budgetSummary.setCumulativeAlterationsAndRenovations( otherDirectCosts.getAlterations().bigDecimalValue()); List<Map<String, String>> cvOthers = otherDirectCosts.getOtherCosts(); for (int j = 0; j < cvOthers.size(); j++) { Map<String, String> hmCosts = cvOthers.get(j); if (j == 0) { budgetSummary .setCumulativeOther1DirectCost(new BigDecimal(hmCosts.get(CostConstants.KEY_COST))); } else if (j == 1) { budgetSummary .setCumulativeOther2DirectCost(new BigDecimal(hmCosts.get(CostConstants.KEY_COST))); } else { budgetSummary .setCumulativeOther3DirectCost(new BigDecimal(hmCosts.get(CostConstants.KEY_COST))); } } budgetSummary.setCumulativeTotalFundsRequestedDirectCosts( budgetSummaryData.getCumTotalDirectCosts().bigDecimalValue()); budgetSummary.setCumulativeTotalFundsRequestedIndirectCost( budgetSummaryData.getCumTotalIndirectCosts().bigDecimalValue()); budgetSummary.setCumulativeTotalFundsRequestedDirectIndirectCosts( budgetSummaryData.getCumTotalCosts().bigDecimalValue()); if (budgetSummaryData.getCumFee() != null) { budgetSummary.setCumulativeFee(budgetSummaryData.getCumFee().bigDecimalValue()); } } } return budgetSummary; }
From source file:net.sourceforge.fenixedu.domain.Shift.java
public BigDecimal getMaxLessonDuration() { BigDecimal maxHours = BigDecimal.ZERO; for (Lesson lesson : getAssociatedLessonsSet()) { BigDecimal lessonHours = lesson.getUnitHours(); if (maxHours.compareTo(lessonHours) == -1) { maxHours = lessonHours;/*ww w . j a v a2 s . c om*/ } } return maxHours; }