001: /*
002: * (c) Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003: * All rights reserved.
004: *
005: * Redistribution and use in source and binary forms, with or without
006: * modification, are permitted provided that the following conditions
007: * are met:
008: * 1. Redistributions of source code must retain the above copyright
009: * notice, this list of conditions and the following disclaimer.
010: * 2. Redistributions in binary form must reproduce the above copyright
011: * notice, this list of conditions and the following disclaimer in the
012: * documentation and/or other materials provided with the distribution.
013: * 3. The name of the author may not be used to endorse or promote products
014: * derived from this software without specific prior written permission.
015:
016: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
017: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
018: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
019: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
020: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
021: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
022: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
023: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
024: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
025: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
026: *
027: * Seq.java
028: *
029: * Created on 26 July 2000, 15:24
030: */
031:
032: package com.hp.hpl.jena.rdf.model;
033:
034: /** RDF Sequence container.
035: *
036: * <p>This interface defines methods for accessing RDF Sequence resources.
037: * These methods operate on the RDF statements contained in a model. The
038: * Sequence implementation may cache state from the underlying model, so
039: * objects should not be added to or removed from the Sequence by directly
040: * manipulating its properties, whilst the Sequence is being
041: * accessed through this interface.</p>
042: *
043: * <p>When a member is deleted from a sequence using this interface, or an
044: * iterator returned through this interface, all the other members with
045: * higher ordinals are renumbered to one below what they previously were.</p>
046: *
047: * <p>This interface provides methods supporting typed literals. This means
048: * that methods are provided which will translate a built in type, or an
049: * object to an RDF Literal. This translation is done by invoking the
050: * <CODE>toString()</CODE> method of the object, or its built in equivalent.
051: * The reverse translation is also supported. This is built in for built
052: * in types. Factory objects, provided by the application, are used
053: * for application objects.</p>
054: * <p>This interface provides methods for supporting enhanced resources. An
055: * enhanced resource is a resource to which the application has added
056: * behaviour. RDF containers are examples of enhanced resources built in
057: * to this package. Enhanced resources are supported by encapsulating a
058: * resource created by an implementation in another class which adds
059: * the extra behaviour. Factory objects are used to construct such
060: * enhanced resources.</p>
061: * @author bwm
062: * @version Release='$Name: $' Revision='$Revision: 1.13 $' Date='$Date: 2008/01/02 12:05:48 $'
063: */
064: public interface Seq extends Container {
065:
066: /** Insert a new member into the sequence at the specified position.
067: *
068: * <p>The existing member at that position, and all others with higher indexes,
069: * have their index increased by one.</p>
070: * @param index The index of the new member,
071: * @param o The member to be added.
072: .
073: * @return this object to enable cascading of method calls.
074: */
075: public Seq add(int index, RDFNode o);
076:
077: /** Insert a new member into the sequence at the specified position.
078: *
079: * <p>The existing member at that position, and all others with higher indexes,
080: * have their index increased by one.</p>
081: * @param index The index of the new member,
082: * @param o The member to be added.
083: .
084: * @return this object to enable cascading of method calls.
085: */
086: public Seq add(int index, boolean o);
087:
088: /** Insert a new member into the sequence at the specified position.
089: *
090: * <p>The existing member at that position, and all others with higher indexes,
091: * have their index increased by one.</p>
092: * @param index The index of the new member,
093: * @param o The member to be added.
094: .
095: * @return this object to enable cascading of method calls.
096: */
097: public Seq add(int index, long o);
098:
099: /** Insert a new member into the sequence at the specified position.
100: *
101: * <p>The existing member at that position, and all others with higher indexes,
102: * have their index increased by one.</p>
103: * @param index The index of the new member,
104: * @param o The member to be added.
105: .
106: * @return this object to enable cascading of method calls.
107: */
108: public Seq add(int index, char o);
109:
110: /** Insert a new member into the sequence at the specified position.
111: *
112: * <p>The existing member at that position, and all others with higher indexes,
113: * have their index increased by one.</p>
114: * @param index The index of the new member,
115: * @param o The member to be added.
116: .
117: * @return this object to enable cascading of method calls.
118: */
119: public Seq add(int index, float o);
120:
121: /** Insert a new member into the sequence at the specified position.
122: *
123: * <p>The existing member at that position, and all others with higher indexes,
124: * have their index increased by one.</p>
125: * @param index The index of the new member,
126: * @param o The member to be added.
127: .
128: * @return this object to enable cascading of method calls.
129: */
130: public Seq add(int index, double o);
131:
132: /** Insert a new member into the sequence at the specified position.
133: *
134: * <p>The existing member at that position, and all others with higher indexes,
135: * have their index increased by one.</p>
136: * @param index The index of the new member,
137: * @param o The member to be added.
138: .
139: * @return this object to enable cascading of method calls.
140: */
141: public Seq add(int index, String o);
142:
143: /** Insert a new member into the sequence at the specified position.
144: *
145: * <p>The existing member at that position, and all others with higher indexes,
146: * have their index increased by one.</p>
147: * @param index The index of the new member,
148: * @param o The member to be added.
149: * @param l the langauge of the value added
150: .
151: * @return this object to enable cascading of method calls.
152: */
153: public Seq add(int index, String o, String l);
154:
155: /** Insert a new member into the sequence at the specified position.
156: *
157: * <p>The existing member at that position, and all others with higher indexes,
158: * have their index increased by one.</p>
159: * @param index The index of the new member,
160: * @param o The member to be added.
161: .
162: * @return this object to enable cascading of method calls.
163: */
164: public Seq add(int index, Object o);
165:
166: /** Get the member at a given index.
167: *
168: * @param index The index of the required member.
169: .
170: * @return The member at the given index.
171: */
172: public boolean getBoolean(int index);
173:
174: /** Get the member at a given index.
175: *
176: * @param index The index of the required member.
177: .
178: * @return The member at the given index.
179: */
180: public byte getByte(int index);
181:
182: /** Get the member at a given index.
183: *
184: * @param index The index of the required member.
185: .
186: * @return The member at the given index.
187: */
188: public short getShort(int index);
189:
190: /** Get the member at a given index.
191: *
192: * @param index The index of the required member.
193: .
194: * @return The member at the given index.
195: */
196: public int getInt(int index);
197:
198: /** Get the member at a given index.
199: *
200: * @param index The index of the required member.
201: .
202: * @return The member at the given index.
203: */
204: public long getLong(int index);
205:
206: /** Get the member at a given index.
207: *
208: * @param index The index of the required member.
209: .
210: * @return The member at the given index.
211: */
212: public char getChar(int index);
213:
214: /** Get the member at a given index.
215: *
216: * @param index The index of the required member.
217: .
218: * @return The member at the given index.
219: */
220: public float getFloat(int index);
221:
222: /** Get the member at a given index.
223: *
224: * @param index The index of the required member.
225: .
226: * @return The member at the given index.
227: */
228: public double getDouble(int index);
229:
230: /** Get the member at a given index.
231: *
232: * @param index The index of the required member.
233: .
234: * @return The member at the given index.
235: */
236: public String getString(int index);
237:
238: /** Get the language of the member at a given index.
239: *
240: * @param index The index of the required member.
241: .
242: * @return The member at the given index.
243: */
244: public String getLanguage(int index);
245:
246: /** Get the member at a given index.
247: *
248: * <p>The supplied factory object is used to created the object return.</p>
249: * @return The member at the given index.
250: * @param index The index of the required member.
251: * @param f A factory object used to create the returned object.
252: .
253: */
254: public Object getObject(int index, ObjectF f);
255:
256: /** Get the member at a given index.
257: *
258: * <p>The supplied factory object is used to create the returned object.</p>
259: * @return The member at the given index.
260: * @param index The index of the required member.
261: * @param f The factory object used to create the returned object.
262: .
263: */
264: public Resource getResource(int index, ResourceF f);
265:
266: /** Get the member at a given index.
267: *
268: * @param index The index of the required member.
269: .
270: * @return The member at the given index.
271: */
272: public Literal getLiteral(int index);
273:
274: /** Get the member at a given index.
275: *
276: * @param index The index of the required member.
277: .
278: * @return The member at the given index.
279: */
280: public Resource getResource(int index);
281:
282: /** Get the member at a given index.
283: *
284: * @param index The index of the required member.
285: .
286: * @return The member at the given index.
287: */
288: public RDFNode getObject(int index);
289:
290: /** Get the member at a given index.
291: *
292: * @param index The index of the required member.
293: .
294: * @return The member at the given index.
295: */
296: public Bag getBag(int index);
297:
298: /** Get the member at a given index.
299: *
300: * @param index The index of the required member.
301: .
302: * @return The member at the given index.
303: */
304: public Alt getAlt(int index);
305:
306: /** Get the member at a given index.
307: *
308: * @param index The index of the required member.
309: .
310: * @return The member at the given index.
311: */
312: public Seq getSeq(int index);
313:
314: /** Remove the member at the specified index.
315: *
316: * <p>All other members with a higher index will have their index reduced by
317: * one.</p>
318: * @param index The index of the member to be removed.
319: .
320: * @return this object to enable cascading of method calls.
321: */
322: public Seq remove(int index);
323:
324: /** Return the index of a given member of the sequence.
325: *
326: * <p>If more the the same value appears more than once in the sequence,
327: * it is undefined which of the indexes will be returned.</p>
328: *
329: * <p>If the member is not found in this sequence, a value of 0 is returned.</p>
330: * @param o The member sought.
331: .
332: * @return an index of the member in this sequence or 0 if the
333: * member is not found in this sequence.
334: */
335: public int indexOf(RDFNode o);
336:
337: /** Return the index of a given member of the sequence.
338: *
339: * <p>If more the the same value appears more than once in the sequence,
340: * it is undefined which of the indexes will be returned.</p>
341: *
342: * <p>If the member is not found in this sequence, a value of 0 is returned.</p>
343: * @param o The member sought.
344: .
345: * @return an index of the member in this sequence or 0 if the
346: * member is not found in this sequence.
347: */
348: public int indexOf(boolean o);
349:
350: /** Return the index of a given member of the sequence.
351: *
352: * <p>If more the the same value appears more than once in the sequence,
353: * it is undefined which of the indexes will be returned.</p>
354: *
355: * <p>If the member is not found in this sequence, a value of 0 is returned.</p>
356: * @param o The member sought.
357: .
358: * @return an index of the member in this sequence or 0 if the
359: * member is not found in this sequence.
360: */
361: public int indexOf(long o);
362:
363: /** Return the index of a given member of the sequence.
364: *
365: * <p>If more the the same value appears more than once in the sequence,
366: * it is undefined which of the indexes will be returned.</p>
367: *
368: * <p>If the member is not found in this sequence, a value of 0 is returned.</p>
369: * @param o The member sought.
370: .
371: * @return an index of the member in this sequence or 0 if the
372: * member is not found in this sequence.
373: */
374: public int indexOf(char o);
375:
376: /** Return the index of a given member of the sequence.
377: *
378: * <p>If more the the same value appears more than once in the sequence,
379: * it is undefined which of the indexes will be returned.</p>
380: *
381: * <p>If the member is not found in this sequence, a value of 0 is returned.</p>
382: * @param o The member sought.
383: .
384: * @return an index of the member in this sequence or 0 if the
385: * member is not found in this sequence.
386: */
387: public int indexOf(float o);
388:
389: /** Return the index of a given member of the sequence.
390: *
391: * <p>If more the the same value appears more than once in the sequence,
392: * it is undefined which of the indexes will be returned.</p>
393: *
394: * <p>If the member is not found in this sequence, a value of 0 is returned.</p>
395: * @param o The member sought.
396: .
397: * @return an index of the member in this sequence or 0 if the
398: * member is not found in this sequence.
399: */
400: public int indexOf(double o);
401:
402: /** Return the index of a given member of the sequence.
403: *
404: * <p>If more the the same value appears more than once in the sequence,
405: * it is undefined which of the indexes will be returned.</p>
406: *
407: * <p>If the member is not found in this sequence, a value of 0 is returned.</p>
408: * @param o The member sought.
409: .
410: * @return an index of the member in this sequence or 0 if the
411: * member is not found in this sequence.
412: */
413: public int indexOf(String o);
414:
415: /** Return the index of a given member of the sequence.
416: *
417: * <p>If more the the same value appears more than once in the sequence,
418: * it is undefined which of the indexes will be returned.</p>
419: *
420: * <p>If the member is not found in this sequence, a value of 0 is returned.</p>
421: * @param o The member sought.
422: * @param l the language of the member sought
423: .
424: * @return an index of the member in this sequence or 0 if the
425: * member is not found in this sequence.
426: */
427: public int indexOf(String o, String l);
428:
429: /** Return the index of a given member of the sequence.
430: *
431: * <p>If more the the same value appears more than once in the sequence,
432: * it is undefined which of the indexes will be returned.</p>
433: *
434: * <p>If the member is not found in this sequence, a value of 0 is returned.</p>
435: * @param o The member sought.
436: .
437: * @return an index of the member in this sequence or 0 if the
438: * member is not found in this sequence.
439: */
440: public int indexOf(Object o);
441:
442: /** Set the value at a given index in the sequence.
443: *
444: * <p>If the index is not in the range 1 to the size of the
445: * sequence, then an exception is raised.</p>
446: * @param index The index whose member is to be set.
447: * @param o The value to be set.
448: * @throws SeqIndexBoundsException
449: * @return this object to enable cascading method calls.
450: */
451: public Seq set(int index, RDFNode o);
452:
453: /** Set the value at a given index in the sequence.
454: *
455: * <p>If the index is not in the range 1 to the size of the
456: * sequence, then a Jena exception is raised.</p>
457: * @param index The index whose member is to be set.
458: * @param o The value to be set.
459: * @throws SeqIndexBoundsException
460: * @return this object to enable cascading method calls.
461: */
462: public Seq set(int index, boolean o);
463:
464: /** Set the value at a given index in the sequence.
465: *
466: * <p>If the index is not in the range 1 to the size of the
467: * sequence, then a Jena exception is raised.</p>
468: * @param index The index whose member is to be set.
469: * @param o The value to be set.
470: * @throws SeqIndexBoundsException
471: * @return this object to enable cascading method calls.
472: */
473: public Seq set(int index, long o);
474:
475: /** Set the value at a given index in the sequence.
476: *
477: * <p>If the index is not in the range 1 to the size of the
478: * sequence, then a Jena exception is raised.</p>
479: * @param index The index whose member is to be set.
480: * @param o The value to be set.
481: * @throws SeqIndexBoundsException
482: * @return this object to enable cascading method calls.
483: */
484: public Seq set(int index, char o);
485:
486: /** Set the value at a given index in the sequence.
487: *
488: * <p>If the index is not in the range 1 to the size of the
489: * sequence, then a Jena exception is raised.</p>
490: * @param index The index whose member is to be set.
491: * @param o The value to be set.
492: * @throws SeqIndexBoundsException
493: * @return this object to enable cascading method calls.
494: */
495: public Seq set(int index, float o);
496:
497: /** Set the value at a given index in the sequence.
498: *
499: * <p>If the index is not in the range 1 to the size of the
500: * sequence, then a Jena exception is raised.</p>
501: * @param index The index whose member is to be set.
502: * @param o The value to be set.
503: * @throws SeqIndexBoundsException
504: * @return this object to enable cascading method calls.
505: */
506: public Seq set(int index, double o);
507:
508: /** Set the value at a given index in the sequence.
509: *
510: * <p>If the index is not in the range 1 to the size of the
511: * sequence, then a Jena exception is raised.</p>
512: * @param index The index whose member is to be set.
513: * @param o The value to be set.
514: * @throws SeqIndexBoundsException
515: * @return this object to enable cascading method calls.
516: */
517: public Seq set(int index, String o);
518:
519: /** Set the value at a given index in the sequence.
520: *
521: * <p>If the index is not in the range 1 to the size of the
522: * sequence, then a Jena exception is raised.</p>
523: * @param index The index whose member is to be set.
524: * @param o The value to be set.
525: * @param l The language of the value set.
526: * @throws SeqIndexBoundsException
527: * @return this object to enable cascading method calls.
528: */
529: public Seq set(int index, String o, String l);
530:
531: /** Set the value at a given index in the sequence.
532: *
533: * <p>If the index is not in the range 1 to the size of the
534: * sequence, then a Jena exception is raised.</p>
535: * @param index The index whose member is to be set.
536: * @param o The value to be set.
537: * @throws SeqIndexBoundsException
538: * @return this object to enable cascading method calls.
539: */
540: public Seq set(int index, Object o);
541: }
|