Interface TypedStructure
-
- All Known Implementing Classes:
Functor,Predicate,TypedStructureAdapter
public interface TypedStructureThis interface defines method which are given by every TypedStructure like a Predicate or an Functor. It has an name, an arity (argument count) and a list of Sort representing the types for the different arguments.- Author:
- Tim Janus
-
-
Method Summary
Modifier and Type Method Description voidaddArgumentType(Sort argType)Adds the given Sort as argument type to the typed StructureTypedStructureclone()Creates a deep copy of this objectList<Sort>getArgumentTypes()intgetArity()StringgetName()booleanisComplete()booleanisTyped()SortremoveArgumentType(int index)Removes the argument type at the specified indexbooleanremoveArgumentType(Sort argType)Removes the given Sort from the list of argument typesvoidsetName(String name)Changes the name of the Structure
-
-
-
Method Detail
-
getName
String getName()
- Returns:
- the unique name of the structure
-
setName
void setName(String name) throws LanguageException
Changes the name of the Structure- Parameters:
name- The new name of the structure- Throws:
LanguageException- if the new name is illegal in the language.
-
getArity
int getArity()
- Returns:
- the arity of this structure
-
getArgumentTypes
List<Sort> getArgumentTypes()
- Returns:
- An unmodifiable list which length equals the arity of the predicate if the structure isComplete().
-
addArgumentType
void addArgumentType(Sort argType) throws LanguageException
Adds the given Sort as argument type to the typed Structure- Parameters:
argType- The Sort descibing the argument type- Throws:
LanguageException- if there is some language issue
-
removeArgumentType
Sort removeArgumentType(int index) throws LanguageException
Removes the argument type at the specified index- Parameters:
index- The index- Returns:
- A reference to the sort that has been remove or null if no sort has been removed.
- Throws:
LanguageException- if something is wrong with the language
-
removeArgumentType
boolean removeArgumentType(Sort argType) throws LanguageException
Removes the given Sort from the list of argument types- Parameters:
argType- The Sort which is removed- Returns:
- true if the Sort exists in the list of argument types and is successfully removed, false otherwise.
- Throws:
LanguageException- if there is some language issue
-
isTyped
boolean isTyped()
- Returns:
- true if at least one sort for an argument is not "Thing".
-
isComplete
boolean isComplete()
- Returns:
- true if the arity of this structure matches the length of it's arguments, false if the arity is bigger than the length of it's arguments.
-
clone
TypedStructure clone()
Creates a deep copy of this object- Returns:
- A deep copy of this object
-
-