Checks whether the given node is relevant for this rule, and, if so, checks whether the node
conforms to the rule. Intended to be called only from {@link SoyConformance}.
764542
final void checkConformance(Node node, ErrorReporter errorReporter) {
    if (nodeClass.isAssignableFrom(node.getClass())) {
      doCheckConformance(nodeClass.cast(node), errorReporter);
    }
  }
209901
Optional<SoyExpression> compileWithNoDetaches(ExprNode node) {
    checkNotNull(node);
    if (RequiresDetachVisitor.INSTANCE.exec(node)) {
      return Optional.absent();
    }
    Supplier<ExpressionDetacher> throwingSupplier =
        () -> {
          throw new AssertionError();
        };
    return Optional.of(
        new CompilerVisitor(parameters, varManager, throwingSupplier, reporter, registry)
            .exec(node));
  }
299237
@Override
  public boolean visit(MethodDeclaration node) {
    if (isSerializationMethod(node.getExecutableElement())) {
      node.remove();
    }
    return false;
  }
1276119
function checkForSemicolonForVariableDeclaration(node) {
				var ancestors = context.getAncestors(),
					parentIndex = ancestors.length - 1,
					parent = ancestors[parentIndex];

				if ((parent.type !== "ForStatement" || parent.init !== node) &&
					(!/^For(?:In|Of)Statement/.test(parent.type) || parent.left !== node)
				) {
					checkForSemicolon(node);
				}
			}
1089609
@Override
  protected void visitSoyFileSetNode(SoyFileSetNode node) {
    // Figure out the generated class name for each Soy file, including adding number suffixes
    // to resolve collisions, and then adding the common suffix "SoyInfo".
    Multimap<String, SoyFileNode> baseGeneratedClassNameToSoyFilesMap = HashMultimap.create();
    for (SoyFileNode soyFile : node.getChildren()) {
      baseGeneratedClassNameToSoyFilesMap.put(
          javaClassNameSource.generateBaseClassName(soyFile), soyFile);
    }
    soyFileToJavaClassNameMap = Maps.newHashMap();
    for (String baseClassName : baseGeneratedClassNameToSoyFilesMap.keySet()) {
      Collection<SoyFileNode> soyFiles = baseGeneratedClassNameToSoyFilesMap.get(baseClassName);
      if (soyFiles.size() == 1) {
        for (SoyFileNode soyFile : soyFiles) {
          soyFileToJavaClassNameMap.put(soyFile, baseClassName + "SoyInfo");
        }
      } else {
        int numberSuffix = 1;
        for (SoyFileNode soyFile : soyFiles) {
          soyFileToJavaClassNameMap.put(soyFile, baseClassName + numberSuffix + "SoyInfo");
          numberSuffix++;
        }
      }
    }

    // Run the pass.
    for (SoyFileNode soyFile : node.getChildren()) {
      visit(soyFile);
    }
  }
195777
private boolean checkMatch() {
        if (matchList == null) {
            return true;
        }
        final int matchSize = matchList.size();
        final int ancestorSize = topicIdList.size();
        final List<String> tail = topicIdList.subList(ancestorSize - matchSize, ancestorSize);
        return matchList.equals(tail);
    }
1227976
protected boolean doesParentMatch(final CSNodeWrapper parent, final CSNodeWrapper entityParent) {
        if (parent != null && entityParent != null) {
            if (parent.getId() != null && parent.getId().equals(entityParent.getId())) {
                return true;
            } else if (parent.getId() == null && entityParent.getId() == null && parent == entityParent) {
                return true;
            } else {
                return false;
            }
        } else if (parent == null && entityParent == null) {
            return true;
        } else {
            return false;
        }
    }
1129047
public static void checkNode(Node node, Node.Type... validTypes) {
		for (Node.Type type : validTypes) {
			if (node.getNodeType() == type) {
				return;
			}
		}
		StringJoiner sj = new StringJoiner(", ");
		for (Node.Type type : validTypes) {
			sj.add(type.toString());
		}
		String nodeName = node.getNodeType().name();
		if (node instanceof NameBearer) {
			nodeName = ((NameBearer) node).getName();
		}
		throw new FuzzerException(nodeName + ": invalid, must be one of " + sj.toString());
	}
1045685
public static boolean hasMixin(final Node node) {
        try {
            return node.isNodeType(FEDORA_TOMBSTONE);
        } catch (final RepositoryException e) {
            throw new RepositoryRuntimeException(e);
        }
    }
851662
function check(node) {
            if (TARGET_NODE_TYPE.test(node.parent.type) &&
                isMixedWithParent(node) &&
                !shouldIgnore(node)
            ) {
                reportBothOperators(node);
            }
        }
