C++ Client API Reference for Oracle Coherence
14c (14.1.2.0.0)

F79659-03

coherence/util/LongArrayIterator.hpp

00001 /*
00002  * Copyright (c) 2000, 2020, Oracle and/or its affiliates.
00003  *
00004  * Licensed under the Universal Permissive License v 1.0 as shown at
00005  * http://oss.oracle.com/licenses/upl.
00006  */
00007 #ifndef COH_LONG_ARRAY_ITERATOR_HPP
00008 #define COH_LONG_ARRAY_ITERATOR_HPP
00009 
00010 #include "coherence/lang.ns"
00011 
00012 #include "coherence/util/Muterator.hpp"
00013 
00014 COH_OPEN_NAMESPACE2(coherence,util)
00015 
00016 
00017 /**
00018 * A LongArray specific iterator that adds a "current element" concept.
00019 *
00020 * @author js 2008.04.04
00021 */
00022 class COH_EXPORT LongArrayIterator
00023     : public interface_spec<LongArrayIterator,
00024         implements<Muterator> >
00025     {
00026     // ----- LongArrayIterator implementation -------------------------------
00027 
00028     public:
00029         /**
00030         * Returns the index of the current value, which is the value returned
00031         * by the most recent call to the <tt>next</tt> method.
00032         *
00033         * @return the current index
00034         *
00035         * @throws IllegalStateException if the <tt>next</tt> method has
00036         *          not yet been called, or the <tt>remove</tt> method has
00037         *          already been called after the last call to the
00038         *          <tt>next</tt> method.
00039         */
00040         virtual int64_t getIndex() const = 0;
00041 
00042         /**
00043         * Returns the current value, which is the same value returned by the
00044         * most recent call to the <tt>next</tt> method, or the most recent
00045         * value passed to <tt>setValue</tt> if <tt>setValue</tt> were called
00046         * after the <tt>next</tt> method.
00047         *
00048         * @return  the current value
00049         *
00050         * @throws IllegalStateException if the <tt>next</tt> method has
00051         *         not yet been called, or the <tt>remove</tt> method has
00052         *         already been called after the last call to the
00053         *          <tt>next</tt> method.
00054         */
00055         virtual Object::Holder getValue() const = 0;
00056 
00057         /**
00058         * Stores a new value at the current value index, returning the value
00059         * that was replaced. The index of the current value is obtainable by
00060         * calling the <tt>getIndex</tt> method.
00061         *
00062         * @return  the replaced value
00063         *
00064         * @throws UnsupportedOperationException if the <tt>remove</tt>
00065         *          operation is not supported by this Iterator
00066         * @throws IllegalStateException if the <tt>next</tt> method has
00067         *          not yet been called, or the <tt>remove</tt> method has
00068         *          already been called after the last call to the
00069         *          <tt>next</tt> method.
00070         */
00071         virtual Object::Holder setValue(Object::Holder oValue) = 0;
00072 
00073         /**
00074         * Removes from the underlying collection the last element returned by
00075         * the iterator (optional operation).  This method can be called only
00076         * once per call to <tt>next</tt>.  The behavior of an iterator is
00077         * unspecified if the underlying collection is modified while the
00078         * iteration is in progress in any way other than by calling this
00079         * method.
00080         *
00081         * @throws UnsupportedOperationException if the <tt>remove</tt>
00082         *             operation is not supported by this Iterator
00083         * @throws IllegalStateException if the <tt>next</tt> method has
00084         *             not yet been called, or the <tt>remove</tt> method has
00085         *             already been called after the last call to the
00086         *             <tt>next</tt> method.
00087         */
00088         virtual void remove() = 0;
00089     };
00090 
00091 COH_CLOSE_NAMESPACE2
00092 
00093 #endif // COH_LONG_ARRAY_ITERATOR_HPP
Copyright © 2000, 2025, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.