Oracle Coherence for C++ API
Release 3.6.0.0

E15728-01

coherence/util/LongArrayIterator.hpp

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