@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, writeToFileGetWrited
public 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
HeapElementManager
heapElementManager
- 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 recordHeapException
public HeapRecord(IHeapElementManager heapElementManager, long positionInFile) throws HeapException
HeapElementManager
heapElementManager
- heap header and record manager in heap filepositionInFile
- record position in fileHeapException
protected void valueChangedAction() throws HeapException
valueChangedAction
in class AbstractFileStorable
HeapException
public void freeRecord() throws HeapException
HeapException
public void unfreeRecord(int dataAssociatedSize, int recordSize, DataRecordIdentifier nodeIdentifier, boolean manageData) throws HeapException
HeapException
public void unfreeRecord(int dataAssociatedSize, DataRecordIdentifier nodeIdentifier) throws HeapException
HeapException
protected int toMarshallSize() throws HeapException
toMarshallSize
in class AbstractFileStorable
HeapException
protected void marshallImpl() throws HeapException
AbstractFileStorable
#crc32
is set to zeromarshallImpl
in class AbstractFileStorable
HeapException
protected void unmarshallImpl() throws HeapException
AbstractFileStorable
#crc32
is set to zerounmarshallImpl
in class AbstractFileStorable
HeapException
public boolean isHeaderRead()
public DataRecordIdentifier getNodeIdentifier()
public IRBTNode<DataRecordIdentifier> getIdNode() throws HeapException
HeapException
public IRBTNode<Integer> getFreeNode() throws HeapException
HeapException
public boolean isFreeRecord()
public long getPreviousRecordPositionInFile() throws HeapException
HeapException
public void setPreviousRecordPositionInFile(long previousRecordPositionInFile) throws HeapException
HeapException
public long getNextRecordFilePosition() throws HeapException
HeapException
public int getRecordSize() throws HeapException
IFileStorable
HeapException
public void setRecordSize(int recordSize)
public Integer getDataAssociatedSize() throws HeapException
HeapException
public byte[] getDataAssociated() throws HeapException
HeapException
@Fortest public byte[] getDataAssociatedField()
public void setDataAssociated(byte[] dataAssociated) throws HeapException
dataAssociated
- new associated data for this recordHeapException
public int hashCode()
hashCode
in class AbstractFileStorable
public boolean equals(Object obj)
equals
in class AbstractFileStorable
public String toString()
toString
in class AbstractFileStorable
Copyright © 2007-2012 Luc Peuvrier. All Rights Reserved.