io.github.danielnaczo.python3parser.model.stmts.Body Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of python3parser Show documentation
Show all versions of python3parser Show documentation
A Java-based Python3-Parser.
package io.github.danielnaczo.python3parser.model.stmts;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import io.github.danielnaczo.python3parser.visitors.basic.Python3ASTVisitor;
//class is used for "suite" because it could have multiple statements
//e.g.:
// body.element1
// body.element2
// .......
public class Body extends Statement {
List statements;
Statement parentStmt;
public Body() {
this.statements = new ArrayList<>();
}
public Body(List statements) {
this.statements = statements;
}
public List getStatements() {
return statements;
}
public void setStatements(List statements) {
this.statements = statements;
}
public Statement getParentStmt() {
return parentStmt;
}
public void setParentStmt(Statement parentStmt) {
this.parentStmt = parentStmt;
}
public void addStatement(Statement statement) {
this.statements.add(statement);
}
public R accept(Python3ASTVisitor visitor, P param) {
return visitor.visitBody(this, param);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Body body = (Body) o;
return Objects.equals(statements, body.statements);
}
@Override
public int hashCode() {
return Objects.hash(statements);
}
@Override
public String toString() {
return "Body";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy