01: /*
02: (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: [See end of file]
04: $Id: StmtIteratorImpl.java,v 1.13 2008/01/02 12:05:04 andy_seaborne Exp $
05: */
06:
07: package com.hp.hpl.jena.rdf.model.impl;
08:
09: import com.hp.hpl.jena.util.iterator.*;
10: import com.hp.hpl.jena.rdf.model.*;
11:
12: import java.util.Iterator;
13:
14: /** An implementation of StmtIterator.
15: *
16: * @author bwm
17: * @version Release='$Name: $' Revision='$Revision: 1.13 $' Date='$Date: 2008/01/02 12:05:04 $'
18: */
19:
20: public class StmtIteratorImpl extends WrappedIterator implements
21: StmtIterator {
22: private Statement current;
23:
24: public StmtIteratorImpl(Iterator iterator) {
25: super (iterator);
26: }
27:
28: /**
29: return *and remember* the next element. It must be remembered
30: so that remove works whichever next-method is called.
31: */
32: public Object next() {
33: return current = (Statement) super .next();
34: }
35:
36: public void remove() {
37: super .remove();
38: current.remove();
39: }
40:
41: public Statement nextStatement() {
42: return (Statement) next();
43: }
44: }
45:
46: /*
47: * (c) Copyright 2000, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
48: * All rights reserved.
49: *
50: * Redistribution and use in source and binary forms, with or without
51: * modification, are permitted provided that the following conditions
52: * are met:
53: * 1. Redistributions of source code must retain the above copyright
54: * notice, this list of conditions and the following disclaimer.
55: * 2. Redistributions in binary form must reproduce the above copyright
56: * notice, this list of conditions and the following disclaimer in the
57: * documentation and/or other materials provided with the distribution.
58: * 3. The name of the author may not be used to endorse or promote products
59: * derived from this software without specific prior written permission.
60:
61: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
62: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
63: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
64: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
65: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
66: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
67: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
68: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
69: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
70: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
71: *
72: * StmtIteratorImpl.java
73: *
74: * Created on 07 August 2000, 07:04
75: */
|