Class FieldList<T>
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.nd.field.FieldList<T>
- All Implemented Interfaces:
IDestructableField,IField
Stores a singly-linked list of blocks, each of which contains a variable number of embedded elements.
Each block contains a header containing the size of the block and pointer to the next block, followed
by the embedded elements themselves.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic FieldPointerPointer to the first block.static FieldPointerPointer to the block where insertions are currently happening.protected int -
Method Summary
Modifier and TypeMethodDescriptionvoidEnsures that the receiver will have space for the given number of elements without additional allocation.Returns the contents of the receiver as aList.static <T> FieldList<T>Creates a newFieldListin the given struct which contains elements of the given type.static <T> FieldList<T>Creates a newFieldListin the given struct which contains elements of the given type.voidReturns the name of the field.intReturns the field offset, in bytes from the start of the struct.intReturns the size of the field, in bytes.protected voidsetFieldName(String fieldName)voidsetOffset(int offset)Sets the field offset (bytes from the start of the struct).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.aspectj.org.eclipse.jdt.internal.core.nd.field.IField
getAlignment
-
Field Details
-
FIRST_BLOCK
Pointer to the first block. -
LAST_BLOCK_WITH_ELEMENTS
Pointer to the block where insertions are currently happening. This is only null if there are no allocated blocks. If there are any blocks containing elements, this points to the last block with a nonzero number of elements. -
offset
protected int offset
-
-
Method Details
-
create
Creates a newFieldListin the given struct which contains elements of the given type. The resulting list will grow by 1 element each time it overflows.- Parameters:
ownerStruct- the struct to which the new list field will be added. Must not have hadStructDef.done()invoked on it yet.elementType- the type of elements that will be contained in the struct.- Returns:
- a newly-constructed list field in the given struct.
-
create
public static <T> FieldList<T> create(StructDef<?> ownerStruct, StructDef<T> elementType, int elementsPerBlock)Creates a newFieldListin the given struct which contains elements of the given type. The resulting list will grow by the given number of elements each time it overflows.- Parameters:
ownerStruct- the struct to which the new list field will be added. Must not have hadStructDef.done()invoked on it yet.elementType- the type of elements that will be contained in the struct.elementsPerBlock- the number of elements that will be allocated each time the list overflows.- Returns:
- a newly-constructed list field in the given struct.
-
getRecordSize
public int getRecordSize()Description copied from interface:IFieldReturns the size of the field, in bytes.- Specified by:
getRecordSizein interfaceIField
-
asList
Returns the contents of the receiver as aList.- Parameters:
nd- the database to be queried.address- the address of the parent struct
-
append
-
allocate
Ensures that the receiver will have space for the given number of elements without additional allocation. Callers should invoke this prior to a sequence ofappend(Nd, long)calls if they know in advance how many elements will be appended. Will create the minimum number of extra blocks needed to the given number of additional elements. -
destruct
- Specified by:
destructin interfaceIDestructableField
-
setFieldName
-
setOffset
public final void setOffset(int offset)Description copied from interface:IFieldSets the field offset (bytes from the start of the struct). This is invoked some time after field construction, after the sizes of all preceeding fields are known. -
getOffset
public final int getOffset()Description copied from interface:IFieldReturns the field offset, in bytes from the start of the struct. -
getFieldName
Description copied from interface:IFieldReturns the name of the field. This is mainly used for error messages, debug output, and diagnostic tools. Meant to be programmer-readable but not user-readable.- Specified by:
getFieldNamein interfaceIField
-