From: Marc P. <ma...@an...> - 2003-07-11 02:15:46
|
Oh, just glancing through the WM source trying to find what looks like a new bug in the current source (dumping out template name "randomly" in stream) and I see this in Block.java and I am wondering "what the f*** is this?". Anybody care to explain what this is all about? final public void write (final FastWriter out, final Context context) throws PropertyException, IOException { final byte[][] bcontent = out.getEncoder().encode(_block); byte[] b; Context.TemplateEvaluationContext teC = context.getTemplateEvaluationContext(); String oldName = teC._templateName; teC._templateName = _name; int i = 0; switch (_remainder) { case 1: b = bcontent[i]; out.write(b, 0, b.length); teC._lineNo = this.getLineNo(i); teC._columnNo = this.getColNo(i); _macros[i++].write(out, context); case 2: b = bcontent[i]; out.write(b, 0, b.length); teC._lineNo = this.getLineNo(i); teC._columnNo = this.getColNo(i); _macros[i++].write(out, context); case 3: b = bcontent[i]; out.write(b, 0, b.length); teC._lineNo = this.getLineNo(i); teC._columnNo = this.getColNo(i); _macros[i++].write(out, context); case 4: b = bcontent[i]; out.write(b, 0, b.length); teC._lineNo = this.getLineNo(i); teC._columnNo = this.getColNo(i); _macros[i++].write(out, context); case 5: b = bcontent[i]; out.write(b, 0, b.length); teC._lineNo = this.getLineNo(i); teC._columnNo = this.getColNo(i); _macros[i++].write(out, context); case 6: b = bcontent[i]; out.write(b, 0, b.length); teC._lineNo = this.getLineNo(i); teC._columnNo = this.getColNo(i); _macros[i++].write(out, context); case 7: b = bcontent[i]; out.write(b, 0, b.length); teC._lineNo = this.getLineNo(i); teC._columnNo = this.getColNo(i); _macros[i++].write(out, context); case 8: b = bcontent[i]; out.write(b, 0, b.length); teC._lineNo = this.getLineNo(i); teC._columnNo = this.getColNo(i); _macros[i++].write(out, context); case 9: b = bcontent[i]; out.write(b, 0, b.length); teC._lineNo = this.getLineNo(i); teC._columnNo = this.getColNo(i); _macros[i++].write(out, context); } ...it goes on with some similar stuff. Why is this required? At best this looks like some really bad optimisation! -- Marc Palmer Contract Java Consultant/Developer * Available For Hire * See my CV at http://www.anyware.co.uk/marc/ |