/** doubleValue returns current value. */
 public void testDoubleValue() {
   AtomicInteger ai = new AtomicInteger();
   assertEquals(0.0d, ai.doubleValue());
   for (int x : VALUES) {
     ai.set(x);
     assertEquals((double) x, ai.doubleValue());
   }
 }
Exemple #2
0
 /** 1. 从Number中继承过来的几个方法, 并实现了它。 */
 public void testValue() {
   AtomicInteger ai = new AtomicInteger(22);
   System.out.println(ai.byteValue());
   System.out.println(ai.shortValue());
   System.out.println(ai.intValue());
   System.out.println(ai.longValue());
   System.out.println(ai.floatValue());
   System.out.println(ai.doubleValue());
 }
Exemple #3
0
  protected void getStateFromApplication(Address requester, Digest digest) {
    StateTransferInfo rsp = (StateTransferInfo) up_prot.up(new Event(Event.GET_APPLSTATE));
    byte[] state = rsp.state;

    if (stats) {
      num_state_reqs.incrementAndGet();
      if (state != null) num_bytes_sent.addAndGet(state.length);
      avg_state_size = num_bytes_sent.doubleValue() / num_state_reqs.doubleValue();
    }

    Message state_rsp =
        new Message(requester, state)
            .putHeader(this.id, new StateHeader(StateHeader.STATE_RSP, digest));
    log.trace(
        "%s: sending state to %s (size=%s)",
        local_addr, state_rsp.getDest(), Util.printBytes(state != null ? state.length : 0));
    down_prot.down(new Event(Event.MSG, state_rsp));
  }
 public double getTotal() {
   return quantity.doubleValue() * product.getPrice().doubleValue();
 }