java/alt2xml-out-xpath/src/cz/frantovo/alt2xml/out/xpath/OneItemIterator.java
author František Kučera <franta-hg@frantovo.cz>
Sun, 02 Oct 2016 15:22:06 +0200
changeset 108 bbb9b31255be
parent 101 fd83cd102325
child 111 e4900596abdb
permissions -rw-r--r--
out-xpath: TODO comment
franta-hg@101
     1
/**
franta-hg@101
     2
 * Alt2XML
franta-hg@101
     3
 * Copyright © 2014 František Kučera (frantovo.cz)
franta-hg@101
     4
 *
franta-hg@101
     5
 * This program is free software: you can redistribute it and/or modify
franta-hg@101
     6
 * it under the terms of the GNU General Public License as published by
franta-hg@101
     7
 * the Free Software Foundation, either version 3 of the License, or
franta-hg@101
     8
 * (at your option) any later version.
franta-hg@101
     9
 *
franta-hg@101
    10
 * This program is distributed in the hope that it will be useful,
franta-hg@101
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@101
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@101
    13
 * GNU General Public License for more details.
franta-hg@101
    14
 *
franta-hg@101
    15
 * You should have received a copy of the GNU General Public License
franta-hg@101
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
franta-hg@101
    17
 */
franta-hg@101
    18
package cz.frantovo.alt2xml.out.xpath;
franta-hg@101
    19
franta-hg@101
    20
import java.util.Iterator;
franta-hg@101
    21
franta-hg@101
    22
/**
franta-hg@101
    23
 *
franta-hg@101
    24
 * @author Ing. František Kučera (frantovo.cz)
franta-hg@101
    25
 */
franta-hg@101
    26
public class OneItemIterator<T> implements Iterator<T> {
franta-hg@101
    27
franta-hg@101
    28
	private final T item;
franta-hg@101
    29
	private boolean unused = true;
franta-hg@101
    30
franta-hg@101
    31
	public OneItemIterator(T item) {
franta-hg@101
    32
		this.item = item;
franta-hg@101
    33
	}
franta-hg@101
    34
franta-hg@101
    35
	@Override
franta-hg@101
    36
	public boolean hasNext() {
franta-hg@101
    37
		return unused;
franta-hg@101
    38
	}
franta-hg@101
    39
franta-hg@101
    40
	@Override
franta-hg@101
    41
	public T next() {
franta-hg@101
    42
		return item;
franta-hg@101
    43
	}
franta-hg@101
    44
franta-hg@101
    45
	@Override
franta-hg@101
    46
	public void remove() {
franta-hg@101
    47
		throw new UnsupportedOperationException("remove not supported");
franta-hg@101
    48
	}
franta-hg@101
    49
}