| 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.Iterator; |
| 21 | |
import java.util.List; |
| 22 | |
import java.util.ListIterator; |
| 23 | |
|
| 24 | |
import org.apache.commons.collections.primitives.BooleanCollection; |
| 25 | |
import org.apache.commons.collections.primitives.BooleanList; |
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | 457 | abstract class AbstractBooleanListList extends AbstractBooleanCollectionCollection implements List { |
| 33 | |
|
| 34 | |
public void add(int index, Object element) { |
| 35 | 50 | getBooleanList().add(index,((Boolean)element).booleanValue()); |
| 36 | 34 | } |
| 37 | |
|
| 38 | |
public boolean addAll(int index, Collection c) { |
| 39 | 2 | return getBooleanList().addAll(index,CollectionBooleanCollection.wrap(c)); |
| 40 | |
} |
| 41 | |
|
| 42 | |
public Object get(int index) { |
| 43 | 14424 | return new Boolean(getBooleanList().get(index)); |
| 44 | |
} |
| 45 | |
|
| 46 | |
public int indexOf(Object element) { |
| 47 | 70 | return getBooleanList().indexOf(((Boolean)element).booleanValue()); |
| 48 | |
} |
| 49 | |
|
| 50 | |
public int lastIndexOf(Object element) { |
| 51 | 70 | return getBooleanList().lastIndexOf(((Boolean)element).booleanValue()); |
| 52 | |
} |
| 53 | |
|
| 54 | |
|
| 55 | |
|
| 56 | |
|
| 57 | |
|
| 58 | |
|
| 59 | |
|
| 60 | |
|
| 61 | |
public ListIterator listIterator() { |
| 62 | 935 | return BooleanListIteratorListIterator.wrap(getBooleanList().listIterator()); |
| 63 | |
} |
| 64 | |
|
| 65 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | |
|
| 72 | |
public ListIterator listIterator(int index) { |
| 73 | 106 | return BooleanListIteratorListIterator.wrap(getBooleanList().listIterator(index)); |
| 74 | |
} |
| 75 | |
|
| 76 | |
public Object remove(int index) { |
| 77 | 50 | return new Boolean(getBooleanList().removeElementAt(index)); |
| 78 | |
} |
| 79 | |
|
| 80 | |
public Object set(int index, Object element) { |
| 81 | 50 | return new Boolean(getBooleanList().set(index, ((Boolean)element).booleanValue() )); |
| 82 | |
} |
| 83 | |
|
| 84 | |
public List subList(int fromIndex, int toIndex) { |
| 85 | 139 | return BooleanListList.wrap(getBooleanList().subList(fromIndex,toIndex)); |
| 86 | |
} |
| 87 | |
|
| 88 | |
public boolean equals(Object obj) { |
| 89 | 891 | if(obj instanceof List) { |
| 90 | 889 | List that = (List)obj; |
| 91 | 889 | if(this == that) { |
| 92 | 4 | return true; |
| 93 | 885 | } else if(this.size() != that.size()) { |
| 94 | 0 | return false; |
| 95 | |
} else { |
| 96 | 885 | Iterator thisiter = iterator(); |
| 97 | 885 | Iterator thatiter = that.iterator(); |
| 98 | 14348 | while(thisiter.hasNext()) { |
| 99 | 13463 | Object thiselt = thisiter.next(); |
| 100 | 13463 | Object thatelt = thatiter.next(); |
| 101 | 13463 | if(null == thiselt ? null != thatelt : !(thiselt.equals(thatelt))) { |
| 102 | 0 | return false; |
| 103 | |
} |
| 104 | 13463 | } |
| 105 | 885 | return true; |
| 106 | |
} |
| 107 | |
} else { |
| 108 | 2 | return false; |
| 109 | |
} |
| 110 | |
} |
| 111 | |
|
| 112 | |
public int hashCode() { |
| 113 | 892 | return getBooleanList().hashCode(); |
| 114 | |
} |
| 115 | |
|
| 116 | |
protected final BooleanCollection getBooleanCollection() { |
| 117 | 7242 | return getBooleanList(); |
| 118 | |
} |
| 119 | |
|
| 120 | |
protected abstract BooleanList getBooleanList(); |
| 121 | |
|
| 122 | |
|
| 123 | |
} |