Reads the content score.

@param node
@return
10541
private static int getContentScore(Element node) {
        try {
            return Integer.parseInt(node.attr(CONTENT_SCORE));
        } catch (NumberFormatException e) {
            return 0;
        }
    }
243321
@SuppressWarnings("ConstantConditions")  // Complains that the code is too complex. Well duh!
  public static double scoreTree0(byte[] tree, double[] row, boolean computeLeafAssignment) {
    ByteBufferWrapper ab = new ByteBufferWrapper(tree);
    GenmodelBitSet bs = null;  // Lazily set on hitting first group test
    long bitsRight = 0;
    int level = 0;
    while (true) {
      int nodeType = ab.get1U();
      int colId = ab.get2();
      if (colId == 65535) return ab.get4f();
      int naSplitDir = ab.get1U();
      boolean naVsRest = naSplitDir == NsdNaVsRest;
      boolean leftward = naSplitDir == NsdNaLeft || naSplitDir == NsdLeft;
      int lmask = (nodeType & 51);
      int equal = (nodeType & 12);  // Can be one of 0, 8, 12
      assert equal != 4;  // no longer supported

      float splitVal = -1;
      if (!naVsRest) {
        // Extract value or group to split on
        if (equal == 0) {
          // Standard float-compare test (either < or ==)
          splitVal = ab.get4f();  // Get the float to compare
        } else {
          // Bitset test
          if (bs == null) bs = new GenmodelBitSet(0);
          if (equal == 8)
            bs.fill2(tree, ab);
          else
            bs.fill3_1(tree, ab);
        }
      }

      double d = row[colId];
      if (Double.isNaN(d)? !leftward : !naVsRest && (equal == 0? d >= splitVal : bs.contains0((int)d))) {
        // go RIGHT
        switch (lmask) {
          case 0:  ab.skip(ab.get1U());  break;
          case 1:  ab.skip(ab.get2());  break;
          case 2:  ab.skip(ab.get3());  break;
          case 3:  ab.skip(ab.get4());  break;
          case 48: ab.skip(4);  break;  // skip the prediction
          default:
            assert false : "illegal lmask value " + lmask + " in tree " + Arrays.toString(tree);
        }
        if (computeLeafAssignment && level < 64) bitsRight |= 1 << level;
        lmask = (nodeType & 0xC0) >> 2;  // Replace leftmask with the rightmask
      } else {
        // go LEFT
        if (lmask <= 3)
          ab.skip(lmask + 1);
      }

      level++;
      if ((lmask & 16) != 0) {
        if (computeLeafAssignment) {
          bitsRight |= 1 << level;  // mark the end of the tree
          return Double.longBitsToDouble(bitsRight);
        } else {
          return ab.get4f();
        }
      }
    }
  }
896395
private static final String getKey(ObjectNode node) {
        JsonNode apiVersion = node.get(API_VERSION);
        JsonNode kind = node.get(KIND);

        return getKey(apiVersion != null ? apiVersion.textValue() : null,
                      kind != null ? kind.textValue() : null);
    }
483434
function (node) {
        if (node.nodeType != 1 || !dtd.$removeEmpty[ node.tagName ]) {
            return 0;
        }
        node = node.firstChild;
        while (node) {
            //如果是创建的bookmark就跳过
            if (domUtils.isBookmarkNode(node)) {
                return 0;
            }
            if (node.nodeType == 1 && !domUtils.isEmptyInlineElement(node) ||
                node.nodeType == 3 && !domUtils.isWhitespace(node)
                ) {
                return 0;
            }
            node = node.nextSibling;
        }
        return 1;

    }
610069
protected long determineBalance(final IntervalTreeNode node) {
        if (node == null) {
            return 0L;
        }

        return (node.hasLeft() ? node.getLeft().getHeight() : 0) -
                (node.hasRight() ? node.getRight().getHeight() : 0);
    }
1152848
private int getElementIndex(Node node) {
        final String nodeName = node.getNodeName();

        int count = 1;
        for (Node previousSibling = node.getPreviousSibling();
                previousSibling != null;
                previousSibling = previousSibling.getPreviousSibling()) {
            if (previousSibling.getNodeType() == Node.ELEMENT_NODE
                    && previousSibling.getNodeName().equals(nodeName)) {
                count++;
            }
        }

        return count;
    }
424830
public boolean matches(final Node node) throws IllegalArgumentException {
        // Precondition checks
        if (node == null) {
            throw new IllegalArgumentException("node must be specified");
        }

        if (!name.equals(node.getName())) {
            return false;
        }

        if ((text != null && node.getText() == null) || (text != null && !text.trim().equals(node.getText().trim()))) {
            return false;
        }

        if (attributes != null) {
            for (final Map.Entry<String, String> attribute : attributes.entrySet()) {
                final String attrValue = attribute.getValue();
                final String attrName = attribute.getKey();

                if (!attrValue.equals(node.getAttribute(attrName))) {
                    return false;
                }
            }
        }

        return true;
    }
183671
protected void parse(Node node) {
		NodeList childNodes = node.getChildNodes();
		for (int i = 0; i < childNodes.getLength(); i++) {
			Node child = childNodes.item(i);
			String nodeName = child.getNodeName();
			if ("Name".equalsIgnoreCase(nodeName)) {
				name = getValueRecursive(child);
			} else if ("Title".equalsIgnoreCase(nodeName)) {
				title = getValueRecursive(child);
			} else if ("Abstract".equalsIgnoreCase(nodeName)) {
				abstractt = getValueRecursive(child);
			} else if ("LegendURL".equalsIgnoreCase(nodeName)) {
				legendUrl = createLegendInfo(child);
			}
		}
	}
