Class HashSet

    • Constructor Detail

      • HashSet

        public HashSet​(Object owner,
                       String fieldName,
                       Class elementType,
                       boolean allowNulls)
        Creates a new empty HashSet object. 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
      • HashSet

        public HashSet​(Object owner,
                       String fieldName,
                       Class elementType,
                       boolean allowNulls,
                       int initialCapacity)
        Creates a new empty HashSet object that has the specified initial capacity.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 hash map.
        Throws:
        IllegalArgumentException - if the initial capacity is less than zero.
        See Also:
        HashSet
    • Method Detail

      • add

        public boolean add​(Object o)
        Adds the specified element to this set if it is not already present.
        Specified by:
        add in interface Collection
        Specified by:
        add in interface Set
        Overrides:
        add in class HashSet
        Parameters:
        o - element to be added to this set.
        Returns:
        true if the set did not already contain the specified element.
        See Also:
        HashSet
      • remove

        public boolean remove​(Object o)
        Removes the given element from this set if it is present.
        Specified by:
        remove in interface Collection
        Specified by:
        remove in interface Set
        Overrides:
        remove in class HashSet
        Parameters:
        o - object to be removed from this set, if present.
        Returns:
        true if the set contained the specified element.
        See Also:
        HashSet
      • clear

        public void clear()
        Removes all of the elements from this set.
        Specified by:
        clear in interface Collection
        Specified by:
        clear in interface Set
        Overrides:
        clear in class HashSet
        See Also:
        HashSet
      • 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 HashSet
      • 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
      • markDeferred

        public void markDeferred()
        Mark this HashSet as deferred.
        Specified by:
        markDeferred in interface SCOCollection
      • isDeferred

        public boolean isDeferred()
        Return true is this HashSet is deferred, false otherwise.
        Specified by:
        isDeferred in interface SCOCollection
      • applyDeferredUpdates

        public void applyDeferredUpdates​(Collection c)
        If the HashSet is deferred, we first initialize the internal collection with c and they apply any deferred updates specified by the added and removed lists.
        Specified by:
        applyDeferredUpdates in interface SCOCollection
      • addInternal

        public void addInternal​(Object o)
        Adds an object to the list without recording changes if the HashSet is not deferred. Otherwise, add o to the added list.
        Specified by:
        addInternal in interface SCOCollection
      • addAllInternal

        public void addAllInternal​(Collection c)
        Adds a Collection to the list without recording changes if the HashSet is not deferred. Otherwise, add o to the removed list.
        Specified by:
        addAllInternal in interface SCOCollection
      • removeAllInternal

        public void removeAllInternal​(Collection c)
        Description copied from interface: SCOCollection
        Removes objects of the given Collection from this Collection without recording the event. Used internaly to remove a collection of elements from this collection.
        Specified by:
        removeAllInternal 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