KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > rdf > model > Container


1 /*
2  * (c) Copyright 2000, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. The name of the author may not be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  * Container.java
28  *
29  * Created on 26 July 2000, 07:49
30  */

31
32 package com.hp.hpl.jena.rdf.model;
33
34
35 /** An RDF Container.
36  *
37  * <p>This interface defines methods for accessing RDF container resources.
38  * These methods operate on the RDF statements contained in a model. The
39  * container implementation may cache state from the underlying model, so
40  * objects should not be added to or removed from the container by directly
41  * manipulating its properties, whilst the container is being
42  * accessed through this interface.</p>
43  *
44  * <p>When a member is deleted from a container using this interface, or an
45  * iterator returned through this interface, all the other members with
46  * higher ordinals are renumbered using an algorithm which may depend on the
47  * type of the container.</p>
48  *
49  * <p>This interface provides methods supporting typed literals. This means
50  * that methods are provided which will translate a built in type, or an
51  * object to an RDF Literal. This translation is done by invoking the
52  * <CODE>toString()</CODE> method of the object, or its built in equivalent.
53  * The reverse translation is also supported. This is built in for built
54  * in types. Factory objects, provided by the application, are used
55  * for application objects.</p>
56  * <p>This interface provides methods for supporting enhanced resources. An
57  * enhanced resource is a resource to which the application has added
58  * behaviour. RDF containers are examples of enhanced resources built in
59  * to this package. Enhanced resources are supported by encapsulating a
60  * resource created by an implementation in another class which adds
61  * the extra behaviour. Factory objects are used to construct such
62  * enhanced resources.</p>
63  * @author bwm
64  * @version Release='$Name: $' Revision='$Revision: 1.4 $' Date='$Date: 2005/02/21 12:13:59 $'
65  */

66 public interface Container extends Resource {
67     
68     public boolean isAlt();
69     public boolean isSeq();
70     public boolean isBag();
71     /** Add a new value to a container.
72      *
73      * <p>The size of the container is extended by 1 and the new value is added as
74      * the last element of the container.</p>
75      * @param o The value to be added.
76      
77      * @return this object so that calls may be cascaded.
78      */

79     public Container add(RDFNode o);
80     /** Add a new value to a container.
81      *
82      * <p>The size of the container is extended by 1 and the new value is added as
83      * the last element of the container.</p>
84      * @param o The value to be added.
85      
86      * @return this object so that calls may be cascaded.
87      */

88     public Container add(boolean o);
89     /** Add a new value to a container.
90      *
91      * <p>The size of the container is extended by 1 and the new value is added as
92      * the last element of the container.</p>
93      * @param o The value to be added.
94      
95      * @return this object so that calls may be cascaded.
96      */

97     public Container add(long o);
98     /** Add a new value to a container.
99      *
100      * <p>The size of the container is extended by 1 and the new value is added as
101      * the last element of the container.</p>
102      * @param o The value to be added.
103      
104      * @return this object so that calls may be cascaded.
105      */

106     public Container add(char o);
107     /** Add a new value to a container.
108      *
109      * <p>The size of the container is extended by 1 and the new value is added as
110      * the last element of the container.</p>
111      * @param o The value to be added.
112      
113      * @return this object so that calls may be cascaded.
114      */

115     public Container add(float o);
116     /** Add a new value to a container.
117      *
118      * <p>The size of the container is extended by 1 and the new value is added as
119      * the last element of the container.</p>
120      * @param o The value to be added.
121      
122      * @return this object so that calls may be cascaded.
123      */

124     public Container add(double o);
125     /** Add a new value to a container.
126      *
127      * <p>The size of the container is extended by 1 and the new value is added as
128      * the last element of the container.</p>
129      * @param o The value to be added.
130      
131      * @return this object so that calls may be cascaded.
132      */

133     public Container add(String JavaDoc o);
134     /** Add a new value to a container.
135      *
136      * <p>The size of the container is extended by 1 and the new value is added as
137      * the last element of the container.</p>
138      * @param o The value to be added.
139      * @param l The language of the string to be added
140      
141      * @return this object so that calls may be cascaded.
142      */

143     public Container add(String JavaDoc o, String JavaDoc l);
144     /** Add a new value to a container.
145      *
146      * <p>The size of the container is extended by 1 and the new value is added as
147      * the last element of the container.</p>
148      * @param o The value to be added.
149      
150      * @return this object so that calls may be cascaded.
151      */

152     public Container add(Object JavaDoc o);
153     
154     /** Determine whether the container contains a value
155      * @param o the value being tested for
156      
157      * @return true if and only if the container contains o
158      */

159     public boolean contains(RDFNode o);
160     /** Determine whether the container contains a value
161      * @param o the value being tested for
162      
163      * @return true if and only if the container contains o
164      */

165     public boolean contains(boolean o);
166     /** Determine whether the container contains a value
167      * @param o the value being tested for
168      
169      * @return true if and only if the container contains o
170      */

171     public boolean contains(long o);
172     /** Determine whether the container contains a value
173      * @param o the value being tested for
174      
175      * @return true if and only if the container contains o
176      */

177     public boolean contains(char o);
178     /** Determine whether the container contains a value
179      * @param o the value being tested for
180      
181      * @return true if and only if the container contains o
182      */

183     public boolean contains(float o);
184     /** Determine whether the container contains a value
185      * @param o the value being tested for
186      
187      * @return true if and only if the container contains o
188      */

189     public boolean contains(double o);
190     /** Determine whether the container contains a value
191      * @param o the value being tested for
192      
193      * @return true if and only if the container contains o
194      */

195     public boolean contains(String JavaDoc o);
196     /** Determine whether the container contains a value
197      * @param o the value being tested for
198      * @param l the language of the string tested
199      
200      * @return true if and only if the container contains o
201      */

202     public boolean contains(String JavaDoc o, String JavaDoc l);
203     /** Determine whether the container contains a value
204      * @param o the value being tested for
205      
206      * @return true if and only if the container contains o
207      */

208     public boolean contains(Object JavaDoc o);
209     
210     /** Remove a value from the container.
211      *
212      * <p>The predicate of the statement <CODE>s</CODE> identifies the
213      * ordinal of the value to be removed. Once removed, the values in the
214      * container with a higher ordinal value are renumbered. The renumbering
215      * algorithm depends on the type of container.<p>
216      * @param s The statement to be removed from the model.
217      
218      * @return this container to enable cascading calls.
219      */

220     public Container remove(Statement s);
221     
222     /** Return an iterator over the values.
223      *
224      * <p><B>Note</B> the interator returned is not a standard java.util.iterator.
225      * It has a <CODE>close</CODE> method which SHOULD be called if the
226      * application has not completed the iteration, but no longer requires
227      * the iterator. This will enable the freeing of resources in, for
228      * example, implementations which store their models in a database.</p>
229      .
230      * @return Return an iterator over the values.
231      */

232     public NodeIterator iterator();
233     /** return the number values in the container.
234      
235      * @return the number of values int the container.
236      */

237     public int size();
238 }
Popular Tags