Class AbstractMapBasedSubstitution
java.lang.Object
fr.lirmm.graphik.integraal.core.AbstractSubstitution
fr.lirmm.graphik.integraal.core.AbstractMapBasedSubstitution
- All Implemented Interfaces:
Substitution, Comparable<Substitution>
- Direct Known Subclasses:
HashMapSubstitution, TreeMapSubstitution
public abstract class AbstractMapBasedSubstitution
extends AbstractSubstitution
implements Substitution
Base substitution implementation backed by a map from variables to terms.
- Author:
- Clément Sipieter (INRIA) clement@6pi.fr
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a substitution backed by an implementation-defined map. -
Method Summary
Modifier and TypeMethodDescriptionbooleanThe aggregation of a substitution is more complex that just add an new mapping for a new variable.voidAppends this object representation to the provided builder.createImageOf(Term term) Get the image of the given term by this substitution, if there is no image specified return the term itself.getMap()Returns the mutable map that stores the substitution mappings.getTerms()Get the domain of this substitution.Get the codomain of this substitution.booleanAdds a mapping from the specified variable into the specified image to this substitution.booleanRemove the mapping for the specified variable.Methods inherited from class AbstractSubstitution
aggregate, appendTo, apply, apply, compareTo, compose, compose, createImageOf, createImageOf, createImageOf, createImageOf, createImageOf, createImageOf, equals, equals, hashCode, put, toStringMethods inherited from interface Comparable
compareToMethods inherited from interface Substitution
aggregate, apply, apply, compose, compose, createImageOf, createImageOf, createImageOf, createImageOf, createImageOf, createImageOf, put
-
Constructor Details
-
AbstractMapBasedSubstitution
protected AbstractMapBasedSubstitution()Creates a substitution backed by an implementation-defined map.
-
-
Method Details
-
getMap
-
getTerms
Description copied from interface:SubstitutionGet the domain of this substitution.- Specified by:
getTermsin interfaceSubstitution- Returns:
- the domain of this substitution.
-
getValues
Description copied from interface:SubstitutionGet the codomain of this substitution.- Specified by:
getValuesin interfaceSubstitution- Returns:
- the codomain of this substitution.
-
createImageOf
Description copied from interface:SubstitutionGet the image of the given term by this substitution, if there is no image specified return the term itself.- Specified by:
createImageOfin interfaceSubstitution- Parameters:
term- the term to substitute- Returns:
- the image of the specified term.
-
put
Description copied from interface:SubstitutionAdds 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.- Specified by:
putin interfaceSubstitution- Parameters:
term- the variable to mapsubstitute- the image of the variable- Returns:
- true if the mapping was accepted, false otherwise
-
remove
Description copied from interface:SubstitutionRemove the mapping for the specified variable.- Specified by:
removein interfaceSubstitution- Parameters:
term- the variable whose mapping must be removed- Returns:
- true if there was a mapping.
-
aggregate
Description copied from interface:SubstitutionThe 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}.- Specified by:
aggregatein interfaceSubstitution- Parameters:
term- the variable to aggregatesubstitut- the image to aggregate with the variable- Returns:
- false, if the aggregation put two constants into a same connected component.
-
appendTo
Appends this object representation to the provided builder.- Parameters:
sb- the target builder
-