@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } ModelASTBranch that = (ModelASTBranch) o; if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) { return false; } return getSteps() != null ? getSteps().equals(that.getSteps()) : that.getSteps() == null; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } ModelASTBranch that = (ModelASTBranch) o; if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) { return false; } return getSteps() != null ? getSteps().equals(that.getSteps()) : that.getSteps() == null; }
/** * Construct the new {@link BlockStatement} for the given branch. */ @Nonnull public final BlockStatement handleBranch(@Nonnull ModelASTBranch branch) { BlockStatement newBlock = block(); for (ModelASTStep s : branch.getSteps()) { // Don't process script blocks or a step that for some reason isn't an expression statement at all if (s instanceof AbstractModelASTCodeBlock || !(s.getSourceLocation() instanceof ExpressionStatement)) { newBlock.addStatement((Statement)s.getSourceLocation()); } else { ExpressionStatement es = (ExpressionStatement) s.getSourceLocation(); if (es.getExpression() instanceof MethodCallExpression) { MethodCallExpression methodCall = (MethodCallExpression) es.getExpression(); newBlock.addStatement(stmt(handleStep(s, methodCall))); } else { newBlock.addStatement(es); } } } return newBlock; }
assertNull(firstBranch.getSourceLocation()); assertNotNull(firstBranch); assertEquals(1, firstBranch.getSteps().size()); ModelASTStep firstStep = firstBranch.getSteps().get(0); assertNull(firstStep.getSourceLocation()); assertEquals("echo", firstStep.getName()); assertNotNull(secondBranch); assertNull(secondBranch.getSourceLocation()); assertEquals(2, secondBranch.getSteps().size()); ModelASTStep scriptStep = secondBranch.getSteps().get(0); assertNull(scriptStep.getSourceLocation()); assertTrue(scriptStep instanceof ModelASTScriptBlock); assertNull(scriptVal.getSourceLocation()); ModelASTStep timeoutStep = secondBranch.getSteps().get(1); assertNull(timeoutStep.getSourceLocation()); assertTrue(timeoutStep instanceof ModelASTTreeStep);