Class TripleSet

All Implemented Interfaces:
Iterable<Triple>, org.apache.jena.atlas.lib.Copyable<TripleSet>, JenaMapSetCommon<Triple>, JenaSet<Triple>, JenaSetHashOptimized<Triple>, JenaSetIndexed<Triple>, Sized, IndexedTripleSource

public class TripleSet extends FastHashSet<Triple> implements org.apache.jena.atlas.lib.Copyable<TripleSet>, IndexedTripleSource
FastHashSet of Triples used as the canonical triple collection inside IndexedSetTripleStore. Adds a hook that fires whenever the underlying keys array grows, so that indexes built on top of this set (such as the reverse-index arrays in EagerStoreStrategy) can resize their parallel data structures in lock-step.
  • Constructor Details

    • TripleSet

      public TripleSet()
      Creates an empty triple set.
  • Method Details

    • setOnKeysGrowHook

      public void setOnKeysGrowHook(IntConsumer onKeysGrowHook)
      Register a callback that is invoked after the keys array grows; the callback receives the new array length. Setting this to null disables notifications.
      Parameters:
      onKeysGrowHook - callback receiving the new keys.length
    • copy

      public TripleSet copy()
      Returns an independent copy of this set. The grow-hook from the source is not propagated to the copy.
      Specified by:
      copy in interface org.apache.jena.atlas.lib.Copyable<TripleSet>
      Returns:
      a new TripleSet with the same triples
    • getInternalKeysLength

      public int getInternalKeysLength()
      Returns the current length of the underlying keys array. This is the upper bound on the indices that may currently be valid; useful for callers that maintain parallel arrays keyed by entry index.
      Returns:
      the current capacity of the keys array
    • getTriples

      public Triple[] getTriples()
      Specified by:
      getTriples in interface IndexedTripleSource
      Returns:
      the raw triples array