Class AbstractSubstitution
java.lang.Object
fr.lirmm.graphik.integraal.core.AbstractSubstitution
- All Implemented Interfaces:
Substitution, Comparable<Substitution>
- Direct Known Subclasses:
AbstractMapBasedSubstitution, EmptySubstitution, VariablePrefixSubstitution, VariableRemovePrefixSubstitution
Base implementation of
Substitution with shared image and composition logic.- Author:
- Clément Sipieter (INRIA) <clement@6pi.fr>
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates an abstract substitution base implementation. -
Method Summary
Modifier and TypeMethodDescription(const) This method construct a new Substitution which is the aggregation of this substitution with the specified one.voidvoidInsert the application of this substitution on the src atom set into the target atom set.voidapply(InMemoryAtomSet src, InMemoryAtomSet dest) Insert the application of this substitution on the src atom set into the target atom set.intcompareTo(Substitution other) (CONST)
This method construct a new Substitution which is the composition of this substitution with the specified one.booleanFor example, if the current substitution is {Y -> Z} and you compose it with {X -> Y, V -> U}, the result is {X -> Z, Y -> Z, V -> U}.createImageOf(Atom atom) Apply this substitution on an atom.createImageOf(AtomSet src) Apply this substitution on an atom set.Apply this substitution on the given conjunctive query.Apply this substitution on an atom set.createImageOf(Rule rule) Apply this substitution on the given rule.createImageOf(Collection<? extends Term> terms) Get the image of each terms of the specified list.booleanequals(Substitution other) Compares this substitution with another one by domain, codomain, and images.booleaninthashCode()booleanput(Substitution substitution) Add all mappings from an other substitution instance.toString()Methods inherited from interface Substitution
aggregate, createImageOf, getTerms, getValues, put, remove
-
Constructor Details
-
AbstractSubstitution
protected AbstractSubstitution()Creates an abstract substitution base implementation.
-
-
Method Details
-
createImageOf
Description copied from interface:SubstitutionGet the image of each terms of the specified list.- Specified by:
createImageOfin interfaceSubstitution- Parameters:
terms- the terms to substitute- Returns:
- A list of images of each terms.
-
put
Description copied from interface:SubstitutionAdd all mappings from an other substitution instance. Returns false if there already exists an other image for a variable from the domain of s, true otherwise.- Specified by:
putin interfaceSubstitution- Parameters:
substitution- the substitution whose mappings should be inserted- Returns:
- false if there already exists an other image for a variable from the domain of s, true otherwise.
-
createImageOf
Description copied from interface:SubstitutionApply this substitution on an atom.- Specified by:
createImageOfin interfaceSubstitution- Parameters:
atom- (const)- Returns:
- an Atom which is the image of specified one by this substitution.
-
createImageOf
Description copied from interface:SubstitutionApply this substitution on an atom set.- Specified by:
createImageOfin interfaceSubstitution- Parameters:
src- (const)- Returns:
- an InMemoryAtomSet which is the image of specified one by this substitution.
- Throws:
AtomSetException- if the image cannot be computed
-
createImageOf
Description copied from interface:SubstitutionApply this substitution on an atom set.- Specified by:
createImageOfin interfaceSubstitution- Parameters:
src- (const)- Returns:
- an InMemoryAtomSet which is the image of specified one by this substitution.
-
apply
Description copied from interface:SubstitutionInsert the application of this substitution on the src atom set into the target atom set.- Specified by:
applyin interfaceSubstitution- Parameters:
src- (const)dest- the atom set receiving the substituted atoms- Throws:
AtomSetException- if the substituted atoms cannot be inserted
-
apply
Description copied from interface:SubstitutionInsert the application of this substitution on the src atom set into the target atom set.- Specified by:
applyin interfaceSubstitution- Parameters:
src- (const)dest- the atom set receiving the substituted atoms
-
createImageOf
Description copied from interface:SubstitutionApply this substitution on the given rule.- Specified by:
createImageOfin interfaceSubstitution- Parameters:
rule- (const)- Returns:
- an Rule which is the image of specified one by this substitution.
-
createImageOf
Description copied from interface:SubstitutionApply this substitution on the given conjunctive query.- Specified by:
createImageOfin interfaceSubstitution- Parameters:
cq- (const)- Returns:
- an conjunctive query which is the image of specified one by this substitution.
-
compose
Description copied from interface:SubstitutionFor example, if the current substitution is {Y -> Z} and you compose it with {X -> Y, V -> U}, the result is {X -> Z, Y -> Z, V -> U}.- Specified by:
composein interfaceSubstitution- Parameters:
term- the variable to composesubstitut- the image to compose with- Returns:
- true if the composition succeeds, false otherwise
-
compose
Description copied from interface:Substitution(CONST)
This method construct a new Substitution which is the composition of this substitution with the specified one. For example, if the current substitution is {Y -> Z} and you compose it with {X -> Y, V -> U}, the result is {X -> Z, Y -> Z, V -> U}.- Specified by:
composein interfaceSubstitution- Parameters:
s- the substitution to compose with this one- Returns:
- the composed substitution
-
aggregate
Description copied from interface:Substitution(const) This method construct a new Substitution which is the aggregation of this substitution with the specified one.- Specified by:
aggregatein interfaceSubstitution- Parameters:
s- the substitution to aggregate with this one- Returns:
- null, if the aggregation put two constants into a same connected component.
-
toString
-
appendTo
-
equals
-
equals
Compares this substitution with another one by domain, codomain, and images.- Parameters:
other- the substitution to compare with- Returns:
- true if both substitutions are equivalent
-
compareTo
- Specified by:
compareToin interfaceComparable<Substitution>
-
hashCode
-