Class VariablePrefixSubstitution

java.lang.Object
fr.lirmm.graphik.integraal.core.AbstractSubstitution
fr.lirmm.graphik.integraal.core.VariablePrefixSubstitution
All Implemented Interfaces:
Substitution, Comparable<Substitution>

public class VariablePrefixSubstitution extends AbstractSubstitution
Substitution that adds a prefix to variable identifiers.
Author:
Clément Sipieter (INRIA) <clement@6pi.fr>
  • Constructor Details

    • VariablePrefixSubstitution

      public VariablePrefixSubstitution(String prefix)
      Creates a substitution adding the given prefix to variables.
      Parameters:
      prefix - the prefix to add
  • Method Details

    • getTerms

      public Set<Variable> getTerms()
      Description copied from interface: Substitution
      Get the domain of this substitution.
      Returns:
      the domain of this substitution.
    • getValues

      public Set<Term> getValues()
      Description copied from interface: Substitution
      Get the codomain of this substitution.
      Returns:
      the codomain of this substitution.
    • createImageOf

      public Term createImageOf(Term term)
      Description copied from interface: Substitution
      Get the image of the given term by this substitution, if there is no image specified return the term itself.
      Parameters:
      term - the term to substitute
      Returns:
      the image of the specified term.
    • put

      public boolean put(Variable var, Term image)
      Description copied from interface: Substitution
      Adds a mapping from the specified variable into the specified image to this substitution. Returns false if there already exists an other image for this variable, true otherwise.
      Parameters:
      var - the variable to map
      image - the image of the variable
      Returns:
      true if the mapping was accepted, false otherwise
    • remove

      public boolean remove(Variable var)
      Description copied from interface: Substitution
      Remove the mapping for the specified variable.
      Parameters:
      var - the variable whose mapping must be removed
      Returns:
      true if there was a mapping.
    • aggregate

      public boolean aggregate(Variable var, Term image)
      Description copied from interface: Substitution
      The aggregation of a substitution is more complex that just add an new mapping for a new variable. Especially, it does not conserve the domain and codomain. It choose a representative term for each connected component by successive application of the mapping. For example, if the current substitution is {X -> Y, Z -> U} and you add a mapping {Y -> 'a', Z -> V}, the result is {Y -> 'a', X -> 'a', Z -> V, U -> V} or {Y -> 'a', X -> 'a', U -> Z, V -> Z} or {Y -> 'a', X -> 'a', Z -> U, V -> U}.
      Parameters:
      var - the variable to aggregate
      image - the image to aggregate with the variable
      Returns:
      false, if the aggregation put two constants into a same connected component.