001/*
002// This software is subject to the terms of the Eclipse Public License v1.0
003// Agreement, available at the following URL:
004// http://www.eclipse.org/legal/epl-v10.html.
005// You must accept the terms of that agreement to use this software.
006//
007// Copyright (C) 2011-2011 Pentaho
008// All Rights Reserved.
009*/
010package mondrian.calc.impl;
011
012import mondrian.calc.TupleIterator;
013import mondrian.olap.Member;
014
015import java.util.List;
016
017/**
018* Abstract implementation of {@link TupleIterator}.
019 *
020 * <p>Derived classes need to implement only {@link #forward()}.
021 * {@code forward} must set the {@link #current}
022 * field, and derived classes can use it.
023 *
024 * @author jhyde
025 */
026public abstract class AbstractTupleIterator
027    extends AbstractTupleCursor
028    implements TupleIterator
029{
030    protected boolean hasNext;
031
032    public AbstractTupleIterator(int arity) {
033        super(arity);
034    }
035
036    public boolean hasNext() {
037        return hasNext;
038    }
039
040    public List<Member> next() {
041        List<Member> o = current();
042        hasNext = forward();
043        return o;
044    }
045
046    public void remove() {
047        throw new UnsupportedOperationException("remove");
048    }
049
050}
051
052// End AbstractTupleIterator.java