Examples of BoundedFIFO


Examples of org.apache.log4j.helpers.BoundedFIFO

    int size = 10;

    for(int n = 1; n < size*2; n++) {
      for(int i = 0; i < size*2; i++) {

        BoundedFIFO bf = new BoundedFIFO(size);
        for(int f = 0; f < i; f++) {
          bf.put(e[f]);
        }

        bf.resize(n);
        int expectedSize = min(n, min(i, size));
        assertEquals(bf.length(), expectedSize);
        for(int c = 0; c < expectedSize; c++) {
          assertEquals(bf.get(), e[c]);
        }
      }
    }
  }
View Full Code Here

Examples of org.apache.log4j.helpers.BoundedFIFO

    for(int n = 1; n < size*2; n++) {
      for(int i = 0; i < size*2; i++) {
  for(int d = 0; d < min(i,size); d++) {
   
    BoundedFIFO bf = new BoundedFIFO(size);
    for(int p = 0; p < i; p++) {
      bf.put(e[p]);
    }

    for(int g = 0; g < d; g++) {
      bf.get();
    }

    // x = the number of elems in
    int x = bf.length();

    bf.resize(n);

    int expectedSize = min(n, x);
    assertEquals(bf.length(), expectedSize);

    for(int c = 0; c < expectedSize; c++) {
      assertEquals(bf.get(), e[c+d]);
    }
    assertNull(bf.get());
  }
      }
    }
  }
View Full Code Here

Examples of org.apache.log4j.helpers.BoundedFIFO

    for(int n = 1; n < size*2; n++) {
      for(int i = 0; i < size; i++) {
  for(int d = 0; d < i; d++) {
    for(int r = 0; r < d; r++) {
   
      BoundedFIFO bf = new BoundedFIFO(size);
      for(int p0 = 0; p0 < i; p0++)
        bf.put(e[p0]);

      for(int g = 0; g < d; g++)
        bf.get();     
      for(int p1 = 0; p1 < r; p1++)
        bf.put(e[i+p1]);
     

     
      int x =  bf.length();

      bf.resize(n);
     

      int expectedSize = min(n, x);
      assertEquals(bf.length(), expectedSize);

      for(int c = 0; c < expectedSize; c++) {
        assertEquals(bf.get(), e[c+d]);
      }
      //assertNull(bf.get());
    }
  }
      }
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.