Class FieldOneToMany<T extends INdStruct>
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.nd.field.FieldOneToMany<T>
- All Implemented Interfaces:
IDestructableField
,IField
,IRefCountedField
public class FieldOneToMany<T extends INdStruct>
extends Object
implements IDestructableField, IRefCountedField
Holds the 1 side of a 1..n relationship between two objects. FieldNodePointer and FieldBackPointer fields always go
together in pairs.
-
Nested Class Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accept(Nd nd, long address, FieldOneToMany.Visitor<T> visitor)
static <T extends INdStruct, B extends INdStruct>
FieldOneToMany<T>create(StructDef<B> builder, FieldManyToOne<B> forwardPointer)
static <T extends INdStruct, B extends INdStruct>
FieldOneToMany<T>create(StructDef<B> builder, FieldManyToOne<B> forwardPointer, int inlineElementCount)
Creates aFieldOneToMany
using the given builder.void
void
ensureCapacity(Nd nd, long address, int capacity)
long
getAddressOf(Nd nd, long address, int index)
int
getCapacity(Nd nd, long address)
Returns the name of the field.int
Returns the field offset, in bytes from the start of the struct.int
Returns the record size of the back pointer listboolean
hasReferences(Nd nd, long address)
Returns true if this field knows of any remaining incoming references to this object.boolean
protected void
setFieldName(String fieldName)
void
setOffset(int offset)
Sets the field offset (bytes from the start of the struct).int
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
-
targetType
-
localType
-
offset
protected int offset
-
-
Method Details
-
create
public static <T extends INdStruct, B extends INdStruct> FieldOneToMany<T> create(StructDef<B> builder, FieldManyToOne<B> forwardPointer, int inlineElementCount)Creates aFieldOneToMany
using the given builder. It will hold the many side of a one-to-many relationship with nodeType.- Parameters:
builder
- builder that is being used to construct the struct containing this fieldforwardPointer
- field of the model object which holds the one side of this one-to-many relationshipinlineElementCount
- number of inline elements. If this is nonzero, space for this number elements is preallocated and reserved in the header. The first few elements inserted will be stored here. For relationships which will usually have more than a certain number of participants, using a small number of inline elements will offer a performance improvement. For relationships that will normally be empty, this should be 0.- Returns:
- the newly constructed backpointer field
-
create
public static <T extends INdStruct, B extends INdStruct> FieldOneToMany<T> create(StructDef<B> builder, FieldManyToOne<B> forwardPointer) -
accept
-
asList
-
isEmpty
-
size
-
get
-
getAddressOf
-
getRecordSize
public int getRecordSize()Returns the record size of the back pointer list- Specified by:
getRecordSize
in interfaceIField
-
ensureCapacity
-
destruct
- Specified by:
destruct
in interfaceIDestructableField
-
getCapacity
-
hasReferences
Description copied from interface:IRefCountedField
Returns true if this field knows of any remaining incoming references to this object. This is used by the implementation ofFieldManyToOne
to determine whether or not a refcounted object should be deleted after a reference is removed.Implementations should return false if the refcount is 0 or true if the refcount is nonzero.
- Specified by:
hasReferences
in interfaceIRefCountedField
-
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
-