Package java.util

Examples of java.util.ArrayList


    }
   
    public void testProjectWithLookupFunction() throws Exception {
        ElementSymbol es1 = new ElementSymbol("e1"); //$NON-NLS-1$
        es1.setType(DataTypeManager.DefaultDataClasses.STRING);      
        List elements = new ArrayList();
        elements.add(es1);

        Function func = new Function("lookup", new Expression[] { new Constant("pm1.g1"), new Constant("e2"), new Constant("e1"), es1 }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
        FunctionDescriptor desc = FakeMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("lookup", new Class[] { String.class, String.class, String.class, String.class } ); //$NON-NLS-1$
        func.setFunctionDescriptor(desc);
        func.setType(DataTypeManager.DefaultDataClasses.STRING);
       
        ExpressionSymbol expr = new ExpressionSymbol("expr", func); //$NON-NLS-1$
        List projectElements = new ArrayList();
        projectElements.add(expr);
       
        List[] data = new List[] {
            Arrays.asList(new Object[] { "1" })//$NON-NLS-1$
            Arrays.asList(new Object[] { "2" }) }; //$NON-NLS-1$
        List[] expected = new List[] {
View Full Code Here


            if (mustRegisterCommands) {
                throw new TeiidComponentException("Unknown command: " + commandString)//$NON-NLS-1$
            }
            // Create one row of nulls
            rows = new List[1];
            rows[0] = new ArrayList();
           
            for(int i=0; i<projectedSymbols.size(); i++) {
                rows[0].add(null);
            }
        }
View Full Code Here

       
        if(expectedSymbols == null) {
            return tuple;
        }
        // Build mapped data tuple, with expectedSymbols
        List mappedTuple = new ArrayList(expectedSymbols.size());
        for(int i=0; i<columnMap.length; i++) {
          int colIndex = columnMap[i];
                if(colIndex >= 0) {
                    mappedTuple.add( tuple.get(colIndex) );
                } else {
                    mappedTuple.add( null );
                }
        }       
      return mappedTuple;
    }
    return null;
View Full Code Here

  public TestBatchedUpdatePlan(String name) {
        super(name);
    }
   
    private void helpTestNextBatch(int[] commandsPerPlan) throws Exception {
        List plans = new ArrayList(commandsPerPlan.length);
        int totalCommands = 0;
        for (int i = 0; i < commandsPerPlan.length; i++) {
            totalCommands += commandsPerPlan[i];
            plans.add(new FakeProcessorPlan(commandsPerPlan[i]));
        }
        BatchedUpdatePlan plan = new BatchedUpdatePlan(plans, totalCommands, null);
        TupleBatch batch = plan.nextBatch();
        assertEquals(totalCommands, batch.getRowCount());
        for (int i = 1; i <= totalCommands; i++) {
View Full Code Here

        es1.setType(DataTypeManager.DefaultDataClasses.INTEGER);

        ElementSymbol es2 = new ElementSymbol("e2"); //$NON-NLS-1$
        es2.setType(DataTypeManager.DefaultDataClasses.STRING);
       
        List elements = new ArrayList();
        elements.add(es1);
        elements.add(es2);
       
        List[] data = new List[20];
        for(int i=0; i<20; i++) {
            data[i] = new ArrayList();
            data[i].add(new Integer((i*51) % 11));
           
            String str = String.valueOf(i*3);
            str = str.substring(0,1);
            data[i].add(str);             
        }
       
        List sortElements = new ArrayList();
        sortElements.add(es1);
       
        List sortTypes = new ArrayList();
        sortTypes.add(new Boolean(OrderBy.ASC));
       
        helpTestSort(elements, data, sortElements, sortTypes, expected, mode);
    }
View Full Code Here

   
    private void helpTestAllSorts(int batches) throws Exception {
        ElementSymbol es1 = new ElementSymbol("e1"); //$NON-NLS-1$
        es1.setType(DataTypeManager.DefaultDataClasses.INTEGER);

        List elements = new ArrayList();
        elements.add(es1);
       
        int rows = batches * BATCH_SIZE;

        ListNestedSortComparator<Integer> comparator = new ListNestedSortComparator<Integer>(new int[] {0}, OrderBy.DESC);

        List<Integer>[] expected = new List[rows];
        List<Integer>[] data = new List[rows];
        TreeSet<List<Integer>> distinct = new TreeSet<List<Integer>>(comparator);
        for(int i=0; i<rows; i++) {
            Integer value = new Integer((i*51) % 11);
            data[i] = Arrays.asList(value);
            expected[i] = Arrays.asList(value);
            distinct.add(Arrays.asList(value));
        }
        List[] expectedDistinct = distinct.toArray(new List[distinct.size()]);
       
        List sortElements = new ArrayList();
        sortElements.add(es1);
       
        List sortTypes = new ArrayList();
        sortTypes.add(new Boolean(OrderBy.DESC));

        Arrays.sort(expected, comparator);
       
        for (Mode mode : Mode.values()) {
        helpTestSort(elements, data, sortElements, sortTypes, mode==Mode.SORT?expected:expectedDistinct, mode);
View Full Code Here

    private List[] createTuples(int startingValue, int count) {
        return createTuples(startingValue, count, false);
    }
   
    private List[] createTuples(int startingValue, int count, boolean addNullAsSecondColumn) {
        ArrayList lists = new ArrayList();
        for (int i=0; i<count; i++) {
            Object[] tuple;
            if (addNullAsSecondColumn) {
                tuple = new Object[] {new Integer(startingValue + i), null };
            } else {
                tuple = new Object[] {new Integer(startingValue + i) };
            }
            lists.add( Arrays.asList(tuple) );
        }
        return (List[]) lists.toArray(new List[] {});
    }
View Full Code Here

        es1.setType(DataTypeManager.DefaultDataClasses.INTEGER);
       
        ElementSymbol es2 = new ElementSymbol("e2"); //$NON-NLS-1$
        es2.setType(DataTypeManager.DefaultDataClasses.INTEGER);
       
        List leftElements = new ArrayList();
        leftElements.add(es1);
        leftNode = new FakeRelationalNode(1, leftTuples);
        leftNode.setElements(leftElements);
       
        List rightElements = new ArrayList();
        rightElements.add(es2);
        rightNode = new FakeRelationalNode(2, rightTuples);
        rightNode.setElements(rightElements);
       
        List joinElements = new ArrayList();
        joinElements.add(es1);
        joinElements.add(es2);
       
        join = new JoinNode(3);
        joinStrategy = new NestedLoopJoinStrategy();
      join.setJoinStrategy(joinStrategy);
        join.setElements(joinElements);
View Full Code Here

      throws TeiidComponentException, TeiidProcessingException {
    this.joinType = JoinType.JOIN_INNER;
        int rows = 100;
        List[] data = new List[rows];
        for(int i=0; i<rows; i++) {
            data[i] = new ArrayList();
            Integer value = new Integer((i*17) % 47);
            data[i].add(value);
        }
        this.leftTuples = data;
        this.rightTuples = createTuples2();
View Full Code Here

    @Test public void testMergeJoinOptimizationWithDistinct() throws Exception {
        this.joinType = JoinType.JOIN_INNER;
        int rows = 50;
        List[] data = new List[rows];
        for(int i=0; i<rows; i++) {
            data[i] = new ArrayList();
            Integer value = new Integer((i*17) % 47);
            data[i].add(value);
        }
        this.leftTuples = data;
        this.rightTuples = new List[] {
View Full Code Here

TOP

Related Classes of java.util.ArrayList

Copyright © 2015 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.