Class Sort
java.lang.Object
org.tweetyproject.logics.commons.syntax.Sort
- All Implemented Interfaces:
LogicStructure
A sort of first-order logic. i.e. a set of constant objects and a set of variables that represent
constants of this sort.
Note: The sort names "Thing" and "_Any" are reserved for the default sort and
for the sort that represents all sorts. They should not be used when creating new sorts.
- Author:
- Matthias Thimm, Tim Janus, Anna Gessler
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given term to this sort.clone()
<C extends Term<?>>
booleancontainsTermsOfType
(Class<C> cls) Checks if this logical structure contains at least one term of type C.boolean
getName()
Getter namegetTerms()
Processes the set containing all terms of type C.int
hashCode()
boolean
Removes the given term from this sort.sortTerms
(Collection<? extends Term<?>> terms) Sorts the set of given terms by their sorts, i.e.toString()
-
Field Details
-
THING
Default sort for unsorted first-order logics -
ANY
Default sort for terms of equality/inequality predicates. Note: This sort is always equal to any other sort.
-
-
Constructor Details
-
Sort
Ctor: Creates an empty Sort with the given name.- Parameters:
name
- The name of the Sort
-
Sort
-
Sort
Copy-Ctor creates a deep copy of the Sort- Parameters:
other
- The Sort that acts as copy source
-
-
Method Details
-
sortTerms
Sorts the set of given terms by their sorts, i.e. the set of terms is partitioned wrt. their sorts and set as value of the sort's key.- Parameters:
terms
- a set of terms.- Returns:
- a map which maps from sorts to terms of their sort.
-
add
-
remove
Removes the given term from this sort.- Parameters:
term
- a term, either a variable or a constant.- Returns:
- "true" if the given term has actually been removed.
-
getName
-
toString
-
hashCode
-
equals
-
getTerms
- Specified by:
getTerms
in interfaceLogicStructure
- 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
- 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
-
containsTermsOfType
Description copied from interface:LogicStructure
Checks if this logical structure contains at least one term of type C. This method is a shortcut for !getTerms(TermImplementation.class).isEmpty().- Specified by:
containsTermsOfType
in interfaceLogicStructure
- Type Parameters:
C
- the type of terms- Parameters:
cls
- The class structure representing the type C of the term.- Returns:
- True if this logical structure contains at least one term of type C or false otherwise.
-
clone
-