Package FAtiMA.Core.wellFormedNames
Class ComposedName
- java.lang.Object
-
- FAtiMA.Core.wellFormedNames.Name
-
- FAtiMA.Core.wellFormedNames.ComposedName
-
- All Implemented Interfaces:
IGroundable,java.io.Serializable,java.lang.Cloneable
public class ComposedName extends Name implements java.io.Serializable
- Author:
- Joao Dias
- See Also:
Name,Well 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
-
-
Constructor Summary
Constructors Constructor Description ComposedName(java.lang.String name, java.lang.String literals)Creates a new ComposedName, receiving a major symbol, and a string with several parameter symbols
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Clones this Composed Name, returning an equal copy.java.lang.Objectevaluate(Memory m)Evaluates this Name according to the evaluation attribute.SymbolGetFirstLiteral()Get's the Name's first symbol.java.util.ArrayList<Symbol>GetLiteralList()Generates a list with all symbols contained in the ComposedNamevoidMakeGround(Substitution subst)Applies a set of substitutions to the object, grounding it.voidMakeGround(java.util.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.java.lang.StringtoString()Converts the ComposedName to a String-
Methods inherited from class FAtiMA.Core.wellFormedNames.Name
equals, isConstant, isGrounded, ParseName
-
-
-
-
Field Detail
-
_literals
protected java.util.ArrayList<Symbol> _literals
-
_evaluate
protected boolean _evaluate
-
-
Constructor Detail
-
ComposedName
public ComposedName(java.lang.String name, java.lang.String literals)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 Detail
-
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
public Symbol 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
public java.util.ArrayList<Symbol> GetLiteralList()
Generates a list with all symbols contained in the ComposedName- Specified by:
GetLiteralListin className- Returns:
- the list with the symbols
-
evaluate
public java.lang.Object evaluate(Memory m)
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
public void MakeGround(java.util.ArrayList<Substitution> bindingConstraints)
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:
Substitution
-
MakeGround
public void MakeGround(Substitution subst)
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:
Substitution
-
clone
public java.lang.Object clone()
Clones this Composed Name, returning an equal copy. If this clone is changed afterwards, the original object remains the same.
-
toString
public java.lang.String toString()
Converts the ComposedName to a String- Overrides:
toStringin classjava.lang.Object- Returns:
- the converted String
-
-