Verify that all non-looping paths from {@code a} to {@code b} pass
through at least one node where {@code nodePredicate} is true.
965402
private boolean checkAllPathsWithoutBackEdges(DiGraphNode<N, E> a,
      DiGraphNode<N, E> b) {
    if (nodePredicate.apply(a.getValue()) &&
        (inclusive || (a != start && a != end))) {
      return true;
    }
    if (a == b) {
      return false;
    }
    for (DiGraphEdge<N, E> e : a.getOutEdges()) {
      // Once we visited that edge once, we no longer need to
      // re-visit it again.
      if (e.getAnnotation() == VISITED_EDGE) {
        continue;
      }
      e.setAnnotation(VISITED_EDGE);

      if (ignoreEdge(e)) {
        continue;
      }
      if (e.getAnnotation() == BACK_EDGE) {
        continue;
      }

      DiGraphNode<N, E> next = e.getDestination();
      if (!checkAllPathsWithoutBackEdges(next, b)) {
        return false;
      }
    }
    return true;
  }
905629
private LinkedList<T> computeRecursiveTraversal(T node, NodePath<T> nodePath) {
    try {


      LinkedList<T> imports = new LinkedList<>();
      Set<T> alreadyIncludedImports = new HashSet<>();

      for (T neighbor : this.traversalFunction.apply(node)) {
        nodePath.appendNode(neighbor);
        addSubtraversal(neighbor, imports, alreadyIncludedImports, nodePath);
        nodePath.popTail();
      }

      return imports;
    } catch (ExecutionException ee) {
      throw new RuntimeException(ee);
    }
  }
897341
public void checkSubTree(TreePath tp, boolean check) {
        CheckedNode cn = nodesCheckingState.get(tp);
        cn.isSelected = check;
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) tp.getLastPathComponent();
        for (int i = 0 ; i < node.getChildCount() ; i++) {              
            checkSubTree(tp.pathByAddingChild(node.getChildAt(i)), check);
        }
        cn.allChildrenSelected = check;
        if (check) {
            checkedPaths.add(tp);
        } else {
            checkedPaths.remove(tp);
        }
        updatePredecessorsAllChildrenSelectedState(tp);
    }
653084
public boolean contains(Node node2) {
        if ((getBeginLine() < node2.getBeginLine())
                || ((getBeginLine() == node2.getBeginLine()) && getBeginColumn() <= node2.getBeginColumn())) {
            if (getEndLine() > node2.getEndLine()) {
                return true;
            } else if ((getEndLine() == node2.getEndLine()) && getEndColumn() >= node2.getEndColumn()) {
                return true;
            }
        }
        return false;
    }
982113
private Boolean hasChildNodes(Node n) {
        boolean flag = n.hasChildNodes();
        if (flag && XMLUnit.getIgnoreComments()) {
            List nl = nodeList2List(n.getChildNodes());
            flag = !nl.isEmpty();
        }
        return flag ? Boolean.TRUE : Boolean.FALSE;
    }
71465
@Override
    boolean checkNodes(final INodeReadTrx paramFirstRtx, final INodeReadTrx paramSecondRtx)
        throws TTIOException {
        assert paramFirstRtx != null;
        assert paramSecondRtx != null;

        boolean found = false;

        if (paramFirstRtx.getNode().getDataKey() == paramSecondRtx.getNode().getDataKey()
            && paramFirstRtx.getNode().equals(paramSecondRtx.getNode())) {
            final long nodeKey = paramFirstRtx.getNode().getDataKey();

            if (paramFirstRtx.getNode().getKind() == IConstants.ELEMENT) {
                if (((ElementNode)paramFirstRtx.getNode()).getNamespaceCount() == 0
                    && ((ElementNode)paramFirstRtx.getNode()).getAttributeCount() == 0
                    && ((ElementNode)paramSecondRtx.getNode()).getAttributeCount() == 0
                    && ((ElementNode)paramSecondRtx.getNode()).getNamespaceCount() == 0) {
                    found = true;
                } else {
                    if (((ElementNode)paramFirstRtx.getNode()).getNamespaceCount() == 0) {
                        found = true;
                    } else {
                        for (int i = 0; i < ((ElementNode)paramFirstRtx.getNode()).getNamespaceCount(); i++) {
                            paramFirstRtx.moveToNamespace(i);
                            for (int j = 0; j < ((ElementNode)paramSecondRtx.getNode()).getNamespaceCount(); j++) {
                                paramSecondRtx.moveToNamespace(i);

                                if (paramFirstRtx.getNode().equals(paramSecondRtx.getNode())) {
                                    found = true;
                                    break;
                                }
                            }
                            paramFirstRtx.moveTo(nodeKey);
                            paramSecondRtx.moveTo(nodeKey);
                        }
                    }

                    if (found) {
                        for (int i = 0; i < ((ElementNode)paramFirstRtx.getNode()).getAttributeCount(); i++) {
                            paramFirstRtx.moveToAttribute(i);
                            for (int j = 0; j < ((ElementNode)paramSecondRtx.getNode()).getAttributeCount(); j++) {
                                paramSecondRtx.moveToAttribute(i);

                                if (paramFirstRtx.getNode().equals(paramSecondRtx.getNode())) {
                                    found = true;
                                    break;
                                }
                            }
                            paramFirstRtx.moveTo(nodeKey);
                            paramSecondRtx.moveTo(nodeKey);
                        }
                    }
                }
            } else {
                found = true;
            }
        }

        return found;
    }
