Package org.tweetyproject.lp.asp.parser
Class ASTLiteral
java.lang.Object
org.tweetyproject.lp.asp.parser.SimpleNode
org.tweetyproject.lp.asp.parser.ASTLiteral
- All Implemented Interfaces:
Node
The
ASTLiteral
class represents a node in the abstract syntax tree (AST)
for literals within the context of Answer Set Programming (ASP). This class
extends SimpleNode
and is used by the ASP parser to handle literal expressions,
which may include a name and an optional negation.-
Field Summary
-
Constructor Summary
ConstructorDescriptionASTLiteral
(int id) Constructs a newASTLiteral
node with the specified identifier.ASTLiteral
(ASPParser p, int id) Constructs a newASTLiteral
node with the specified parser and identifier. -
Method Summary
Modifier and TypeMethodDescriptionjjtAccept
(ASPParserVisitor visitor, Object data) Accepts a visitor object, which implements theASPParserVisitor
interface, and allows it to process this node in the AST.void
Sets the name of the literal represented by this AST node.void
neg
(boolean b) Sets whether this literal is negated.Methods inherited from class org.tweetyproject.lp.asp.parser.SimpleNode
childrenAccept, dump, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtGetValue, jjtOpen, jjtSetParent, jjtSetValue, toString, toString
-
Field Details
-
name
The name of the literal represented by this AST node.
-
-
Constructor Details
-
ASTLiteral
public ASTLiteral(int id) Constructs a newASTLiteral
node with the specified identifier.- Parameters:
id
- The node identifier.
-
ASTLiteral
Constructs a newASTLiteral
node with the specified parser and identifier.- Parameters:
p
- TheASPParser
that is constructing this node.id
- The node identifier.
-
-
Method Details
-
jjtAccept
Accepts a visitor object, which implements theASPParserVisitor
interface, and allows it to process this node in the AST.- Specified by:
jjtAccept
in interfaceNode
- Overrides:
jjtAccept
in classSimpleNode
- Parameters:
visitor
- The visitor object that processes this node.data
- Additional data that might be needed for the visitor's processing.- Returns:
- The result of the visitor's processing, typically dependent on the visitor's implementation.
-
neg
public void neg(boolean b) Sets whether this literal is negated.- Parameters:
b
-true
if the literal is negated,false
otherwise.
-
name
Sets the name of the literal represented by this AST node.- Parameters:
n
- The string representing the name of the literal.
-