Examples of PageAddress


Examples of lupos.datastructures.buffermanager.BufferManager.PageAddress

   * @param i The amount to increase the size
   */
  protected void incSize(final int i) {
    this.size += i;
    try {
      final ByteBuffer byteBuffer = ByteBuffer.wrap(this.bufferManager.getPage(this.pageSize, new PageAddress(0, this.path1)));
      byteBuffer.putInt(0, this.size() + i);
      this.bufferManager.modifyPage(this.pageSize, new PageAddress(0, this.path1), byteBuffer.array());
      this.bufferManager.writeAllModifiedPages();
    } catch (final IOException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

Examples of lupos.datastructures.buffermanager.BufferManager.PageAddress

   * @param i The amount to decrease the size
   */
  protected void decSize(final int i) {
    this.size -= i;
    try {
      final ByteBuffer byteBuffer = ByteBuffer.wrap(this.bufferManager.getPage(this.pageSize, new PageAddress(0, this.path1)));
      byteBuffer.putInt(0, this.size() - i);
      this.bufferManager.modifyPage(this.pageSize, new PageAddress(0, this.path1), byteBuffer.array());
      this.bufferManager.writeAllModifiedPages();
    } catch (final IOException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

Examples of lupos.datastructures.buffermanager.BufferManager.PageAddress

    final byte[] element = new byte[size];

    int offset = 0;
    for (int i = leftPage; i <= rightPage; i++) {
      try {
        final byte[] page = this.bufferManager.getPage(this.pageSize, new PageAddress(i, this.path1));
        if (leftPage == rightPage) {
          System.arraycopy(page, leftBound, element, offset, size);
          break;
        } else if (i == leftPage) {
          if (this.pageSize < leftBound) {
View Full Code Here

Examples of lupos.datastructures.buffermanager.BufferManager.PageAddress

    }

    // Remove unused pages
    if (index == this.size - 1) {
      for (int l = pageEndNew + 1; l < this.size; l++) {
        this.bufferManager.releasePage(new PageAddress(l, this.path1));
      }
      if (this.getPointerPage(this.size - 1) < bm2LastElement) {
        this.bufferManager.releasePage(new PageAddress(bm2LastElement, this.path2));
      }
    }

    this.decSize(1);
View Full Code Here

Examples of lupos.datastructures.buffermanager.BufferManager.PageAddress

  }

  protected Pointer getPointers(final int index) {
    ByteBuffer byteBuffer = null;
    try {
      byteBuffer = ByteBuffer.wrap(this.bufferManager.getPage(this.pageSize, new PageAddress(this.getPointerPage(index), this.path2)));
    } catch (final IOException e) {
      e.printStackTrace();
    }

    final int pointerBound = this.getPointerBound(index);
View Full Code Here

Examples of lupos.datastructures.buffermanager.BufferManager.PageAddress

    return new Pointer(byteBuffer.getInt(pointerBound), byteBuffer.getInt(pointerBound + 4), byteBuffer.getInt(pointerBound + 8));
  }

  protected void setPointers(final int index, final int leftPage, final int leftBound, final int size) {
    try {
      final ByteBuffer byteBuffer = ByteBuffer.wrap(this.bufferManager.getPage(this.pageSize, new PageAddress(this.getPointerPage(index), this.path2)));

      byteBuffer.putInt(this.getPointerBound(index), leftPage);
      byteBuffer.putInt(this.getPointerBound(index) + 4, leftBound);
      byteBuffer.putInt(this.getPointerBound(index) + 8, size);
      this.bufferManager.modifyPage(this.pageSize, new PageAddress(this.getPointerPage(index), this.path2), byteBuffer.array());
      this.bufferManager.writeAllModifiedPages();
    } catch (final IOException e1) {
      e1.printStackTrace();
    }
  }
View Full Code Here

Examples of lupos.datastructures.buffermanager.BufferManager.PageAddress

    final int rightPage = this.calcRightPage(pointer.leftPage, pointer.leftBound, pointer.size);
    final int rightBound = this.calcRightBound(pointer.leftBound, pointer.size);

    for (int i = pointer.leftPage; i <= rightPage; i++) {
      try {
        final byte[] page = this.bufferManager.getPage(this.pageSize, new PageAddress(i, this.path1));
        if (pointer.leftPage == rightPage) {
          baos = new ByteArrayOutputStream();
          baos.write(page, pointer.leftBound, pointer.size);
          bais = new ByteArrayInputStream(baos.toByteArray());
View Full Code Here

Examples of lupos.datastructures.buffermanager.BufferManager.PageAddress

  public boolean add(final V element) {

    try {
      this.size++;

      final PageAddress pageAddress = new PageAddress(0, this.pointersFilename);
      final byte[] page = BufferManager.getBufferManager().getPage(this.TABLEPAGESIZE, pageAddress);

      final int hashAddress = Math.abs(element.hashCode() % this.TABLESIZE);

      long pointer = InputHelper.readLuposLong(new ByteArrayInputStream(page, hashAddress * 8, 8));
View Full Code Here

Examples of lupos.datastructures.buffermanager.BufferManager.PageAddress

    @Override
  public boolean contains(final Object element) {
    try {
      this.size++;

      final PageAddress pageAddress = new PageAddress(0, this.pointersFilename);
      final byte[] page = BufferManager.getBufferManager().getPage(this.TABLEPAGESIZE, pageAddress);

      final int hashAddress = Math.abs(element.hashCode() % this.TABLESIZE);

      long pointer = InputHelper.readLuposLong(new ByteArrayInputStream(page, hashAddress * 8, 8));
View Full Code Here

Examples of lupos.datastructures.buffermanager.BufferManager.PageAddress


  @Override
  public boolean remove(final Object element) {
    try {
      final PageAddress pageAddress = new PageAddress(0, this.pointersFilename);
      final byte[] page = BufferManager.getBufferManager().getPage(this.TABLEPAGESIZE, pageAddress);

      final int hashAddress = Math.abs(element.hashCode() % this.TABLESIZE);

      long pointer = InputHelper.readLuposLong(new ByteArrayInputStream(page, hashAddress * 8, 8));
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.