1 31 32 package com.hp.hpl.jena.rdf.model.impl; 33 34 import com.hp.hpl.jena.util.iterator.*; 35 import com.hp.hpl.jena.rdf.model.*; 36 37 import java.util.NoSuchElementException ; 38 import java.util.Iterator ; 39 40 46 public class SeqNodeIteratorImpl extends WrappedIterator implements NodeIterator { 47 48 Statement stmt = null; 49 Seq seq; 50 int size; 51 int index=0; 52 int numDeleted=0; 53 55 public SeqNodeIteratorImpl (Iterator iterator, 56 57 Seq seq) { 58 super( iterator ); 59 this.seq = seq; 60 this.size = seq.size(); 61 } 62 63 public Object next() throws NoSuchElementException { 64 stmt = (Statement) super.next(); 65 index += 1; 66 return stmt.getObject(); 67 } 68 69 public RDFNode nextNode() throws NoSuchElementException { 70 return (RDFNode) next(); 71 } 72 73 public void remove() throws NoSuchElementException { 74 if (stmt == null) throw new NoSuchElementException (); 75 ((ContainerI)seq).remove(index-numDeleted, stmt.getObject()); 76 stmt = null; 77 numDeleted++; 78 } 79 80 public void close() { 81 super.close(); 82 } 83 } | Popular Tags |