112131
private ComparisonState compareNodeLists(Iterable<Node> controlSeq,
                                             final XPathContext controlContext,
                                             Iterable<Node> testSeq,
                                             final XPathContext testContext) {
        ComparisonState chain = new OngoingComparisonState();

        Iterable<Map.Entry<Node, Node>> matches =
            getNodeMatcher().match(controlSeq, testSeq);
        List<Node> controlList = Linqy.asList(controlSeq);
        List<Node> testList = Linqy.asList(testSeq);
        Set<Node> seen = new HashSet<Node>();
        for (Map.Entry<Node, Node> pair : matches) {
            final Node control = pair.getKey();
            seen.add(control);
            final Node test = pair.getValue();
            seen.add(test);
            int controlIndex = controlList.indexOf(control);
            int testIndex = testList.indexOf(test);

            controlContext.navigateToChild(controlIndex);
            testContext.navigateToChild(testIndex);
            try {
                chain =
                    chain.andThen(new Comparison(ComparisonType.CHILD_NODELIST_SEQUENCE,
                                                 control, getXPath(controlContext),
                                                 Integer.valueOf(controlIndex), getParentXPath(controlContext),
                                                 test, getXPath(testContext),
                                                 Integer.valueOf(testIndex), getParentXPath(testContext)))
                    .andThen(new DeferredComparison() {
                            @Override
                            public ComparisonState apply() {
                                return compareNodes(control, controlContext,
                                                    test, testContext);
                            }
                        });
            } finally {
                testContext.navigateToParent();
                controlContext.navigateToParent();
            }
        }

        return chain.andThen(new UnmatchedControlNodes(controlList, controlContext, seen, testContext))
            .andThen(new UnmatchedTestNodes(testList, testContext, seen, controlContext));
    }
92052
public void addEdge(N a, N b)
    {
        if( !containsBoth(a, b) )
            return;//Cant add nodes to things that doing exist
        nodes.get(a).getOutgoing().add(b);
        nodes.get(b).getIncoming().add(a);
    }
1080678
private boolean isDangling(Node node)
	{
		if (!result.contains(node)) return false;
		if (ST.contains(node)) return false;

		boolean hasIncoming = false;

		for (Edge edge : node.getUpstream())
		{
			if (result.contains(edge))
			{
				hasIncoming = true;
				break;
			}
		}

		boolean hasOutgoing = false;

		for (Edge edge : node.getDownstream())
		{
			if (result.contains(edge))
			{
				hasOutgoing = true;
				break;
			}
		}

		if (hasIncoming && hasOutgoing) return false;

		boolean hasParent = false;

		for (Node parent : node.getUpperEquivalent())
		{
			if (result.contains(parent))
			{
				hasParent = true;
				break;
			}
		}

		if (hasParent && (hasIncoming || hasOutgoing)) return false;

		boolean hasChild = false;

		for (Node child : node.getLowerEquivalent())
		{
			if (result.contains(child))
			{
				hasChild = true;
				break;
			}
		}

		return !(hasChild && (hasIncoming || hasOutgoing || hasParent));
	}
