Examples of Accumulator


Examples of org.rascalmpl.interpreter.Accumulator

      if (!this.getLabel().isEmpty()) {
        label = org.rascalmpl.interpreter.utils.Names.name(this
            .getLabel().getName());
      }
      __eval.__getAccumulators().push(
          new Accumulator(__eval.__getVf(), label));
      try {
        // a while statement is different from a for statement, the body of
        // the while can influence the
        // variables that are used to test the condition of the loop
        // while does not iterate over all possible matches, rather it
View Full Code Here

Examples of org.shiftone.jrat.core.Accumulator

  /**
   * Method getValue
   */
  public long getValue(int index) {

    Accumulator acc = rateModel.getAccumulator(index, methodNumber);
    long totalDuration = acc.getTotalDuration(TimeUnit.MS);
    long totalExits = acc.getTotalExits();
    return (totalExits != 0) ? totalDuration / totalExits : 0;
  }
View Full Code Here

Examples of org.simpleframework.http.core.Accumulator

      MockSender sender = new MockSender();
      MockMonitor monitor = new MockMonitor();
      MockRequest request = new MockRequest();
      MockResponse response = new MockResponse();
      Conversation support = new Conversation(request, response);
      Accumulator buffer = new Accumulator(support, sender, monitor);
     
      byte[] content = { 'T', 'E', 'S', 'T' };
     
      // Start a HTTP/1.1 conversation
      request.setMajor(1);
      request.setMinor(1);
     
      // Write to a zero capacity buffer
      buffer.expand(0);
      buffer.write(content, 0, content.length);
     
      assertEquals(response.getValue("Connection"), "keep-alive");
      assertEquals(response.getValue("Transfer-Encoding"), "chunked");
      assertEquals(response.getValue("Content-Length"), null);
      assertEquals(response.getContentLength(), -1);
      assertTrue(response.isCommitted());
     
      sender = new MockSender();
      monitor = new MockMonitor();
      request = new MockRequest();
      response = new MockResponse();
      support = new Conversation(request, response);
      buffer = new Accumulator(support, sender, monitor);
     
      // Start a HTTP/1.0 conversation
      request.setMajor(1);
      request.setMinor(0);
     
      // Write to a zero capacity buffer
      buffer.expand(0);
      buffer.write(content, 0, content.length);
     
      assertEquals(response.getValue("Connection"), "close");
      assertEquals(response.getValue("Transfer-Encoding"), null);
      assertEquals(response.getValue("Content-Length"), null);
      assertEquals(response.getContentLength(), -1);
      assertTrue(response.isCommitted());
     
      sender = new MockSender();
      monitor = new MockMonitor();
      request = new MockRequest();
      response = new MockResponse();
      support = new Conversation(request, response);
      buffer = new Accumulator(support, sender, monitor);
     
      // Start a HTTP/1.1 conversation
      request.setMajor(1);
      request.setMinor(1);
     
      // Write to a large capacity buffer
      buffer.expand(1024);
      buffer.write(content, 0, content.length);
     
      assertEquals(response.getValue("Connection"), null);
      assertEquals(response.getValue("Transfer-Encoding"), null);
      assertEquals(response.getValue("Content-Length"), null);
      assertEquals(response.getContentLength(), -1);
      assertFalse(response.isCommitted());
      assertFalse(monitor.isReady());
      assertFalse(monitor.isClose());
      assertFalse(monitor.isError());
     
      // Flush the buffer
      buffer.close();
     
      assertEquals(response.getValue("Connection"), "keep-alive");
      assertEquals(response.getValue("Transfer-Encoding"), null);
      assertEquals(response.getValue("Content-Length"), "4");
      assertEquals(response.getContentLength(), 4);
      assertTrue(response.isCommitted());
      assertTrue(monitor.isReady());
      assertFalse(monitor.isClose());
      assertFalse(monitor.isError());

      boolean catchOverflow = false;
     
      try {
         buffer.write(content, 0, content.length);
      } catch(Exception e) {
         catchOverflow = true;
      }
      assertTrue(catchOverflow);
   }
View Full Code Here

Examples of se.grunka.fortuna.accumulator.Accumulator

    public static Fortuna createInstance() {
        Pool[] pools = new Pool[32];
        for (int pool = 0; pool < pools.length; pool++) {
            pools[pool] = new Pool();
        }
        Accumulator accumulator = new Accumulator(pools);
        accumulator.addSource(new SchedulingEntropySource());
        accumulator.addSource(new GarbageCollectorEntropySource());
        accumulator.addSource(new LoadAverageEntropySource());
        accumulator.addSource(new FreeMemoryEntropySource());
        accumulator.addSource(new ThreadTimeEntropySource());
        accumulator.addSource(new UptimeEntropySource());
        if (Files.exists(Paths.get("/dev/urandom"))) {
            accumulator.addSource(new URandomEntropySource());
        }
        while (pools[0].size() < MIN_POOL_SIZE) {
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
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.