Class ArrayList

    • Constructor Detail

      • ArrayList

        public ArrayList​(Object owner,
                         String fieldName,
                         Class elementType,
                         boolean allowNulls)
        Constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero. Assigns owning object and field name
        Parameters:
        owner - the owning object
        fieldName - the owning field name
        elementType - the element types allowed
        allowNulls - true if nulls are allowed
      • ArrayList

        public ArrayList​(Object owner,
                         String fieldName,
                         Class elementType,
                         boolean allowNulls,
                         int initialCapacity)
        Constructs an empty vector with the specified initial capacity and with its capacity increment equal to zero. Assigns owning object and field name
        Parameters:
        owner - the owning object
        fieldName - the owning field name
        elementType - the element types allowed
        allowNulls - true if nulls are allowed
        initialCapacity - the initial capacity of the vector.
        Throws:
        IllegalArgumentException - if the specified initial capacity is negative
    • Method Detail

      • set

        public Object set​(int index,
                          Object element)
        Replaces the element at the specified position in this ArrayList with the specified element.
        Specified by:
        set in interface List
        Overrides:
        set in class ArrayList
        Parameters:
        index - index of element to replace.
        element - element to be stored at the specified position.
        Returns:
        the element previously at the specified position.
        Throws:
        IndexOutOfBoundsException - index out of range (index < 0 || index >= size()).
        IllegalArgumentException - fromIndex > toIndex.
        See Also:
        ArrayList
      • add

        public boolean add​(Object o)
        Appends the specified element to the end of this ArrayList.
        Specified by:
        add in interface Collection
        Specified by:
        add in interface List
        Overrides:
        add in class ArrayList
        Parameters:
        o - element to be appended to this ArrayList.
        Returns:
        true (as per the general contract of Collection.add).
        See Also:
        ArrayList
      • remove

        public boolean remove​(Object o)
        Removes the first occurrence of the specified element in this ArrayList If the ArrayList does not contain the element, it is unchanged.
        Specified by:
        remove in interface Collection
        Specified by:
        remove in interface List
        Overrides:
        remove in class ArrayList
        Parameters:
        o - element to be removed from this ArrayList, if present.
        Returns:
        true if the ArrayList contained the specified element.
        See Also:
        ArrayList
      • add

        public void add​(int index,
                        Object element)
        Inserts the specified element at the specified position in this ArrayList.
        Specified by:
        add in interface List
        Overrides:
        add in class ArrayList
        Parameters:
        index - index at which the specified element is to be inserted.
        element - element to be inserted.
        Throws:
        IndexOutOfBoundsException - index is out of range (index < 0 || index > size()).
        See Also:
        ArrayList
      • remove

        public Object remove​(int index)
        Removes the element at the specified position in this ArrayList. shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the ArrayList.
        Specified by:
        remove in interface List
        Overrides:
        remove in class ArrayList
        Parameters:
        index - the index of the element to removed.
        Throws:
        IndexOutOfBoundsException - index out of range (index < 0 || index >= size()).
        See Also:
        ArrayList
      • clear

        public void clear()
        Removes all of the elements from this ArrayList. The ArrayList will be empty after this call returns (unless it throws an exception).
        Specified by:
        clear in interface Collection
        Specified by:
        clear in interface List
        Overrides:
        clear in class ArrayList
        See Also:
        ArrayList
      • addAll

        public boolean addAll​(Collection c)
        Appends all of the elements in the specified Collection to the end of this ArrayList, in the order that they are returned by the specified Collection's Iterator.
        Specified by:
        addAll in interface Collection
        Specified by:
        addAll in interface List
        Overrides:
        addAll in class ArrayList
        Parameters:
        c - elements to be inserted into this ArrayList.
        Throws:
        IndexOutOfBoundsException - index out of range (index < 0 || index > size()).
        See Also:
        ArrayList
      • removeAll

        public boolean removeAll​(Collection c)
        Removes from this ArrayList all of its elements that are contained in the specified Collection.
        Specified by:
        removeAll in interface Collection
        Specified by:
        removeAll in interface List
        Overrides:
        removeAll in class ArrayList
        Returns:
        true if this ArrayList changed as a result of the call.
        See Also:
        ArrayList
      • addAll

        public boolean addAll​(int index,
                              Collection c)
        Inserts all of the elements in in the specified Collection into this ArrayList at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the ArrayList in the order that they are returned by the specified Collection's iterator.
        Specified by:
        addAll in interface List
        Overrides:
        addAll in class ArrayList
        Parameters:
        index - index at which to insert first element from the specified collection.
        c - elements to be inserted into this ArrayList.
        Throws:
        IndexOutOfBoundsException - index out of range (index < 0 || index > size()).
        See Also:
        ArrayList
      • retainAll

        public boolean retainAll​(Collection c)
        Retains only the elements in this ArrayList that are contained in the specified Collection.
        Specified by:
        retainAll in interface Collection
        Specified by:
        retainAll in interface List
        Overrides:
        retainAll in class ArrayList
        Returns:
        true if this ArrayList changed as a result of the call.
        See Also:
        ArrayList
      • clone

        public Object clone()
        Creates and returns a copy of this object.

        Mutable Second Class Objects are required to provide a public clone method in order to allow for copying PersistenceCapable objects. In contrast to Object.clone(), this method must not throw a CloneNotSupportedException.

        Overrides:
        clone in class ArrayList
      • cloneInternal

        public Object cloneInternal()
        Creates and returns a copy of this object without resetting the owner and field value.
        Specified by:
        cloneInternal in interface SCO
      • reset

        public void reset()
        Cleans removed and added lists
        Specified by:
        reset in interface SCOCollection
      • addInternal

        public void addInternal​(Object o)
        Adds an object to the list without recording changes
        Specified by:
        addInternal in interface SCOCollection
      • getAdded

        public Collection getAdded()
        Returns added collection
        Specified by:
        getAdded in interface SCOCollection
        Returns:
        added collection of added elements
      • getRemoved

        public Collection getRemoved()
        Returns removed collection
        Specified by:
        getRemoved in interface SCOCollection
        Returns:
        removed collection of removed elements
      • clearInternal

        public void clearInternal()
        Clears Collection without notifing the owner
        Specified by:
        clearInternal in interface SCOCollection
      • unsetOwner

        public void unsetOwner()
        Nullifies references to the owner Object and Field
        Specified by:
        unsetOwner in interface SCO
      • getOwner

        public Object getOwner()
        Returns the owner object of the SCO instance
        Specified by:
        getOwner in interface SCO
        Returns:
        owner object
      • getFieldName

        public String getFieldName()
        Returns the field name
        Specified by:
        getFieldName in interface SCO
        Returns:
        field name as java.lang.String
      • makeDirty

        public StateManager makeDirty()
        Marks object dirty
        Specified by:
        makeDirty in interface SCO
        Returns:
        StateManager associated with the owner
      • applyUpdates

        public void applyUpdates​(StateManager sm,
                                 boolean modified)
        Apply changes (can be a no-op)
        Specified by:
        applyUpdates in interface SCO