Class AtomSetUtils

java.lang.Object
fr.lirmm.graphik.integraal.core.atomset.AtomSetUtils

public final class AtomSetUtils extends Object
Utility methods for common atom-set predicates and transformations.
Author:
Clément Sipieter (INRIA) <clement@6pi.fr>
  • Method Details

    • isSingleton

      public static boolean isSingleton(AtomSet a) throws IteratorException
      Returns whether the specified atom set contains exactly one atom.
      Parameters:
      a - the atom set to inspect
      Returns:
      true if the atom set is a singleton
      Throws:
      IteratorException - if the atom set iterator fails
    • isSingleton

      public static boolean isSingleton(InMemoryAtomSet a)
      Returns whether the specified in-memory atom set contains exactly one atom.
      Parameters:
      a - the atom set to inspect
      Returns:
      true if the atom set is a singleton
    • hasSize2

      public static boolean hasSize2(AtomSet a) throws IteratorException
      Returns whether the specified atom set contains exactly two atoms.
      Parameters:
      a - the atom set to inspect
      Returns:
      true if the atom set contains exactly two atoms
      Throws:
      IteratorException - if the atom set iterator fails
    • hasSize2

      public static boolean hasSize2(InMemoryAtomSet a)
      Returns whether the specified in-memory atom set contains exactly two atoms.
      Parameters:
      a - the atom set to inspect
      Returns:
      true if the atom set contains exactly two atoms
    • contains

      public static boolean contains(InMemoryAtomSet a1, InMemoryAtomSet a2)
      Returns whether the first atom set contains all atoms from the second one.
      Parameters:
      a1 - the candidate superset
      a2 - the candidate subset
      Returns:
      true if a1 contains a2, false otherwise.
    • minus

      public static InMemoryAtomSet minus(InMemoryAtomSet a1, InMemoryAtomSet a2)
      Computes the set difference a1 \ a2.
      Parameters:
      a1 - the source atom set
      a2 - the atoms to remove
      Returns:
      the atoms of a1 that are not in a2
    • sep

      public static LinkedList<Term> sep(InMemoryAtomSet a1, InMemoryAtomSet a2)
      Returns the separator terms occurring both in Q \\ P and P.
      Parameters:
      a1 - the first atom set
      a2 - the second atom set
      Returns:
      the separator terms
    • union

      public static InMemoryAtomSet union(InMemoryAtomSet a1, InMemoryAtomSet a2)
      Computes the union of two in-memory atom sets.
      Parameters:
      a1 - the first atom set
      a2 - the second atom set
      Returns:
      the union of both atom sets