franta-hg@101: /**
franta-hg@101: * Alt2XML
franta-hg@101: * Copyright © 2014 František Kučera (frantovo.cz)
franta-hg@101: *
franta-hg@101: * This program is free software: you can redistribute it and/or modify
franta-hg@101: * it under the terms of the GNU General Public License as published by
franta-hg@111: * the Free Software Foundation, version 3 of the License.
franta-hg@101: *
franta-hg@101: * This program is distributed in the hope that it will be useful,
franta-hg@101: * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@101: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@101: * GNU General Public License for more details.
franta-hg@101: *
franta-hg@101: * You should have received a copy of the GNU General Public License
franta-hg@101: * along with this program. If not, see .
franta-hg@101: */
franta-hg@101: package cz.frantovo.alt2xml.out.xpath;
franta-hg@101:
franta-hg@101: import java.util.Iterator;
franta-hg@101:
franta-hg@101: /**
franta-hg@101: *
franta-hg@101: * @author Ing. František Kučera (frantovo.cz)
franta-hg@101: */
franta-hg@101: public class OneItemIterator implements Iterator {
franta-hg@101:
franta-hg@101: private final T item;
franta-hg@101: private boolean unused = true;
franta-hg@101:
franta-hg@101: public OneItemIterator(T item) {
franta-hg@101: this.item = item;
franta-hg@101: }
franta-hg@101:
franta-hg@101: @Override
franta-hg@101: public boolean hasNext() {
franta-hg@101: return unused;
franta-hg@101: }
franta-hg@101:
franta-hg@101: @Override
franta-hg@101: public T next() {
franta-hg@101: return item;
franta-hg@101: }
franta-hg@101:
franta-hg@101: @Override
franta-hg@101: public void remove() {
franta-hg@101: throw new UnsupportedOperationException("remove not supported");
franta-hg@101: }
franta-hg@101: }