Examples of SequenceNode


Examples of org.terasology.logic.behavior.tree.SequenceNode

        String jsonActual = os.toString();
        Assert.assertEquals(jsonActual, jsonExpected);
    }

    private BehaviorTreeData buildSample() {
        SequenceNode sequence = new SequenceNode();
        sequence.children().add(new DebugNode(1));
        sequence.children().add(new RepeatNode(new DebugNode(2)));
        ParallelNode parallel = new ParallelNode(ParallelNode.Policy.RequireAll, ParallelNode.Policy.RequireAll);
        sequence.children().add(parallel);
        parallel.children().add(new MonitorNode());
        parallel.children().add(new DebugNode(3));
        BehaviorTreeData tree = new BehaviorTreeData();
        tree.setRoot(sequence);
        tree.createRenderable();
View Full Code Here

Examples of org.terasology.logic.behavior.tree.SequenceNode

            @Override
            public void mock(Task spy) {
                spies[1] = spy;
            }
        });
        SequenceNode node = new SequenceNode();
        node.children().add(one);
        node.children().add(two);

        Task selector = interpreter.start(node);
        interpreter.tick(0);
        Assert.assertEquals(Status.RUNNING, selector.getStatus());
        interpreter.tick(0);
View Full Code Here

Examples of org.terasology.logic.behavior.tree.SequenceNode

            public void mock(Task spy) {
                when(spy.update(anyInt())).thenReturn(Status.RUNNING);
                spies[1] = spy;
            }
        });
        SequenceNode node = new SequenceNode();
        node.children().add(one);
        node.children().add(two);

        Task selector = interpreter.start(node);
        interpreter.tick(0);
        Assert.assertEquals(Status.RUNNING, selector.getStatus());
        interpreter.tick(0);
View Full Code Here

Examples of org.terasology.logic.behavior.tree.SequenceNode

                public void mock(Task spy) {
                    when(spy.update(0)).thenReturn(Status.RUNNING, status);
                    spies[0] = spy;
                }
            });
            SequenceNode node = new SequenceNode();

            node.children().add(mock);

            Task task = interpreter.start(node);
            interpreter.tick(0);
            Assert.assertEquals(Status.RUNNING, task.getStatus());
            interpreter.tick(0);
View Full Code Here

