Verifies if the element with the given source identifier can reach the element with the target identifier through following sequence flow.
763315
public static boolean isReachable(String processDefinitionId, String sourceElementId, String targetElementId) {

    // Fetch source and target elements
    Process process = ProcessDefinitionUtil.getProcess(processDefinitionId);

    FlowElement sourceFlowElement = process.getFlowElement(sourceElementId, true);
    FlowNode sourceElement = null;
    if (sourceFlowElement instanceof FlowNode) {
      sourceElement = (FlowNode) sourceFlowElement;
    } else if (sourceFlowElement instanceof SequenceFlow) {
      sourceElement = (FlowNode) ((SequenceFlow) sourceFlowElement).getTargetFlowElement();
    }

    FlowElement targetFlowElement = process.getFlowElement(targetElementId, true);
    FlowNode targetElement = null;
    if (targetFlowElement instanceof FlowNode) {
      targetElement = (FlowNode) targetFlowElement;
    } else if (targetFlowElement instanceof SequenceFlow) {
      targetElement = (FlowNode) ((SequenceFlow) targetFlowElement).getTargetFlowElement();
    }

    if (sourceElement == null) {
      throw new ActivitiException("Invalid sourceElementId '" + sourceElementId + "': no element found for this id n process definition '" + processDefinitionId + "'");
    }
    if (targetElement == null) {
      throw new ActivitiException("Invalid targetElementId '" + targetElementId + "': no element found for this id n process definition '" + processDefinitionId + "'");
    }

    Set<String> visitedElements = new HashSet<String>();
    return isReachable(process, sourceElement, targetElement, visitedElements);
  }
720389
public static void verify (final AbstractCodepointIterator aIter, final IntPredicate aFilter)
  {
    final CodepointIteratorRestricted rci = aIter.restrict (aFilter, false);
    while (rci.hasNext ())
      rci.next ();
  }