335106
@Override
    public boolean accept(final Node aNode) {

        // Only deal with Element nodes.
        if (aNode.getNodeType() != Node.ELEMENT_NODE) {
            return false;
        }

        // We should accept:
        //
        // 1) A simpleType Element
        // 2) An enumeration Element
        final Element theElement = (Element) aNode;

        final String localName = theElement.getLocalName();
        if (localName != null) {

            final String trimmed = localName.trim();
            return trimmed.equalsIgnoreCase("enumeration")
                    || trimmed.equalsIgnoreCase("simpleType");
        }

        /*
        <xs:simpleType name="foodPreference">
            <!-- ClassLocation JavaDocData insertion point -->

            <xs:restriction base="xs:string">

                <!-- FieldLocation or MethodLocation JavaDocData insertion point (within child) -->
                <xs:enumeration value="NONE"/>

                <!-- FieldLocation or MethodLocation JavaDocData insertion point (within child) -->
                <xs:enumeration value="LACTO_VEGETARIAN"/>

                <!-- FieldLocation or MethodLocation JavaDocData insertion point (within child) -->
                <xs:enumeration value="VEGAN"/>

            </xs:restriction>
        </xs:simpleType>
         */

        /*
  <xs:simpleType name="foodPreference">
    <xs:restriction base="xs:string">
      <xs:enumeration value="NONE"/>
      <xs:enumeration value="LACTO_VEGETARIAN"/>
      <xs:enumeration value="VEGAN"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="americanCoin">
    <xs:restriction base="xs:int">
      <xs:enumeration value="25"/>
      <xs:enumeration value="1"/>
      <xs:enumeration value="5"/>
      <xs:enumeration value="10"/>
    </xs:restriction>
  </xs:simpleType>
        */

        // All done.
        return false;
    }
594863
protected void isElementWellFormed(Node node) {
        boolean isNameWF = false;
        if ((fFeatures & NAMESPACES) != 0) {
            isNameWF =
                isValidQName(
                    node.getPrefix(),
                    node.getLocalName(),
                    fIsXMLVersion11);
        } else {
            isNameWF = isXMLName(node.getNodeName(), fIsXMLVersion11);
        }

        if (!isNameWF) {
            String msg =
                Utils.messages.createMessage(
                    MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME,
                    new Object[] { "Element", node.getNodeName()});

            if (fErrorHandler != null) {
                fErrorHandler.handleError(
                    new DOMErrorImpl(
                        DOMError.SEVERITY_FATAL_ERROR,
                        msg,
                        MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME,
                        null,
                        null,
                        null));
            }
        }
    }
1354462
private boolean areChildrenComputableAsJsExprs(ParentSoyNode<?> node) {

    for (SoyNode child : node.getChildren()) {
      if (canSkipChild(child)) {
        continue;
      }
      if (!visit(child)) {
        return false;
      }
    }

    return true;
  }
204159
public boolean isAncestor(XMLNode node) {
		return node == parent || (parent != null && parent.isAncestor(node));
	}
56667
@Override
  protected boolean hasOverflow(FlatRStarTreeNode node) {
    if(node.isLeaf()) {
      return node.getNumEntries() == leafCapacity;
    }
    else if(node.getNumEntries() == node.getCapacity()) {
      node.increaseEntries();
    }
    return false;
  }
696001
public static boolean isVersion(Node node)
   {
      try
      {
         if (node.isNodeType("nt:version"))
            return true;
         return false;
      }
      catch (RepositoryException exc)
      {
         LOG.error(exc.getMessage(), exc);
         return false;
      }
   }
1280312
Content scanFormulaNode(Element formulaNode) throws Exception {
        // first off, try scanning for a semantic split, this indicates multiple semantics
        Boolean containsSemantic = XMLHelper.getElementB(formulaNode, xPath.compile("//m:semantics")) != null;

        // check if there is an annotationNode and if so check which semantics are present
        Element annotationNode = (Element) XMLHelper.getElementB(formulaNode, xPath.compile("//m:annotation-xml"));
        Boolean containsCMML = annotationNode != null && annotationNode.getAttribute("encoding").equals("MathML-Content");
        Boolean containsPMML = annotationNode != null && annotationNode.getAttribute("encoding").equals("MathML-Presentation");

        // if apply are present, the content semantics is used somewhere
        NonWhitespaceNodeList applyNodes = new NonWhitespaceNodeList(XMLHelper.getElementsB(formulaNode, xPath.compile("//m:apply")));
        containsCMML |= applyNodes.getLength() > 0;

        // if mrow nodes are present, the presentation semantic is used somewhere
        NonWhitespaceNodeList mrowNodes = new NonWhitespaceNodeList(XMLHelper.getElementsB(formulaNode, xPath.compile("//m:mrow")));
        containsPMML |= mrowNodes.getLength() > 0;

        // TODO the containCMML and -PMML can be more specific, e.g. check if identifiers of each semantics is present
        if (containsSemantic) {
            // if semantic separator is present plus one opposite semantic, we assume a LaTeXML produced content
            return containsCMML || containsPMML ? Content.mathml : Content.unknown;
        } else {
            if (containsCMML && containsPMML) {
                // both semantics without semantic separator suggests broken syntax
                return Content.unknown;
            } else if (containsCMML) {
                return Content.cmml;
            } else if (containsPMML) {
                return Content.pmml;
            }
        }

        // next, try to identify latex
        Element child = (Element) XMLHelper.getElementB(formulaNode, "./*[1]");
        // if there is no child node, we currently anticipate some form of latex formula
        if (child == null && StringUtils.isNotEmpty(formulaNode.getTextContent())) {
            return Content.latex;
        }

        // found nothing comprehensible
        return Content.unknown;
    }