744102
function(p) {

            if (!p) return false;

            var segments = this.segments;
            var otherSegments = p.segments;

            var numSegments = segments.length;
            if (otherSegments.length !== numSegments) return false; // if the two paths have different number of segments, they cannot be equal

            for (var i = 0; i < numSegments; i++) {

                var segment = segments[i];
                var otherSegment = otherSegments[i];

                // as soon as an inequality is found in segments, return false
                if ((segment.type !== otherSegment.type) || (!segment.equals(otherSegment))) return false;
            }

            // if no inequality found in segments, return true
            return true;
        }
634578
public boolean nodeExists(String path) throws ZooKeeperException {
        try {
            Stat stat = curatorFramework.checkExists().forPath(path);
            return stat != null;
        } catch (Exception e) {
            if (e instanceof ZooKeeperException) {
                throw (ZooKeeperException) e;
            } else {
                throw new ZooKeeperException(e);
            }
        }
    }
671497
@SafeVarargs
    public static final <T> Predicate<T> and(Predicate<T>... predicates) {
        return Seq.of(predicates).reduce(t -> true, (t1, t2) -> t1.and(t2));
    }
722053
public boolean matches(String path) {
        List<String> segments;

        segments = Filesystem.SEPARATOR.split(path);
        if (segments.size() < minDepth || segments.size() > maxDepth) {
            return false;
        }
        if (predicates.size() > 0) {
            throw new UnsupportedOperationException("cannot match with predicates");
        }
        return matches(0, segments, new ArrayList<>(includes), new ArrayList<>(excludes));
    }
509478
private Collection<Node> check(final Collection<Selector> parts) throws NodeSelectorException {
		Collection<Node> result = new LinkedHashSet<Node>();
		result.add(root);

		boolean initialPart=true;
		for (Selector selector : parts) {
			Checker<Node> checker = new TagChecker<Node>(helper, selector, initialPart);
			result = checker.check(result);
			if (selector.hasSpecifiers())
				for (Specifier specifier : selector.getSpecifiers()) {
					switch (specifier.getType()) {
					case ATTRIBUTE:
						checker = new AttributeSpecifierChecker<Node>(helper, (AttributeSpecifier) specifier);
						break;
					case PSEUDO:
						if (specifier instanceof PseudoClassSpecifier)
							checker = new PseudoClassSpecifierChecker<Node>(helper, (PseudoClassSpecifier) specifier);
						else if (specifier instanceof PseudoNthSpecifier)
							checker = new PseudoNthSpecifierChecker<Node>(helper, (PseudoNthSpecifier) specifier);
						else if (specifier instanceof PseudoContainsSpecifier)
							checker = new PseudoContainsSpecifierChecker<Node>(helper, (PseudoContainsSpecifier) specifier);

						break;

					case NEGATION:
						final Collection<Node> negationNodes = checkNegationSpecifier((NegationSpecifier) specifier);
						checker = new Checker<Node>() {
							@Override
							public List<Node> check(final Collection<Node> nodes) {
								Collection<Node> set = new LinkedHashSet<Node>(nodes);
								set.removeAll(negationNodes);
								return new ArrayList<Node>(set);
							}
						};
						break;
					}

					result = checker.check(result);
					if (result.isEmpty())
						// Bail out early.
						return result;
				}
			initialPart=false;
		}

		return result;
	}
138419
static Predicate<CtClass> createMatchingPredicate(final Set<PathMatcher> pathMatchers) {
        return ctClass -> {
            for (final PathMatcher pathMatcher : pathMatchers) {
                if (pathMatcher.matches(Paths.get(ctClass.getName()))) {
                    return true;
                }
            }
            return false;
        };
    }
289714
public static <N, E, D> boolean traverse(TraversalOrder order,
                                             IndefiniteGraph<N, E> graph,
                                             int limit,
                                             N initialNode,
                                             GraphTraversalVisitor<N, E, D> vis) {
        return traverse(order, graph, limit, Collections.singleton(initialNode), vis);
    }
806208
public static Predicate<Matcher> preventLoops() {
        return new Predicate<Matcher>() {
            private final Set<Matcher> visited = new HashSet<Matcher>();

            public boolean apply(Matcher node) {
                node = unwrap(node);
                if (visited.contains(node)) {
                    return false;
                }
                visited.add(node);
                return true;
            }
        };
    }