490318
@Override
	protected void parse(Node node) {
		NamedNodeMap attributes = node.getAttributes();
		version = getValueRecursive(attributes.getNamedItem("version"));
		tilemapservice = getValueRecursive(attributes.getNamedItem("tilemapservice"));

		NodeList childNodes = node.getChildNodes();
		for (int i = 0; i < childNodes.getLength(); i++) {
			Node child = childNodes.item(i);
			String nodeName = child.getNodeName();
			if ("Title".equalsIgnoreCase(nodeName)) {
				title = getValueRecursive(child);
			} else if ("Abstract".equalsIgnoreCase(nodeName)) {
				abstractt = getValueRecursive(child);
			} else if ("SRS".equalsIgnoreCase(nodeName)) {
				srs = getValueRecursive(child);
			} else if ("BoundingBox".equalsIgnoreCase(nodeName)) {
				boundingBox = getBoundingBox(child);
			} else if ("Origin".equalsIgnoreCase(nodeName)) {
				origin = getCoordinate(child);
			} else if ("TileFormat".equalsIgnoreCase(nodeName)) {
				tileFormat = new TileFormatInfo100(child);
			} else if ("TileSets".equalsIgnoreCase(nodeName)) {
				addTileSets(child);
			}
		}
		if (title == null) {
			throw new IllegalArgumentException("Cannot parse XML into a TileMapInfo object.");
		}
		setParsed(true);
	}
729453
public static Map<String, Object> xmlToMap(Node node) {
		return xmlToMap(node, new HashMap<String, Object>());
	}
315011
private String readContent(java.io.InputStream in) throws Exception {

        StringBuffer resultBuffer = new StringBuffer();
        SAXReader reader = new SAXReader();
        Document doc = reader.read(in);
        List<Node> textlist = CmsXmlGenericWrapper.selectNodes(doc, "//text:p[@*] | //text:span[@*]");
        Iterator<Node> li = textlist.iterator();
        while (li.hasNext()) {
            Node textNode = li.next();
            String text = textNode.getText();
            if (text.length() > 1) {
                text = " " + text + " ";
                resultBuffer.append(text);
            }
        }
        return resultBuffer.toString();
    }
300510
def _load_score(self):
        """"""
        score = int(self.score_file.read())
        self.score_file.seek(0, os.SEEK_SET)
        return score
244546
private boolean computeScore(Sentence sentence, SmartForest<Double> forest, boolean offset) {
		SmartGetWord<Double> sgw = new SmartGetWord<Double>(forest, sentence.value.toLowerCase());
		String name = null;
		boolean flag = false;
		while ((name = sgw.getFrontWords()) != null) {
			flag = true;
			sentence.updateScore(name, sgw.getParam());
			if (offset) {
				Triplet<Integer, Integer, Double> triplet = new Triplet<Integer, Integer, Double>(sgw.offe, sgw.offe+name.length(), sgw.getParam());
				sentence.offset.add(triplet);
			}
		}
		if (sentence.score == 0) {
			sentence.score = sentence.value.length() * -0.005;
		} else {
			sentence.score /= Math.log(sentence.value.length() + 3);
		}

		return flag;
	}
1089809
private ImmutableMap<String, Expression> getStaticAttributes(HtmlOpenTagNode node) {
    List<HtmlAttributeNode> nodesToRemove = new ArrayList<>();
    ImmutableMap.Builder<String, Expression> builder = ImmutableMap.builder();
    // The 0th index is actually the tag itself, so we don't need to iterate over it.
    for (int i = 1; i < node.numChildren(); i++) {
      if (node.getChild(i) instanceof HtmlAttributeNode) {
        HtmlAttributeNode attrNode = (HtmlAttributeNode) node.getChild(i);
        String attributeKey = attrNode.getStaticKey();
        Expression value = getStaticContent(attrNode);
        if (attributeKey != null && value != null) {
          nodesToRemove.add(attrNode);
          builder.put(attributeKey, value);
        }
      }
    }

    for (HtmlAttributeNode child : nodesToRemove) {
      node.removeChild(child);
    }
    return builder.build();
  }
794472
public static String getNodeTitle(Node node) {
        String result = null;
        try {
            Property title = node.getProperty(JCR_TITLE);
            if (title != null) {
                result = title.getString();
            }
        } catch (RepositoryException rex) {
            LOG.error(rex.getMessage(), rex);
        }
        return result;
    }
7910
private static Stream<Node> streamAttributes(Node node) {
        final NamedNodeMap attributes = node.getAttributes();
        if (attributes == null) return Stream.empty();
        return IntStream.range(0, attributes.getLength()).mapToObj(attributes::item);
    }
293670
public static int nodeHashCode(final Node node) {
        assert node != null;
        int hash = 1 + node.getNodeType();
        hash = (hash * 17) + Arrays.hashCode(getNodeAttributes(node));
        if (node.hasAttributes()) {
            NamedNodeMap nodeMap = node.getAttributes();
            for (int i = 0; i < nodeMap.getLength(); ++i) {
                hash = (31 * hash) + nodeHashCode(nodeMap.item(i));
            }
        }
        if (node.hasChildNodes()) {
            NodeList childNodes = node.getChildNodes();
            for (int i = 0; i < childNodes.getLength(); ++i) {
                hash = (hash * 47) + nodeHashCode(childNodes.item(i));
            }
        }
        return hash;
    }