use of priv.bajdcc.util.VisitBag in project jMiniLang by bajdcc.
the class BranchExp method visit.
@Override
public void visit(ISyntaxComponentVisitor visitor) {
VisitBag bag = new VisitBag();
visitor.visitBegin(this, bag);
if (bag.bVisitChildren) {
for (ISyntaxComponent exp : arrExpressions) {
exp.visit(visitor);
}
}
if (bag.bVisitEnd) {
visitor.visitEnd(this);
}
}
use of priv.bajdcc.util.VisitBag in project jMiniLang by bajdcc.
the class NGAStatus method visit.
/**
* 用于遍历包括该状态在内的所有状态(连通),结果存放在PATH中
*
* @param bfs
* 遍历算法
*/
public void visit(BreadthFirstSearch<NGAEdge, NGAStatus> bfs) {
ArrayList<NGAStatus> stack = bfs.arrStatus;
HashSet<NGAStatus> set = new HashSet<>();
stack.clear();
set.add(this);
stack.add(this);
for (int i = 0; i < stack.size(); i++) {
// 遍历每个状态
NGAStatus status = stack.get(i);
VisitBag bag = new VisitBag();
bfs.visitBegin(status, bag);
if (bag.bVisitChildren) {
// 遍历状态的出边
// 边未被访问,且边类型符合要求
status.outEdges.stream().filter(edge -> !set.contains(edge.end) && bfs.testEdge(edge)).forEach(edge -> {
// 边未被访问,且边类型符合要求
stack.add(edge.end);
set.add(edge.end);
});
}
if (bag.bVisitEnd) {
bfs.visitEnd(status);
}
}
}
use of priv.bajdcc.util.VisitBag in project jMiniLang by bajdcc.
the class RuleExp method visit.
@Override
public void visit(ISyntaxComponentVisitor visitor) {
VisitBag bag = new VisitBag();
visitor.visitBegin(this, bag);
if (bag.bVisitEnd) {
visitor.visitEnd(this);
}
}
use of priv.bajdcc.util.VisitBag in project jMiniLang by bajdcc.
the class SequenceExp method visit.
@Override
public void visit(ISyntaxComponentVisitor visitor) {
VisitBag bag = new VisitBag();
visitor.visitBegin(this, bag);
if (bag.bVisitChildren) {
for (ISyntaxComponent exp : arrExpressions) {
exp.visit(visitor);
}
}
if (bag.bVisitEnd) {
visitor.visitEnd(this);
}
}
use of priv.bajdcc.util.VisitBag in project jMiniLang by bajdcc.
the class TokenExp method visit.
@Override
public void visit(ISyntaxComponentVisitor visitor) {
VisitBag bag = new VisitBag();
visitor.visitBegin(this, bag);
if (bag.bVisitEnd) {
visitor.visitEnd(this);
}
}
Aggregations