Package FAtiMA.Core.wellFormedNames
Class Symbol
java.lang.Object
FAtiMA.Core.wellFormedNames.Name
FAtiMA.Core.wellFormedNames.Symbol
- All Implemented Interfaces:
IGroundable,Serializable,Cloneable
Well Formed Name with just one literal The alphabet that makes up the symbols
expressions consists of: � The set of letters, upper and lowercase. � The set
of digits, 0,1,..,9 � The symbols �_� and �-� Symbols expressions begin with
a letter and are followed by any sequence of these legal characters. Well
formed names are composed by four types of symbols: 1. The Truth symbols
"True" and "False". 2. Constant symbols, which are simple symbol expressions.
3. Variables symbols, which are symbol expressions enclosed in square
parentheses. Ex: [x] represents the variable x. 4. The Self symbol [SELF], a
reserved special variable which refers to the agent.
- Author:
- Joao Dias
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Clones this Symbol, returning an equal copy.Evaluates this symbolGets the Name's First Symbol or LiteralGenerates a list with all symbols contained in the NamegetName()Gets the String that represents the Symbol's namevoidMakeGround(Substitution subst) Applies a set of substitutions to the object, grounding it.voidMakeGround(ArrayList<Substitution> bindings) 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.toString()Converts the Symbol to a StringMethods inherited from class FAtiMA.Core.wellFormedNames.Name
equals, isConstant, isGrounded, ParseName
-
Field Details
-
_name
-
-
Constructor Details
-
Symbol
Creates a new Symbol- Parameters:
name- - A String that corresponds to a Well Formed Symbol
-
-
Method Details
-
GetFirstLiteral
Gets the Name's First Symbol or Literal- Specified by:
GetFirstLiteralin className- Returns:
- the first Symbol
-
GetLiteralList
Generates a list with all symbols contained in the Name- Specified by:
GetLiteralListin className- Returns:
- the list with the symbols
-
getName
Gets the String that represents the Symbol's name- Returns:
- the Symbol's name
-
evaluate
Evaluates this symbol -
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:
bindings- - 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 Symbol, returning an equal copy. If this clone is changed afterwards, the original object remains the same. -
toString
Converts the Symbol to a String
-