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
Modifier and TypeFieldDescriptionstatic FieldPointer
Pointer to the first block.static FieldPointer
Pointer to the block where insertions are currently happening.protected int
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Ensures 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 newFieldList
in the given struct which contains elements of the given type.static <T> FieldList<T>
Creates a newFieldList
in the given struct which contains elements of the given type.void
Returns the name of the field.int
Returns the field offset, in bytes from the start of the struct.int
Returns the size of the field, in bytes.protected void
setFieldName(String fieldName)
void
setOffset(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, wait
Methods 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 newFieldList
in 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 newFieldList
in 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:IField
Returns the size of the field, in bytes.- Specified by:
getRecordSize
in 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:
destruct
in interfaceIDestructableField
-
setFieldName
-
setOffset
public final void setOffset(int offset)Description copied from interface:IField
Sets 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:IField
Returns the field offset, in bytes from the start of the struct. -
getFieldName
Description copied from interface:IField
Returns 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:
getFieldName
in interfaceIField
-