1164424
private StackElement followSources(StackElement stack, Symbol symbol, GTerminal laSymbol)
    {
        /*******************************************************************/
        /* If the starting configuration consists of a single state and    */
        /* the initial [state, symbol] pair has already been visited,      */
        /* return the null set. Otherwise, mark the pair visited and ...   */
        /*******************************************************************/
        StackElement configs = null;

        Lr0State stateNo = stack.getState();
        if (stack.getSize() == 1)
        {
            if (visited.contains(stateNo, symbol)
                    || (stateNo.getNumber() == 1 && start.equals(symbol)))
            {
                return configs;
            }
            visited.add(stateNo, symbol);
        }
        /*******************************************************************/
        /* Find the transition defined on the symbol...                    */
        /* If the SYMBOL is a nonterminal and we can determine that the    */
        /* lookahead symbol (LA_SYMBOL) cannot possibly follow the         */
        /* nonterminal in question in this context, we simply abandon the  */
        /* search and return the NULL set.                                 */
        /*******************************************************************/
        Action act = null;
        if (symbol instanceof Nonterminal)
        {
            Set<Goto> go_to = stateNo.getGotoList();

            Goto go = null;
            for (Goto i : go_to)
            {
                if (symbol.equals(i.getSymbol()))
                {
                    go = i;
                    break;
                }
            }
            if (laIndexOf(go.getLa()) == 0)
            {
                Deque<LaPtr> stackTop = new ArrayDeque<LaPtr>();
                laTraverse(stateNo, go, stackTop);
            }
            if (!go.getLa().getLaSet().contains(laSymbol))
            {
                return configs;
            }
            act = go.getAction();
        }
        else
        {
            Shift sh = null;
            for (Shift i : stateNo.getShiftList())
            {
                if (symbol.equals(i.getSymbol()))
                {
                    sh = i;
                    break;
                }
            }
            act = sh.getAction();
        }
        /*******************************************************************/
        /* If the ACTion on the symbol is a shift or a goto, ...           */
        /*******************************************************************/
        if (act instanceof Lr0State)
        {
            /***************************************************************/
            /* We check to see if the new state contains an action on the  */
            /* lookahead symbol. If that's the case then we create a new   */
            /* configuration by appending ACT to the starting configuration*/
            /* and add this newly formed configuration to the set(list) of */
            /* configurations...                                           */
            /***************************************************************/
            Lr0State actst = (Lr0State) act;
            boolean trans = false;
            for (Shift sh : actst.getShiftList())
            {
                if (laSymbol.equals(sh.getSymbol()))
                {
                    trans = true;
                    break;
                }
            }
            if (trans)
            {
                configs = new StackElement(actst, stack);
            }
            /***************************************************************/
            /* If the new state cannot get into a cycle of null            */
            /* transitions, we check to see if it contains any transition  */
            /* on a nullable nonterminal. For each such transition, we     */
            /* append the new state to the stack and recursively invoke    */
            /* FOLLOW_SOURCES to check if a transition on LA_SYMBOL cannot */
            /* follow such a null transition.                              */
            /***************************************************************/
            if (!actst.isCyclic())
            {
                for (Goto i : actst.getGotoList())
                {
                    Nonterminal nt = i.getSymbol();
                    if (nt.isNullable())
                    {
                        StackElement q = new StackElement(actst);
                        StackElement newConfigs = followSources(q, nt, laSymbol);
                        if (newConfigs != null)
                        {
                            configs = StackElement.unionConfigSets(configs, newConfigs);
                        }
                    }
                }
            }
        }
        /*******************************************************************/
        /* We now iterate over the kernel set of items associated with the */
        /* ACTion defined on SYMBOL...                                     */
        /*******************************************************************/
        PeekableIterator<Item> itemPtr = null;
        if (act instanceof Lr0State)
        {
            Lr0State sact = (Lr0State) act;
            itemPtr = sact.getKernelItemsPtr();
        }
        else
        {
            GRule ract = (GRule) act;
            itemPtr = ract.getAdequateItemPtr();
        }
        while (itemPtr.hasNext())
        {
            Item itemNo = itemPtr.next();
            /***************************************************************/
            /* For each item that is a final item whose left-hand side     */
            /* is neither the starting symbol nor a symbol that can        */
            /* right-most produce itself...                                */
            /***************************************************************/
            if (empty.equals(itemNo.getSymbol()))
            {
                GRule ruleNo = itemNo.getRule();
                Nonterminal lhsSymbol = ruleNo.getLeft();
                if (!start.equals(lhsSymbol) && !lhsSymbol.isRmpSelf())
                {
                    /*******************************************************/
                    /* If the length of the prefix of the item preceeding  */
                    /* the dot is shorter that the length of the stack, we */
                    /* retrace the item's path within the stack and        */
                    /* invoke FOLLOW_SOURCES with the prefix of the stack  */
                    /* where the item was introduced through closure, the  */
                    /* left-hand side of the item and the lookahead symbol.*/
                    /*******************************************************/
                    if (itemNo.getDot() < stack.getSize())
                    {
                        StackElement q = stack;
                        for (int i = 1; i < itemNo.getDot(); i++)
                        {
                            q = q.getPrevious();
                        }
                        q = followSources(q, lhsSymbol, laSymbol);
                        configs = StackElement.unionConfigSets(configs, q);

                    }
                    else
                    {
                        /***************************************************/
                        /* Compute the item in the root state of the stack,*/
                        /* and find the root state...                      */
                        /***************************************************/
                        itemNo = itemNo.predessor(stack.getSize());
                        StackElement q = stack;
                        for (; q.getSize() != 1;q = q.getPrevious());
                    /***************************************************/
                    /* We are now back in the main automaton, find all */
                    /* sources where the item was introduced through   */
                    /* closure start a new configuration and invoke    */
                    /* FOLLOW_SOURCES with the appropriate arguments to*/
                    /* calculate the set of configurations associated  */
                    /* with these sources.                             */
                    /***************************************************/
                        for (Lr0State p : lpgAccess(q.getState(), itemNo))
                        {
                            q = new StackElement(p);
                            StackElement newConfigs = followSources(q, lhsSymbol, laSymbol);
                            if (newConfigs != null)
                            {
                                configs = StackElement.unionConfigSets(configs, newConfigs);
                            }
                        }
                    }
                }
            }
        }
        return configs;
    }
