Class FunctionalTerm
java.lang.Object
org.tweetyproject.logics.commons.syntax.TermAdapter<Pair<Functor,List<Term<?>>>>
org.tweetyproject.logics.commons.syntax.FunctionalTerm
-
Constructor Summary
ConstructorDescriptionFunctionalTerm
(FunctionalTerm other) Constructs a newFunctionalTerm
by copying the contents of anotherFunctionalTerm
.FunctionalTerm
(Functor functor) Creates a new functional term with the given functor.FunctionalTerm
(Functor functor, List<Term<?>> arguments) Creates a new functional term with the given functor and the given list of arguments.FunctionalTerm
(Functor functor, Term<?>... terms) Constructs a newFunctionalTerm
with the specified functor and arguments. -
Method Summary
Modifier and TypeMethodDescriptionaddArgument
(Term<?> term) Appends the given argument to this term's arguments and returns itself.clone()
Creates a deep copy of the termReturns an unmodifiable view of the list of arguments for thisFunctionalTerm
.Returns the functor associated with thisFunctionalTerm
.getTerms()
Processes the set containing all terms of type C.boolean
Checks whether this term is complete, i.e.Term
<?> substitute
(Term<?> v, Term<?> t) Substitutes all occurrences of term "v" in this term by term "t" and returns the new term.toString()
Methods inherited from class org.tweetyproject.logics.commons.syntax.TermAdapter
containsTermsOfType, equals, get, getSort, hashCode, set
-
Constructor Details
-
FunctionalTerm
Constructs a newFunctionalTerm
with the specified functor and arguments. This constructor initializes the term with a given functor and a variable number of arguments.- Parameters:
functor
- TheFunctor
representing the function or operator symbol to be applied.terms
- TheTerm<?>
arguments to which the functor is applied. These terms are passed as a varargs parameter, allowing for flexibility in the number of arguments.
-
FunctionalTerm
-
FunctionalTerm
Constructs a newFunctionalTerm
by copying the contents of anotherFunctionalTerm
. This copy constructor creates a deep copy of the functor and a shallow copy of the list of arguments.- Parameters:
other
- TheFunctionalTerm
object to be copied.
-
FunctionalTerm
Creates a new functional term with the given functor.- Parameters:
functor
- a functor
-
-
Method Details
-
getFunctor
Returns the functor associated with thisFunctionalTerm
. The functor represents the function or operator symbol that is applied to the arguments of this term.- Returns:
- The
Functor
object representing the function or operator symbol.
-
getArguments
Returns an unmodifiable view of the list of arguments for thisFunctionalTerm
. The arguments are the terms to which the functor is applied. This method ensures that the returned list cannot be modified.- Returns:
- An unmodifiable
List
ofTerm<?>
objects representing the arguments.
-
isComplete
public boolean isComplete()Checks whether this term is complete, i.e. whether every argument is set.- Returns:
- "true" if the term is complete.
-
addArgument
Appends the given argument to this term's arguments and returns itself.- Parameters:
term
- an argument to be added- Returns:
- the term itself.
- Throws:
IllegalArgumentException
- if the given term does not correspond to the expected sort or the argument list is complete.
-
getTerms
- Specified by:
getTerms
in interfaceLogicStructure
- Overrides:
getTerms
in classTermAdapter<Pair<Functor,
List<Term<?>>>> - Returns:
- a set containing all terms of this logical structure
-
getTerms
Description copied from interface:LogicStructure
Processes the set containing all terms of type C. This method uses the equals method of the given Class and therefore does not add terms which are sub classes of type C to the set.- Specified by:
getTerms
in interfaceLogicStructure
- Overrides:
getTerms
in classTermAdapter<Pair<Functor,
List<Term<?>>>> - Type Parameters:
C
- the type of terms- Parameters:
cls
- The Class structure containing type information about the searched term- Returns:
- A set containing all terms of type C of this logical structure
-
substitute
Description copied from interface:Term
Substitutes all occurrences of term "v" in this term by term "t" and returns the new term.- Specified by:
substitute
in interfaceTerm<Pair<Functor,
List<Term<?>>>> - Overrides:
substitute
in classTermAdapter<Pair<Functor,
List<Term<?>>>> - Parameters:
v
- the term to be substituted.t
- the term to substitute.- Returns:
- a term where every occurrence of "v" is replaced by "t".
- Throws:
IllegalArgumentException
- if "v" and "t" are of different sorts (NOTE: this exception is only thrown when "v" actually appears in this formula)
-
toString
-
clone
-