Package rasj.odmg

Class RasBag

All Implemented Interfaces:
Iterable, Collection, DBag, DCollection

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

    • RasBag

      public RasBag()
      constructor
  • Method Details

    • add

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

      public int occurrences(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 Iterator iterator()
      Returns an iterator over the elements in this Bag in proper sequence.
      Specified by:
      iterator in interface Collection
      Specified by:
      iterator in interface Iterable
      Overrides:
      iterator in class RasCollection
    • size

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