Class Translator

java.lang.Object
org.tweetyproject.logics.translators.Translator
Direct Known Subclasses:
AspFolTranslator, ClNLPTranslator, FOLPropTranslator

public abstract class Translator extends Object
Allows translation between different logic languages, sub classes have to implement the translation between complex formulas but this base class provides methods to translate, predicates, Atoms, Associative formulas and Rules. To translate more complex formulas subclasses shall override the translateUsingMap() method. It is recommended to call the super method when overriding to have the correct translate behavior for basic constructs like Atoms, Predicate etc. The sub class also have to implement the createTranslateMap() method. The map maps a source class to a pair of a target class and an implementation which shall be used for translation. Although sub classes shall provide an easy user-interface with different overloads of methods like: toLang1() and toLang2() the translate map is necessary to support nested formulas like a disjunction of conjunction of several disjunction etc. Remark: The implementations used unchecked generic casts. It is important that the subclasses create consistent translation maps, otherwise there might be a ClassCastException which is not thrown by this code although it is caused by the inconsistent translation map. Also see org.tweetyproject.logics.translate.folprop for a short example implementation.
Author:
Tim Janus