use of org.umlg.sqlg.sql.parse.ReplacedStepTree in project sqlg by pietermartin.
the class SqlgVertexStep method addReplacedStep.
@Override
public ReplacedStepTree.TreeNode addReplacedStep(ReplacedStep replacedStep) {
replacedStep.setDepth(this.replacedSteps.size());
this.replacedSteps.add(replacedStep);
if (this.replacedStepTree == null) {
// the first root node
this.replacedStepTree = new ReplacedStepTree(replacedStep);
} else {
this.replacedStepTree.addReplacedStep(replacedStep);
}
return this.replacedStepTree.getCurrentTreeNodeNode();
}
use of org.umlg.sqlg.sql.parse.ReplacedStepTree in project sqlg by pietermartin.
the class SqlgGraphStep method addReplacedStep.
@Override
public ReplacedStepTree.TreeNode addReplacedStep(ReplacedStep<?, ?> replacedStep) {
// depth is + 1 because there is always a root node who's depth is 0
replacedStep.setDepth(this.replacedSteps.size());
this.replacedSteps.add(replacedStep);
// New way of interpreting steps
if (this.replacedStepTree == null) {
// the first root node
this.replacedStepTree = new ReplacedStepTree(replacedStep);
} else {
this.replacedStepTree.addReplacedStep(replacedStep);
}
return this.replacedStepTree.getCurrentTreeNodeNode();
}
use of org.umlg.sqlg.sql.parse.ReplacedStepTree in project sqlg by pietermartin.
the class VertexStrategy method combineSteps.
void combineSteps() {
List<Step<?, ?>> steps = new ArrayList(this.traversal.asAdmin().getSteps());
ListIterator<Step<?, ?>> stepIterator = steps.listIterator();
MutableInt pathCount = new MutableInt(0);
while (stepIterator.hasNext()) {
Step<?, ?> step = stepIterator.next();
if (this.reset) {
this.reset = false;
this.sqlgStep = null;
}
if (isReplaceableStep(step.getClass())) {
stepIterator.previous();
boolean keepGoing = handleStep(stepIterator, pathCount);
if (!keepGoing) {
break;
}
} else {
// restart
this.sqlgStep = null;
}
}
if (this.currentTreeNodeNode != null) {
ReplacedStepTree replacedStepTree = this.currentTreeNodeNode.getReplacedStepTree();
replacedStepTree.maybeAddLabelToLeafNodes();
}
}
Aggregations