本文整理汇总了Java中org.pegdown.ast.Node.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getChildren方法的具体用法?Java Node.getChildren怎么用?Java Node.getChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pegdown.ast.Node
的用法示例。
在下文中一共展示了Node.getChildren方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: lookupChild
import org.pegdown.ast.Node; //导入方法依赖的package包/类
public static Node lookupChild(Node node, Class<? extends Node>... childClasses) {
Node child = node;
for (Class<? extends Node> childClass : childClasses) {
if(child==null)
return null;
List<Node> children = child.getChildren();
if(children==null || children.isEmpty())
return null;
child = children.get(0);
if (!childClass.isInstance(child))
return null;
}
return child;
}
示例2: query
import org.pegdown.ast.Node; //导入方法依赖的package包/类
public Optional<TreeNavigation> query(TreeNavigation nav) {
int len = nav.numberOfAncestors();
if (len <= 1)
return Optional.absent();
List<Node> ancestors = nav.ancestorsStack();
Node n = ancestors.get(len - 1);
Node p = ancestors.get(len - 2);
Node s = null;
for (Node sibling : p.getChildren()) {
if (sibling == n) {
if (s == null) {
return Optional.absent();
}
List<Node> nodes = Lists.newArrayList(ancestors.subList(0, len - 2));
nodes.add(s);
return Optional.of(new TreeNavigation(nodes));
}
s = sibling;
}
return Optional.absent();
}
示例3: xwithIndicesShifted
import org.pegdown.ast.Node; //导入方法依赖的package包/类
Node xwithIndicesShifted(Node node, int delta) {
((AbstractNode) node).shiftIndices(delta);
for (Node subNode : node.getChildren()) {
xwithIndicesShifted(subNode, delta);
}
return node;
}
示例4: traverse
import org.pegdown.ast.Node; //导入方法依赖的package包/类
public void traverse(Node node) {
if (node instanceof ReferenceNode) {
declareReference((ReferenceNode) node);
}
for (Node child : node.getChildren()) {
traverse(child);
}
}
示例5: isValidNodeGroup
import org.pegdown.ast.Node; //导入方法依赖的package包/类
public static boolean isValidNodeGroup(Node node) {
boolean result = true;
for (Node child : node.getChildren()) {
result = result && isValidTextNode(child);
}
return result;
}
示例6: isValidNodeGroup
import org.pegdown.ast.Node; //导入方法依赖的package包/类
public static boolean isValidNodeGroup(Node node) {
if (node.getChildren().size() != 1) return false;
boolean result = true;
for (Node child : node.getChildren()) {
result = result && isValidImageNode(child);
}
return result;
}
示例7: dump
import org.pegdown.ast.Node; //导入方法依赖的package包/类
public void dump(int indent, Node node) {
String prefix = indent(indent);
out.append(prefix).append(toString(node)).append('\n');
for (Node child : node.getChildren())
dump(indent + 1, child);
}