@ Override public List < EcodDomain > filterByHierarchy ( String hierarchy ) throws IOException { String [ ] xhtGroup = hierarchy . split ( "\\." ) ; Integer xGroup = xhtGroup . length > 0 ? Integer . parseInt ( xhtGroup [ 0 ] ) : null ; Integer hGroup = xhtGroup . length > 1 ? Integer . parseInt ( xhtGroup [ 1 ] ) : null ; Integer tGroup = xhtGroup . length > 2 ? Integer . parseInt ( xhtGroup [ 2 ] ) : null ; List < EcodDomain > filtered = new ArrayList < EcodDomain > ( ) ; for ( EcodDomain d : getAllDomains ( ) ) { boolean match = true ; if ( xhtGroup . length > 0 ) { match = match && xGroup . equals ( d . getXGroup ( ) ) ; } if ( xhtGroup . length > 1 ) { match = match && hGroup . equals ( d . getHGroup ( ) ) ; } if ( xhtGroup . length > 2 ) { match = match && tGroup . equals ( d . getTGroup ( ) ) ; } if ( xhtGroup . length > 3 ) { logger . warn ( "Ignoring unexpected additional parts of ECOD {}" , hierarchy ) ; } if ( match ) { filtered . add ( d ) ; } } return filtered ; }
Get a list of domains within a particular level of the hierarchy