org.jboss.shrinkwrap.descriptor.spi.node.Node.getChildren()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中org.jboss.shrinkwrap.descriptor.spi.node.Node.getChildren()方法的一些代码示例,展示了Node.getChildren()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getChildren()方法的具体详情如下:
包路径:org.jboss.shrinkwrap.descriptor.spi.node.Node
类名称:Node
方法名:getChildren

Node.getChildren介绍

[英]Get all the defined children for this node in an immutable view.
[中]在不可变视图中获取此节点的所有已定义子级。

代码示例

代码示例来源:origin: org.jboss.shrinkwrap.descriptors/shrinkwrap-descriptors-spi

  1. protected List<Node> findMatch(Node start, List<Pattern> patterns) {
  2. // Get the next pattern in sequence
  3. final Pattern pattern = patterns.get(0);
  4. if (!pattern.matches(start)) {
  5. return Collections.emptyList();
  6. }
  7. // Hold the matched Nodes
  8. final List<Node> matchedNodes = new ArrayList<Node>();
  9. if (patterns.size() == 1) {
  10. matchedNodes.add(start);
  11. return matchedNodes;
  12. }
  13. for (final Node child : start.getChildren()) {
  14. // Only use patterns that haven't already matched
  15. final List<Pattern> remainingPatterns = patterns.subList(1, patterns.size());
  16. // Recursion point
  17. matchedNodes.addAll(findMatch(child, remainingPatterns));
  18. }
  19. return matchedNodes;
  20. }

代码示例来源:origin: org.projectodd.shrinkwrap.descriptors/shrinkwrap-descriptors-spi

  1. protected List<Node> findMatch(Node start, List<Pattern> patterns) {
  2. // Get the next pattern in sequence
  3. final Pattern pattern = patterns.get(0);
  4. if (!pattern.matches(start)) {
  5. return Collections.emptyList();
  6. }
  7. // Hold the matched Nodes
  8. final List<Node> matchedNodes = new ArrayList<Node>();
  9. if (patterns.size() == 1) {
  10. matchedNodes.add(start);
  11. return matchedNodes;
  12. }
  13. for (final Node child : start.getChildren()) {
  14. // Only use patterns that haven't already matched
  15. final List<Pattern> remainingPatterns = patterns.subList(1, patterns.size());
  16. // Recursion point
  17. matchedNodes.addAll(findMatch(child, remainingPatterns));
  18. }
  19. return matchedNodes;
  20. }

代码示例来源:origin: org.projectodd.shrinkwrap.descriptors/shrinkwrap-descriptors-spi

  1. private List<Node> findMatch(final Node start, final List<Pattern> patternSequence,
  2. final List<Pattern> entirePatternSequence) {
  3. // Hold the matched Nodes
  4. final List<Node> matchedNodes = new ArrayList<Node>();
  5. // Get the next pattern in sequence
  6. final Pattern pattern = patternSequence.get(0);
  7. // See if we've got a match
  8. if (pattern.matches(start)) {
  9. // If no more patterns to check, we're at the end of the line; just add this Node
  10. if (patternSequence.size() == 1) {
  11. matchedNodes.add(start);
  12. } else {
  13. for (final Node child : start.getChildren()) {
  14. // Only use patterns that haven't already matched
  15. final List<Pattern> remainingPatterns = patternSequence.subList(1, patternSequence.size());
  16. // Recursion point
  17. matchedNodes.addAll(findMatch(child, remainingPatterns, entirePatternSequence));
  18. }
  19. }
  20. }
  21. // Apply whole pattern sequence starting from the subtrees
  22. // created by node's children
  23. for (final Node child : start.getChildren()) {
  24. matchedNodes.addAll(findMatch(child, entirePatternSequence, entirePatternSequence));
  25. }
  26. return matchedNodes;
  27. }

