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.
  • Field Details

  • Method Details

    • create

      public static <T extends INdStruct,​ B extends INdStruct> FieldOneToMany<T> create(StructDef<B> builder, FieldManyToOne<B> forwardPointer, int inlineElementCount)
      Creates a FieldOneToMany 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 field
      forwardPointer - field of the model object which holds the one side of this one-to-many relationship
      inlineElementCount - 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

      public void accept(Nd nd, long address, FieldOneToMany.Visitor<T> visitor)
    • asList

      public List<T> asList(Nd nd, long address)
    • isEmpty

      public boolean isEmpty(Nd nd, long address)
    • size

      public int size(Nd nd, long address)
    • get

      public T get(Nd nd, long address, int index)
    • getAddressOf

      public long getAddressOf(Nd nd, long address, int index)
    • getRecordSize

      public int getRecordSize()
      Returns the record size of the back pointer list
      Specified by:
      getRecordSize in interface IField
    • ensureCapacity

      public void ensureCapacity(Nd nd, long address, int capacity)
    • destruct

      public void destruct(Nd nd, long address)
      Specified by:
      destruct in interface IDestructableField
    • getCapacity

      public int getCapacity(Nd nd, long address)
    • hasReferences

      public boolean hasReferences(Nd nd, long address)
      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 of FieldManyToOne 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 interface IRefCountedField
    • setFieldName

      protected final void setFieldName(String fieldName)
    • 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.
      Specified by:
      setOffset in interface IField
    • getOffset

      public final int getOffset()
      Description copied from interface: IField
      Returns the field offset, in bytes from the start of the struct.
      Specified by:
      getOffset in interface IField
    • getFieldName

      public final String 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 interface IField