Examples of org.yaml.snakeyaml.nodes.SequenceNode

                parent.addChild(node);

                build(tuple.getValueNode(), node);
            }
        } else if (yaml instanceof SequenceNode) {
            SequenceNode sequenceNode = (SequenceNode) yaml;
            debug("writing sequence with size: {}", sequenceNode.getValue().size());
            List<Object> list = Lists.newArrayList();
            for (org.yaml.snakeyaml.nodes.Node node : sequenceNode.getValue()) {
                if (node instanceof ScalarNode) {
                    list.add(getScalarValue((ScalarNode) node));
                } else {
                    YamlProperties conf = new YamlProperties();
                    Node root = new Node();
View Full Code Here

Examples of org.yaml.snakeyaml.nodes.SequenceNode

    NodeTuple tuple = super.representJavaBeanProperty(javaBean, property, propertyValue, customTag);
    Node valueNode = tuple.getValueNode();
    if (valueNode instanceof CollectionNode) {
      // Removed null check
      if (Tag.SEQ.equals(valueNode.getTag())) {
        SequenceNode seq = (SequenceNode) valueNode;
        if (seq.getValue().isEmpty()) { return null; // skip empty lists
        }
      }
      if (Tag.MAP.equals(valueNode.getTag())) {
        MappingNode seq = (MappingNode) valueNode;
        if (seq.getValue().isEmpty()) { return null; // skip empty maps
        }
      }
    }
    return tuple;
  }
View Full Code Here

Examples of org.yaml.snakeyaml.nodes.SequenceNode

        int size = 10;// default for ArrayList
        if (sequence instanceof List<?>) {
            size = ((List<?>) sequence).size();
        }
        List<Node> value = new ArrayList<Node>(size);
        SequenceNode node = new SequenceNode(tag, value, flowStyle);
        representedObjects.put(objectToRepresent, node);
        boolean bestStyle = true;
        for (Object item : sequence) {
            Node nodeItem = representData(item);
            if (!((nodeItem instanceof ScalarNode && ((ScalarNode) nodeItem).getStyle() == null))) {
                bestStyle = false;
            }
            value.add(nodeItem);
        }
        if (flowStyle == null) {
            if (defaultFlowStyle != FlowStyle.AUTO) {
                node.setFlowStyle(defaultFlowStyle.getStyleBoolean());
            } else {
                node.setFlowStyle(bestStyle);
            }
        }
        return node;
    }
View Full Code Here

Examples of org.yaml.snakeyaml.nodes.SequenceNode

            ScalarNode scalar2 = (ScalarNode) node2;
            assertEquals(scalar1.getTag(), scalar2.getTag());
            assertEquals(scalar1.getValue(), scalar2.getValue());
        } else {
            if (node1 instanceof SequenceNode) {
                SequenceNode seq1 = (SequenceNode) node1;
                SequenceNode seq2 = (SequenceNode) node2;
                assertEquals(seq1.getTag(), seq2.getTag());
                assertEquals(seq1.getValue().size(), seq2.getValue().size());
                Iterator<Node> iter2 = seq2.getValue().iterator();
                for (Node child1 : seq1.getValue()) {
                    Node child2 = iter2.next();
                    compareNodes(child1, child2);
                }
            } else {
                MappingNode seq1 = (MappingNode) node1;
                MappingNode seq2 = (MappingNode) node2;
                assertEquals(seq1.getTag(), seq2.getTag());
                assertEquals(seq1.getValue().size(), seq2.getValue().size());
                Iterator<NodeTuple> iter2 = seq2.getValue().iterator();
                for (NodeTuple child1 : seq1.getValue()) {
                    NodeTuple child2 = iter2.next();
                    compareNodes(child1.getKeyNode(), child2.getKeyNode());
                    compareNodes(child1.getValueNode(), child2.getValueNode());
                }
View Full Code Here

Examples of org.yaml.snakeyaml.nodes.SequenceNode

                NodeTuple standard = super.representJavaBeanProperty(javaBean, property,
                        propertyValue, customTag);
                if (property.getName().equals("numbers")) {
                    // when the list is small, make it block collection style
                    if (bean.getNumbers().size() < 5) {
                        SequenceNode n = (SequenceNode) standard.getValueNode();
                        return new NodeTuple(standard.getKeyNode(), new SequenceNode(n.getTag(),
                                true, n.getValue(), n.getStartMark(), n.getEndMark(), false));
                    }
                }
                if (property.getName().equals("description")) {
                    // if description contains ':' use folded scalar style and
                    // not single quoted scalar style
                    if (bean.getDescription().indexOf(':') > 0) {
                        ScalarNode n = (ScalarNode) standard.getValueNode();
                        return new NodeTuple(standard.getKeyNode(), new ScalarNode(n.getTag(),
                                n.getValue(), n.getStartMark(), n.getEndMark(), '>'));
                    }
                }
                return standard;
            } else {
                return super
View Full Code Here

Examples of org.yaml.snakeyaml.nodes.SequenceNode

            if (Tag.NULL.equals(valueNode.getTag())) {
                return null;// skip 'null' values
            }
            if (valueNode instanceof CollectionNode) {
                if (Tag.SEQ.equals(valueNode.getTag())) {
                    SequenceNode seq = (SequenceNode) valueNode;
                    if (seq.getValue().isEmpty()) {
                        return null;// skip empty lists
                    }
                }
                if (Tag.MAP.equals(valueNode.getTag())) {
                    MappingNode seq = (MappingNode) valueNode;
                    if (seq.getValue().isEmpty()) {
                        return null;// skip empty maps
                    }
                }
            }
            return tuple;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.