KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > util > iterator > ExtendedIterator


1 /*
2   (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3   [See end of file]
4   $Id: ExtendedIterator.java,v 1.6 2005/02/21 12:19:15 andy_seaborne Exp $
5 */

6
7 package com.hp.hpl.jena.util.iterator;
8
9 /**
10     an ExtendedIterator is a ClosableIterator on which other operations are
11     defined for convenience in iterator composition: composition, filtering
12     in, filtering out, and element mapping.
13 <br>
14     NOTE that the result of each of these operations consumes the base
15     iterator(s); they do not make independant copies.
16 <br>
17     The canonical implementation of ExtendedIterator is NiceIterator, which
18     also defines static methods for these operations that will work on any
19     ClosableIterators.
20 <br>
21      @author kers
22 */

23
24 public interface ExtendedIterator extends ClosableIterator
25     {
26     /**
27          Answer the next object, and remove it. Equivalent to next(); remove().
28     */

29     public Object JavaDoc removeNext();
30     
31     /**
32          return a new iterator which delivers all the elements of this iterator and
33          then all the elements of the other iterator. Does not copy either iterator;
34          they are consumed as the result iterator is consumed.
35      */

36      public ExtendedIterator andThen( ClosableIterator other );
37
38      /**
39          return a new iterator containing only the elements of _this_ which
40          pass the filter _f_. The order of the elements is preserved. Does not
41          copy _this_, which is consumed as the result is consumed.
42      */

43      public ExtendedIterator filterKeep( Filter f );
44
45      /**
46          return a new iterator containing only the elements of _this_ which
47          are rejected by the filter _f_. The order of the elements is preserved.
48          Does not copy _this_, which is consumed as the reult is consumed.
49      */

50      public ExtendedIterator filterDrop( Filter f );
51
52      /**
53          return a new iterator where each element is the result of applying
54          _map1_ to the corresponding element of _this_. _this_ is not
55          copied; it is consumed as the result is consumed.
56      */

57      public ExtendedIterator mapWith( Map1 map1 );
58     }
59
60 /*
61     (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
62     All rights reserved.
63
64     Redistribution and use in source and binary forms, with or without
65     modification, are permitted provided that the following conditions
66     are met:
67
68     1. Redistributions of source code must retain the above copyright
69        notice, this list of conditions and the following disclaimer.
70
71     2. Redistributions in binary form must reproduce the above copyright
72        notice, this list of conditions and the following disclaimer in the
73        documentation and/or other materials provided with the distribution.
74
75     3. The name of the author may not be used to endorse or promote products
76        derived from this software without specific prior written permission.
77
78     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
79     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
80     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
81     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
82     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
83     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
84     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
85     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
86     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
87     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
88 */

89
Popular Tags