KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > n3 > ChainedN3EventHandler


1 /*
2  * (c) Copyright 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3  * [See end of file]
4  */

5
6 package com.hp.hpl.jena.n3;
7
8 import antlr.collections.AST ;
9
10 /** Support for chaining handlers. Sends the operations to a chained handler.
11  * @author Andy Seaborne
12  * @version $Id: ChainedN3EventHandler.java,v 1.6 2005/02/21 12:04:03 andy_seaborne Exp $
13  */

14
15 public class ChainedN3EventHandler implements N3ParserEventHandler
16 {
17     N3ParserEventHandler here = null ;
18     N3ParserEventHandler next = null ;
19     
20     public ChainedN3EventHandler(N3ParserEventHandler car, N3ParserEventHandler cdr)
21     {
22         here = car ;
23         next = cdr ;
24     }
25     
26     public void startDocument() { here.startDocument() ; next.startDocument() ; }
27     public void endDocument() { here.endDocument() ; next.startDocument() ; }
28     
29     public void error(Exception JavaDoc ex, String JavaDoc message) { System.err.println(message) ; }
30     //public void warning(Exception ex, String message) { System.err.println(message) ; }
31
//public void deprecated(Exception ex, String message) { System.err.println(message) ; }
32

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

84
Popular Tags