Package uk.org.ogsadai.tuple

Examples of uk.org.ogsadai.tuple.Tuple


      throws ActivityProcessingException, ActivityTerminatedException,
      ActivityUserException {
      try {
       
        TupleListIterator dataTuples = (TupleListIterator)iterationInputs[0];
        Tuple tuple;
        List<String> binNames = getBinNames((ListIterator)iterationInputs[1]);
        List<Double> aggregates = getAggregates((TupleListIterator)iterationInputs[2]);
        mOutput.write(ControlBlock.LIST_BEGIN);
        mOutput.write(prepareMetadata(dataTuples));
        while((tuple = (Tuple)dataTuples.nextValue()) != null) {
View Full Code Here


                column = new SimpleColumnMetadata("class", TupleTypes._STRING, 0, 0, 0);
            }
           
            TupleMetadata outMetadata = new SimpleTupleMetadata(Collections.singletonList(column));
            mOutput.write(new MetadataWrapper(outMetadata));
            Tuple tuple;
            while ((tuple = (Tuple)tuples.nextValue()) != null)
            {
               
               
                Object result = classify(classifiers, tuple);
               
                LOG.debug("Classified " + tuple + " : " + result);
                List<?> elements = Collections.singletonList(result);
                Tuple out = new SimpleTuple(elements);
                mOutput.write(out);
            }
            mOutput.write(ControlBlock.LIST_END);
           
           
View Full Code Here

        MockInputPipe inputSize = new MockInputPipe(2);
       
        ColumnMetadata colA = new SimpleColumnMetadata("A", TupleTypes._STRING, 0, 0, 0);
        ColumnMetadata colB = new SimpleColumnMetadata("B", TupleTypes._DOUBLE, 0, 0, 0);
        TupleMetadata metadata = new SimpleTupleMetadata(Arrays.asList(colA, colB));
        Tuple tuple1 = new SimpleTuple(Arrays.<Object>asList("Amy", 0));
        Tuple tuple2 = new SimpleTuple(Arrays.<Object>asList("Ally", 1.0));
        Tuple tuple3 = new SimpleTuple(Arrays.<Object>asList("Radek", 2.0));
        Tuple tuple4 = new SimpleTuple(Arrays.<Object>asList("Adrian", 3.0));
        Tuple tuple5 = new SimpleTuple(Arrays.<Object>asList("Rob", 4.0));
        MockInputPipe inputData = new MockInputPipe(new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                tuple1, tuple2, tuple3, tuple4, tuple5,
                ControlBlock.LIST_END
View Full Code Here

        MockInputPipe inputTemplate = new MockInputPipe("Hello $REPLACE(A)$, hello $REPLACE(B)$!");
       
        ColumnMetadata colA = new SimpleColumnMetadata("A", TupleTypes._STRING, 0, 0, 0);
        ColumnMetadata colB = new SimpleColumnMetadata("B", TupleTypes._DOUBLE, 0, 0, 0);
        TupleMetadata metadata = new SimpleTupleMetadata(Arrays.asList(colA, colB));
        Tuple tuple1 = new SimpleTuple(Arrays.<Object>asList("Amy", 0));
        Tuple tuple2 = new SimpleTuple(Arrays.<Object>asList("Ally", 1.0));
        Tuple tuple3 = new SimpleTuple(Arrays.<Object>asList("Radek", 2.0));
        MockInputPipe inputData = new MockInputPipe(new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                tuple1, tuple2, tuple3,
                ControlBlock.LIST_END
View Full Code Here

       
        MockInputPipe inputTemplate = new MockInputPipe("Hello $REPLACE(A)$, hello $REPLACE(B)$!");
       
        ColumnMetadata colA = new SimpleColumnMetadata("A", TupleTypes._STRING, 0, 0, 0);
        TupleMetadata metadata = new SimpleTupleMetadata(Arrays.asList(colA));
        Tuple tuple1 = new SimpleTuple(Arrays.<Object>asList("Amy", 0));
        Tuple tuple2 = new SimpleTuple(Arrays.<Object>asList("Ally", 1.0));
        Tuple tuple3 = new SimpleTuple(Arrays.<Object>asList("Radek", 2.0));
        MockInputPipe inputData = new MockInputPipe(new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                tuple1, tuple2, tuple3,
                ControlBlock.LIST_END
View Full Code Here

        List<Object> elements = new ArrayList<Object>();
        for (int i=0; i<mModifiers.length; i++)
        {
            elements.add(mModifiers[i].getValue(tuple));
        }
        Tuple result = new SimpleTuple(elements);
        return result;
    }
View Full Code Here

            ActivityUserException
    {
        TupleListIterator tuples = (TupleListIterator)iterationData[0];
        TupleMetadata metadata =
            (TupleMetadata)tuples.getMetadataWrapper().getMetadata();
        Tuple tuple;
        Mean[] calc = getMeanCalculator(metadata);
        while ((tuple = (Tuple)tuples.nextValue()) != null)
        {
            for (int i = 0; i < calc.length; i++)
            {
View Full Code Here

        List elements = new ArrayList();
        for (int i = 0; i < calc.length; i++)
        {
            elements.add(calc[i].getMean());
        }
        Tuple tuple = new SimpleTuple(elements);
        return tuple;
    }
View Full Code Here

    public void testSimple() throws Exception
    {
        FilterActivity activity = new FilterActivity();
       
        Tuple tuple1 = createTuple(new Object[] {1, 3});
        Tuple tuple2 = createTuple(new Object[] {4, 5});
        Tuple tuple3 = createTuple(new Object[] {10, 100});
        MockInputPipe dataInput = new MockInputPipe(
                new Object[] {
                        ControlBlock.LIST_BEGIN,
                        createTupleMetadata(),
                        tuple1,
View Full Code Here

   
    public void testAnotherExpression() throws Exception
    {
        FilterActivity activity = new FilterActivity();
       
        Tuple tuple1 = createTuple(new Object[] {1, 3});
        Tuple tuple2 = createTuple(new Object[] {-4, 8});
        MockInputPipe dataInput = new MockInputPipe(
                new Object[] {
                        ControlBlock.LIST_BEGIN,
                        createTupleMetadata(),
                        tuple1,
View Full Code Here

TOP

Related Classes of uk.org.ogsadai.tuple.Tuple

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.