Class ArrayBunch

java.lang.Object
org.apache.jena.mem.ArrayBunch
All Implemented Interfaces:
TripleBunch

public class ArrayBunch extends Object implements TripleBunch
An ArrayBunch implements TripleBunch with a linear search of a short-ish array of Triples. The array can grow, but it only grows by 4 elements each time (because, if it gets big enough for this linear growth to be bad, it should anyways have been replaced by a more efficient set-of-triples implementation).
  • Constructor Details

    • ArrayBunch

      public ArrayBunch()
  • Method Details

    • containsBySameValueAs

      public boolean containsBySameValueAs(Triple t)
      Description copied from interface: TripleBunch
      Answer true iff this TripleBunch contains a triple with .sameValueAs subject, predicate, and object. (Typically this only matters for the object. For example, integer literals with different numbers of leading zeroes can be .sameValueAs but not .equals).
      Specified by:
      containsBySameValueAs in interface TripleBunch
    • contains

      public boolean contains(Triple t)
      Description copied from interface: TripleBunch
      Answer true iff this TripleBunch contains a triple .equals to t.
      Specified by:
      contains in interface TripleBunch
    • size

      public int size()
      Description copied from interface: TripleBunch
      Answer the number of triples in this bunch.
      Specified by:
      size in interface TripleBunch
    • add

      public void add(Triple t)
      Description copied from interface: TripleBunch
      Add t to the triples in this bunch. If t is already a member, nothing happens. The bunch now .contains this triple.
      Specified by:
      add in interface TripleBunch
    • remove

      public void remove(Triple t)
      Description copied from interface: TripleBunch
      Remove t from the triples in this bunch. If it wasn't a member, nothing happens. The bunch no longer .contains this triple.
      Specified by:
      remove in interface TripleBunch
    • iterator

      public ExtendedIterator<Triple> iterator()
      Description copied from interface: TripleBunch
      Answer an iterator over all the triples in this bunch. It is unwise to .remove from this iterator. (It may become illegal.)
      Specified by:
      iterator in interface TripleBunch
    • iterator

      public ExtendedIterator<Triple> iterator(HashCommon.NotifyEmpty container)
      Description copied from interface: TripleBunch
      Answer an iterator over all the triples in this bunch. If use of .remove on this iterator empties the bunch, the emptied method of container is invoked.
      Specified by:
      iterator in interface TripleBunch
    • spliterator

      public Spliterator<Triple> spliterator()
      Description copied from interface: TripleBunch
      Answer a spliterator over all the triples in this bunch.
      Specified by:
      spliterator in interface TripleBunch