JTP API Documentation

jtp
Interface Substitutable

All Known Subinterfaces:
Clause, CNFSentence, Literal
All Known Implementing Classes:
DefaultClause, DefaultCNFSentence, DefaultLiteral, SubstitutableList

public interface Substitutable

This interface represents objects that can replace some of their data members with other objects using a substitution mapping.


Method Summary
 Object substitute(Map m)
          Performs substitution in this object.
 

Method Detail

substitute

public Object substitute(Map m)
Performs substitution in this object. Specifically, this method produces an object derived from this Substitutable, with every occurrence of each key in the supplied map replaced by the corresponding value. This method shouldn't modify the original Substitutable, but rather construct a new instance, if changes are necessary. If this Substitutable does not contain any of the keys in the map, the method can and should return this.

Note that this method does not have to check if this object is itself a key in the substitution map and therefore has to be replaced. If you need that functionality, SubstUtils.substitute(Object, Map) should be used instead.

Returns:
the result of the substitution

JTP API Documentation