private cfTagReturnType renderDropThruSwitch(String expr, cfSession _Session) throws cfmRunTimeException { cfTagReturnType rt = cfTagReturnType.NORMAL; boolean dropThruExec = false; cfTag tagList[] = getTagList(); for (int i = 0; i < tagList.length; i++) { cfTag tag = tagList[i]; if (tag instanceof cfCASE) { if (dropThruExec) { _Session.pushTag(tag); rt = tag.render(_Session); _Session.popTag(); if (rt.isBreak()) return cfTagReturnType.NORMAL; } else { String[] values = ((cfCASE) tag).getValues(); for (int j = 0; j < values.length; j++) { if (expr.equals(values[j])) { _Session.pushTag(tag); rt = tag.render(_Session); _Session.popTag(); if (rt.isBreak()) return cfTagReturnType.NORMAL; else dropThruExec = true; } } } } } // Got here, but no CASE was matched if (defaultCase != null) { _Session.pushTag(defaultCase); rt = defaultCase.render(_Session); _Session.popTag(); } return rt; }
private cfTagReturnType renderOptimzedSwitch(String expr, cfSession _Session) throws cfmRunTimeException { cfCASE thisCase = (cfCASE) caseMap.get(expr); cfTagReturnType rt = null; if (thisCase != null) { _Session.pushTag(thisCase); rt = thisCase.render(_Session); } else if (defaultCase != null) { _Session.pushTag(defaultCase); rt = defaultCase.render(_Session); } else { // we didn't do anything, so don't invoke _Session.popTag() or return rt return cfTagReturnType.NORMAL; } _Session.popTag(); return rt; }