private String aggregateWildcard(String targetToken){
  int len=0;
  if (targetToken == null || (len=targetToken.length()) == 0) {
    return targetToken;
  }
  char[] oldchars=targetToken.toCharArray();
  char[] newchars=new char[len];
  int i=0;
  int j=0;
  int k=0;
  boolean foundWildcard=false;
  while (i < len) {
    if (targetToken.startsWith(oneLevelWildcard,i)) {
      if (!foundWildcard) {
        k=i;
        while (i < k + oneLevelWildcardLength) {
          newchars[j++]=oldchars[i++];
        }
        foundWildcard=true;
      }
 else {
        i=i + oneLevelWildcardLength;
      }
    }
 else {
      foundWildcard=false;
      newchars[j++]=oldchars[i++];
    }
  }
  return String.valueOf(newchars,0,j);
}

private String aggregateWildcard ( String targetToken ) { int len = 0 ; if ( targetToken == null || ( len = targetToken . length ( ) ) == 0 ) { return targetToken ; } char [ ] oldchars = targetToken . toCharArray ( ) ; char [ ] newchars = new char [ len ] ; int i = 0 ; int j = 0 ; int k = 0 ; boolean foundWildcard = false ; while ( i < len ) { if ( targetToken . startsWith ( oneLevelWildcard , i ) ) { if ( ! foundWildcard ) { k = i ; while ( i < k + oneLevelWildcardLength ) { newchars [ j ++ ] = oldchars [ i ++ ] ; } foundWildcard = true ; } else { i = i + oneLevelWildcardLength ; } } else { foundWildcard = false ; newchars [ j ++ ] = oldchars [ i ++ ] ; } } return String . valueOf ( newchars , 0 , j ) ; }
this method is used to reduce mutiple oocurrences of one level wildcard immediately following a previous one to just one . so " a [ * ] [ * ] [ * ] b " where one level wild pattern is " [ * ] " reduces to " a [ * ] b " .
