| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
package org.apache.commons.collections.primitives.adapters; |
| 18 | |
|
| 19 | |
import java.util.Collection; |
| 20 | |
import java.util.List; |
| 21 | |
|
| 22 | |
import org.apache.commons.collections.primitives.BooleanCollection; |
| 23 | |
import org.apache.commons.collections.primitives.BooleanIterator; |
| 24 | |
import org.apache.commons.collections.primitives.BooleanList; |
| 25 | |
import org.apache.commons.collections.primitives.BooleanListIterator; |
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | 6 | abstract class AbstractListBooleanList extends AbstractCollectionBooleanCollection implements BooleanList { |
| 34 | |
|
| 35 | |
public void add(int index, boolean element) { |
| 36 | 0 | getList().add(index,new Boolean(element)); |
| 37 | 0 | } |
| 38 | |
|
| 39 | |
public boolean addAll(int index, BooleanCollection collection) { |
| 40 | 0 | return getList().addAll(index,BooleanCollectionCollection.wrap(collection)); |
| 41 | |
} |
| 42 | |
|
| 43 | |
public boolean get(int index) { |
| 44 | 0 | return ((Boolean)getList().get(index)).booleanValue(); |
| 45 | |
} |
| 46 | |
|
| 47 | |
public int indexOf(boolean element) { |
| 48 | 0 | return getList().indexOf(new Boolean(element)); |
| 49 | |
} |
| 50 | |
|
| 51 | |
public int lastIndexOf(boolean element) { |
| 52 | 0 | return getList().lastIndexOf(new Boolean(element)); |
| 53 | |
} |
| 54 | |
|
| 55 | |
|
| 56 | |
|
| 57 | |
|
| 58 | |
|
| 59 | |
|
| 60 | |
|
| 61 | |
|
| 62 | |
public BooleanListIterator listIterator() { |
| 63 | 0 | return ListIteratorBooleanListIterator.wrap(getList().listIterator()); |
| 64 | |
} |
| 65 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | |
|
| 72 | |
|
| 73 | |
public BooleanListIterator listIterator(int index) { |
| 74 | 0 | return ListIteratorBooleanListIterator.wrap(getList().listIterator(index)); |
| 75 | |
} |
| 76 | |
|
| 77 | |
public boolean removeElementAt(int index) { |
| 78 | 0 | return ((Boolean)getList().remove(index)).booleanValue(); |
| 79 | |
} |
| 80 | |
|
| 81 | |
public boolean set(int index, boolean element) { |
| 82 | 0 | return ((Boolean)getList().set(index,new Boolean(element))).booleanValue(); |
| 83 | |
} |
| 84 | |
|
| 85 | |
public BooleanList subList(int fromIndex, int toIndex) { |
| 86 | 0 | return ListBooleanList.wrap(getList().subList(fromIndex,toIndex)); |
| 87 | |
} |
| 88 | |
|
| 89 | |
public boolean equals(Object obj) { |
| 90 | 3 | if(obj instanceof BooleanList) { |
| 91 | 3 | BooleanList that = (BooleanList)obj; |
| 92 | 3 | if(this == that) { |
| 93 | 0 | return true; |
| 94 | 3 | } else if(this.size() != that.size()) { |
| 95 | 0 | return false; |
| 96 | |
} else { |
| 97 | 3 | BooleanIterator thisiter = iterator(); |
| 98 | 3 | BooleanIterator thatiter = that.iterator(); |
| 99 | 10 | while(thisiter.hasNext()) { |
| 100 | 7 | if(thisiter.next() != thatiter.next()) { |
| 101 | 0 | return false; |
| 102 | |
} |
| 103 | |
} |
| 104 | 3 | return true; |
| 105 | |
} |
| 106 | |
} else { |
| 107 | 0 | return false; |
| 108 | |
} |
| 109 | |
} |
| 110 | |
|
| 111 | |
public int hashCode() { |
| 112 | 0 | return getList().hashCode(); |
| 113 | |
} |
| 114 | |
|
| 115 | |
final protected Collection getCollection() { |
| 116 | 12 | return getList(); |
| 117 | |
} |
| 118 | |
|
| 119 | |
abstract protected List getList(); |
| 120 | |
} |