public List matchAll ( String uri ) { ClauseNode currentNode = root ; ArrayList < Object > returnList = new ArrayList < Object > ( ) ; // extension matching done first in the matchAll case // since it is most generic // int dot = uri . lastIndexOf ( "." ) ; if ( dot != - 1 ) { Object tar = extensions . get ( uri . substring ( dot + 1 ) ) ; if ( tar != null ) { returnList . add ( tar ) ; } } // add the default node if it exists if ( defaultNode != null ) { returnList . add ( defaultNode . getStarTarget ( ) ) ; } // walk the nodes adding star targets only boolean exact = true ; int startIdx = 1 ; int slashIdx ; boolean done = false ; while ( ! done ) { slashIdx = uri . indexOf ( ' ' , startIdx ) ; String segment ; if ( slashIdx == - 1 ) { // last segment done = true ; slashIdx = uri . length ( ) ; segment = ( startIdx < slashIdx ) ? uri . substring ( startIdx , slashIdx ) : null ; } else { segment = uri . substring ( startIdx , slashIdx ) ; } if ( segment != null ) { currentNode = currentNode . traverse ( segment ) ; // PM06111 if ( currentNode == null ) { // no exact match, matches star node if it exists exact = false ; done = true ; } else if ( currentNode . getStarTarget ( ) != null ) { returnList . add ( currentNode . getStarTarget ( ) ) ; } startIdx = slashIdx + 1 ; } } if ( exact ) { // add exact only nodes since star nodes were added already Object target = currentNode . getTarget ( ) ; if ( target != null && currentNode . getStarTarget ( ) == null ) { returnList . add ( target ) ; } } return returnList ; }
Returns a list of all targets that match the specified uri in the increasing order of specificity