Package java.math

Examples of java.math.BigDecimal.intValue()


      for(int i=0;i<cells.length;i++) {
        row = cells[i];
        for(int j=0;j<row.length;j++)
          if (cells[i][j]!=null) {
            qty = (BigDecimal)cells[i][j];
            for(int k=0;k<qty.intValue();k++) {
              model.addRow(new Object[] {
                 ((VariantsMatrixRowVO)matrixVO.getRowDescriptors()[i]).getRowDescription()+" "+((VariantsMatrixColumnVO)matrixVO.getColumnDescriptors()[j]).getColumnDescription(),
                 serialNums.get(pos)
              });
              pos++;
View Full Code Here


          rows = pstmt2.executeUpdate();
          pstmt2.close();
          if (rows==0)
            throw new Exception("Updating not performed: the record was previously updated.");

          progressive = new BigDecimal(progressive.intValue()+incrementValue.intValue());
        }
        else
          throw new Exception("internal error on calculating progressive in WAR02");

        conn.commit();
View Full Code Here

   * @param price
   * @return true iff player dropped the amount of money
   */
  public static boolean substractTradingFee(Player player, int price) {
    BigDecimal fee = calculateFee(player, price);
    return player.drop("money", fee.intValue());
  }
 
  /**
   * checks if a player can afford the trading fee depending on price
   *
 
View Full Code Here

    int ownedMoney = 0;
    for(Item item : allEquipped) {
      Money m = (Money) item;
      ownedMoney += m.getQuantity();
    }
    return fee.intValue() <= ownedMoney;
  }
 
  /**
   * calculates the trading fee a player has to pay when selling for a certain price
   * @param player
View Full Code Here

    // Add the keys which have a non-null value
    if (family != null) {
      put("family", new Integer(family.intValue()));
    }
    if (prefLength != null) {
      put("prefix_length", new Integer(prefLength.intValue()));
    }

    }

  public void writeSQL(SQLOutput stream) throws SQLException {
View Full Code Here

    public void testPxCreatesPixel() {
      Unit pixel = PassePartout.px( 23 );

      BigDecimal value = pixel.getValue();

      assertEquals( 23, value.intValue() );
      assertTrue( pixel instanceof Pixel );
    }

  @Test
  public void testMarginsCreatesMarginsInstruction() {
View Full Code Here

        byte hour = (byte)(js / (60L * 60L));
        js = js % (60L * 60L);
        byte minute = (byte)(js / (60L));
        js = js % (60L);
        return new DateTimeValue(date.getYear(), date.getMonth(), date.getDay(),
                hour, minute, (byte)js, microseconds.intValue(),0);
    }

    /**
     * Convert to target data type
     *
 
View Full Code Here

    BigDecimal cur = bd.stripTrailingZeros();
    StringBuilder sb = new StringBuilder();

    for (int numConverted = 0; numConverted < MAX_CHARS; numConverted++) {
      cur = cur.multiply(ONE_PLACE);
      int curCodePoint = cur.intValue();
      if (0 == curCodePoint) {
        break;
      }

      cur = cur.subtract(new BigDecimal(curCodePoint));
View Full Code Here

    BigDecimal cur = bd.stripTrailingZeros();
    StringBuilder sb = new StringBuilder();

    for (int numConverted = 0; numConverted < MAX_CHARS; numConverted++) {
      cur = cur.multiply(ONE_PLACE);
      int curCodePoint = cur.intValue();
      if (0 == curCodePoint) {
        break;
      }

      cur = cur.subtract(new BigDecimal(curCodePoint));
View Full Code Here

  public final BigDecimal getContributionMargin() {
    BigDecimal ownProductionCostCustomer = getCost("Egenproduksjon",
        "Kunde");
    if (ownProductionCostCustomer != null
        && ownProductionCostCustomer.intValue() != 0) {
      BigDecimal ownProductionCostInternal = getCost("Egenproduksjon",
          "Intern");
      if (ownProductionCostInternal != null) {
        return ownProductionCostCustomer
            .subtract(ownProductionCostInternal);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.