Class FreeSlotsDynamicLength
java.lang.Object
com.semedy.reasoner.edb.persistentstore.bplustree.FreeSlotsDynamicLength
- All Implemented Interfaces:
FreeSlotsHandler
Handles file pieces with dynamic length
- Author:
- angele
-
Constructor Summary
ConstructorDescriptionFreeSlotsDynamicLength
(RandomAccessToFile file, long pagesPosition, long freePosition, long validPosition) -
Method Summary
Modifier and TypeMethodDescriptionint
allocate
(int length) allocate a new address and get index of itvoid
allocate
(int index, int length) search for a new address for indexint
append
(int length) append a slot of length len at end of filevoid
clear()
clear all used slotsvoid
copy
(FreeSlotsHandler freeSlots) copy all pages and free slots from freeSlots to thisvoid
free
(int index) free address at indexvoid
free
(long address) free addresslong
getAddress
(int index) get the file address of slot indexboolean
isValid()
is it valid?void
load()
load slot table from filevoid
save()
save slot table to filevoid
setFile
(RandomAccessToFile file) set basic filevoid
setValid
(boolean b) set valid flagint
size()
number of slotstoString()
-
Constructor Details
-
FreeSlotsDynamicLength
public FreeSlotsDynamicLength(RandomAccessToFile file, long pagesPosition, long freePosition, long validPosition)
-
-
Method Details
-
clear
public void clear()Description copied from interface:FreeSlotsHandler
clear all used slots- Specified by:
clear
in interfaceFreeSlotsHandler
-
setFile
Description copied from interface:FreeSlotsHandler
set basic file- Specified by:
setFile
in interfaceFreeSlotsHandler
-
setValid
Description copied from interface:FreeSlotsHandler
set valid flag- Specified by:
setValid
in interfaceFreeSlotsHandler
- Throws:
IOException
-
isValid
Description copied from interface:FreeSlotsHandler
is it valid?- Specified by:
isValid
in interfaceFreeSlotsHandler
- Returns:
- Throws:
IOException
-
load
Description copied from interface:FreeSlotsHandler
load slot table from file- Specified by:
load
in interfaceFreeSlotsHandler
- Throws:
IOException
-
save
Description copied from interface:FreeSlotsHandler
save slot table to file- Specified by:
save
in interfaceFreeSlotsHandler
- Throws:
IOException
-
allocate
Description copied from interface:FreeSlotsHandler
search for a new address for index- Specified by:
allocate
in interfaceFreeSlotsHandler
- Parameters:
index
- , indexlength
- TODO- Throws:
IOException
-
allocate
Description copied from interface:FreeSlotsHandler
allocate a new address and get index of it- Specified by:
allocate
in interfaceFreeSlotsHandler
- Parameters:
length
- TODO- Returns:
- slot index
- Throws:
IOException
-
free
Description copied from interface:FreeSlotsHandler
free address at index- Specified by:
free
in interfaceFreeSlotsHandler
- Throws:
IOException
-
getAddress
public long getAddress(int index) Description copied from interface:FreeSlotsHandler
get the file address of slot index- Specified by:
getAddress
in interfaceFreeSlotsHandler
- Returns:
-
append
Description copied from interface:FreeSlotsHandler
append a slot of length len at end of file- Specified by:
append
in interfaceFreeSlotsHandler
- Parameters:
length
- , length of slot- Returns:
- Throws:
IOException
-
size
public int size()Description copied from interface:FreeSlotsHandler
number of slots- Specified by:
size
in interfaceFreeSlotsHandler
- Returns:
-
free
Description copied from interface:FreeSlotsHandler
free address- Specified by:
free
in interfaceFreeSlotsHandler
- Throws:
IOException
-
copy
Description copied from interface:FreeSlotsHandler
copy all pages and free slots from freeSlots to this- Specified by:
copy
in interfaceFreeSlotsHandler
-
toString
-