KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > graph > compose > Dyadic


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

6
7 package com.hp.hpl.jena.graph.compose;
8
9 import com.hp.hpl.jena.graph.*;
10
11 /**
12     Base class for the two-operand composition operations; has two graphs L and R
13     @author kers
14     @author Ian Dickinson - refactored most of the content to {@link CompositionBase}.
15 */

16
17 public abstract class Dyadic extends CompositionBase
18     {
19     protected Graph L;
20     protected Graph R;
21     
22     /**
23         When the graph is constructed, copy the prefix mappings of both components
24         into this prefix mapping. The prefix mapping doesn't change afterwards with the
25         components, which might be regarded as a bug.
26     */

27     public Dyadic( Graph L, Graph R )
28         {
29         this.L = L;
30         this.R = R;
31         getPrefixMapping()
32             .setNsPrefixes( L.getPrefixMapping() )
33             .setNsPrefixes( R.getPrefixMapping() )
34             ;
35         }
36
37     public void close()
38         {
39         L.close();
40         R.close();
41         }
42         
43     /**
44         Generic dependsOn, true iff it depends on either of the subgraphs.
45     */

46     public boolean dependsOn( Graph other )
47         { return other == this || L.dependsOn( other ) || R.dependsOn( other ); }
48                 
49     public Union union( Graph X )
50         { return new Union( this, X ); }
51
52     /**
53          Answer the left (first) operand of this Dyadic.
54     */

55     public Object JavaDoc getL()
56         { return L; }
57
58     /**
59          Answer the right (second) operand of this Dyadic.
60     */

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

95
Popular Tags