Package rasj.odmg

Class RasBag

  • All Implemented Interfaces:
    java.lang.Iterable, java.util.Collection, DBag, DCollection

    public class RasBag
    extends RasCollection
    implements DBag
    This class implements the ODMG DBag interface.
    • Constructor Summary

      Constructors 
      Constructor Description
      RasBag()
      constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(java.lang.Object o)
      Appends the specified element to this Bag.
      DBag difference​(DBag otherBag)
      A new DBag instance is created that contains the difference of this object and the DBag instance referenced by otherBag.
      DBag intersection​(DBag otherBag)
      A new DBag instance is created that contains the intersection of this object and the DBag referenced by otherBag.
      java.util.Iterator iterator()
      Returns an iterator over the elements in this Bag in proper sequence.
      int occurrences​(java.lang.Object obj)
      This method returns the number of occurrences of the object obj in the DBag collection.
      int size()
      Returns the number of elements in this Bag.
      DBag union​(DBag otherBag)
      A new DBag instance is created that is the union of this object and otherBag.
      • Methods inherited from class java.util.AbstractCollection

        addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        addAll, clear, contains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
    • Constructor Detail

      • RasBag

        public RasBag()
        constructor
    • Method Detail

      • add

        public boolean add​(java.lang.Object o)
        Appends the specified element to this Bag.
        Specified by:
        add in interface java.util.Collection
        Overrides:
        add in class java.util.AbstractCollection
      • occurrences

        public int occurrences​(java.lang.Object obj)
        This method returns the number of occurrences of the object obj in the DBag collection.
        Specified by:
        occurrences in interface DBag
        Parameters:
        obj - The value that may have elements in the collection.
        Returns:
        The number of occurrences of obj in this collection.
      • difference

        public DBag difference​(DBag otherBag)
        A new DBag instance is created that contains the difference of this object and the DBag instance referenced by otherBag.
        Specified by:
        difference in interface DBag
        Parameters:
        otherBag - The other bag to use in creating the difference.
        Returns:
        A DBag instance that contains the elements of this object minus the elements in otherBag.
      • intersection

        public DBag intersection​(DBag otherBag)
        A new DBag instance is created that contains the intersection of this object and the DBag referenced by otherBag.
        Specified by:
        intersection in interface DBag
        Parameters:
        otherBag - The other bag to use in creating the intersection.
        Returns:
        A DBag instance that contains the intersection of this object and otherBag.
      • union

        public DBag union​(DBag otherBag)
        A new DBag instance is created that is the union of this object and otherBag.
        Specified by:
        union in interface DBag
        Parameters:
        otherBag - The other bag to use in the union operation.
        Returns:
        A DBag instance that contains the union of this object and otherBag.
      • iterator

        public java.util.Iterator iterator()
        Returns an iterator over the elements in this Bag in proper sequence.
        Specified by:
        iterator in interface java.util.Collection
        Specified by:
        iterator in interface java.lang.Iterable
        Overrides:
        iterator in class RasCollection
      • size

        public int size()
        Returns the number of elements in this Bag.
        Specified by:
        size in interface java.util.Collection
        Overrides:
        size in class RasCollection