Match the pattern at the provided root.

@param root the root atom of the molecule
@return mappings
@see Mappings
977198
Mappings matchRoot(IAtom root) {
        checkCompatibleAPI(root);
        IAtomContainer mol = root.getContainer();
        if (query.getAtomCount() > 0 && ((IQueryAtom) query.getAtom(0)).matches(root)) {
            DfState local = new DfState(state);
            local.setRoot(root);
            return filter(new Mappings(query, mol, local), query, mol);
        } else {
            return new Mappings(query, mol, Collections.<int[]>emptySet());
        }
    }
1124989
public static Set<String> getSpecifiedRealms(Root root) {
        Set<String> result = new HashSet<String>();
        List<Context> contexts = root.getContexts();
        for (Context context : contexts) {
            String key = context.getKey();
            if (key != null && key.equals(SchemaConstants.PROP_REALM)) {
                String value = (String) context.getValue();
                result.add(value);
            }
        }
        return result;
    }
127729
static String readMapping(String root, String index) throws IOException {
		if (root == null) {
			return readMapping(index);
		}
		String mappingFile = root + "/" + index + "/_doc" + Defaults.JsonFileExtension;
		return readFileFromClasspath(mappingFile);
	}
746697
public static boolean start(com.sun.javadoc.RootDoc root) {
        try {
            BeanDocDoclet doclet = new BeanDocDoclet(root);
            doclet.start();
        }
        catch (Exception e) {
            e.printStackTrace();
            return false;
        }

        return true;
    }
231761
Node getNode(Node root) {
        if (isRoot()) {
            return root;
        }

        Node startNode = root;
        Matcher pathMatcher = dotWithPreviousChar.matcher(path);
        int pos = 0;
        while (pathMatcher.find()) {
            String step = path.substring(pos, pathMatcher.end() - 1);
            pos = pathMatcher.end();
            startNode = doStep(step, startNode);
        }
        startNode = doStep(path.substring(pos), startNode);
        return startNode;
    }
601065
public Tree parent(Tree root) {
        List<Tree> kids = root.children();
        return traverse(root, kids, this);
    }
922293
public ScriptNode transformTree(AstRoot root) {
        currentScriptOrFn = root;
        this.inUseStrictDirective = root.isInStrictMode();
        int sourceStartOffset = decompiler.getCurrentOffset();

        if (Token.printTrees) {
            System.out.println("IRFactory.transformTree");
            System.out.println(root.debugPrint());
        }
        ScriptNode script = (ScriptNode)transform(root);

        int sourceEndOffset = decompiler.getCurrentOffset();
        script.setEncodedSourceBounds(sourceStartOffset,
                                      sourceEndOffset);

        if (compilerEnv.isGeneratingSource()) {
            script.setEncodedSource(decompiler.getEncodedSource());
        }

        decompiler = null;
        return script;
    }
679689
public static UnindexedMatcher matcherWithSelector(Map<String, Object> selector) {
        ChildrenQueryNode root = buildExecutionTreeForSelector(selector);

        if (root == null) {
            return null;
        }

        UnindexedMatcher matcher = new UnindexedMatcher();
        matcher.root = root;

        return matcher;
    }
1112044
public void setRoot(int root)
  {
    super.setRoot(root);
    m_iterator = getDTM(root).getAxisIterator(m_axis);
    m_iterator.setStartNode(root);
  }
497019
public static List<File> listDirectories( File root ) {

		List<File> result = new ArrayList<> ();
		File[] files = root.listFiles( new DirectoryFileFilter());
		if( files != null )
			result.addAll( Arrays.asList( files ));

		Collections.sort( result, new FileNameComparator());
		return result;
	}
1169986
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;
    }
1080510
public JavaCompiler processAnnotations(List<JCCompilationUnit> roots) {
        return processAnnotations(roots, List.<String>nil());
    }
