Package FAtiMA.Core.wellFormedNames
Class Symbol
- java.lang.Object
-
- FAtiMA.Core.wellFormedNames.Name
-
- FAtiMA.Core.wellFormedNames.Symbol
-
- All Implemented Interfaces:
IGroundable,java.io.Serializable,java.lang.Cloneable
public class Symbol extends Name implements java.io.Serializable
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:
Name, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Symbol(java.lang.String name)Creates a new Symbol
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Clones this Symbol, returning an equal copy.java.lang.Objectevaluate(Memory m)Evaluates this symbolSymbolGetFirstLiteral()Gets the Name's First Symbol or Literaljava.util.ArrayList<Symbol>GetLiteralList()Generates a list with all symbols contained in the Namejava.lang.StringgetName()Gets the String that represents the Symbol's namevoidMakeGround(Substitution subst)Applies a set of substitutions to the object, grounding it.voidMakeGround(java.util.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.java.lang.StringtoString()Converts the Symbol to a String-
Methods inherited from class FAtiMA.Core.wellFormedNames.Name
equals, isConstant, isGrounded, ParseName
-
-
-
-
Method Detail
-
GetFirstLiteral
public Symbol GetFirstLiteral()
Gets the Name's First Symbol or Literal- Specified by:
GetFirstLiteralin className- Returns:
- the first Symbol
-
GetLiteralList
public java.util.ArrayList<Symbol> GetLiteralList()
Generates a list with all symbols contained in the Name- Specified by:
GetLiteralListin className- Returns:
- the list with the symbols
-
getName
public java.lang.String getName()
Gets the String that represents the Symbol's name- Returns:
- the Symbol's name
-
evaluate
public java.lang.Object evaluate(Memory m)
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
public void MakeGround(java.util.ArrayList<Substitution> bindings)
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:
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 Symbol, returning an equal copy. If this clone is changed afterwards, the original object remains the same.
-
toString
public java.lang.String toString()
Converts the Symbol to a String- Overrides:
toStringin classjava.lang.Object- Returns:
- the converted String
-
-