public class FieldOneToMany<T extends INdStruct> extends java.lang.Object implements IDestructableField, IRefCountedField
| Modifier and Type | Class and Description |
|---|---|
static interface |
FieldOneToMany.Visitor<T> |
| Modifier and Type | Field and Description |
|---|---|
StructDef<? extends INdStruct> |
localType |
protected int |
offset |
StructDef<T> |
targetType |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(Nd nd,
long address,
FieldOneToMany.Visitor<T> visitor) |
java.util.List<T> |
asList(Nd nd,
long address) |
static <T extends INdStruct,B extends INdStruct> |
create(StructDef<B> builder,
FieldManyToOne<B> forwardPointer) |
static <T extends INdStruct,B extends INdStruct> |
create(StructDef<B> builder,
FieldManyToOne<B> forwardPointer,
int inlineElementCount)
Creates a
FieldOneToMany using the given builder. |
void |
destruct(Nd nd,
long address) |
void |
ensureCapacity(Nd nd,
long address,
int capacity) |
T |
get(Nd nd,
long address,
int index) |
long |
getAddressOf(Nd nd,
long address,
int index) |
int |
getCapacity(Nd nd,
long address) |
java.lang.String |
getFieldName()
Returns the name of the field.
|
int |
getOffset()
Returns the field offset, in bytes from the start of the struct.
|
int |
getRecordSize()
Returns the record size of the back pointer list
|
boolean |
hasReferences(Nd nd,
long address)
Returns true if this field knows of any remaining incoming references to this object.
|
boolean |
isEmpty(Nd nd,
long address) |
protected void |
setFieldName(java.lang.String fieldName) |
void |
setOffset(int offset)
Sets the field offset (bytes from the start of the struct).
|
int |
size(Nd nd,
long address) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAlignmentpublic static <T extends INdStruct,B extends INdStruct> FieldOneToMany<T> create(StructDef<B> builder, FieldManyToOne<B> forwardPointer, int inlineElementCount)
FieldOneToMany using the given builder. It will hold the many side of a one-to-many
relationship with nodeType.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.public static <T extends INdStruct,B extends INdStruct> FieldOneToMany<T> create(StructDef<B> builder, FieldManyToOne<B> forwardPointer)
public void accept(Nd nd, long address, FieldOneToMany.Visitor<T> visitor)
public boolean isEmpty(Nd nd, long address)
public int size(Nd nd, long address)
public long getAddressOf(Nd nd, long address, int index)
public int getRecordSize()
getRecordSize in interface IFieldpublic void ensureCapacity(Nd nd, long address, int capacity)
public void destruct(Nd nd, long address)
destruct in interface IDestructableFieldpublic int getCapacity(Nd nd, long address)
public boolean hasReferences(Nd nd, long address)
IRefCountedFieldFieldManyToOne 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.
hasReferences in interface IRefCountedFieldprotected final void setFieldName(java.lang.String fieldName)
public final void setOffset(int offset)
IFieldpublic final int getOffset()
IFieldpublic final java.lang.String getFieldName()
IFieldgetFieldName in interface IField