1269110
public static Set<IBond> findMappedBonds(IReaction reaction) {
        Set<IBond> mapped = new HashSet<>();

        // first we collect the occurrance of mapped bonds from reacants then products
        Set<IntTuple> mappedReactantBonds = new HashSet<>();
        Set<IntTuple> mappedProductBonds  = new HashSet<>();
        for (IAtomContainer reactant : reaction.getReactants().atomContainers()) {
            for (IBond bond : reactant.bonds()) {
                Integer begidx = bond.getBegin().getProperty(CDKConstants.ATOM_ATOM_MAPPING);
                Integer endidx = bond.getEnd().getProperty(CDKConstants.ATOM_ATOM_MAPPING);
                if (begidx != null && endidx != null)
                    mappedReactantBonds.add(new IntTuple(begidx, endidx));
            }
        }
        // fail fast
        if (mappedReactantBonds.isEmpty())
            return Collections.emptySet();

        for (IAtomContainer product : reaction.getProducts().atomContainers()) {
            for (IBond bond : product.bonds()) {
                Integer begidx = bond.getBegin().getProperty(CDKConstants.ATOM_ATOM_MAPPING);
                Integer endidx = bond.getEnd().getProperty(CDKConstants.ATOM_ATOM_MAPPING);
                if (begidx != null && endidx != null)
                    mappedProductBonds.add(new IntTuple(begidx, endidx));
            }
        }
        // fail fast
        if (mappedProductBonds.isEmpty())
            return Collections.emptySet();

        // repeat above but now store any that are different or unmapped as being mapped
        for (IAtomContainer reactant : reaction.getReactants().atomContainers()) {
            for (IBond bond : reactant.bonds()) {
                Integer begidx = bond.getBegin().getProperty(CDKConstants.ATOM_ATOM_MAPPING);
                Integer endidx = bond.getEnd().getProperty(CDKConstants.ATOM_ATOM_MAPPING);
                if (begidx != null && endidx != null && mappedProductBonds.contains(new IntTuple(begidx, endidx)))
                    mapped.add(bond);
            }
        }
        for (IAtomContainer product : reaction.getProducts().atomContainers()) {
            for (IBond bond : product.bonds()) {
                Integer begidx = bond.getBegin().getProperty(CDKConstants.ATOM_ATOM_MAPPING);
                Integer endidx = bond.getEnd().getProperty(CDKConstants.ATOM_ATOM_MAPPING);
                if (begidx != null && endidx != null && mappedReactantBonds.contains(new IntTuple(begidx, endidx)))
                    mapped.add(bond);
            }
        }
        return mapped;
    }
1037539
public static ActionConfig imports(Xml root)
    {
        Check.notNull(root);

        final Xml nodeAction = root.getChild(NODE_ACTION);
        final String name = nodeAction.readString(ATT_NAME);
        final String description = nodeAction.readString(ATT_DESCRIPTION);
        final int x = nodeAction.readInteger(ATT_X);
        final int y = nodeAction.readInteger(ATT_Y);
        final int width = nodeAction.readInteger(ATT_WIDTH);
        final int height = nodeAction.readInteger(ATT_HEIGHT);

        return new ActionConfig(name, description, x, y, width, height);
    }
130242
public static ProducibleConfig imports(Xml root)
    {
        Check.notNull(root);

        final Xml node = root.getChild(NODE_PRODUCIBLE);
        final SizeConfig size = SizeConfig.imports(root);
        final int time = node.readInteger(ATT_STEPS);

        return new ProducibleConfig(time, size.getWidth(), size.getHeight());
    }
214747
private Element searchForKey(final Element root, final String key, final String tagName) {
        if (root == null || StringUtils.isEmptyString(key)) {
            return null;
        }
        final Queue<Element> queue = new LinkedList<>();
        queue.offer(root);

        while (!queue.isEmpty()) {
            final Element pe = queue.poll();
            final NodeList pchildrenList = pe.getChildNodes();
            for (int i = 0; i < pchildrenList.getLength(); i++) {
                final Node node = pchildrenList.item(i);
                if (node.getNodeType() == Node.ELEMENT_NODE) {
                    queue.offer((Element)node);
                }
            }
            String value = pe.getNodeName();
            if (StringUtils.isEmptyString(value)||
                    !value.equals(tagName)) {
                continue;
            }

            value = pe.getAttribute(ATTRIBUTE_NAME_NAME);
            if (StringUtils.isEmptyString(value)) {
                continue;
            }

            if (value.equals(key)) {
                return pe;
            }
        }
        return null;
    }
697666
public static <T, R> TreeNode<R> copy(TreeDef<T> treeDef, T root, Function<? super T, ? extends R> mapper) {
		List<T> children = treeDef.childrenOf(root);
		R mapped = mapper.apply(root);
		TreeNode<R> copyRoot = new TreeNode<>(null, mapped, children.size());
		copyRecurse(copyRoot, treeDef, root, children, mapper);
		return copyRoot;
	}