⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lazyjbtopiterator.java

📁 OPIAM stands for Open Identity and Access Management. This Suite will provide modules for user & rig
💻 JAVA
字号:
/*
 * OPIAM Suite
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package opiam.admin.faare.persistence;

import java.util.ConcurrentModificationException;

/**
  * Iterator for the LazyJBTopCollection.
  */
public final class LazyJBTopIterator extends LazyIterator
{
    /**
     * Creates an iterator.
     * @param rc enclosing LazyJBTopCollection.
     */
    protected LazyJBTopIterator(LazyJBTopCollection rc)
    {
        super(rc);
    }

    /**
     * @see java.util.Iterator#next().
     */
    public Object next()
    {
        if (getChangestamp() != getParent().getChangecount())
        {
            throw new ConcurrentModificationException(
                "Concurrent Modification is not allowed!");
        }

        if (getCursor() >= getParent().size())
        {
            return null;
        }

        Object dn;
        Object o;

        if (getCursor() < getParent().getAdded().size())
        {
            dn = getParent().getAdded().get(getCursor());
            incCursor();
            o = ((LazyJBTopCollection) getParent()).getLoaded().get(dn);

            if (o != null)
            {
                return o;
            }

            Object obj = ((LazyJBTopCollection) getParent()).lazyLoadObj(dn,
                    getParent().getUserContext());

            if (obj == null)
            {
                remove();

                return next();
            }
            else
            {
                return obj;
            }
        }
        else
        {
            // skip to the first "not deleted" dn
            dn = getParent().getValues().get(getCursor() -
                    getParent().getAdded().size());
            incCursor();

            while (isSkipped(dn))
            {
                dn = getParent().getValues().get(getCursor() -
                        getParent().getAdded().size());
                incCursor();
            }

            o = ((LazyJBTopCollection) getParent()).getLoaded().get(dn);

            if (o != null)
            {
                return o;
            }

            Object obj = ((LazyJBTopCollection) getParent()).lazyLoadObj(dn,
                    getParent().getUserContext());

            if (obj == null)
            {
                return next();
            }
            else
            {
                return obj;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -