KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > graph > impl > WrappedGraph


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

6
7 package com.hp.hpl.jena.graph.impl;
8
9 import com.hp.hpl.jena.graph.*;
10 import com.hp.hpl.jena.graph.query.*;
11 import com.hp.hpl.jena.shared.*;
12 import com.hp.hpl.jena.util.iterator.*;
13
14 /**
15     A wrapper class which simply defers all operations to its base.
16     @author kers
17 */

18 public class WrappedGraph implements GraphWithPerform
19     {
20     protected Graph base;
21     protected Reifier reifier;
22     protected BulkUpdateHandler bud;
23     protected GraphEventManager gem;
24     
25     public WrappedGraph( Graph base )
26         { this.base = base;
27         this.reifier = new WrappedReifier( base.getReifier(), this ); }
28
29     public boolean dependsOn( Graph other )
30         { return base.dependsOn( other ); }
31
32     public QueryHandler queryHandler()
33         { return base.queryHandler(); }
34
35     public TransactionHandler getTransactionHandler()
36         { return base.getTransactionHandler(); }
37
38     public BulkUpdateHandler getBulkUpdateHandler()
39         {
40         if (bud == null) bud = new WrappedBulkUpdateHandler( this, base.getBulkUpdateHandler() );
41         return bud;
42         }
43
44     public Capabilities getCapabilities()
45         { return base.getCapabilities(); }
46
47     public GraphEventManager getEventManager()
48         {
49         if (gem == null) gem = new SimpleEventManager( this );
50         return gem;
51         }
52
53     public Reifier getReifier()
54         {return reifier; }
55
56     public PrefixMapping getPrefixMapping()
57         { return base.getPrefixMapping(); }
58
59     public void add( Triple t )
60         { base.add( t );
61         getEventManager().notifyAddTriple( this, t ); }
62
63     public void delete( Triple t )
64         { base.delete( t );
65         getEventManager().notifyDeleteTriple( this, t ); }
66
67     public ExtendedIterator find( TripleMatch m )
68         { return SimpleEventManager.notifyingRemove( this, base.find( m ) ); }
69
70     public ExtendedIterator find( Node s, Node p, Node o )
71         { return SimpleEventManager.notifyingRemove( this, base.find( s, p, o ) ); }
72
73     public boolean isIsomorphicWith( Graph g )
74         { return base.isIsomorphicWith( g ); }
75
76     public boolean contains( Node s, Node p, Node o )
77         { return base.contains( s, p, o ); }
78
79     public boolean contains( Triple t )
80         { return base.contains( t ); }
81
82     public void close()
83         { base.close(); }
84
85     public boolean isEmpty()
86         { return base.isEmpty(); }
87
88     public int size()
89         { return base.size(); }
90     
91     public void performAdd(Triple t)
92         { base.add( t ); }
93
94     public void performDelete(Triple t)
95         { base.delete( t ); }
96     }
97
98
99 /*
100     (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
101     All rights reserved.
102
103     Redistribution and use in source and binary forms, with or without
104     modification, are permitted provided that the following conditions
105     are met:
106
107     1. Redistributions of source code must retain the above copyright
108        notice, this list of conditions and the following disclaimer.
109
110     2. Redistributions in binary form must reproduce the above copyright
111        notice, this list of conditions and the following disclaimer in the
112        documentation and/or other materials provided with the distribution.
113
114     3. The name of the author may not be used to endorse or promote products
115        derived from this software without specific prior written permission.
116
117     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
118     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
119     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
120     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
121     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
122     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
123     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
124     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
125     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
126     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
127 */
Popular Tags