@NotStorableClass public class HeapRecord extends AbstractFileStorable
| Modifier and Type | Field and Description |
|---|---|
static int |
DATA_RECORD_HEADER_SIZE
for idNode 4+3*8+1+4+8+1
4 for dataAssociatedSize 8 for parentFilePosition 8 for leftFilePosition 8 for rightFilePosition 1 for color 4 for number of child 8 for node identification |
static int |
FREE_RECORD_HEADER_SIZE
for freeNode 3*8+1+4
8 for parentFilePosition 8 for leftFilePosition 8 for rightFilePosition 1 for color 4 for number of child |
static int |
MAX_RECORD_HEADER_SIZE |
fileForStorable, justCreated, logger, numberOfByteReadWrote, positionInFile, valueChangedToSave| Constructor and Description |
|---|
HeapRecord(IHeapElementManager heapElementManager,
long positionInFile)
construction for reading, unknown data associated size, and unknown node
identification
should be only used bye HeapElementManager |
HeapRecord(IHeapElementManager heapElementManager,
long positionInFile,
Long previousRecordPositionInFile,
DataRecordIdentifier nodeIdentifier,
boolean freeRecord,
int dataAssociatedSize,
int recordSize)
construction for node creation, it is a data record, not free should be
only used by
HeapElementManager |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
void |
freeRecord() |
byte[] |
getDataAssociated() |
byte[] |
getDataAssociatedField() |
Integer |
getDataAssociatedSize() |
IRBTNode<Integer> |
getFreeNode() |
IRBTNode<DataRecordIdentifier> |
getIdNode() |
long |
getNextRecordFilePosition() |
DataRecordIdentifier |
getNodeIdentifier() |
long |
getPreviousRecordPositionInFile() |
int |
getRecordSize()
get the record size
|
int |
hashCode() |
boolean |
isFreeRecord()
to know if is a free record, mark a free space
|
boolean |
isHeaderRead() |
protected void |
marshallImpl()
marshaling implementation for write
#crc32 is set to zero |
void |
setDataAssociated(byte[] dataAssociated)
set data associated to this record
|
void |
setPreviousRecordPositionInFile(long previousRecordPositionInFile) |
void |
setRecordSize(int recordSize) |
protected int |
toMarshallSize() |
String |
toString() |
void |
unfreeRecord(int dataAssociatedSize,
DataRecordIdentifier nodeIdentifier) |
void |
unfreeRecord(int dataAssociatedSize,
int recordSize,
DataRecordIdentifier nodeIdentifier,
boolean manageData) |
protected void |
unmarshallImpl()
Unmarshalling implementation for read
#crc32 is set to zero |
protected void |
valueChangedAction() |
clear, getPositionInFile, isJustCreated, isValueChangedToSave, readAndCheckCrc32, readBoolean, readByte, readBytes, readBytes, readFileAppendToIoBuffer, readFileToIoBuffer, readFromFile, readInteger, readLong, setValueIsChangedValueToSave, setValueIsNotChanged, writeBoolean, writeByte, writeBytes, writeCrc32, writeInteger, writeLong, writeToFile, writeToFileGetWritedpublic static final int FREE_RECORD_HEADER_SIZE
public static final int DATA_RECORD_HEADER_SIZE
public static final int MAX_RECORD_HEADER_SIZE
public HeapRecord(IHeapElementManager heapElementManager, long positionInFile, Long previousRecordPositionInFile, DataRecordIdentifier nodeIdentifier, boolean freeRecord, int dataAssociatedSize, int recordSize) throws HeapException
HeapElementManagerheapElementManager - heap header and record manager in heap filepositionInFile - record position in filepreviousRecordPositionInFile - previous record position in filenodeIdentifier - data node identification numberfreeRecord - true if free recorddataAssociatedSize - size of associated data if not a free record, else it is the
free spacerecordSize - area size for this recordHeapExceptionpublic HeapRecord(IHeapElementManager heapElementManager, long positionInFile) throws HeapException
HeapElementManagerheapElementManager - heap header and record manager in heap filepositionInFile - record position in fileHeapExceptionprotected void valueChangedAction()
throws HeapException
valueChangedAction in class AbstractFileStorableHeapExceptionpublic void freeRecord()
throws HeapException
HeapExceptionpublic void unfreeRecord(int dataAssociatedSize,
int recordSize,
DataRecordIdentifier nodeIdentifier,
boolean manageData)
throws HeapException
HeapExceptionpublic void unfreeRecord(int dataAssociatedSize,
DataRecordIdentifier nodeIdentifier)
throws HeapException
HeapExceptionprotected int toMarshallSize()
throws HeapException
toMarshallSize in class AbstractFileStorableHeapExceptionprotected void marshallImpl()
throws HeapException
AbstractFileStorable#crc32 is set to zeromarshallImpl in class AbstractFileStorableHeapExceptionprotected void unmarshallImpl()
throws HeapException
AbstractFileStorable#crc32 is set to zerounmarshallImpl in class AbstractFileStorableHeapExceptionpublic boolean isHeaderRead()
public DataRecordIdentifier getNodeIdentifier()
public IRBTNode<DataRecordIdentifier> getIdNode() throws HeapException
HeapExceptionpublic IRBTNode<Integer> getFreeNode() throws HeapException
HeapExceptionpublic boolean isFreeRecord()
public long getPreviousRecordPositionInFile()
throws HeapException
HeapExceptionpublic void setPreviousRecordPositionInFile(long previousRecordPositionInFile)
throws HeapException
HeapExceptionpublic long getNextRecordFilePosition()
throws HeapException
HeapExceptionpublic int getRecordSize()
throws HeapException
IFileStorableHeapExceptionpublic void setRecordSize(int recordSize)
public Integer getDataAssociatedSize() throws HeapException
HeapExceptionpublic byte[] getDataAssociated()
throws HeapException
HeapException@Fortest public byte[] getDataAssociatedField()
public void setDataAssociated(byte[] dataAssociated)
throws HeapException
dataAssociated - new associated data for this recordHeapExceptionpublic int hashCode()
hashCode in class AbstractFileStorablepublic boolean equals(Object obj)
equals in class AbstractFileStorablepublic String toString()
toString in class AbstractFileStorableCopyright © 2007-2012 Luc Peuvrier. All Rights Reserved.