|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2001 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.mdr.handlers; import java.util.Collection; import java.util.List; import java.util.ListIterator; import org.netbeans.mdr.storagemodel.MdrStorage; import org.netbeans.mdr.util.TransactionMutex; /** * * @author Martin Matula */ public final class AttrImmutListWrapper extends AttrImmutCollWrapper implements List { /** Creates new ListWrapper */ public AttrImmutListWrapper(MdrStorage mdrStorage, FeaturedHandler source, int attrIndex, String attrName) { super(mdrStorage, source, attrIndex, attrName); } public AttrImmutListWrapper(MdrStorage mdrStorage, Collection inner) { super(mdrStorage, inner); } public List getInnerList() { return (List) getInnerCollection(); } public Object remove(int param) { throw new UnsupportedOperationException(); } public ListIterator listIterator(int param) { lock(false); try { return new AttrImmutListIteratorWrapper(getInnerList().listIterator(param)); } finally { unlock(); } } public void add(int param, Object obj) { throw new UnsupportedOperationException(); } public int indexOf(Object obj) { lock(false); try { return getInnerList().indexOf(obj); } finally { unlock(); } } public int lastIndexOf(Object obj) { lock(false); try { return getInnerList().lastIndexOf(obj); } finally { unlock(); } } public Object get(int param) { lock(false); try { return getInnerList().get(param); } finally { unlock(); } } public Object set(int param, Object obj) { throw new UnsupportedOperationException(); } public boolean addAll(int param, Collection collection) { throw new UnsupportedOperationException(); } public ListIterator listIterator() { lock(false); try { return new AttrImmutListIteratorWrapper(getInnerList().listIterator()); } finally { unlock(); } } public List subList(int param, int param1) { lock(false); try { return new AttrImmutListWrapper(storage, getInnerList().subList(param, param1)); } finally { unlock(); } } public boolean equals(Object object) { if (object instanceof List) { return super.equals(object); } else { return false; } } private final class AttrImmutListIteratorWrapper extends AttrImmutIteratorWrapper implements ListIterator { private final ListIterator innerListIterator; AttrImmutListIteratorWrapper(ListIterator innerIterator) { super(innerIterator); this.innerListIterator = innerIterator; } public int previousIndex() { lock(false); try { return innerListIterator.previousIndex(); } finally { unlock(); } } public void set(Object obj) { throw new UnsupportedOperationException(); } public int nextIndex() { lock(false); try { return innerListIterator.nextIndex(); } finally { unlock(); } } public boolean hasPrevious() { lock(false); try { return innerListIterator.hasPrevious(); } finally { unlock(); } } public void add(Object obj) { throw new UnsupportedOperationException(); } public Object previous() { lock(false); try { return innerListIterator.previous(); } finally { unlock(); } } } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.