Class GroundingRequirementsParser


  • public class GroundingRequirementsParser
    extends java.lang.Object
    This class parses a list of grounding requirements of the form REQUIREMENT ("," REQUIREMENT)*
    Author:
    Sebastian Homann
    • Method Summary

      Modifier and Type Method Description
      private Constant getConstant​(java.lang.String name, Sort sort)
      Returns the constant with the name 'name' of the sort 'sort', if one exists, null otherwise.
      GroundingRequirement parseRequirement​(java.lang.String s, java.util.Set<Variable> variables)
      Parses a string of the following form: (VARIABLENAME "<>" VARIABLENAME | VARIABLENAME "<>" CONSTANTNAME) where the constant CONSTANTNAME has to be of the same sort as the variable VARIABLENAME.
      java.util.Set<GroundingRequirement> parseRequirements​(java.lang.String s, java.util.Set<Variable> variables)
      Parses a string of the following form: REQUIREMENT ("," REQUIREMENT)*
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GroundingRequirementsParser

        public GroundingRequirementsParser()
    • Method Detail

      • parseRequirements

        public java.util.Set<GroundingRequirement> parseRequirements​(java.lang.String s,
                                                                     java.util.Set<Variable> variables)
                                                              throws ParserException
        Parses a string of the following form: REQUIREMENT ("," REQUIREMENT)*
        Parameters:
        s - a string
        variables - A set of variables which are allowed in these requirements.
        Returns:
        The set of grounding requirements parsed from the given string.
        Throws:
        ParserException - if parsing fails
      • parseRequirement

        public GroundingRequirement parseRequirement​(java.lang.String s,
                                                     java.util.Set<Variable> variables)
                                              throws ParserException
        Parses a string of the following form: (VARIABLENAME "<>" VARIABLENAME | VARIABLENAME "<>" CONSTANTNAME) where the constant CONSTANTNAME has to be of the same sort as the variable VARIABLENAME.
        Parameters:
        s - a string containing a single requirement
        variables - a set of variables
        Returns:
        the parsed grounding requirement.
        Throws:
        ParserException - if parsing fails
      • getConstant

        private Constant getConstant​(java.lang.String name,
                                     Sort sort)
        Returns the constant with the name 'name' of the sort 'sort', if one exists, null otherwise.
        Parameters:
        name - some constant name represented by a string
        sort - the sort of that constant
        Returns:
        The constant with the name 'name' of the sort 'sort', if one exists, null otherwise.