/* (non-Javadoc)
@see com.ibm.ws.sib.matchspace.impl.NumericMatcher#handleGet(java.lang.Object, com.ibm.ws.sib.matchspace.MatchSpaceKey, com.ibm.ws.sib.matchspace.EvalCache, java.lang.Object, com.ibm.ws.sib.matchspace.SearchResults)
485737
void handleGet(Object value, 
                 MatchSpaceKey msg, 
                 EvalCache cache,
                 Object contextValue,
                 SearchResults result) 
      throws MatchingException, BadMessageFormatMatchingException 
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.entry(this,
               cclass, 
               "handleGet", 
               new Object[] {value,msg,cache,contextValue,result});
    
    // Call the handleGet() method in the parent class but 
    // provide a context and we may need to call it multiple times
    if (value != null && value instanceof SetValEvaluationContext)
    {
      // The "value" we get back is a list of wrapped string values and
      // DOM nodes that we need to process individually
      ArrayList nodeList = ((SetValEvaluationContext)value).getWrappedNodeList();
      
      // Iterate over the nodes that were passed into us
      Iterator iter = nodeList.iterator();

      while(iter.hasNext())
      {
        WrappedNodeResults wrappedNode = (WrappedNodeResults)iter.next();
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
          tc.debug(this,cclass, "handleGet", "Processing node: " + wrappedNode); 
        
        // Need to be careful here, we propagate a Number, but the
        // context for subsequent operations is the parent node.
        // We retrieve a list of numbers each of which are processed
        // in turn
        ArrayList numberList = wrappedNode.getNumberList(id.getName());
        if(numberList != null)
        {
          Iterator iterNumber= numberList.iterator();
          
          while(iterNumber.hasNext())
          {
            Number num = (Number)iterNumber.next();

            // Need to pass in an XPathEvaluationContext
            SetValEvaluationContext xpEval = new SetValEvaluationContext(wrappedNode);
      
            super.handleGet(num, msg, cache, xpEval, result);
          } // eof while             
        } // eof if numberList not null        
      } // eof iteration over nodes
    } // value not null
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.exit(this,cclass, "handleGet");    
  }
1310463
void get(
    Object value,
    MatchSpaceKey msg,
    EvalCache cache,
    Object contextValue,
    SearchResults result)
    throws MatchingException, BadMessageFormatMatchingException
  {
    if (value == null && msg != null)
      value = getValue(msg, contextValue);
    if (value == null)
    {
      if (nullChild != null)
        nullChild.get(null, msg, cache, contextValue, result);
    }
    else
    {
      handleGet(value, msg, cache, contextValue, result);
      if (notNullChild != null)
        notNullChild.get(null, msg, cache, contextValue, result);
    }
    super.get(null, msg, cache, contextValue, result);
  }
1331903
public static MatchResult doMatch(final String requestURI, final String httpMethod) {
        MatchResult ret;
        final int segs = StringUtils.countMatches(requestURI, "/");
        ContextHandlerMeta contextHandlerMeta;
        String concreteKey = httpMethod + "." + requestURI;
        switch (segs) {
            case 1:
                contextHandlerMeta = ONE_SEG_CONCRETE_CTX_HANDLER_METAS.get(concreteKey);
                if (null != contextHandlerMeta) {
                    return new MatchResult(contextHandlerMeta, requestURI, httpMethod, requestURI);
                }

                switch (httpMethod) {
                    case "GET":
                        return route(requestURI, httpMethod, ONE_SEG_GET_VAR_CTX_HANDLER_METAS);
                    case "POST":
                        return route(requestURI, httpMethod, ONE_SEG_POST_VAR_CTX_HANDLER_METAS);
                    case "PUT":
                        return route(requestURI, httpMethod, ONE_SEG_PUT_VAR_CTX_HANDLER_METAS);
                    case "DELETE":
                        return route(requestURI, httpMethod, ONE_SEG_DELETE_VAR_CTX_HANDLER_METAS);
                    default:
                        return route(requestURI, httpMethod, ONE_SEG_OTHER_METHOD_VAR_CTX_HANDLER_METAS);
                }
            case 2:
                contextHandlerMeta = TWO_SEG_CONCRETE_CTX_HANDLER_METAS.get(concreteKey);
                if (null != contextHandlerMeta) {
                    return new MatchResult(contextHandlerMeta, requestURI, httpMethod, requestURI);
                }

                switch (httpMethod) {
                    case "GET":
                        return route(requestURI, httpMethod, TWO_SEG_GET_VAR_CTX_HANDLER_METAS);
                    case "POST":
                        return route(requestURI, httpMethod, TWO_SEG_POST_VAR_CTX_HANDLER_METAS);
                    case "PUT":
                        return route(requestURI, httpMethod, TWO_SEG_PUT_VAR_CTX_HANDLER_METAS);
                    case "DELETE":
                        return route(requestURI, httpMethod, TWO_SEG_DELETE_VAR_CTX_HANDLER_METAS);
                    default:
                        return route(requestURI, httpMethod, TWO_SEG_OTHER_METHOD_VAR_CTX_HANDLER_METAS);
                }
            case 3:
                contextHandlerMeta = THREE_SEG_CONCRETE_CTX_HANDLER_METAS.get(concreteKey);
                if (null != contextHandlerMeta) {
                    return new MatchResult(contextHandlerMeta, requestURI, httpMethod, requestURI);
                }

                switch (httpMethod) {
                    case "GET":
                        return route(requestURI, httpMethod, THREE_SEG_GET_VAR_CTX_HANDLER_METAS);
                    case "POST":
                        return route(requestURI, httpMethod, THREE_SEG_POST_VAR_CTX_HANDLER_METAS);
                    case "PUT":
                        return route(requestURI, httpMethod, THREE_SEG_PUT_VAR_CTX_HANDLER_METAS);
                    case "DELETE":
                        return route(requestURI, httpMethod, THREE_SEG_DELETE_VAR_CTX_HANDLER_METAS);
                    default:
                        return route(requestURI, httpMethod, THREE_SEG_OTHER_METHOD_VAR_CTX_HANDLER_METAS);
                }
            default:
                contextHandlerMeta = FOUR_MORE_SEG_CONCRETE_CTX_HANDLER_METAS.get(concreteKey);
                if (null != contextHandlerMeta) {
                    return new MatchResult(contextHandlerMeta, requestURI, httpMethod, requestURI);
                }

                switch (httpMethod) {
                    case "GET":
                        return route(requestURI, httpMethod, FOUR_MORE_SEG_GET_VAR_CTX_HANDLER_METAS);
                    case "POST":
                        return route(requestURI, httpMethod, FOUR_MORE_SEG_POST_VAR_CTX_HANDLER_METAS);
                    case "PUT":
                        return route(requestURI, httpMethod, FOUR_MORE_SEG_PUT_VAR_CTX_HANDLER_METAS);
                    case "DELETE":
                        return route(requestURI, httpMethod, FOUR_MORE_SEG_DELETE_VAR_CTX_HANDLER_METAS);
                    default:
                        return route(requestURI, httpMethod, FOUR_MORE_SEG_OTHER_METHOD_VAR_CTX_HANDLER_METAS);
                }
        }
    }
9177
public final Object handleGetObject(String key) {
        // lazily load the lookup hashtable.
        if (lookup == null) {
            loadLookup();
        }
        if (key == null) {
            throw new NullPointerException();
        }
        return lookup.get(key); // this class ignores locales
    }
962706
void handleRemove(
    SimpleTest test,
    Conjunction selector,
    MatchTarget object,
    InternTable subExpr,
    OrdinalPosition parentId)
    throws MatchingException {
      if (tc.isEntryEnabled())
        tc.entry(this,cclass, "handleRemove",
          new Object[] {test,selector,object,subExpr} );
      Object value = test.getValue();
      if (value == null)
        throw new IllegalStateException();
      handleEqualityRemove(value, selector, object, subExpr, parentId);
      if (tc.isEntryEnabled())
        tc.exit(this,cclass, "handleRemove");        
  }
1148081
@Override
    public Object getE(int intKey) throws PageException {
	Iterator it = valueIterator();// getMap().keySet().iterator();
	int count = 0;
	Object o;
	while (it.hasNext()) {
	    o = it.next();
	    if ((++count) == intKey) {
		return o;// super.get(o.toString());
	    }
	}
	throw new ExpressionException("invalid index [" + intKey + "] for argument scope");
    }
539321
private synchronized void pessimisticGet(
    Object key,
    MatchSpaceKey msg,
    EvalCache cache,
    Object rootContext,
    SearchResults result)
    throws MatchingException, BadMessageFormatMatchingException
  {

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.entry(
        this,cclass,
        "pessimisticGet", new Object[] {key,msg,cache,result});

    // Everything must execute under the MatchSpace lock
    // Obtain the cache entry and determine if its otherMatchers and results entries are
    // usable, invalidating them if not.
    CacheEntry e = getCacheEntry(key, true);
    if (e.matchTreeGeneration != matchTreeGeneration)
    {
      e.cachedResults = null;
      e.otherMatchers = null;
    }
    // Look in the cache for a usable cachedResults, using them to satisfy the request
    // iff the results object is willing to accept them.
    if (e.cachedResults != null && result.acceptCacheable(e.cachedResults))
    {
      resultCacheHitGets++;
      pessimisticGets++;

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        tc.exit(this,cclass, "pessimisticGet");
      return;
    }
    // Prepare the EvalCache, since we will be passing the msg through at least some
    // matchers.
    cache.prepareCache(subExpr.evalCacheSize());
    // Next, look in cache for reusable otherMatchers, to avoid searching
    // the full matchTree.
    if (e.otherMatchers != null)
    {
      // Have a cache hit that covers other matchers, so just run them.
      for (int i = 0; i < e.otherMatchers.length; i++)
      {
        try
        {
          e.otherMatchers[i].get(null, msg, cache, rootContext, result);
        }
        catch (RuntimeException exc)
        {
          // No FFDC Code Needed.
          // FFDC driven by wrapper class.
          FFDC.processException(this,
              cclass,
              "com.ibm.ws.sib.matchspace.impl.MatchSpaceImpl.pessimisticGet",
              exc,
              "1:677:1.44");      
//TODO:          tc.exception(tc, exc);
           
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            tc.exit(this,cclass, "pessimisticGet", exc);
          throw new MatchingException(exc);
        }
      }
      wildCacheHitGets++;
    }
    else
      // Have to do wildcards the slow way
      if (matchTree != null)
      {
        CacheingSearchResults csr = new CacheingSearchResults(result);
        try
        {
          matchTree.get(key, msg, cache, rootContext, csr);
        }
        catch (RuntimeException exc)
        {
          // No FFDC Code Needed.
          // FFDC driven by wrapper class.
          FFDC.processException(this,
              cclass,
              "com.ibm.ws.sib.matchspace.impl.MatchSpaceImpl.pessimisticGet",
              exc,
              "1:704:1.44");               
//TODO:          tc.exception(tc, exc);
            
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            tc.exit(this,cclass, "pessimisticGet", exc);
          throw new MatchingException(exc);
        }
        e.otherMatchers = csr.getMatchers();
        e.matchTreeGeneration = matchTreeGeneration;
        e.noResultCache |= csr.hasContent;
        wildCacheMissGets++;
      }
    // Now do exact match (if any)
    if (e.exactMatcher != null)
    {
      try
      {
        e.exactMatcher.get(null, msg, cache, rootContext, result);
      }
      catch (RuntimeException exc)
      {
        // No FFDC Code Needed.
        // FFDC driven by wrapper class.
        FFDC.processException(this,
            cclass,
            "com.ibm.ws.sib.matchspace.impl.MatchSpaceImpl.pessimisticGet",
            exc,
            "1:731:1.44");            
//TODO:        tc.exception(tc, exc);
          
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
          tc.exit(this,cclass, "pessimisticGet", exc);
        throw new MatchingException(exc);
      }
      exactMatches++;
    }
    // If we are able, place something in the cache for next time
    if (!e.noResultCache)
    {
      e.cachedResults = result.provideCacheable(key);
      if (e.cachedResults != null)
        resultsCached++;
    }
    // And we are done
    pessimisticGets++;

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.exit(this,cclass, "pessimisticGet");
    return;
  }
541609
void handlePut(SimpleTest test, Conjunction selector, MatchTarget object,
                 InternTable subExpr) throws MatchingException
  {
    if (tc.isEntryEnabled())
	    tc.entry(this,cclass, "handlePut",
               new Object[] {test,selector,object, subExpr}	
	);
	  	
    ContentMatcher next;
    if (test.getKind() == SimpleTest.ID)
      next = trueChild = nextMatcher(selector, trueChild);
    else if (test.getKind() == SimpleTest.NOTID)
      next = falseChild = nextMatcher(selector, falseChild);
    else
      throw new IllegalStateException();
    next.put(selector, object, subExpr);

    if (tc.isEntryEnabled())
	    tc.exit(this,cclass, "handlePut");    
  }
1367682
public void get(Object rootVal,
                  MatchSpaceKey msg,
                  EvalCache cache,
                  Object contextValue,
                  SearchResults result)
    throws MatchingException,BadMessageFormatMatchingException
  {
    if (tc.isEntryEnabled())
	    tc.entry(this,cclass, "get", new Object[]{rootVal,msg,cache,result});

    if (result instanceof CacheingSearchResults)
      ((CacheingSearchResults) result).setMatcher(vacantChild);
    vacantChild.get(null, msg, cache, contextValue, result);

    if (tc.isEntryEnabled())
	    tc.exit(this,cclass, "get");
  }
1340010
void handleGet(Object value, 
                   MatchSpaceKey msg, 
                   EvalCache cache,
                   Object contextValue,
                   SearchResults result) 
      throws MatchingException, BadMessageFormatMatchingException 
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.entry(this,
               cclass, 
               "handleGet", 
               new Object[] {value,msg,cache,contextValue,result});
    // Call the handleGet() method in the parent class but 
    // provide a context and we may need to call it multiple times
    if (value != null && value instanceof SetValEvaluationContext)
    {
      // The "value" we get back is a list of wrapped string values and
      // DOM nodes that we need to process individually
      
      SetValEvaluationContext xpContext = (SetValEvaluationContext)value;
      ArrayList nodeList = xpContext.getWrappedNodeList();
      
      // Iterate over the nodes that were passed into us
      Iterator iter = nodeList.iterator();

      while(iter.hasNext())
      {
        WrappedNodeResults wrappedNode = (WrappedNodeResults)iter.next();
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
          tc.debug(this,cclass, "handleGet", "Processing node: " + wrappedNode); 
        
        // Need to be careful here, we propagate the string value of
        // the attribute or element that we have retrieved, but the
        // context for subsequent operations is the parent node.
        ArrayList stringList = wrappedNode.getStringList(id.getName());
        if(stringList != null)
        {
          Iterator iterString = stringList.iterator();
          
          while(iterString.hasNext())
          {
            String strValue = (String)iterString.next();

            // Need to pass in an XPathEvaluationContext
            SetValEvaluationContext xpEval = new SetValEvaluationContext(wrappedNode);
      
            super.handleGet(strValue, msg, cache, xpEval, result);
          } // eof while             
        } // eof if integerList not null               
      } // eof iterating over the nodes
    } // eof value not null 
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.exit(this,cclass, "handleGet");        
  }
1010570
@Override
    public void handleAttribute(
            final char[] buffer,
            final int nameOffset, final int nameLen, final int nameLine, final int nameCol,
            final int operatorOffset, final int operatorLen, final int operatorLine, final int operatorCol,
            final int valueContentOffset, final int valueContentLen,
            final int valueOuterOffset, final int valueOuterLen,
            final int valueLine, final int valueCol)
            throws ParseException {


        if (!this.insideAllSelectorMatchingBlock) {
            // We are not in a matching block, so let's put this attribute into the buffer just in case it matches
            this.elementBuffer.bufferAttribute(
                    buffer,
                    nameOffset, nameLen, nameLine, nameCol,
                    operatorOffset, operatorLen, operatorLine, operatorCol,
                    valueContentOffset, valueContentLen, valueOuterOffset, valueOuterLen, valueLine, valueCol);
            return;
        }


        this.selectedHandler.handleAttribute(
                buffer,
                nameOffset, nameLen, nameLine, nameCol,
                operatorOffset, operatorLen, operatorLine, operatorCol,
                valueContentOffset, valueContentLen, valueOuterOffset, valueOuterLen, valueLine, valueCol);

    }
549376
@Override
  protected Object handleGetObject(String key) {
    for (ResourceBundle b : bundles) {
      try {
        return b.getObject(key);
      } catch (MissingResourceException mre) {
        // iterate
      }
    }
    throw new MissingResourceException(null, null, key);
  }
1303519
private void collectStaticGettersResults(@NonNull Class<?> someClass, @NonNull JSONObject container) throws JSONException {
        final Method[] methods = someClass.getMethods();
        for (final Method method : methods) {
            if (method.getParameterTypes().length == 0
                    && (method.getName().startsWith("get") || method.getName().startsWith("is"))
                    && !"getClass".equals(method.getName())) {
                try {
                    container.put(method.getName(), method.invoke(null, (Object[]) null));
                } catch (@NonNull IllegalArgumentException ignored) {
                    // NOOP
                } catch (@NonNull InvocationTargetException ignored) {
                    // NOOP
                } catch (@NonNull IllegalAccessException ignored) {
                    // NOOP
                }
            }
        }
    }
949738
private void searchMatchSpace(
                                  SIMPMessage msg,
                                  MessageProcessorSearchResults searchResults)
                    throws SIDiscriminatorSyntaxException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "searchMatchSpace", new Object[] { msg, searchResults });

        // Defect 382250, set the unlockCount from MsgStore into the message
        // in the case where the message is being redelivered.
        JsMessage searchMsg = msg.getMessage();
        int redelCount = msg.guessRedeliveredCount();

        if (redelCount > 0)
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(tc, "Set deliverycount into message: " + redelCount);
            searchMsg.setDeliveryCount(redelCount);
        }

        // Search the match space.
        _messageProcessor
                        .getMessageProcessorMatching()
                        .retrieveMatchingConsumerPoints(
                                                        _baseDestHandler.getUuid(), // the uuid of the destination
                                                        getUuid(), // the uuid of the ConsumerDispatcher
                                                        searchMsg,
                                                        searchResults);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "searchMatchSpace", searchResults);
    }
1273217
@Override
	public Result<Response> handleAsync(JsonPath jsonPath, QueryAdapter queryAdapter, Document requestBody) {
		Serializable id = jsonPath.getId();

		RegistryEntry rootEntry = jsonPath.getRootEntry();
		ResourceRepositoryAdapter resourceRepository = rootEntry.getResourceRepository();

		DocumentMappingConfig docummentMapperConfig = DocumentMappingConfig.create();
		DocumentMapper documentMapper = context.getDocumentMapper();

		return resourceRepository.findOne(id, queryAdapter)
				.merge(it -> documentMapper.toDocument(it, queryAdapter, docummentMapperConfig))
				.map(this::toResponse);
	}
1115670
@Override
    public void handleText(
            final char[] buffer, final int offset, final int len,
            final int line, final int col)
            throws ParseException {

        this.someSelectorsMatch = false;
        for (int i = 0; i < this.selectorsLen; i++) {

            this.selectorMatches[i] =
                    this.selectorFilters[i].matchText(false, this.markupLevel, this.markupBlocks[this.markupLevel]);
            if (this.selectorMatches[i]) {
                this.someSelectorsMatch = true;
            }

        }

        if (this.someSelectorsMatch) {
            markCurrentSelection();
            this.selectedHandler.handleText(buffer, offset, len, line, col);
            unmarkCurrentSelection();
            return;
        }

        unmarkCurrentSelection();
        this.nonSelectedHandler.handleText(buffer, offset, len, line, col);

    }
393255
public <T> List<T> resultOf(DomainObjectMatch<T> match) {
		return resultOf(match, false);
	}