question: private void checkHeadingsHierarchy ( Elements elements , TestSolutionHandler testSolutionHandler ) { if ( elements . isEmpty ( ) ) { testSolutionHandler . addTestSolution ( TestSolution . NOT_APPLICABLE ) ; return ; } TestSolution checkResult = TestSolution . PASSED ; Iterator < Element > iter = elements . iterator ( ) ; Element element = iter . next ( ) ; int indexOfReference = getHeaderIndex ( element ) ; int currentIndex ; int previousIndex = indexOfReference ; Element elementOfReference = element ; Element previousElement = element ; while ( iter . hasNext ( ) ) { element = iter . next ( ) ; currentIndex = getHeaderIndex ( element ) ; if ( currentIndex != - 1 ) { if ( currentIndex - previousIndex >= 2 ) { checkResult = TestSolution . FAILED ; addSourceCodeRemark ( TestSolution . FAILED , element , HEADER_NOT_HIERARCHICALLY_WELL_DEFINED_MSG , getEvidenceElement ( PREVIOUS_H_TAG_INDEX_EE , getEvidenceElementMsg ( previousIndex , previousElement ) ) ) ; } else if ( currentIndex < indexOfReference ) { checkResult = TestSolution . FAILED ; addSourceCodeRemark ( TestSolution . FAILED , element , HEADER_NOT_HIERARCHICALLY_WELL_DEFINED_MSG , getEvidenceElement ( FIRST_H_TAG_INDEX_EE , getEvidenceElementMsg ( indexOfReference , elementOfReference ) ) ) ; } previousIndex = currentIndex ; previousElement = element ; } } testSolutionHandler . addTestSolution ( checkResult ) ; }
target:  This methods checks whether the headings hierarchy is well-structured