01: /*
02: (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: All rights reserved - see end of file.
04: $Id: QueryNodeFactoryBase.java,v 1.4 2008/01/02 12:07:57 andy_seaborne Exp $
05: */
06:
07: package com.hp.hpl.jena.graph.query;
08:
09: import com.hp.hpl.jena.graph.Node;
10: import com.hp.hpl.jena.graph.query.QueryNode.*;
11: import com.hp.hpl.jena.graph.query.QueryNode.Bind;
12: import com.hp.hpl.jena.graph.query.QueryNode.Bound;
13: import com.hp.hpl.jena.graph.query.QueryNode.Fixed;
14:
15: /**
16: A base-level implementation of the QueryNodeFactory that uses the
17: QueryNode/QueryTriple classes directly.
18:
19: @author kers
20: */
21: public class QueryNodeFactoryBase implements QueryNodeFactory {
22: public QueryNode createAny() {
23: return new Any();
24: }
25:
26: public QueryNode createFixed(Node n) {
27: return new Fixed(n);
28: }
29:
30: public QueryNode createBind(Node node, int i) {
31: return new Bind(node, i);
32: }
33:
34: public QueryNode createJustBound(Node node, int i) {
35: return new JustBound(node, i);
36: }
37:
38: public QueryNode createBound(Node node, int i) {
39: return new Bound(node, i);
40: }
41:
42: public QueryTriple createTriple(QueryNode S, QueryNode P,
43: QueryNode O) {
44: return new QueryTriple(S, P, O);
45: }
46:
47: public QueryTriple[] createArray(int size) {
48: return new QueryTriple[size];
49: }
50: }
51:
52: /*
53: * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
54: * All rights reserved.
55: *
56: * Redistribution and use in source and binary forms, with or without
57: * modification, are permitted provided that the following conditions
58: * are met:
59: * 1. Redistributions of source code must retain the above copyright
60: * notice, this list of conditions and the following disclaimer.
61: * 2. Redistributions in binary form must reproduce the above copyright
62: * notice, this list of conditions and the following disclaimer in the
63: * documentation and/or other materials provided with the distribution.
64: * 3. The name of the author may not be used to endorse or promote products
65: * derived from this software without specific prior written permission.
66: *
67: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
68: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
69: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
70: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
71: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
72: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
73: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
74: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
75: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
76: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
77: */
|