Package uk.org.ogsadai.tuple

Examples of uk.org.ogsadai.tuple.TupleMetadata


                    TupleTypes._FLOAT,
                    0,
                    ColumnMetadata.COLUMN_NULLABLE,
                    20);
        columns.add(col);
        TupleMetadata metadata = new SimpleTupleMetadata(columns);
        List<Object> elements = new ArrayList<Object>();
        elements.add(new Float(10));
        Tuple tuple1 = new SimpleTuple(elements);
        elements = new ArrayList<Object>();
        elements.add(new Float(20));
View Full Code Here


                    TupleTypes._FLOAT,
                    0,
                    ColumnMetadata.columnNullable,
                    20);
        columns.add(col);
        TupleMetadata metadata = new SimpleTupleMetadata(columns);
        List elements = new ArrayList();
        elements.add(new Float(10));
        Tuple tuple1 = new SimpleTuple(elements);
        elements = new ArrayList();
        elements.add(new Float(20));
View Full Code Here

        throws ActivityUserException,
               ActivityProcessingException,
               ActivityTerminatedException
    {
        // set metadata to colInfo
        TupleMetadata metadata =
            (TupleMetadata)mTupleList.getMetadataWrapper().getMetadata();
        columnCount = metadata.getColumnCount();
        colInfo = new ColInfo[columnCount];
        for(int i=0; i<columnCount; i++)
        {
            ColumnMetadata column = metadata.getColumnMetadata(i);
            colInfo[i] = new ColInfo();
            colInfo[i].setName(column.getName());
            colInfo[i].setDisplayName("");
            colInfo[i].setOpType("");
            colInfo[i].setDataType(
View Full Code Here

    {
        TupleListIterator tuples = (TupleListIterator)iterationData[2];
        TupleListIterator values = (TupleListIterator)iterationData[0];

        Set<Integer> columns = getColumns((ListIterator)iterationData[1]);
        TupleMetadata valuesMetadata = (TupleMetadata)values.getMetadataWrapper().getMetadata();
        TupleMetadata tuplesMetadata = (TupleMetadata)tuples.getMetadataWrapper().getMetadata();
        Tuple value = getValues(values);
       
        Replace replace = new Replace(value, columns, valuesMetadata, tuplesMetadata);
       
        writeBlock(ControlBlock.LIST_BEGIN);
View Full Code Here

    // No post processing
   
  }

  private MetadataWrapper prepareMetadata(TupleListIterator tuples) throws ActivityUserException, ActivityProcessingException, ActivityTerminatedException {
        TupleMetadata prevMetadata = (TupleMetadata)tuples.getMetadataWrapper().getMetadata();
        List<ColumnMetadata> columns = new ArrayList<ColumnMetadata>();
        ColumnMetadata column = new SimpleColumnMetadata(prevMetadata.getColumnMetadata(0).getName(), TupleTypes._STRING, 0, 0, 0);
        columns.add(column);
        TupleMetadata metadata = new SimpleTupleMetadata(columns);
    return new MetadataWrapper(metadata);
  }
View Full Code Here

    public void testSimple() throws Exception
    {
        List<ColumnMetadata> columns = new ArrayList<ColumnMetadata>();
        columns.add(new SimpleColumnMetadata("A", TupleTypes._INT, 0, 0, 0));
        columns.add(new SimpleColumnMetadata("B", TupleTypes._INT, 0, 0, 0));
        TupleMetadata metadata = new SimpleTupleMetadata(columns);
        MockInputPipe dataInput = new MockInputPipe(new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                new SimpleTuple(Arrays.asList(0, 1)),
                new SimpleTuple(Arrays.asList(2, 3)),
View Full Code Here

    public void testReplaceNulls() throws Exception
    {
        List<ColumnMetadata> columns = new ArrayList<ColumnMetadata>();
        columns.add(new SimpleColumnMetadata("A", TupleTypes._INT, 0, 0, 0));
        columns.add(new SimpleColumnMetadata("B", TupleTypes._INT, 0, 0, 0));
        TupleMetadata metadata = new SimpleTupleMetadata(columns);
        MockInputPipe dataInput = new MockInputPipe(new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                new SimpleTuple(Arrays.asList(Null.VALUE, "a")),
                new SimpleTuple(Arrays.asList(0, "b")),
View Full Code Here

            ActivityUserException
    {

        List<ClassifierPriorityPair> classifiers = getClassifiers(iterationInputs);
        TupleListIterator tuples = (TupleListIterator)iterationInputs[0];
        TupleMetadata metadata =
            (TupleMetadata)tuples.getMetadataWrapper().getMetadata();
        try
        {
          boolean isNumeric = classifiers.get(0).classifier.classIsNumeric();
            mOutput.write(ControlBlock.LIST_BEGIN);
            ColumnMetadata column;
            if (isNumeric)
            {
                column = new SimpleColumnMetadata("class", TupleTypes._DOUBLE, 0, 0, 0);               
            }
            else
            {
                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)
            {
               
View Full Code Here

    @Test
    public void testSimple() throws Exception
    {
        List<ColumnMetadata> columns = new ArrayList<ColumnMetadata>();
        columns.add(new SimpleColumnMetadata("A", TupleTypes._STRING, 0, 0, 0));
        TupleMetadata metadata = new SimpleTupleMetadata(columns);
        MockInputPipe data1Input = new MockInputPipe(new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                new SimpleTuple(Arrays.asList("Rupert")),
                new SimpleTuple(Arrays.asList("Ally")),
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));
View Full Code Here

TOP

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

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.