Package java.util

Examples of java.util.ArrayList


   */
  private List getMessages(int nb, String selector, boolean remove) {  
    if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log(BasicLevel.DEBUG, "Queue.getMessages(" + nb + ',' + selector + ',' + remove + ')');

    List lsMessages = new ArrayList();
    Message message;
    int j = 0;
    // Checking the deliverable messages:
    while ((lsMessages.size() < nb || nb == -1) &&  j < messages.size()) {
      message = (Message) messages.get(j);

      // If selector matches, sending the message:
      if (Selector.matches(message.getHeaderMessage(), selector) &&
          checkDelivery(message.getHeaderMessage())) {
        message.incDeliveryCount();
        nbMsgsDeliverSinceCreation++;

        // use in sub class see ClusterQueue
        messageDelivered(message.getIdentifier());

        if (logger.isLoggable(BasicLevel.DEBUG))
          logger.log(BasicLevel.DEBUG, "Message " + message.getIdentifier());

        lsMessages.add(message);

        if (remove) {
          messages.remove(message);
          message.delete();
        } else {
View Full Code Here


       
        joinNode.setProperty(joinNode.getFirstChild() == childNode ? NodeConstants.Info.SORT_LEFT : NodeConstants.Info.SORT_RIGHT, SortOption.SORT);
       
        if (needsCorrection) {
            PlanNode projectNode = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
            projectNode.setProperty(NodeConstants.Info.PROJECT_COLS, new ArrayList(outputSymbols));
            childNode.addAsParent(projectNode);
            correctOutputElements(joinNode, outputSymbols, projectNode);
        }       
        return false;
    }
View Full Code Here

    private static PlanNode createSortNode(List<SingleElementSymbol> orderSymbols,
                                           Collection outputElements) {
        PlanNode sortNode = NodeFactory.getNewNode(NodeConstants.Types.SORT);
        sortNode.setProperty(NodeConstants.Info.SORT_ORDER, new OrderBy(orderSymbols));
        sortNode.setProperty(NodeConstants.Info.OUTPUT_COLS, new ArrayList(outputElements));
        return sortNode;
    }
View Full Code Here

    private static void correctOutputElements(PlanNode endNode,
                                              Collection outputElements,
                                              PlanNode startNode) {
        while (startNode != endNode) {
            startNode.setProperty(NodeConstants.Info.OUTPUT_COLS, new ArrayList(outputElements));
            startNode = startNode.getParent();
        }
    }
View Full Code Here

public class TestJoinRegion extends TestCase {
   
    public void testFindJoinRegions() {
       
        List regions = new ArrayList();
       
        PlanNode joinRoot = TestFrameUtil.getExamplePlan();
       
        PlanNode joinRoot1 = TestFrameUtil.getExamplePlan();
       
        PlanNode outerJoin = NodeFactory.getNewNode(NodeConstants.Types.JOIN);
       
        outerJoin.setProperty(NodeConstants.Info.JOIN_TYPE, JoinType.JOIN_LEFT_OUTER);
       
        outerJoin.addFirstChild(joinRoot);
        outerJoin.addFirstChild(joinRoot1);
       
        PlanNode source = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
       
        source.addFirstChild(outerJoin);
       
        RulePlanJoins.findJoinRegions(source, null, regions);
       
        assertEquals(3, regions.size());
       
        JoinRegion region = (JoinRegion)regions.get(0);
       
        //ensure that the first region is the trivial region of the outer join
        assertEquals(1, region.getJoinSourceNodes().size());
    }
View Full Code Here

        assertEquals(1, region.getJoinSourceNodes().size());
    }

    public void testReconstruction() {
       
        List regions = new ArrayList();
       
        PlanNode joinRoot = TestFrameUtil.getExamplePlan();
       
        PlanNode source = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
       
        source.addFirstChild(joinRoot);
       
        RulePlanJoins.findJoinRegions(source, null, regions);
       
        assertEquals(1, regions.size());
       
        JoinRegion region = (JoinRegion)regions.get(0);
       
        assertEquals(3, region.getJoinSourceNodes().size());
       
        assertEquals(joinRoot, region.getJoinRoot());
       
View Full Code Here

   
    private FakeRelationalNode createFakeNode(List[] data) {
        // setup
        ElementSymbol element = new ElementSymbol("a"); //$NON-NLS-1$
        element.setType(DataTypeManager.DefaultDataClasses.INTEGER);
        List elements = new ArrayList();
        elements.add(element);
       
        FakeRelationalNode fakeNode = new FakeRelationalNode(1, data, 100);
        fakeNode.setElements(elements);
        CommandContext context = new CommandContext("pid", "group", null, null, null, 1, null, true); //$NON-NLS-1$ //$NON-NLS-2$
        fakeNode.initialize(context, BufferManagerFactory.getStandaloneBufferManager(), null);
View Full Code Here

    }
   
    private List[] createData(int rows) {
        List[] data = new List[rows];
        for(int i=0; i<rows; i++) {
            data[i] = new ArrayList();
            data[i].add(new Integer(i));
        }  
        return data;
    }  
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);
        RelationalNode leftNode = new FakeRelationalNode(1, new List[0]);
        leftNode.setElements(leftElements);

        List rightElements = new ArrayList();
        rightElements.add(es2);
        RelationalNode rightNode = new FakeRelationalNode(2, new List[0]);
        rightNode.setElements(rightElements);
       
        List unionElements = new ArrayList();
        unionElements.add(es1);

        UnionAllNode union = new UnionAllNode(3);
        union.setElements(unionElements);
       
        helpTestUnion(new RelationalNode[] {leftNode, rightNode}, union, new List[0]);       
View Full Code Here

        ElementSymbol es2 = new ElementSymbol("e2"); //$NON-NLS-1$
        es2.setType(DataTypeManager.DefaultDataClasses.INTEGER);

        RelationalNode[] nodes = new RelationalNode[sources];
        for(int i=0; i<nodes.length; i++) {
            List childElements = new ArrayList();
            childElements.add(es1);
           
            // Build source data
            List[] tuples = new List[rowsPerSource];
            for(int r = 0; r<rowsPerSource; r++) {
                tuples[r] = Arrays.asList(new Object[] { new Integer(i) });
            }
           
            if(blockModIndex >= 0 && (i % blockModIndex == 0)) {
                nodes[i] = new BlockingFakeRelationalNode(i, tuples, batchSize);
            } else {               
                nodes[i] = new FakeRelationalNode(i, tuples, batchSize);
            }
            nodes[i].setElements(childElements);          
        }
       
        List unionElements = new ArrayList();
        unionElements.add(es1);

        UnionAllNode union = new UnionAllNode(nodes.length);
        union.setElements(unionElements);
       
        helpTestUnion(nodes, union, expected);          
View Full Code Here

TOP

Related Classes of java.util.ArrayList

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.