java.lang.Object
com.semedy.reasoner.edb.persistentstore.bplustree.PageTable

public class PageTable extends Object
handles a page table for blus files
Author:
angele
  • Constructor Summary

    Constructors
    Constructor
    Description
    PageTable(int number, long rootPosition, long sizePosition, long validPosition, long pagesPosition, long freePosition, long nodeSizePosition, int nodeSize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    allocate(int length)
    allocate a new piece with length
    void
    allocateAddress4Index(int index, int length)
    allocate a new address for index
    int
    append(int length)
    append a slot at file end
    void
     
    void
    close page table on file (does not save it)
    void
    Commit transaction
    add blocked slots to free slots
    void
    copy page table
    void
    create page table (does not load it)
    void
    flush file
    void
    free(int index)
    free up a slot at index
    void
    free(gnu.trove.list.TLongList allocatedSlots)
    add slots to free slots
    long
    get(int index)
    get address to index
    gnu.trove.list.TLongList
    get allocated slots
    int
    get node size
    int
    get index of root node
    long
    get number of elements
    boolean
    is page table valid?
    void
    Load page table from file
    void
    open page table (does not load it)
    long
    reallocate(int index, int length)
    allocate a new slot for index
    block old slot
    void
    save page table in file
    void
     
    void
    setNodeSize(int size)
    set node size
    void
    setRoot(int index)
    set index of root node
    void
    setSize(long size)
    set the number of elements
    void
    setValid(boolean b)
    set page table to valid
    int
    number of slots
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PageTable

      public PageTable(int number, long rootPosition, long sizePosition, long validPosition, long pagesPosition, long freePosition, long nodeSizePosition, int nodeSize)
  • Method Details

    • setBplusFile

      public void setBplusFile(RandomAccessToFile bplusfile)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • clear

      public void clear()
    • open

      public void open() throws IOException
      open page table (does not load it)
      Throws:
      IOException
    • create

      public void create() throws IOException
      create page table (does not load it)
      Throws:
      IOException
    • flush

      public void flush() throws IOException
      flush file
      Throws:
      IOException
    • close

      public void close() throws IOException
      close page table on file (does not save it)
      Throws:
      IOException
    • setRoot

      public void setRoot(int index)
      set index of root node
      Parameters:
      index -
    • setNodeSize

      public void setNodeSize(int size)
      set node size
      Parameters:
      index -
    • setSize

      public void setSize(long size)
      set the number of elements
      Parameters:
      size -
    • getSize

      public long getSize()
      get number of elements
      Returns:
    • getRoot

      public int getRoot()
      get index of root node
      Returns:
    • getNodeSize

      public int getNodeSize()
      get node size
      Returns:
    • setValid

      public void setValid(boolean b) throws IOException
      set page table to valid
      Throws:
      IOException
    • isValid

      public boolean isValid() throws IOException
      is page table valid?
      Returns:
      Throws:
      IOException
    • loadPagetable

      public void loadPagetable() throws IOException
      Load page table from file
      Throws:
      IOException
    • savePagetable

      public void savePagetable() throws IOException
      save page table in file
      Throws:
      IOException
    • append

      public int append(int length) throws IOException
      append a slot at file end
      Parameters:
      length - , length to append
      Returns:
      Throws:
      IOException
    • allocate

      public int allocate(int length) throws IOException
      allocate a new piece with length
      Parameters:
      length - , length of file piece
      Returns:
      Throws:
      IOException
    • allocateAddress4Index

      public void allocateAddress4Index(int index, int length) throws IOException
      allocate a new address for index
      Parameters:
      index -
      Throws:
      IOException
    • reallocate

      public long reallocate(int index, int length) throws IOException
      allocate a new slot for index
      block old slot
      Parameters:
      index -
      Throws:
      IOException
    • commit

      public void commit() throws IOException
      Commit transaction
      add blocked slots to free slots
      Throws:
      IOException
    • getAllocatedSlots

      public gnu.trove.list.TLongList getAllocatedSlots()
      get allocated slots
      Returns:
    • free

      public void free(gnu.trove.list.TLongList allocatedSlots) throws IOException
      add slots to free slots
      Parameters:
      allocatedSlots -
      Throws:
      IOException
    • free

      public void free(int index) throws IOException
      free up a slot at index
      Parameters:
      index -
      Throws:
      IOException
    • size

      public int size()
      number of slots
      Returns:
    • get

      public long get(int index)
      get address to index
      Parameters:
      i -
      Returns:
    • copy

      public void copy(PageTable p) throws IOException
      copy page table
      Parameters:
      p -
      Throws:
      IOException