KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > graph > query > Stage


1 /*
2   (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3   [See end of file]
4   $Id: Stage.java,v 1.9 2005/02/21 11:52:26 andy_seaborne Exp $
5 */

6
7 package com.hp.hpl.jena.graph.query;
8
9 /**
10     a processing stage in the query pipeline. Each stage
11     gets connected to its predecessor in the pipeline, and
12     mangles the contents before handing them on to the next
13     stage.
14
15     @author hedgehog
16 */

17
18 public abstract class Stage
19     {
20     /** the previous stage of the pipeline, once connected */
21     protected Stage previous;
22     
23     protected volatile boolean stillOpen = true;
24     
25     /** construct a new initial stage for the pipeline */
26     public static Stage initial( int count )
27         { return new InitialStage( count ); }
28         
29     /** connect this stage to its supplier; return this for chaining. */
30     public Stage connectFrom( Stage s )
31         { previous = s; return this; }
32         
33     public boolean isClosed()
34         { return !stillOpen; }
35         
36     protected final void markClosed()
37         { stillOpen = false; }
38         
39     public void close()
40         {
41         previous.close();
42         markClosed();
43         }
44
45     /**
46         execute the pipeline and pump the results into _sink_; this is asynchronous.
47         deliver that same _sink_ as our result. (This allows the sink to be created
48         as the argument to _deliver_.)
49     */

50     public abstract Pipe deliver( Pipe sink );
51     }
52
53 /*
54     (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
55     All rights reserved.
56
57     Redistribution and use in source and binary forms, with or without
58     modification, are permitted provided that the following conditions
59     are met:
60
61     1. Redistributions of source code must retain the above copyright
62        notice, this list of conditions and the following disclaimer.
63
64     2. Redistributions in binary form must reproduce the above copyright
65        notice, this list of conditions and the following disclaimer in the
66        documentation and/or other materials provided with the distribution.
67
68     3. The name of the author may not be used to endorse or promote products
69        derived from this software without specific prior written permission.
70
71     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
72     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
73     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
74     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
75     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
76     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
77     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
78     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
79     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
80     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
81 */

82
Popular Tags