if (stateObject.isDecorated()) {
toText(stateObject);
}
else {
CaseExpression expression = stateObject.getExpression();
// 'CASE'
appendIdentifier((expression != null) ? expression.getActualCaseIdentifier() : CASE, CASE);
if (shouldOutput(expression) || expression.hasSpaceAfterCase()) {
writer.append(SPACE);
}
// Case operand
if (stateObject.hasCaseOperand()) {
stateObject.getCaseOperand().accept(this);
if (shouldOutput(expression) || expression.hasSpaceAfterCaseOperand()) {
writer.append(SPACE);
}
}
// WHEN clauses
if (stateObject.hasItems()) {
toStringChildren(stateObject, false);
}
if (shouldOutput(expression) || expression.hasSpaceAfterWhenClauses()) {
writer.append(SPACE);
}
// 'ELSE'
if (shouldOutput(expression) || expression.hasElse()) {
appendIdentifier((expression != null) ? expression.getActualElseIdentifier() : ELSE, ELSE);
}
if (shouldOutput(expression) || expression.hasSpaceAfterElse()) {
writer.append(SPACE);
}
// Else expression
if (stateObject.hasElse()) {
stateObject.getElse().accept(this);
}
if (shouldOutput(expression) || expression.hasSpaceAfterElseExpression()) {
writer.append(SPACE);
}
// END
if (shouldOutput(expression) || expression.hasEnd()) {
appendIdentifier((expression != null) ? expression.getActualEndIdentifier() : END, END);
}
}
}