Package FAtiMA.Core.wellFormedNames
Class ComposedName
java.lang.Object
FAtiMA.Core.wellFormedNames.Name
FAtiMA.Core.wellFormedNames.ComposedName
- All Implemented Interfaces:
IGroundable,Serializable,Cloneable
- Author:
- Joao Dias
- See Also:
-
NameWell Formed Name composed by several symbols. If S and s1,s2,...sn are symbols, then S(s1,s2,...,sn) is a Composed Name The first symbol "S" is called the major symbol and it is followed by a list of comma separated parameter symbols (s1,s2,..,sn), which are enclosed in parenthesis.- Serialized Form
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionComposedName(String name, String literals) Creates a new ComposedName, receiving a major symbol, and a string with several parameter symbols -
Method Summary
Modifier and TypeMethodDescriptionclone()Clones this Composed Name, returning an equal copy.Evaluates this Name according to the evaluation attribute.Get's the Name's first symbol.Generates a list with all symbols contained in the ComposedNamevoidMakeGround(Substitution subst) Applies a set of substitutions to the object, grounding it.voidMakeGround(ArrayList<Substitution> bindingConstraints) Applies a set of substitutions to the object, grounding it.voidReplaceUnboundVariables(int id) Replaces all unbound variables in the object by applying a numeric identifier to each one.voidSetEvaluation(boolean evaluate) Sets the evaluation method.toString()Converts the ComposedName to a StringMethods inherited from class FAtiMA.Core.wellFormedNames.Name
equals, isConstant, isGrounded, ParseName
-
Field Details
-
_literals
-
_evaluate
protected boolean _evaluate
-
-
Constructor Details
-
ComposedName
Creates a new ComposedName, receiving a major symbol, and a string with several parameter symbols- Parameters:
name- - the Major symbolliterals- - string containing parameter symbols separated by commas
-
-
Method Details
-
SetEvaluation
public void SetEvaluation(boolean evaluate) Sets the evaluation method. If this attribute is false, the evaluate method behaves like a Symbol, and does not evaluate the name but just returns a String with the composedName. If the attribute is true, it will evaluate using the value stored in the KB. -
GetFirstLiteral
Get's the Name's first symbol. Since this name is a ComposedName (composed by several symbols), this function returns the first one, which corresponds to the Major symbol- Specified by:
GetFirstLiteralin className- Returns:
- the Major symbol
-
GetLiteralList
Generates a list with all symbols contained in the ComposedName- Specified by:
GetLiteralListin className- Returns:
- the list with the symbols
-
evaluate
Evaluates this Name according to the evaluation attribute. If this attribute is false, the evaluate method behaves like a Symbol, and does not evaluate the name but just returns a String with the composedName. If the attribute is true, it will search the value associated to the ComposedName in the KnowledgeBase -
ReplaceUnboundVariables
public void ReplaceUnboundVariables(int id) Replaces all unbound variables in the object by applying a numeric identifier to each one. For example, the variable [x] becomes [x4] if the received ID is 4. Attention, this method modifies the original object.- Specified by:
ReplaceUnboundVariablesin interfaceIGroundable- Parameters:
id- - the identifier to be applied
-
MakeGround
Applies a set of substitutions to the object, grounding it. Example: Applying the substitution "[X]/John" in the name "Weak([X])" returns "Weak(John)". Attention, this method modifies the original object.- Specified by:
MakeGroundin interfaceIGroundable- Parameters:
bindingConstraints- - A list of substitutions of the type "[Variable]/value"- See Also:
-
MakeGround
Applies a set of substitutions to the object, grounding it. Example: Applying the substitution "[X]/John" in the name "Weak([X])" returns "Weak(John)". Attention, this method modifies the original object.- Specified by:
MakeGroundin interfaceIGroundable- Parameters:
subst- - a substitution of the type "[Variable]/value"- See Also:
-
clone
Clones this Composed Name, returning an equal copy. If this clone is changed afterwards, the original object remains the same. -
toString
Converts the ComposedName to a String
-