private String [ ] computeFilteredSplitValues ( String [ ] values , String filter ) throws MtasConfigException { if ( filter != null ) { String [ ] filters = filter . split ( "," ) ; boolean [ ] valuesFilter = new boolean [ values . length ] ; boolean doSplitFilter = false ; for ( String item : filters ) { if ( item . trim ( ) . matches ( "^" + Pattern . quote ( MAPPING_FILTER_SPLIT ) + "\\([0-9\\-]+\\)$" ) ) { doSplitFilter = true ; Pattern splitContent = Pattern . compile ( "^" + Pattern . quote ( MAPPING_FILTER_SPLIT ) + "\\(([0-9]+)(-([0-9]+))?\\)$" ) ; Matcher splitContentMatcher = splitContent . matcher ( item . trim ( ) ) ; while ( splitContentMatcher . find ( ) ) { if ( splitContentMatcher . group ( 3 ) == null ) { int i = Integer . parseInt ( splitContentMatcher . group ( 1 ) ) ; if ( i >= 0 && i < values . length ) { valuesFilter [ i ] = true ; } } else { int i1 = Integer . parseInt ( splitContentMatcher . group ( 1 ) ) ; int i2 = Integer . parseInt ( splitContentMatcher . group ( 3 ) ) ; for ( int i = Math . max ( 0 , i1 ) ; i < Math . min ( values . length , i2 ) ; i ++ ) { valuesFilter [ i ] = true ; } } } } } if ( doSplitFilter ) { int number = 0 ; for ( int i = 0 ; i < valuesFilter . length ; i ++ ) { if ( valuesFilter [ i ] ) { number ++ ; } } if ( number > 0 ) { String [ ] newValues = new String [ number ] ; number = 0 ; for ( int i = 0 ; i < valuesFilter . length ; i ++ ) { if ( valuesFilter [ i ] ) { newValues [ number ] = values [ i ] ; number ++ ; } } return newValues ; } else { return new String [ ] { } ; } } } return values ; }
Compute filtered split values .