851968
public char match(ISense source, ISense target) throws MatcherLibraryException {
        String sSynset = source.getGloss();
        String tSynset = target.getGloss();
        StringTokenizer stSource = new StringTokenizer(sSynset, " ,.\"'();");
        StringTokenizer stTarget = new StringTokenizer(tSynset, " ,.\"'();");
        String lemma;
        int counter = 0;
        while (stSource.hasMoreTokens()) {
            lemma = stSource.nextToken();
            if (!meaninglessWords.contains(lemma)) {
                List<String> lemmas = target.getLemmas();
                for (String lemmaToCompare : lemmas) {
                    if (lemma.equals(lemmaToCompare)) {
                        counter++;
                    }
                }
            }
        }
        if (counter >= threshold) {
            return IMappingElement.LESS_GENERAL;
        }

        while (stTarget.hasMoreTokens()) {
            lemma = stTarget.nextToken();
            if (!meaninglessWords.contains(lemma)) {
                List<String> lemmas = source.getLemmas();
                for (String lemmaToCompare : lemmas) {
                    if (lemma.equals(lemmaToCompare)) {
                        counter++;
                    }
                }
            }
        }
        if (counter >= threshold) {
            return IMappingElement.MORE_GENERAL;
        }
        return IMappingElement.IDK;
    }
120785
def build_additional_match(self, ident, node_set):
        
        source_ident = ident

        for key, value in node_set.must_match.items():
            if isinstance(value, dict):
                label = ':' + value['node_class'].__label__
                stmt = _rel_helper(lhs=source_ident, rhs=label, ident='', **value)
                self._ast['where'].append(stmt)
            else:
                raise ValueError("Expecting dict got: " + repr(value))

        for key, val in node_set.dont_match.items():
            if isinstance(val, dict):
                label = ':' + val['node_class'].__label__
                stmt = _rel_helper(lhs=source_ident, rhs=label, ident='', **val)
                self._ast['where'].append('NOT ' + stmt)
            else:
                raise ValueError("Expecting dict got: " + repr(val))
1081999
public static boolean isCertificateOperationIdentifier(String identifier) {
        identifier = verifyNonEmpty(identifier, "identifier");

        URI baseUri;
        try {
            baseUri = new URI(identifier);
        } catch (URISyntaxException e) {
            return false;
        }

        // Path is of the form "/certificates/[name]/pending"
        String[] segments = baseUri.getPath().split("/");
        if (segments.length != 4) {
            return false;
        }

        if (!(segments[1]).equals("certificates")) {
            return false;
        }

        if (!(segments[3]).equals("pending")) {
            return false;
        }

        return true;
    }
674469
protected void ensureSequenceFlowIdSet(SequenceFlow sequenceFlow) {
    // We really must have ids for sequence flow to be able to generate
    // stuff
    if (sequenceFlow.getId() == null) {
      sequenceFlow.setId("sequenceFlow-" + UUID.randomUUID().toString());
    }
  }
769957
public char match(ISense source, ISense target) throws MatcherLibraryException {
        List<ISense> sourceList = getAncestors(source, depth);
        List<ISense> targetList = getAncestors(target, depth);
        targetList.retainAll(sourceList);
        if (targetList.size() > 0)
            return IMappingElement.EQUIVALENCE;
        else
            return IMappingElement.IDK;
    }
220870
private boolean includes(String identifier) {
    if (includes.isEmpty()) return !exclude(identifier);

    String includeMatch = null;
    String excludeMatch = null;
    for (String rule = identifier; rule != null; rule = enclosing(rule)) {
      if (excludes.contains(rule)) {
        excludeMatch = rule;
      }
      if (includes.contains(rule)) {
        includeMatch = rule;
      }
    }
    if (excludeMatch != null) {
      usedExcludes.add(excludeMatch);
      return false;
    }
    if (includeMatch != null) {
      usedIncludes.add(includeMatch);
      return true;
    }
    return false;
  }
