Class FieldManyToOne<T extends INdStruct>
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.nd.field.FieldManyToOne<T>
- All Implemented Interfaces:
IDestructableField
,IField
,IRefCountedField
public class FieldManyToOne<T extends INdStruct>
extends Object
implements IDestructableField, IRefCountedField
Holds the n side of a n..1 relationship. Declares a Nd field which is a pointer of a NdNode of the specified
type.
FieldManyToOne
forms a one-to-many relationship with FieldOneToMany
. Whenever a
FieldManyToOne
points to an object, the inverse pointer is automatically inserted into the matching back
pointer list.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic FieldInt
protected int
boolean
True iff the other end of this pointer should delete this object when its end of the pointer is cleared.static FieldPointer
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends INdStruct, B extends INdStruct>
FieldManyToOne<T>create(StructDef<B> builder, FieldOneToMany<B> forwardPointer)
static <T extends INdStruct, B extends INdStruct>
FieldManyToOne<T>createNonNull(StructDef<B> builder, FieldOneToMany<B> forwardPointer)
static <T extends INdStruct, B extends INdStruct>
FieldManyToOne<T>createOwner(StructDef<B> builder, FieldOneToMany<B> forwardPointer)
Creates a many-to-one pointer which points to this object's owner.void
protected void
detachFromOldTarget(Nd nd, long address, long oldTargetAddress)
long
getAddress(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 size of the field, in bytes.boolean
hasReferences(Nd nd, long address)
Returns true if this field knows of any remaining incoming references to this object.permitNull(boolean permitted)
Sets whether or not this field permits nulls to be assigned.void
void
Directs this pointer to the given target.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
-
TARGET
-
BACKPOINTER_INDEX
-
pointsToOwner
public final boolean pointsToOwnerTrue iff the other end of this pointer should delete this object when its end of the pointer is cleared. -
offset
protected int offset
-
-
Method Details
-
createNonNull
public static <T extends INdStruct, B extends INdStruct> FieldManyToOne<T> createNonNull(StructDef<B> builder, FieldOneToMany<B> forwardPointer) -
create
public static <T extends INdStruct, B extends INdStruct> FieldManyToOne<T> create(StructDef<B> builder, FieldOneToMany<B> forwardPointer) -
createOwner
public static <T extends INdStruct, B extends INdStruct> FieldManyToOne<T> createOwner(StructDef<B> builder, FieldOneToMany<B> forwardPointer)Creates a many-to-one pointer which points to this object's owner. If the pointer is non-null when the owner is deleted, this object will be deleted too.- Parameters:
builder
- the struct to which the field will be addedforwardPointer
- the field which holds the pointer in the other direction- Returns:
- a newly constructed field
-
permitNull
Sets whether or not this field permits nulls to be assigned.- Parameters:
permitted
- true iff the field permits nulls- Returns:
- this
-
get
-
getAddress
-
put
Directs this pointer to the given target. Also removes this pointer from the old backpointer list (if any) and inserts it into the new backpointer list (if any) -
put
-
detachFromOldTarget
-
destruct
- Specified by:
destruct
in interfaceIDestructableField
-
getRecordSize
public int getRecordSize()Description copied from interface:IField
Returns the size of the field, in bytes.- Specified by:
getRecordSize
in interfaceIField
-
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
-