代码示例来源:origin: org.jboss.shrinkwrap.descriptors/shrinkwrap-descriptors-spi

  1. private List<Node> findMatch(final Node start, final List<Pattern> patternSequence,
  2. final List<Pattern> entirePatternSequence) {
  3. // Hold the matched Nodes
  4. final List<Node> matchedNodes = new ArrayList<Node>();
  5. // Get the next pattern in sequence
  6. final Pattern pattern = patternSequence.get(0);
  7. // See if we've got a match
  8. if (pattern.matches(start)) {
  9. // If no more patterns to check, we're at the end of the line; just add this Node
  10. if (patternSequence.size() == 1) {
  11. matchedNodes.add(start);
  12. } else {
  13. for (final Node child : start.getChildren()) {
  14. // Only use patterns that haven't already matched
  15. final List<Pattern> remainingPatterns = patternSequence.subList(1, patternSequence.size());
  16. // Recursion point
  17. matchedNodes.addAll(findMatch(child, remainingPatterns, entirePatternSequence));
  18. }
  19. }
  20. }
  21. // Apply whole pattern sequence starting from the subtrees
  22. // created by node's children
  23. for (final Node child : start.getChildren()) {
  24. matchedNodes.addAll(findMatch(child, entirePatternSequence, entirePatternSequence));
  25. }
  26. return matchedNodes;
  27. }

代码示例来源:origin: org.jboss.shrinkwrap.descriptors/shrinkwrap-descriptors-spi

  1. for (Node sourceChild : source.getChildren()) {
  2. writeRecursive(targetChild, sourceChild);

代码示例来源:origin: org.projectodd.shrinkwrap.descriptors/shrinkwrap-descriptors-spi

  1. for (Node sourceChild : source.getChildren()) {
  2. writeRecursive(targetChild, sourceChild);

代码示例来源:origin: org.projectodd.shrinkwrap.descriptors/shrinkwrap-descriptors-spi

  1. /**
  2. * Copies <code>this</code> reference to the specified {@link Node}
  3. * @param copyTarget
  4. * @return
  5. */
  6. private Node deepCopy(final Node copyTarget){
  7. // Precondition checks
  8. assert copyTarget != null : "Node to copy information into must be specified";
  9. // Set attributes
  10. final Map<String, String> attributes = this.getAttributes();
  11. final Set<String> attributeKeys = attributes.keySet();
  12. for (final String key : attributeKeys) {
  13. final String value = attributes.get(key);
  14. copyTarget.attribute(key, value);
  15. }
  16. // Set text
  17. copyTarget.text(this.getText());
  18. // Set children
  19. final List<Node> children = this.getChildren();
  20. for (final Node child : children) {
  21. final Node newChild = copyTarget.createChild(child.getName());
  22. // Recurse in
  23. child.deepCopy(newChild);
  24. }
  25. // Return
  26. return this;
  27. }

代码示例来源:origin: org.jboss.shrinkwrap.descriptors/shrinkwrap-descriptors-spi

  1. /**
  2. * Copies <code>this</code> reference to the specified {@link Node}
  3. * @param copyTarget
  4. * @return
  5. */
  6. private Node deepCopy(final Node copyTarget){
  7. // Precondition checks
  8. assert copyTarget != null : "Node to copy information into must be specified";
  9. // Set attributes
  10. final Map<String, String> attributes = this.getAttributes();
  11. final Set<String> attributeKeys = attributes.keySet();
  12. for (final String key : attributeKeys) {
  13. final String value = attributes.get(key);
  14. copyTarget.attribute(key, value);
  15. }
  16. // Set text
  17. copyTarget.text(this.getText());
  18. // Set children
  19. final List<Node> children = this.getChildren();
  20. for (final Node child : children) {
  21. final Node newChild = copyTarget.createChild(child.getName());
  22. // Recurse in
  23. child.deepCopy(newChild);
  24. }
  25. // Return
  26. return this;
  27. }

相关文章