878578
private boolean checkHeader(RandomAccessInputStream raf) throws IOException
	{
		raf.seek(HEAD_LOCATION);

		byte[] buf = new byte[HEAD_SIZE];
		if (raf.read(buf) != HEAD_SIZE)
		{
			throw new IOException("Error encountered finding id3v2 header");
		}

		String result = new String(buf, ENC_TYPE);
		if (result.substring(0, TAG_START.length()).equals(TAG_START))
		{
			if ((((int)buf[3]&0xFF) < 0xff) && (((int)buf[4]&0xFF) < 0xff))
			{
				if ((((int)buf[6]&0xFF) < 0x80) && (((int)buf[7]&0xFF) < 0x80) && (((int)buf[8]&0xFF) < 0x80) && (((int)buf[9]&0xFF) < 0x80))
				{
					return true;
				}
			}
		}

		return false;
	}
764449
private boolean allDefinitionsEquivalent(Collection<Node> definitions) {
    Node first = null;
    for (Node n : definitions) {
      if (first == null) {
        first = n;
      } else if (!compiler.areNodesEqualForInlining(first, n)) {
        return false;
      } // else continue
    }
    return true;
  }
1360110
private boolean perform(CompilationService sjavac,
                            File outputDir,
                            Map<String,Transformer> suffixRules) {
        boolean rc = true;
        // Group sources based on transforms. A source file can only belong to a single transform.
        Map<Transformer,Map<String,Set<URI>>> groupedSources = new HashMap<>();
        for (Source src : now.sources().values()) {
            Transformer t = suffixRules.get(src.suffix());
            if (t != null) {
                if (taintedPackages.contains(src.pkg().name()) && !src.isLinkedOnly()) {
                    addFileToTransform(groupedSources, t, src);
                }
            }
        }
        // Go through the transforms and transform them.
        for (Map.Entry<Transformer, Map<String, Set<URI>>> e : groupedSources.entrySet()) {
            Transformer t = e.getKey();
            Map<String, Set<URI>> srcs = e.getValue();
            // These maps need to be synchronized since multiple threads will be
            // writing results into them.
            Map<String, Set<URI>> packageArtifacts = Collections.synchronizedMap(new HashMap<>());
            Map<String, Map<String, Set<String>>> packageDependencies = Collections.synchronizedMap(new HashMap<>());
            Map<String, Map<String, Set<String>>> packageCpDependencies = Collections.synchronizedMap(new HashMap<>());
            Map<String, PubApi> packagePublicApis = Collections.synchronizedMap(new HashMap<>());
            Map<String, PubApi> dependencyPublicApis = Collections.synchronizedMap(new HashMap<>());

            boolean r = t.transform(sjavac,
                                    srcs,
                                    visibleSrcs,
                                    prev.dependents(),
                                    outputDir.toURI(),
                                    packageArtifacts,
                                    packageDependencies,
                                    packageCpDependencies,
                                    packagePublicApis,
                                    dependencyPublicApis,
                                    0,
                                    isIncremental(),
                                    numCores);
            if (!r)
                rc = false;

            for (String p : srcs.keySet()) {
                recompiledPackages.add(p);
            }
            // The transform is done! Extract all the artifacts and store the info into the Package objects.
            for (Map.Entry<String, Set<URI>> a : packageArtifacts.entrySet()) {
                Module mnow = now.findModuleFromPackageName(a.getKey());
                mnow.addArtifacts(a.getKey(), a.getValue());
            }
            // Extract all the dependencies and store the info into the Package objects.
            for (Map.Entry<String, Map<String, Set<String>>> a : packageDependencies.entrySet()) {
                Map<String, Set<String>> deps = a.getValue();
                Module mnow = now.findModuleFromPackageName(a.getKey());
                mnow.setDependencies(a.getKey(), deps, false);
            }
            for (Map.Entry<String, Map<String, Set<String>>> a : packageCpDependencies.entrySet()) {
                Map<String, Set<String>> deps = a.getValue();
                Module mnow = now.findModuleFromPackageName(a.getKey());
                mnow.setDependencies(a.getKey(), deps, true);
            }

            // This map contains the public api of the types that this
            // compilation depended upon. This means that it may not contain
            // full packages. In other words, we shouldn't remove knowledge of
            // public apis but merge these with what we already have.
            for (Map.Entry<String, PubApi> a : dependencyPublicApis.entrySet()) {
                String pkg = a.getKey();
                PubApi packagePartialPubApi = a.getValue();
                Package pkgNow = now.findModuleFromPackageName(pkg).lookupPackage(pkg);
                PubApi currentPubApi = pkgNow.getPubApi();
                PubApi newPubApi = PubApi.mergeTypes(currentPubApi, packagePartialPubApi);
                pkgNow.setPubapi(newPubApi);

                // See JDK-8071904
                if (now.packages().containsKey(pkg))
                    now.packages().get(pkg).setPubapi(newPubApi);
                else
                    now.packages().put(pkg, pkgNow);
            }

            // The packagePublicApis cover entire packages (since sjavac compiles
            // stuff on package level). This means that if a type is missing
            // in the public api of a given package, it means that it has been
            // removed. In other words, we should *set* the pubapi to whatever
            // this map contains, and not merge it with what we already have.
            for (Map.Entry<String, PubApi> a : packagePublicApis.entrySet()) {
                String pkg = a.getKey();
                PubApi newPubApi = a.getValue();
                Module mprev = prev.findModuleFromPackageName(pkg);
                Module mnow = now.findModuleFromPackageName(pkg);
                mnow.setPubapi(pkg, newPubApi);
                if (mprev.hasPubapiChanged(pkg, newPubApi)) {
                    // Aha! The pubapi of this package has changed!
                    // It can also be a new compile from scratch.
                    if (mprev.lookupPackage(pkg).existsInJavacState()) {
                        // This is an incremental compile! The pubapi
                        // did change. Trigger recompilation of dependents.
                        packagesWithChangedPublicApis.add(pkg);
                        Log.debug("The API of " + Util.justPackageName(pkg) + " has changed!");
                    }
                }
            }
        }
        return rc;
    }
