public virtual Subband nextSubband() { Subband sb; if (isNode) { throw new System.ArgumentException(); } switch (orientation) { case WT_ORIENT_LL: sb = Parent; if (sb == null || sb.resLvl != resLvl) { // Already at top-level or last subband in res. level return null; } else { return sb.HL; } //goto case WT_ORIENT_HL; case WT_ORIENT_HL: return Parent.LH; case WT_ORIENT_LH: return Parent.HH; case WT_ORIENT_HH: // This is the complicated one sb = this; while (sb.orientation == WT_ORIENT_HH) { sb = sb.Parent; } switch (sb.orientation) { case WT_ORIENT_LL: sb = sb.Parent; if (sb == null || sb.resLvl != resLvl) { // Already at top-level or last subband in res. level return null; } else { sb = sb.HL; } break; case WT_ORIENT_HL: sb = sb.Parent.LH; break; case WT_ORIENT_LH: sb = sb.Parent.HH; break; default: throw new System.InvalidOperationException("You have found a bug in JJ2000"); } while (sb.isNode) { sb = sb.LL; } return sb; default: throw new System.InvalidOperationException("You have found a bug in JJ2000"); } }