Package eu.admire.dispel.graph

Examples of eu.admire.dispel.graph.Repeater


            if (node instanceof LiteralValuesNode)
            {
                List<Object> values = ((LiteralValuesNode) node).getValues();
                assertEquals(1, values.size());
                assertTrue(values.get(0) instanceof Repeater);
                Repeater repeater = (Repeater)values.get(0);
                assertFalse(repeater.isInfinite());
                assertEquals("http://example.com/", repeater.getValue());
            }
        }
    }   
View Full Code Here


            if (node instanceof LiteralValuesNode)
            {
                List<Object> values = ((LiteralValuesNode) node).getValues();
                assertEquals(1, values.size());
                assertTrue(values.get(0) instanceof Repeater);
                Repeater repeater = (Repeater)values.get(0);
                assertTrue(repeater.isInfinite());
                assertEquals(
                        Arrays.<Object>asList(ListMarker.BEGIN, "test", ListMarker.END),
                        repeater.getValue());
            }
        }
    }   
View Full Code Here

        }
    }
   
    public Repeater getRepeater()
    {
        return new Repeater(mRepeats, mValue);
    }
View Full Code Here

                "this is a string that is too long",
                "another very long string that doesn't fit",
                "and a \\\"string\\\" with quotes",
                ListMarker.END,
                ListMarker.BEGIN,
                new Repeater(null, Arrays.asList(ListMarker.BEGIN, "X", "Y", 2, ListMarker.END)),
                ListMarker.END);
        graph.add(nodeC);
        nodeA.connectInput("in1", 0, nodeB.getOutput());
        nodeA.connectInput("in2", 0, nodeC.getOutput());
        String dot = DotGenerator.generate(graph);
View Full Code Here

   
    public void testRepeatEnough() throws Exception
    {
        LiteralValuesNode literal = new LiteralValuesNode();
        literal.addAnnotation(AnnotationKeys.LOCATION, mLocation);
        literal.add(new Repeater(null, "X"));
        ProcessingElementNode node1 = new ProcessingElementNode("1");
        node1.addAnnotation(AnnotationKeys.LOCATION, mLocation);
        literal.connectOutput("output", 0, node1.getInput("input", 0));
        ProcessingElementNode node2 = new ProcessingElementNode("2");
        node2.addAnnotation(AnnotationKeys.LOCATION, mLocation);
View Full Code Here

   
    public void testRepeatEnoughWithTee() throws Exception
    {
        LiteralValuesNode literal = new LiteralValuesNode();
        literal.addAnnotation(AnnotationKeys.LOCATION, mLocation);
        literal.add(new Repeater(null, "X"));
        ProcessingElementNode node1 = new ProcessingElementNode("1");
        node1.addAnnotation(AnnotationKeys.LOCATION, mLocation);
        literal.connectOutput("output", 0, node1.getInput("input", 0));
        ProcessingElementNode node2 = new ProcessingElementNode("2");
        node2.addAnnotation(AnnotationKeys.LOCATION, mLocation);
View Full Code Here

   
    public void testRepeatEnoughWithLiteralControl() throws Exception
    {
        LiteralValuesNode literal = new LiteralValuesNode();
        literal.addAnnotation(AnnotationKeys.LOCATION, mLocation);
        literal.add(new Repeater(null, "X"));
        LiteralValuesNode control = new LiteralValuesNode();
        control.addAnnotation(AnnotationKeys.LOCATION, mLocation);
        control.add("Y");
        control.add("Z");
        ProcessingElementNode node1 = new ProcessingElementNode("1");
View Full Code Here

   
    public void testDoubleRepeatEnough() throws Exception
    {
        LiteralValuesNode repeat1 = new LiteralValuesNode();
        repeat1.addAnnotation(AnnotationKeys.LOCATION, mLocation);
        repeat1.add(new Repeater(null, "X"));
        LiteralValuesNode repeat2 = new LiteralValuesNode();
        repeat2.addAnnotation(AnnotationKeys.LOCATION, mLocation);
        repeat2.add(new Repeater(null, "Y"));
        LiteralValuesNode control = new LiteralValuesNode();
        control.addAnnotation(AnnotationKeys.LOCATION, mLocation);
        control.add("1");
        control.add("2");
        ProcessingElementNode node1 = new ProcessingElementNode("1");
View Full Code Here

   
    public void testRepeat() throws Exception
    {
        LiteralValuesNode literal1 = new LiteralValuesNode();
        literal1.addAnnotation(AnnotationKeys.LOCATION, mLocation);
        literal1.add(new Repeater(5, "X"));
        LiteralValuesNode literal2 = new LiteralValuesNode();
        literal2.addAnnotation(AnnotationKeys.LOCATION, mLocation);
        literal2.add(new Repeater(3, Arrays.asList(ListMarker.BEGIN, "Y", ListMarker.END)));
        ProcessingElementNode node1 = new ProcessingElementNode("1");
        node1.addAnnotation(AnnotationKeys.LOCATION, mLocation);
        literal1.connectOutput("output", 0, node1.getInput("input1", 0));
        literal2.connectOutput("output", 0, node1.getInput("input2", 0));
        Graph graph = new Graph();
View Full Code Here

        {
            return new DataValue[] {ListEnd.VALUE};
        }
        else if (object instanceof Repeater)
        {
            Repeater repeater = (Repeater)object;
            List<DataValue> values = new ArrayList<DataValue>();
            if (repeater.isInfinite())
            {
                throw new IllegalArgumentException("Cannot encode infinite repeaters as Data Value.");
            }
            Object value = repeater.getValue();
            List<DataValue> torepeat = new ArrayList<DataValue>();
            if (value instanceof List<?>)
            {
                for (Object v : (List<Object>) value)
                {
                    DataValue[] repVals = toDataValue(v);
                    for (DataValue dataValue : repVals)
                    {
                        torepeat.add(dataValue);
                    }
                }
            }
            else
            {
                torepeat.addAll(Arrays.asList(toDataValue(value)));
            }
            for (long i=0; i<repeater.getNumberOfRepeats(); i++)
            {
                for (DataValue repVal : torepeat)
                {
                    values.add(repVal);
                }
View Full Code Here

TOP

Related Classes of eu.admire.dispel.graph.Repeater

Copyright © 2018 www.massapicom. 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.