159093
private StepIdentifier generateIdentifier(List<Pair<StepContextId, INodeEntry>> stack) {
        List<StepContextId> ctxs = new ArrayList<>();
        int i = 0;
        for (Pair<StepContextId, INodeEntry> pair : stack) {
            Map<String, String> params = null;
            if (null != pair.getSecond() && i < stack.size() - 1) {
                //include node as a parameter to the context only when it is an intermediate step,
                // i.e. a parent in the sequence
                params = new HashMap<>();
                params.put("node", pair.getSecond().getNodename());
            }
            ctxs.add(StateUtils.stepContextId(pair.getFirst().getStep(), !pair.getFirst().getAspect().isMain(),
                                              params
            ));
            i++;
        }
        return StateUtils.stepIdentifier(ctxs);
    }
366896
def has_target(alias, target):
    '''
    
    '''
    if target == '':
        raise SaltInvocationError('target can not be an empty string')
    aliases = list_aliases()
    if alias not in aliases:
        return False
    if isinstance(target, list):
        target = ', '.join(target)
    return target == aliases[alias]
769386
public boolean process(Trace trace, Node node, Direction direction,
            Map<String, ?> headers, Object[] values) {

        if (predicate != null) {
            return predicate.test(trace, node, direction, headers, values);
        }

        return true;
    }
921889
function isOnSameLineWithNextToken(node) {
            const prevToken = sourceCode.getLastToken(node, 1);
            const nextToken = sourceCode.getTokenAfter(node);

            return !!nextToken && astUtils.isTokenOnSameLine(prevToken, nextToken);
        }
385617
private boolean areTypesAssignable(Class<?> source, Class<?> target)
   {
      if (target.isAssignableFrom(source))
      {
         return true;
      }
      else if (!source.isPrimitive() && !target.isPrimitive())
      {
         return false;
      }
      else if (source.isPrimitive())
      {
         // source is primitive
         return primitiveToWrapperMap.get(source) == target;
      }
      else
      {
         // target is primitive
         return source == primitiveToWrapperMap.get(target);
      }
   }