Class FreeSlotsFixedLength
java.lang.Object
com.semedy.reasoner.edb.persistentstore.bplustree.FreeSlotsFixedLength
- All Implemented Interfaces:
FreeSlotsHandler
Handles file pices with fixed length
- Author:
- angele
-
Constructor Summary
ConstructorsConstructorDescriptionFreeSlotsFixedLength(RandomAccessToFile file, long pagesPosition, long freePosition, long validPosition, int nodeSize) -
Method Summary
Modifier and TypeMethodDescriptionintallocate(int length) allocate a new address and get index of itvoidallocate(int index, int length) search for a new address for indexintappend(int length) append a slot of length len at end of filevoidclear()clear all used slotsvoidcopy(FreeSlotsHandler freeSlots) copy all pages and free slots from freeSlots to thisvoidfree(int index) free address at indexvoidfree(long address) free addresslonggetAddress(int index) get the file address of slot indexbooleanisValid()is it valid?voidload()load slot table from filevoidsave()save slot table to filevoidsetFile(RandomAccessToFile file) set basic filevoidsetValid(boolean b) set valid flagintsize()number of slotstoString()
-
Constructor Details
-
FreeSlotsFixedLength
public FreeSlotsFixedLength(RandomAccessToFile file, long pagesPosition, long freePosition, long validPosition, int nodeSize)
-
-
Method Details
-
clear
public void clear()Description copied from interface:FreeSlotsHandlerclear all used slots- Specified by:
clearin interfaceFreeSlotsHandler
-
setFile
Description copied from interface:FreeSlotsHandlerset basic file- Specified by:
setFilein interfaceFreeSlotsHandler
-
setValid
Description copied from interface:FreeSlotsHandlerset valid flag- Specified by:
setValidin interfaceFreeSlotsHandler- Throws:
IOException
-
isValid
Description copied from interface:FreeSlotsHandleris it valid?- Specified by:
isValidin interfaceFreeSlotsHandler- Returns:
- Throws:
IOException
-
load
Description copied from interface:FreeSlotsHandlerload slot table from file- Specified by:
loadin interfaceFreeSlotsHandler- Throws:
IOException
-
save
Description copied from interface:FreeSlotsHandlersave slot table to file- Specified by:
savein interfaceFreeSlotsHandler- Throws:
IOException
-
allocate
Description copied from interface:FreeSlotsHandlersearch for a new address for index- Specified by:
allocatein interfaceFreeSlotsHandler- Parameters:
index- , indexlength- TODO- Throws:
IOException
-
allocate
Description copied from interface:FreeSlotsHandlerallocate a new address and get index of it- Specified by:
allocatein interfaceFreeSlotsHandler- Parameters:
length- TODO- Returns:
- slot index
- Throws:
IOException
-
free
public void free(int index) Description copied from interface:FreeSlotsHandlerfree address at index- Specified by:
freein interfaceFreeSlotsHandler
-
getAddress
public long getAddress(int index) Description copied from interface:FreeSlotsHandlerget the file address of slot index- Specified by:
getAddressin interfaceFreeSlotsHandler- Returns:
-
append
Description copied from interface:FreeSlotsHandlerappend a slot of length len at end of file- Specified by:
appendin interfaceFreeSlotsHandler- Parameters:
length- , length of slot- Returns:
- Throws:
IOException
-
size
public int size()Description copied from interface:FreeSlotsHandlernumber of slots- Specified by:
sizein interfaceFreeSlotsHandler- Returns:
-
free
public void free(long address) Description copied from interface:FreeSlotsHandlerfree address- Specified by:
freein interfaceFreeSlotsHandler
-
copy
Description copied from interface:FreeSlotsHandlercopy all pages and free slots from freeSlots to this- Specified by:
copyin interfaceFreeSlotsHandler
-
toString
-