void remove ( PatternWrapper pattern , Conjunction selector , MatchTarget object , InternTable subExpr , OrdinalPosition parentId ) throws MatchingException { if ( tc . isEntryEnabled ( ) ) tc . entry ( this , cclass , "remove" , new Object [ ] { pattern , selector , object , subExpr } ) ; switch ( pattern . getState ( ) ) { case PatternWrapper . FINAL_EXACT : exactChild = exactChild . remove ( selector , object , subExpr , parentId ) ; break ; case PatternWrapper . FINAL_MANY : if ( hasMidClauses ( pattern ) ) { // We have multiple multi-level wildcarding and need to work with the // matchManyChildren list MatchManyWrapper wrapper = findMatchManyWrapper ( pattern ) ; // if we couldn't find the wrapper, throw an exception if ( wrapper == null ) throw new MatchingException ( ) ; ContentMatcher next = wrapper . matcher ; ContentMatcher newNext = ( ContentMatcher ) next . remove ( selector , object , subExpr , parentId ) ; if ( newNext == null ) matchManyChildren . remove ( wrapper ) ; else if ( newNext != next ) { MatchManyWrapper newWrapper = new MatchManyWrapper ( pattern , newNext ) ; matchManyChildren . add ( newWrapper ) ; } } else { // Simpler case where there is a single multi-level wildcard singleMatchManyChild = singleMatchManyChild . remove ( selector , object , subExpr , parentId ) ; } break ; case PatternWrapper . PREFIX_CHARS : case PatternWrapper . SUFFIX_CHARS : char [ ] chars = pattern . getChars ( ) ; for ( PartialMatch pm = this ; ; pm = pm . next ) { if ( pm == null ) throw new MatchingException ( ) ; if ( Arrays . equals ( chars , pm . key ) ) { pm . remove ( pattern , selector , object , subExpr , parentId ) ; break ; } } break ; case PatternWrapper . SKIP_ONE_PREFIX : case PatternWrapper . SKIP_ONE_SUFFIX : pattern . advance ( ) ; matchOneChild . remove ( pattern , selector , object , subExpr , parentId ) ; if ( matchOneChild . isEmptyChain ( ) ) matchOneChild = null ; break ; case PatternWrapper . SWITCH_TO_SUFFIX : pattern . advance ( ) ; suffix . remove ( pattern , selector , object , subExpr , parentId ) ; if ( suffix . isEmptyChain ( ) ) suffix = null ; break ; } if ( key . length == 0 ) cleanChain ( ) ; if ( tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "remove" ) ; }
Remove a Pattern or part thereof from this PartialMatch or its down - chain peers