Class Symbol

java.lang.Object
FAtiMA.Core.wellFormedNames.Name
FAtiMA.Core.wellFormedNames.Symbol
All Implemented Interfaces:
IGroundable, Serializable, Cloneable

public class Symbol extends Name implements 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:
  • Field Details

    • _name

      protected String _name
  • Constructor Details

    • Symbol

      public Symbol(String name)
      Creates a new Symbol
      Parameters:
      name - - A String that corresponds to a Well Formed Symbol
  • Method Details

    • GetFirstLiteral

      public Symbol GetFirstLiteral()
      Gets the Name's First Symbol or Literal
      Specified by:
      GetFirstLiteral in class Name
      Returns:
      the first Symbol
    • GetLiteralList

      public ArrayList<Symbol> GetLiteralList()
      Generates a list with all symbols contained in the Name
      Specified by:
      GetLiteralList in class Name
      Returns:
      the list with the symbols
    • getName

      public String getName()
      Gets the String that represents the Symbol's name
      Returns:
      the Symbol's name
    • evaluate

      public Object evaluate(Memory m)
      Evaluates this symbol
      Specified by:
      evaluate in class Name
      Parameters:
      m - - a reference to the memory
      Returns:
      the Symbol's name
    • 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:
      ReplaceUnboundVariables in interface IGroundable
      Parameters:
      id - - the identifier to be applied
    • MakeGround

      public void MakeGround(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:
      MakeGround in interface IGroundable
      Parameters:
      bindings - - A list of substitutions of the type "[Variable]/value"
      See Also:
    • 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:
      MakeGround in interface IGroundable
      Parameters:
      subst - - a substitution of the type "[Variable]/value"
      See Also:
    • clone

      public Object clone()
      Clones this Symbol, returning an equal copy. If this clone is changed afterwards, the original object remains the same.
      Specified by:
      clone in class Name
      Returns:
      The Symbol's copy.
    • toString

      public String toString()
      Converts the Symbol to a String
      Overrides:
      toString in class Object
      Returns:
      the converted String