KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > excalibur > pipeline > DefaultPipeline


1 /*
2  * Copyright (C) The Apache Software Foundation. All rights reserved.
3  *
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE.txt file.
7  */

8 package org.apache.avalon.excalibur.pipeline;
9
10 import java.util.ArrayList JavaDoc;
11 import java.util.NoSuchElementException JavaDoc;
12
13 /**
14  * This is basic array based pipeline.
15  *
16  * @author <a HREF="mailto:peter@apache.org">Peter Donald</a>
17  */

18 public class DefaultPipeline
19     implements Pipeline
20 {
21     protected final ArrayList JavaDoc m_stages = new ArrayList JavaDoc();
22
23     /**
24      * Retrieve size of pipeline (number of stages).
25      *
26      * @return the size of pipeline
27      */

28     public int getSize()
29     {
30         return m_stages.size();
31     }
32
33     /**
34      * Retrieve a particular stage of pipeline
35      *
36      * @param index the index of stage
37      * @return the stage
38      * @exception NoSuchElementException if index >= getSize() or index < 0
39      */

40     public Stage getStage( final int index )
41         throws NoSuchElementException JavaDoc
42     {
43         return (Stage)m_stages.get( index );
44     }
45
46     public void addStage( final Stage stage )
47     {
48         m_stages.add( stage );
49     }
50 }
51
Popular Tags