protected int levelOffset(Context context){
  int levelOffset;
switch (context.position) {
case DOCUMENT_BEFORE:
case DOCUMENT_AFTER:
    levelOffset=0;
  break;
case DOCUMENT_BEGIN:
case DOCUMENT_END:
case OPERATION_BEFORE:
case OPERATION_AFTER:
levelOffset=1;
break;
case OPERATION_BEGIN:
case OPERATION_END:
levelOffset=increaseLevelOffset(2);
break;
case OPERATION_DESCRIPTION_BEFORE:
case OPERATION_DESCRIPTION_AFTER:
case OPERATION_PARAMETERS_BEFORE:
case OPERATION_PARAMETERS_AFTER:
case OPERATION_RESPONSES_BEFORE:
case OPERATION_RESPONSES_AFTER:
case OPERATION_SECURITY_BEFORE:
case OPERATION_SECURITY_AFTER:
levelOffset=increaseLevelOffset(2);
break;
case OPERATION_DESCRIPTION_BEGIN:
case OPERATION_DESCRIPTION_END:
case OPERATION_PARAMETERS_BEGIN:
case OPERATION_PARAMETERS_END:
case OPERATION_RESPONSES_BEGIN:
case OPERATION_RESPONSES_END:
case OPERATION_SECURITY_BEGIN:
case OPERATION_SECURITY_END:
levelOffset=3;
break;
default :
throw new RuntimeException(String.format("Unknown position '%s'",context.position));
}
return levelOffset;
}

protected int levelOffset ( Context context ) { int levelOffset ; switch ( context . position ) { case DOCUMENT_BEFORE : case DOCUMENT_AFTER : levelOffset = 0 ; break ; case DOCUMENT_BEGIN : case DOCUMENT_END : case OPERATION_BEFORE : case OPERATION_AFTER : levelOffset = 1 ; break ; case OPERATION_BEGIN : case OPERATION_END : levelOffset = increaseLevelOffset ( 2 ) ; break ; case OPERATION_DESCRIPTION_BEFORE : case OPERATION_DESCRIPTION_AFTER : case OPERATION_PARAMETERS_BEFORE : case OPERATION_PARAMETERS_AFTER : case OPERATION_RESPONSES_BEFORE : case OPERATION_RESPONSES_AFTER : case OPERATION_SECURITY_BEFORE : case OPERATION_SECURITY_AFTER : levelOffset = increaseLevelOffset ( 2 ) ; break ; case OPERATION_DESCRIPTION_BEGIN : case OPERATION_DESCRIPTION_END : case OPERATION_PARAMETERS_BEGIN : case OPERATION_PARAMETERS_END : case OPERATION_RESPONSES_BEGIN : case OPERATION_RESPONSES_END : case OPERATION_SECURITY_BEGIN : case OPERATION_SECURITY_END : levelOffset = 3 ; break ; default : throw new RuntimeException ( String . format ( "Unknown position '%s'" , context . position ) ) ; } return levelOffset ; }
returns title level offset from 1 to apply to content
