Coverage Report - org.apache.commons.collections.primitives.adapters.AbstractFloatListList
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractFloatListList
100%
30/30
78%
11/14
1.714
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *     http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 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.FloatCollection;
 25  
 import org.apache.commons.collections.primitives.FloatList;
 26  
 
 27  
 /**
 28  
  * @since Commons Primitives 1.0
 29  
  * @version $Revision: 480462 $ $Date: 2006-11-29 03:15:00 -0500 (Wed, 29 Nov 2006) $
 30  
  * @author Rodney Waldhoff 
 31  
  */
 32  1145
 abstract class AbstractFloatListList extends AbstractFloatCollectionCollection implements List {
 33  
     
 34  
     public void add(int index, Object element) {
 35  119
         getFloatList().add(index,((Number)element).floatValue());
 36  79
     }
 37  
 
 38  
     public boolean addAll(int index, Collection c) {
 39  5
         return getFloatList().addAll(index,CollectionFloatCollection.wrap(c));
 40  
     }
 41  
 
 42  
     public Object get(int index) {
 43  31398
         return new Float(getFloatList().get(index));
 44  
     }
 45  
 
 46  
     public int indexOf(Object element) {
 47  148
         return getFloatList().indexOf(((Number)element).floatValue());
 48  
     }
 49  
 
 50  
     public int lastIndexOf(Object element) {
 51  148
         return getFloatList().lastIndexOf(((Number)element).floatValue());
 52  
     }
 53  
 
 54  
     /**
 55  
      * {@link FloatListIteratorListIterator#wrap wraps} the 
 56  
      * {@link org.apache.commons.collections.primitives.FloatListIterator FloatListIterator}
 57  
      * returned by my underlying 
 58  
      * {@link FloatList FloatList}, 
 59  
      * if any.
 60  
      */
 61  
     public ListIterator listIterator() {
 62  2207
         return FloatListIteratorListIterator.wrap(getFloatList().listIterator());
 63  
     }
 64  
 
 65  
     /**
 66  
      * {@link FloatListIteratorListIterator#wrap wraps} the 
 67  
      * {@link org.apache.commons.collections.primitives.FloatListIterator FloatListIterator}
 68  
      * returned by my underlying 
 69  
      * {@link FloatList FloatList}, 
 70  
      * if any.
 71  
      */
 72  
     public ListIterator listIterator(int index) {
 73  247
         return FloatListIteratorListIterator.wrap(getFloatList().listIterator(index));
 74  
     }
 75  
 
 76  
     public Object remove(int index) {
 77  119
         return new Float(getFloatList().removeElementAt(index));
 78  
     }
 79  
 
 80  
     public Object set(int index, Object element) {
 81  119
         return new Float(getFloatList().set(index, ((Number)element).floatValue() ));
 82  
     }
 83  
 
 84  
     public List subList(int fromIndex, int toIndex) {
 85  304
         return FloatListList.wrap(getFloatList().subList(fromIndex,toIndex));
 86  
     }
 87  
 
 88  
     public boolean equals(Object obj) {
 89  2153
         if(obj instanceof List) {
 90  2138
             List that = (List)obj;
 91  2138
             if(this == that) {
 92  20
                 return true;
 93  2118
             } else if(this.size() != that.size()) {
 94  19
                 return false;            
 95  
             } else {
 96  2099
                 Iterator thisiter = iterator();
 97  2099
                 Iterator thatiter = that.iterator();
 98  31440
                 while(thisiter.hasNext()) {
 99  29347
                     Object thiselt = thisiter.next();
 100  29347
                     Object thatelt = thatiter.next();
 101  29347
                     if(null == thiselt ? null != thatelt : !(thiselt.equals(thatelt))) {
 102  6
                         return false;
 103  
                     }
 104  29341
                 }
 105  2093
                 return true;
 106  
             }
 107  
         } else {
 108  15
             return false;
 109  
         }
 110  
     }
 111  
 
 112  
     public int hashCode() {
 113  2101
         return getFloatList().hashCode();
 114  
     }
 115  
     
 116  
     protected final FloatCollection getFloatCollection() {
 117  17224
         return getFloatList();
 118  
     }
 119  
     
 120  
     protected abstract FloatList getFloatList();
 121  
         
 122  
 
 123  
 }