| 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.collections4.list; | |
| 18 | ||
| 19 | import java.util.AbstractList; | |
| 20 | import java.util.Collection; | |
| 21 | import java.util.ConcurrentModificationException; | |
| 22 | import java.util.Iterator; | |
| 23 | import java.util.ListIterator; | |
| 24 | import java.util.NoSuchElementException; | |
| 25 | ||
| 26 | import org.apache.commons.collections4.ArrayStack; | |
| 27 | import org.apache.commons.collections4.OrderedIterator; | |
| 28 | ||
| 29 | /** | |
| 30 | * A List implementation that is optimised for fast insertions and | |
| 31 | * removals at any index in the list. | |
| 32 | *
 | |
| 33 | * This list implementation utilises a tree structure internally to ensure that | |
| 34 | * all insertions and removals are O(log n). This provides much faster performance | |
| 35 | * than both an ArrayList and a LinkedList where elements | |
| 36 | * are inserted and removed repeatedly from anywhere in the list. | |
| 37 | *
 | |
| 38 | * The following relative performance statistics are indicative of this class: | |
| 39 | *
 | |
| 40 | * get add insert iterate remove | |
| 41 | * TreeList 3 5 1 2 1 | |
| 42 | * ArrayList 1 1 40 1 40 | |
| 43 | * LinkedList 5800 1 350 2 325 | |
| 44 | *
 | |
| 45 | * ArrayList is a good general purpose list implementation. | |
| 46 | * It is faster than TreeList for most operations except inserting | |
| 47 | * and removing in the middle of the list. ArrayList also uses less | |
| 48 | * memory as TreeList uses one object per entry. | |
| 49 | *
 | |
| 50 | * LinkedList is rarely a good choice of implementation. | |
| 51 | * TreeList is almost always a good replacement for it, although it | |
| 52 | * does use slightly more memory. | |
| 53 | * | |
| 54 | * @since 3.1 | |
| 55 | * @version $Id: TreeList.java 1533984 2013-10-20 21:12:51Z tn $ | |
| 56 | */ | |
| 57 | @SuppressWarnings("deprecation") // replace ArrayStack by ArrayDeque when moving to Java 1.6 | |
| 58 | public class TreeList<E> extends AbstractList<E> { | |
| 59 | // add; toArray; iterator; insert; get; indexOf; remove | |
| 60 | // TreeList = 1260;7360;3080; 160; 170;3400; 170; | |
| 61 | // ArrayList = 220;1480;1760; 6870; 50;1540; 7200; | |
| 62 | // LinkedList = 270;7360;3350;55860;290720;2910;55200; | |
| 63 | ||
| 64 | /** The root node in the AVL tree */ | |
| 65 | private AVLNode<E> root; | |
| 66 | ||
| 67 | /** The current size of the list */ | |
| 68 | private int size; | |
| 69 | ||
| 70 | //----------------------------------------------------------------------- | |
| 71 | /** | |
| 72 | * Constructs a new empty list. | |
| 73 | */ | |
| 74 | public TreeList() { | |
| 75 | super(); | |
| 76 | } | |
| 77 | ||
| 78 | /** | |
| 79 | * Constructs a new empty list that copies the specified collection. | |
| 80 | * | |
| 81 | * @param coll the collection to copy | |
| 82 | * @throws NullPointerException if the collection is null | |
| 83 | */ | |
| 84 | public TreeList(final Collection<? extends E> coll) { | |
| 85 | super(); | |
| 86 |
1
1. |
if (!coll.isEmpty()) { |
| 87 | root = new AVLNode<E>(coll); | |
| 88 | size = coll.size(); | |
| 89 | } | |
| 90 | } | |
| 91 | ||
| 92 | //----------------------------------------------------------------------- | |
| 93 | /** | |
| 94 | * Gets the element at the specified index. | |
| 95 | * | |
| 96 | * @param index the index to retrieve | |
| 97 | * @return the element at the specified index | |
| 98 | */ | |
| 99 | @Override | |
| 100 | public E get(final int index) { | |
| 101 |
2
1. get : Replaced integer subtraction with addition → NO_COVERAGE 2. get : removed call to org/apache/commons/collections4/list/TreeList::checkInterval → NO_COVERAGE |
checkInterval(index, 0, size() - 1); |
| 102 |
1
1. get : mutated return of Object value for org/apache/commons/collections4/list/TreeList::get to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return root.get(index).getValue(); |
| 103 | } | |
| 104 | ||
| 105 | /** | |
| 106 | * Gets the current size of the list. | |
| 107 | * | |
| 108 | * @return the current size | |
| 109 | */ | |
| 110 | @Override | |
| 111 | public int size() { | |
| 112 |
1
1. size : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return size; |
| 113 | } | |
| 114 | ||
| 115 | /** | |
| 116 | * Gets an iterator over the list. | |
| 117 | * | |
| 118 | * @return an iterator over the list | |
| 119 | */ | |
| 120 | @Override | |
| 121 | public Iterator<E> iterator() { | |
| 122 | // override to go 75% faster | |
| 123 |
1
1. iterator : mutated return of Object value for org/apache/commons/collections4/list/TreeList::iterator to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return listIterator(0); |
| 124 | } | |
| 125 | ||
| 126 | /** | |
| 127 | * Gets a ListIterator over the list. | |
| 128 | * | |
| 129 | * @return the new iterator | |
| 130 | */ | |
| 131 | @Override | |
| 132 | public ListIterator<E> listIterator() { | |
| 133 | // override to go 75% faster | |
| 134 |
1
1. listIterator : mutated return of Object value for org/apache/commons/collections4/list/TreeList::listIterator to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return listIterator(0); |
| 135 | } | |
| 136 | ||
| 137 | /** | |
| 138 | * Gets a ListIterator over the list. | |
| 139 | * | |
| 140 | * @param fromIndex the index to start from | |
| 141 | * @return the new iterator | |
| 142 | */ | |
| 143 | @Override | |
| 144 | public ListIterator<E> listIterator(final int fromIndex) { | |
| 145 | // override to go 75% faster | |
| 146 | // cannot use EmptyIterator as iterator.add() must work | |
| 147 |
1
1. listIterator : removed call to org/apache/commons/collections4/list/TreeList::checkInterval → NO_COVERAGE |
checkInterval(fromIndex, 0, size()); |
| 148 |
1
1. listIterator : mutated return of Object value for org/apache/commons/collections4/list/TreeList::listIterator to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new TreeListIterator<E>(this, fromIndex); |
| 149 | } | |
| 150 | ||
| 151 | /** | |
| 152 | * Searches for the index of an object in the list. | |
| 153 | * | |
| 154 | * @param object the object to search | |
| 155 | * @return the index of the object, -1 if not found | |
| 156 | */ | |
| 157 | @Override | |
| 158 | public int indexOf(final Object object) { | |
| 159 | // override to go 75% faster | |
| 160 |
1
1. indexOf : negated conditional → NO_COVERAGE |
if (root == null) { |
| 161 |
1
1. indexOf : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return -1; |
| 162 | } | |
| 163 |
1
1. indexOf : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return root.indexOf(object, root.relativePosition); |
| 164 | } | |
| 165 | ||
| 166 | /** | |
| 167 | * Searches for the presence of an object in the list. | |
| 168 | * | |
| 169 | * @param object the object to check | |
| 170 | * @return true if the object is found | |
| 171 | */ | |
| 172 | @Override | |
| 173 | public boolean contains(final Object object) { | |
| 174 |
3
1. contains : changed conditional boundary → NO_COVERAGE 2. contains : negated conditional → NO_COVERAGE 3. contains : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return indexOf(object) >= 0; |
| 175 | } | |
| 176 | ||
| 177 | /** | |
| 178 | * Converts the list into an array. | |
| 179 | * | |
| 180 | * @return the list as an array | |
| 181 | */ | |
| 182 | @Override | |
| 183 | public Object[] toArray() { | |
| 184 | // override to go 20% faster | |
| 185 | final Object[] array = new Object[size()]; | |
| 186 |
1
1. toArray : negated conditional → NO_COVERAGE |
if (root != null) { |
| 187 |
1
1. toArray : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::toArray → NO_COVERAGE |
root.toArray(array, root.relativePosition); |
| 188 | } | |
| 189 |
1
1. toArray : mutated return of Object value for org/apache/commons/collections4/list/TreeList::toArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return array; |
| 190 | } | |
| 191 | ||
| 192 | //----------------------------------------------------------------------- | |
| 193 | /** | |
| 194 | * Adds a new element to the list. | |
| 195 | * | |
| 196 | * @param index the index to add before | |
| 197 | * @param obj the element to add | |
| 198 | */ | |
| 199 | @Override | |
| 200 | public void add(final int index, final E obj) { | |
| 201 |
1
1. add : Replaced integer addition with subtraction → NO_COVERAGE |
modCount++; |
| 202 |
1
1. add : removed call to org/apache/commons/collections4/list/TreeList::checkInterval → NO_COVERAGE |
checkInterval(index, 0, size()); |
| 203 |
1
1. add : negated conditional → NO_COVERAGE |
if (root == null) { |
| 204 | root = new AVLNode<E>(index, obj, null, null); | |
| 205 | } else { | |
| 206 | root = root.insert(index, obj); | |
| 207 | } | |
| 208 |
1
1. add : Replaced integer addition with subtraction → NO_COVERAGE |
size++; |
| 209 | } | |
| 210 | ||
| 211 | /** | |
| 212 | * Appends all of the elements in the specified collection to the end of this list, | |
| 213 | * in the order that they are returned by the specified collection's Iterator. | |
| 214 | *
 | |
| 215 | * This method runs in O(n + log m) time, where m is | |
| 216 | * the size of this list and n is the size of {@code c}. | |
| 217 | * | |
| 218 | * @param c the collection to be added to this list | |
| 219 | * @return {@code true} if this list changed as a result of the call | |
| 220 | * @throws NullPointerException {@inheritDoc} | |
| 221 | */ | |
| 222 | @Override | |
| 223 | public boolean addAll(final Collection<? extends E> c) { | |
| 224 |
1
1. addAll : negated conditional → NO_COVERAGE |
if (c.isEmpty()) { |
| 225 |
1
1. addAll : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
| 226 | } | |
| 227 |
1
1. addAll : Replaced integer addition with subtraction → NO_COVERAGE |
modCount += c.size(); |
| 228 | final AVLNode<E> cTree = new AVLNode<E>(c); | |
| 229 |
1
1. addAll : negated conditional → NO_COVERAGE |
root = root == null ? cTree : root.addAll(cTree, size); |
| 230 |
1
1. addAll : Replaced integer addition with subtraction → NO_COVERAGE |
size += c.size(); |
| 231 |
1
1. addAll : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
| 232 | } | |
| 233 | ||
| 234 | /** | |
| 235 | * Sets the element at the specified index. | |
| 236 | * | |
| 237 | * @param index the index to set | |
| 238 | * @param obj the object to store at the specified index | |
| 239 | * @return the previous object at that index | |
| 240 | * @throws IndexOutOfBoundsException if the index is invalid | |
| 241 | */ | |
| 242 | @Override | |
| 243 | public E set(final int index, final E obj) { | |
| 244 |
2
1. set : Replaced integer subtraction with addition → NO_COVERAGE 2. set : removed call to org/apache/commons/collections4/list/TreeList::checkInterval → NO_COVERAGE |
checkInterval(index, 0, size() - 1); |
| 245 | final AVLNode<E> node = root.get(index); | |
| 246 | final E result = node.value; | |
| 247 |
1
1. set : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setValue → NO_COVERAGE |
node.setValue(obj); |
| 248 |
1
1. set : mutated return of Object value for org/apache/commons/collections4/list/TreeList::set to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return result; |
| 249 | } | |
| 250 | ||
| 251 | /** | |
| 252 | * Removes the element at the specified index. | |
| 253 | * | |
| 254 | * @param index the index to remove | |
| 255 | * @return the previous object at that index | |
| 256 | */ | |
| 257 | @Override | |
| 258 | public E remove(final int index) { | |
| 259 |
1
1. remove : Replaced integer addition with subtraction → NO_COVERAGE |
modCount++; |
| 260 |
2
1. remove : Replaced integer subtraction with addition → NO_COVERAGE 2. remove : removed call to org/apache/commons/collections4/list/TreeList::checkInterval → NO_COVERAGE |
checkInterval(index, 0, size() - 1); |
| 261 | final E result = get(index); | |
| 262 | root = root.remove(index); | |
| 263 |
1
1. remove : Replaced integer subtraction with addition → NO_COVERAGE |
size--; |
| 264 |
1
1. remove : mutated return of Object value for org/apache/commons/collections4/list/TreeList::remove to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return result; |
| 265 | } | |
| 266 | ||
| 267 | /** | |
| 268 | * Clears the list, removing all entries. | |
| 269 | */ | |
| 270 | @Override | |
| 271 | public void clear() { | |
| 272 |
1
1. clear : Replaced integer addition with subtraction → NO_COVERAGE |
modCount++; |
| 273 | root = null; | |
| 274 | size = 0; | |
| 275 | } | |
| 276 | ||
| 277 | //----------------------------------------------------------------------- | |
| 278 | /** | |
| 279 | * Checks whether the index is valid. | |
| 280 | * | |
| 281 | * @param index the index to check | |
| 282 | * @param startIndex the first allowed index | |
| 283 | * @param endIndex the last allowed index | |
| 284 | * @throws IndexOutOfBoundsException if the index is invalid | |
| 285 | */ | |
| 286 | private void checkInterval(final int index, final int startIndex, final int endIndex) { | |
| 287 |
4
1. checkInterval : changed conditional boundary → NO_COVERAGE 2. checkInterval : changed conditional boundary → NO_COVERAGE 3. checkInterval : negated conditional → NO_COVERAGE 4. checkInterval : negated conditional → NO_COVERAGE |
if (index < startIndex || index > endIndex) { |
| 288 | throw new IndexOutOfBoundsException("Invalid index:" + index + ", size=" + size()); | |
| 289 | } | |
| 290 | } | |
| 291 | ||
| 292 | //----------------------------------------------------------------------- | |
| 293 | /** | |
| 294 | * Implements an AVLNode which keeps the offset updated. | |
| 295 | *
 | |
| 296 | * This node contains the real work. | |
| 297 | * TreeList is just there to implement {@link java.util.List}. | |
| 298 | * The nodes don't know the index of the object they are holding. They | |
| 299 | * do know however their position relative to their parent node. | |
| 300 | * This allows to calculate the index of a node while traversing the tree. | |
| 301 | *
 | |
| 302 | * The Faedelung calculation stores a flag for both the left and right child | |
| 303 | * to indicate if they are a child (false) or a link as in linked list (true). | |
| 304 | */ | |
| 305 | static class AVLNode<E> { | |
| 306 | /** The left child node or the predecessor if {@link #leftIsPrevious}.*/ | |
| 307 | private AVLNode<E> left; | |
| 308 | /** Flag indicating that left reference is not a subtree but the predecessor. */ | |
| 309 | private boolean leftIsPrevious; | |
| 310 | /** The right child node or the successor if {@link #rightIsNext}. */ | |
| 311 | private AVLNode<E> right; | |
| 312 | /** Flag indicating that right reference is not a subtree but the successor. */ | |
| 313 | private boolean rightIsNext; | |
| 314 | /** How many levels of left/right are below this one. */ | |
| 315 | private int height; | |
| 316 | /** The relative position, root holds absolute position. */ | |
| 317 | private int relativePosition; | |
| 318 | /** The stored element. */ | |
| 319 | private E value; | |
| 320 | ||
| 321 | /** | |
| 322 | * Constructs a new node with a relative position. | |
| 323 | * | |
| 324 | * @param relativePosition the relative position of the node | |
| 325 | * @param obj the value for the node | |
| 326 | * @param rightFollower the node with the value following this one | |
| 327 | * @param leftFollower the node with the value leading this one | |
| 328 | */ | |
| 329 | private AVLNode(final int relativePosition, final E obj, | |
| 330 | final AVLNode<E> rightFollower, final AVLNode<E> leftFollower) { | |
| 331 | this.relativePosition = relativePosition; | |
| 332 | value = obj; | |
| 333 | rightIsNext = true; | |
| 334 | leftIsPrevious = true; | |
| 335 | right = rightFollower; | |
| 336 | left = leftFollower; | |
| 337 | } | |
| 338 | ||
| 339 | /** | |
| 340 | * Constructs a new AVL tree from a collection. | |
| 341 | *
 | |
| 342 | * The collection must be nonempty. | |
| 343 | * | |
| 344 | * @param coll a nonempty collection | |
| 345 | */ | |
| 346 | private AVLNode(final Collection<? extends E> coll) { | |
| 347 |
1
1. |
this(coll.iterator(), 0, coll.size() - 1, 0, null, null); |
| 348 | } | |
| 349 | ||
| 350 | /** | |
| 351 | * Constructs a new AVL tree from a collection. | |
| 352 | *
 | |
| 353 | * This is a recursive helper for {@link #AVLNode(Collection)}. A call | |
| 354 | * to this method will construct the subtree for elements {@code start} | |
| 355 | * through {@code end} of the collection, assuming the iterator | |
| 356 | * {@code e} already points at element {@code start}. | |
| 357 | * | |
| 358 | * @param iterator an iterator over the collection, which should already point | |
| 359 | * to the element at index {@code start} within the collection | |
| 360 | * @param start the index of the first element in the collection that | |
| 361 | * should be in this subtree | |
| 362 | * @param end the index of the last element in the collection that | |
| 363 | * should be in this subtree | |
| 364 | * @param absolutePositionOfParent absolute position of this node's | |
| 365 | * parent, or 0 if this node is the root | |
| 366 | * @param prev the {@code AVLNode} corresponding to element (start - 1) | |
| 367 | * of the collection, or null if start is 0 | |
| 368 | * @param next the {@code AVLNode} corresponding to element (end + 1) | |
| 369 | * of the collection, or null if end is the last element of the collection | |
| 370 | */ | |
| 371 | private AVLNode(final Iterator<? extends E> iterator, final int start, final int end, | |
| 372 | final int absolutePositionOfParent, final AVLNode<E> prev, final AVLNode<E> next) { | |
| 373 |
3
1. 2. 3. |
final int mid = start + (end - start) / 2; |
| 374 |
2
1. 2. |
if (start < mid) { |
| 375 |
1
1. |
left = new AVLNode<E>(iterator, start, mid - 1, mid, prev, this); |
| 376 | } else { | |
| 377 | leftIsPrevious = true; | |
| 378 | left = prev; | |
| 379 | } | |
| 380 | value = iterator.next(); | |
| 381 |
1
1. |
relativePosition = mid - absolutePositionOfParent; |
| 382 |
2
1. 2. |
if (mid < end) { |
| 383 |
1
1. |
right = new AVLNode<E>(iterator, mid + 1, end, mid, this, next); |
| 384 | } else { | |
| 385 | rightIsNext = true; | |
| 386 | right = next; | |
| 387 | } | |
| 388 |
1
1. |
recalcHeight(); |
| 389 | } | |
| 390 | ||
| 391 | /** | |
| 392 | * Gets the value. | |
| 393 | * | |
| 394 | * @return the value of this node | |
| 395 | */ | |
| 396 | E getValue() { | |
| 397 |
1
1. getValue : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::getValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return value; |
| 398 | } | |
| 399 | ||
| 400 | /** | |
| 401 | * Sets the value. | |
| 402 | * | |
| 403 | * @param obj the value to store | |
| 404 | */ | |
| 405 | void setValue(final E obj) { | |
| 406 | this.value = obj; | |
| 407 | } | |
| 408 | ||
| 409 | /** | |
| 410 | * Locate the element with the given index relative to the | |
| 411 | * offset of the parent of this node. | |
| 412 | */ | |
| 413 | AVLNode<E> get(final int index) { | |
| 414 |
1
1. get : Replaced integer subtraction with addition → NO_COVERAGE |
final int indexRelativeToMe = index - relativePosition; |
| 415 | ||
| 416 |
1
1. get : negated conditional → NO_COVERAGE |
if (indexRelativeToMe == 0) { |
| 417 |
1
1. get : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::get to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return this; |
| 418 | } | |
| 419 | ||
| 420 |
2
1. get : changed conditional boundary → NO_COVERAGE 2. get : negated conditional → NO_COVERAGE |
final AVLNode<E> nextNode = indexRelativeToMe < 0 ? getLeftSubTree() : getRightSubTree(); |
| 421 |
1
1. get : negated conditional → NO_COVERAGE |
if (nextNode == null) { |
| 422 |
1
1. get : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::get to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
| 423 | } | |
| 424 |
1
1. get : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::get to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return nextNode.get(indexRelativeToMe); |
| 425 | } | |
| 426 | ||
| 427 | /** | |
| 428 | * Locate the index that contains the specified object. | |
| 429 | */ | |
| 430 | int indexOf(final Object object, final int index) { | |
| 431 |
1
1. indexOf : negated conditional → NO_COVERAGE |
if (getLeftSubTree() != null) { |
| 432 |
1
1. indexOf : Replaced integer addition with subtraction → NO_COVERAGE |
final int result = left.indexOf(object, index + left.relativePosition); |
| 433 |
1
1. indexOf : negated conditional → NO_COVERAGE |
if (result != -1) { |
| 434 |
1
1. indexOf : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return result; |
| 435 | } | |
| 436 | } | |
| 437 |
3
1. indexOf : negated conditional → NO_COVERAGE 2. indexOf : negated conditional → NO_COVERAGE 3. indexOf : negated conditional → NO_COVERAGE |
if (value == null ? value == object : value.equals(object)) { |
| 438 |
1
1. indexOf : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return index; |
| 439 | } | |
| 440 |
1
1. indexOf : negated conditional → NO_COVERAGE |
if (getRightSubTree() != null) { |
| 441 |
2
1. indexOf : Replaced integer addition with subtraction → NO_COVERAGE 2. indexOf : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return right.indexOf(object, index + right.relativePosition); |
| 442 | } | |
| 443 |
1
1. indexOf : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return -1; |
| 444 | } | |
| 445 | ||
| 446 | /** | |
| 447 | * Stores the node and its children into the array specified. | |
| 448 | * | |
| 449 | * @param array the array to be filled | |
| 450 | * @param index the index of this node | |
| 451 | */ | |
| 452 | void toArray(final Object[] array, final int index) { | |
| 453 | array[index] = value; | |
| 454 |
1
1. toArray : negated conditional → NO_COVERAGE |
if (getLeftSubTree() != null) { |
| 455 |
2
1. toArray : Replaced integer addition with subtraction → NO_COVERAGE 2. toArray : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::toArray → NO_COVERAGE |
left.toArray(array, index + left.relativePosition); |
| 456 | } | |
| 457 |
1
1. toArray : negated conditional → NO_COVERAGE |
if (getRightSubTree() != null) { |
| 458 |
2
1. toArray : Replaced integer addition with subtraction → NO_COVERAGE 2. toArray : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::toArray → NO_COVERAGE |
right.toArray(array, index + right.relativePosition); |
| 459 | } | |
| 460 | } | |
| 461 | ||
| 462 | /** | |
| 463 | * Gets the next node in the list after this one. | |
| 464 | * | |
| 465 | * @return the next node | |
| 466 | */ | |
| 467 | AVLNode<E> next() { | |
| 468 |
2
1. next : negated conditional → NO_COVERAGE 2. next : negated conditional → NO_COVERAGE |
if (rightIsNext || right == null) { |
| 469 |
1
1. next : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::next to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return right; |
| 470 | } | |
| 471 |
1
1. next : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::next to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return right.min(); |
| 472 | } | |
| 473 | ||
| 474 | /** | |
| 475 | * Gets the node in the list before this one. | |
| 476 | * | |
| 477 | * @return the previous node | |
| 478 | */ | |
| 479 | AVLNode<E> previous() { | |
| 480 |
2
1. previous : negated conditional → NO_COVERAGE 2. previous : negated conditional → NO_COVERAGE |
if (leftIsPrevious || left == null) { |
| 481 |
1
1. previous : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::previous to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return left; |
| 482 | } | |
| 483 |
1
1. previous : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::previous to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return left.max(); |
| 484 | } | |
| 485 | ||
| 486 | /** | |
| 487 | * Inserts a node at the position index. | |
| 488 | * | |
| 489 | * @param index is the index of the position relative to the position of | |
| 490 | * the parent node. | |
| 491 | * @param obj is the object to be stored in the position. | |
| 492 | */ | |
| 493 | AVLNode<E> insert(final int index, final E obj) { | |
| 494 |
1
1. insert : Replaced integer subtraction with addition → NO_COVERAGE |
final int indexRelativeToMe = index - relativePosition; |
| 495 | ||
| 496 |
2
1. insert : changed conditional boundary → NO_COVERAGE 2. insert : negated conditional → NO_COVERAGE |
if (indexRelativeToMe <= 0) { |
| 497 |
1
1. insert : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::insert to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return insertOnLeft(indexRelativeToMe, obj); |
| 498 | } | |
| 499 |
1
1. insert : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::insert to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return insertOnRight(indexRelativeToMe, obj); |
| 500 | } | |
| 501 | ||
| 502 | private AVLNode<E> insertOnLeft(final int indexRelativeToMe, final E obj) { | |
| 503 |
1
1. insertOnLeft : negated conditional → NO_COVERAGE |
if (getLeftSubTree() == null) { |
| 504 |
1
1. insertOnLeft : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setLeft → NO_COVERAGE |
setLeft(new AVLNode<E>(-1, obj, this, left), null); |
| 505 | } else { | |
| 506 |
1
1. insertOnLeft : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setLeft → NO_COVERAGE |
setLeft(left.insert(indexRelativeToMe, obj), null); |
| 507 | } | |
| 508 | ||
| 509 |
2
1. insertOnLeft : changed conditional boundary → NO_COVERAGE 2. insertOnLeft : negated conditional → NO_COVERAGE |
if (relativePosition >= 0) { |
| 510 |
1
1. insertOnLeft : Replaced integer addition with subtraction → NO_COVERAGE |
relativePosition++; |
| 511 | } | |
| 512 | final AVLNode<E> ret = balance(); | |
| 513 |
1
1. insertOnLeft : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::recalcHeight → NO_COVERAGE |
recalcHeight(); |
| 514 |
1
1. insertOnLeft : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::insertOnLeft to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return ret; |
| 515 | } | |
| 516 | ||
| 517 | private AVLNode<E> insertOnRight(final int indexRelativeToMe, final E obj) { | |
| 518 |
1
1. insertOnRight : negated conditional → NO_COVERAGE |
if (getRightSubTree() == null) { |
| 519 |
1
1. insertOnRight : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setRight → NO_COVERAGE |
setRight(new AVLNode<E>(+1, obj, right, this), null); |
| 520 | } else { | |
| 521 |
1
1. insertOnRight : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setRight → NO_COVERAGE |
setRight(right.insert(indexRelativeToMe, obj), null); |
| 522 | } | |
| 523 |
2
1. insertOnRight : changed conditional boundary → NO_COVERAGE 2. insertOnRight : negated conditional → NO_COVERAGE |
if (relativePosition < 0) { |
| 524 |
1
1. insertOnRight : Replaced integer subtraction with addition → NO_COVERAGE |
relativePosition--; |
| 525 | } | |
| 526 | final AVLNode<E> ret = balance(); | |
| 527 |
1
1. insertOnRight : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::recalcHeight → NO_COVERAGE |
recalcHeight(); |
| 528 |
1
1. insertOnRight : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::insertOnRight to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return ret; |
| 529 | } | |
| 530 | ||
| 531 | //----------------------------------------------------------------------- | |
| 532 | /** | |
| 533 | * Gets the left node, returning null if its a faedelung. | |
| 534 | */ | |
| 535 | private AVLNode<E> getLeftSubTree() { | |
| 536 |
2
1. getLeftSubTree : negated conditional → NO_COVERAGE 2. getLeftSubTree : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::getLeftSubTree to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return leftIsPrevious ? null : left; |
| 537 | } | |
| 538 | ||
| 539 | /** | |
| 540 | * Gets the right node, returning null if its a faedelung. | |
| 541 | */ | |
| 542 | private AVLNode<E> getRightSubTree() { | |
| 543 |
2
1. getRightSubTree : negated conditional → NO_COVERAGE 2. getRightSubTree : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::getRightSubTree to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return rightIsNext ? null : right; |
| 544 | } | |
| 545 | ||
| 546 | /** | |
| 547 | * Gets the rightmost child of this node. | |
| 548 | * | |
| 549 | * @return the rightmost child (greatest index) | |
| 550 | */ | |
| 551 | private AVLNode<E> max() { | |
| 552 |
2
1. max : negated conditional → NO_COVERAGE 2. max : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::max to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return getRightSubTree() == null ? this : right.max(); |
| 553 | } | |
| 554 | ||
| 555 | /** | |
| 556 | * Gets the leftmost child of this node. | |
| 557 | * | |
| 558 | * @return the leftmost child (smallest index) | |
| 559 | */ | |
| 560 | private AVLNode<E> min() { | |
| 561 |
2
1. min : negated conditional → NO_COVERAGE 2. min : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::min to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return getLeftSubTree() == null ? this : left.min(); |
| 562 | } | |
| 563 | ||
| 564 | /** | |
| 565 | * Removes the node at a given position. | |
| 566 | * | |
| 567 | * @param index is the index of the element to be removed relative to the position of | |
| 568 | * the parent node of the current node. | |
| 569 | */ | |
| 570 | AVLNode<E> remove(final int index) { | |
| 571 |
1
1. remove : Replaced integer subtraction with addition → NO_COVERAGE |
final int indexRelativeToMe = index - relativePosition; |
| 572 | ||
| 573 |
1
1. remove : negated conditional → NO_COVERAGE |
if (indexRelativeToMe == 0) { |
| 574 |
1
1. remove : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::remove to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return removeSelf(); |
| 575 | } | |
| 576 |
2
1. remove : changed conditional boundary → NO_COVERAGE 2. remove : negated conditional → NO_COVERAGE |
if (indexRelativeToMe > 0) { |
| 577 |
1
1. remove : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setRight → NO_COVERAGE |
setRight(right.remove(indexRelativeToMe), right.right); |
| 578 |
2
1. remove : changed conditional boundary → NO_COVERAGE 2. remove : negated conditional → NO_COVERAGE |
if (relativePosition < 0) { |
| 579 |
1
1. remove : Replaced integer addition with subtraction → NO_COVERAGE |
relativePosition++; |
| 580 | } | |
| 581 | } else { | |
| 582 |
1
1. remove : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setLeft → NO_COVERAGE |
setLeft(left.remove(indexRelativeToMe), left.left); |
| 583 |
2
1. remove : changed conditional boundary → NO_COVERAGE 2. remove : negated conditional → NO_COVERAGE |
if (relativePosition > 0) { |
| 584 |
1
1. remove : Replaced integer subtraction with addition → NO_COVERAGE |
relativePosition--; |
| 585 | } | |
| 586 | } | |
| 587 |
1
1. remove : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::recalcHeight → NO_COVERAGE |
recalcHeight(); |
| 588 |
1
1. remove : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::remove to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return balance(); |
| 589 | } | |
| 590 | ||
| 591 | private AVLNode<E> removeMax() { | |
| 592 |
1
1. removeMax : negated conditional → NO_COVERAGE |
if (getRightSubTree() == null) { |
| 593 |
1
1. removeMax : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::removeMax to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return removeSelf(); |
| 594 | } | |
| 595 |
1
1. removeMax : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setRight → NO_COVERAGE |
setRight(right.removeMax(), right.right); |
| 596 |
2
1. removeMax : changed conditional boundary → NO_COVERAGE 2. removeMax : negated conditional → NO_COVERAGE |
if (relativePosition < 0) { |
| 597 |
1
1. removeMax : Replaced integer addition with subtraction → NO_COVERAGE |
relativePosition++; |
| 598 | } | |
| 599 |
1
1. removeMax : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::recalcHeight → NO_COVERAGE |
recalcHeight(); |
| 600 |
1
1. removeMax : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::removeMax to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return balance(); |
| 601 | } | |
| 602 | ||
| 603 | private AVLNode<E> removeMin() { | |
| 604 |
1
1. removeMin : negated conditional → NO_COVERAGE |
if (getLeftSubTree() == null) { |
| 605 |
1
1. removeMin : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::removeMin to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return removeSelf(); |
| 606 | } | |
| 607 |
1
1. removeMin : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setLeft → NO_COVERAGE |
setLeft(left.removeMin(), left.left); |
| 608 |
2
1. removeMin : changed conditional boundary → NO_COVERAGE 2. removeMin : negated conditional → NO_COVERAGE |
if (relativePosition > 0) { |
| 609 |
1
1. removeMin : Replaced integer subtraction with addition → NO_COVERAGE |
relativePosition--; |
| 610 | } | |
| 611 |
1
1. removeMin : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::recalcHeight → NO_COVERAGE |
recalcHeight(); |
| 612 |
1
1. removeMin : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::removeMin to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return balance(); |
| 613 | } | |
| 614 | ||
| 615 | /** | |
| 616 | * Removes this node from the tree. | |
| 617 | * | |
| 618 | * @return the node that replaces this one in the parent | |
| 619 | */ | |
| 620 | private AVLNode<E> removeSelf() { | |
| 621 |
2
1. removeSelf : negated conditional → NO_COVERAGE 2. removeSelf : negated conditional → NO_COVERAGE |
if (getRightSubTree() == null && getLeftSubTree() == null) { |
| 622 |
1
1. removeSelf : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::removeSelf to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
| 623 | } | |
| 624 |
1
1. removeSelf : negated conditional → NO_COVERAGE |
if (getRightSubTree() == null) { |
| 625 |
2
1. removeSelf : changed conditional boundary → NO_COVERAGE 2. removeSelf : negated conditional → NO_COVERAGE |
if (relativePosition > 0) { |
| 626 |
4
1. removeSelf : changed conditional boundary → NO_COVERAGE 2. removeSelf : Replaced integer addition with subtraction → NO_COVERAGE 3. removeSelf : Replaced integer addition with subtraction → NO_COVERAGE 4. removeSelf : negated conditional → NO_COVERAGE |
left.relativePosition += relativePosition + (relativePosition > 0 ? 0 : 1); |
| 627 | } | |
| 628 |
1
1. removeSelf : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setRight → NO_COVERAGE |
left.max().setRight(null, right); |
| 629 |
1
1. removeSelf : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::removeSelf to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return left; |
| 630 | } | |
| 631 |
1
1. removeSelf : negated conditional → NO_COVERAGE |
if (getLeftSubTree() == null) { |
| 632 |
4
1. removeSelf : changed conditional boundary → NO_COVERAGE 2. removeSelf : Replaced integer subtraction with addition → NO_COVERAGE 3. removeSelf : Replaced integer addition with subtraction → NO_COVERAGE 4. removeSelf : negated conditional → NO_COVERAGE |
right.relativePosition += relativePosition - (relativePosition < 0 ? 0 : 1); |
| 633 |
1
1. removeSelf : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setLeft → NO_COVERAGE |
right.min().setLeft(null, left); |
| 634 |
1
1. removeSelf : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::removeSelf to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return right; |
| 635 | } | |
| 636 | ||
| 637 |
2
1. removeSelf : changed conditional boundary → NO_COVERAGE 2. removeSelf : negated conditional → NO_COVERAGE |
if (heightRightMinusLeft() > 0) { |
| 638 | // more on the right, so delete from the right | |
| 639 | final AVLNode<E> rightMin = right.min(); | |
| 640 | value = rightMin.value; | |
| 641 |
1
1. removeSelf : negated conditional → NO_COVERAGE |
if (leftIsPrevious) { |
| 642 | left = rightMin.left; | |
| 643 | } | |
| 644 | right = right.removeMin(); | |
| 645 |
2
1. removeSelf : changed conditional boundary → NO_COVERAGE 2. removeSelf : negated conditional → NO_COVERAGE |
if (relativePosition < 0) { |
| 646 |
1
1. removeSelf : Replaced integer addition with subtraction → NO_COVERAGE |
relativePosition++; |
| 647 | } | |
| 648 | } else { | |
| 649 | // more on the left or equal, so delete from the left | |
| 650 | final AVLNode<E> leftMax = left.max(); | |
| 651 | value = leftMax.value; | |
| 652 |
1
1. removeSelf : negated conditional → NO_COVERAGE |
if (rightIsNext) { |
| 653 | right = leftMax.right; | |
| 654 | } | |
| 655 | final AVLNode<E> leftPrevious = left.left; | |
| 656 | left = left.removeMax(); | |
| 657 |
1
1. removeSelf : negated conditional → NO_COVERAGE |
if (left == null) { |
| 658 | // special case where left that was deleted was a double link | |
| 659 | // only occurs when height difference is equal | |
| 660 | left = leftPrevious; | |
| 661 | leftIsPrevious = true; | |
| 662 | } | |
| 663 |
2
1. removeSelf : changed conditional boundary → NO_COVERAGE 2. removeSelf : negated conditional → NO_COVERAGE |
if (relativePosition > 0) { |
| 664 |
1
1. removeSelf : Replaced integer subtraction with addition → NO_COVERAGE |
relativePosition--; |
| 665 | } | |
| 666 | } | |
| 667 |
1
1. removeSelf : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::recalcHeight → NO_COVERAGE |
recalcHeight(); |
| 668 |
1
1. removeSelf : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::removeSelf to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return this; |
| 669 | } | |
| 670 | ||
| 671 | //----------------------------------------------------------------------- | |
| 672 | /** | |
| 673 | * Balances according to the AVL algorithm. | |
| 674 | */ | |
| 675 | private AVLNode<E> balance() { | |
| 676 | switch (heightRightMinusLeft()) { | |
| 677 | case 1 : | |
| 678 | case 0 : | |
| 679 | case -1 : | |
| 680 |
1
1. balance : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::balance to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return this; |
| 681 | case -2 : | |
| 682 |
2
1. balance : changed conditional boundary → NO_COVERAGE 2. balance : negated conditional → NO_COVERAGE |
if (left.heightRightMinusLeft() > 0) { |
| 683 |
1
1. balance : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setLeft → NO_COVERAGE |
setLeft(left.rotateLeft(), null); |
| 684 | } | |
| 685 |
1
1. balance : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::balance to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return rotateRight(); |
| 686 | case 2 : | |
| 687 |
2
1. balance : changed conditional boundary → NO_COVERAGE 2. balance : negated conditional → NO_COVERAGE |
if (right.heightRightMinusLeft() < 0) { |
| 688 |
1
1. balance : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setRight → NO_COVERAGE |
setRight(right.rotateRight(), null); |
| 689 | } | |
| 690 |
1
1. balance : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::balance to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return rotateLeft(); |
| 691 | default : | |
| 692 | throw new RuntimeException("tree inconsistent!"); | |
| 693 | } | |
| 694 | } | |
| 695 | ||
| 696 | /** | |
| 697 | * Gets the relative position. | |
| 698 | */ | |
| 699 | private int getOffset(final AVLNode<E> node) { | |
| 700 |
1
1. getOffset : negated conditional → NO_COVERAGE |
if (node == null) { |
| 701 |
1
1. getOffset : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return 0; |
| 702 | } | |
| 703 |
1
1. getOffset : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return node.relativePosition; |
| 704 | } | |
| 705 | ||
| 706 | /** | |
| 707 | * Sets the relative position. | |
| 708 | */ | |
| 709 | private int setOffset(final AVLNode<E> node, final int newOffest) { | |
| 710 |
1
1. setOffset : negated conditional → NO_COVERAGE |
if (node == null) { |
| 711 |
1
1. setOffset : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return 0; |
| 712 | } | |
| 713 | final int oldOffset = getOffset(node); | |
| 714 | node.relativePosition = newOffest; | |
| 715 |
1
1. setOffset : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return oldOffset; |
| 716 | } | |
| 717 | ||
| 718 | /** | |
| 719 | * Sets the height by calculation. | |
| 720 | */ | |
| 721 | private void recalcHeight() { | |
| 722 |
3
1. recalcHeight : Replaced integer addition with subtraction → NO_COVERAGE 2. recalcHeight : negated conditional → NO_COVERAGE 3. recalcHeight : negated conditional → NO_COVERAGE |
height = Math.max( |
| 723 | getLeftSubTree() == null ? -1 : getLeftSubTree().height, | |
| 724 | getRightSubTree() == null ? -1 : getRightSubTree().height) + 1; | |
| 725 | } | |
| 726 | ||
| 727 | /** | |
| 728 | * Returns the height of the node or -1 if the node is null. | |
| 729 | */ | |
| 730 | private int getHeight(final AVLNode<E> node) { | |
| 731 |
2
1. getHeight : negated conditional → NO_COVERAGE 2. getHeight : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return node == null ? -1 : node.height; |
| 732 | } | |
| 733 | ||
| 734 | /** | |
| 735 | * Returns the height difference right - left | |
| 736 | */ | |
| 737 | private int heightRightMinusLeft() { | |
| 738 |
2
1. heightRightMinusLeft : Replaced integer subtraction with addition → NO_COVERAGE 2. heightRightMinusLeft : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return getHeight(getRightSubTree()) - getHeight(getLeftSubTree()); |
| 739 | } | |
| 740 | ||
| 741 | private AVLNode<E> rotateLeft() { | |
| 742 | final AVLNode<E> newTop = right; // can't be faedelung! | |
| 743 | final AVLNode<E> movedNode = getRightSubTree().getLeftSubTree(); | |
| 744 | ||
| 745 |
1
1. rotateLeft : Replaced integer addition with subtraction → NO_COVERAGE |
final int newTopPosition = relativePosition + getOffset(newTop); |
| 746 |
1
1. rotateLeft : removed negation → NO_COVERAGE |
final int myNewPosition = -newTop.relativePosition; |
| 747 |
1
1. rotateLeft : Replaced integer addition with subtraction → NO_COVERAGE |
final int movedPosition = getOffset(newTop) + getOffset(movedNode); |
| 748 | ||
| 749 |
1
1. rotateLeft : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setRight → NO_COVERAGE |
setRight(movedNode, newTop); |
| 750 |
1
1. rotateLeft : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setLeft → NO_COVERAGE |
newTop.setLeft(this, null); |
| 751 | ||
| 752 | setOffset(newTop, newTopPosition); | |
| 753 | setOffset(this, myNewPosition); | |
| 754 | setOffset(movedNode, movedPosition); | |
| 755 |
1
1. rotateLeft : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::rotateLeft to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return newTop; |
| 756 | } | |
| 757 | ||
| 758 | private AVLNode<E> rotateRight() { | |
| 759 | final AVLNode<E> newTop = left; // can't be faedelung | |
| 760 | final AVLNode<E> movedNode = getLeftSubTree().getRightSubTree(); | |
| 761 | ||
| 762 |
1
1. rotateRight : Replaced integer addition with subtraction → NO_COVERAGE |
final int newTopPosition = relativePosition + getOffset(newTop); |
| 763 |
1
1. rotateRight : removed negation → NO_COVERAGE |
final int myNewPosition = -newTop.relativePosition; |
| 764 |
1
1. rotateRight : Replaced integer addition with subtraction → NO_COVERAGE |
final int movedPosition = getOffset(newTop) + getOffset(movedNode); |
| 765 | ||
| 766 |
1
1. rotateRight : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setLeft → NO_COVERAGE |
setLeft(movedNode, newTop); |
| 767 |
1
1. rotateRight : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setRight → NO_COVERAGE |
newTop.setRight(this, null); |
| 768 | ||
| 769 | setOffset(newTop, newTopPosition); | |
| 770 | setOffset(this, myNewPosition); | |
| 771 | setOffset(movedNode, movedPosition); | |
| 772 |
1
1. rotateRight : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::rotateRight to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return newTop; |
| 773 | } | |
| 774 | ||
| 775 | /** | |
| 776 | * Sets the left field to the node, or the previous node if that is null | |
| 777 | * | |
| 778 | * @param node the new left subtree node | |
| 779 | * @param previous the previous node in the linked list | |
| 780 | */ | |
| 781 | private void setLeft(final AVLNode<E> node, final AVLNode<E> previous) { | |
| 782 |
1
1. setLeft : negated conditional → NO_COVERAGE |
leftIsPrevious = node == null; |
| 783 |
1
1. setLeft : negated conditional → NO_COVERAGE |
left = leftIsPrevious ? previous : node; |
| 784 |
1
1. setLeft : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::recalcHeight → NO_COVERAGE |
recalcHeight(); |
| 785 | } | |
| 786 | ||
| 787 | /** | |
| 788 | * Sets the right field to the node, or the next node if that is null | |
| 789 | * | |
| 790 | * @param node the new left subtree node | |
| 791 | * @param next the next node in the linked list | |
| 792 | */ | |
| 793 | private void setRight(final AVLNode<E> node, final AVLNode<E> next) { | |
| 794 |
1
1. setRight : negated conditional → NO_COVERAGE |
rightIsNext = node == null; |
| 795 |
1
1. setRight : negated conditional → NO_COVERAGE |
right = rightIsNext ? next : node; |
| 796 |
1
1. setRight : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::recalcHeight → NO_COVERAGE |
recalcHeight(); |
| 797 | } | |
| 798 | ||
| 799 | /** | |
| 800 | * Appends the elements of another tree list to this tree list by efficiently | |
| 801 | * merging the two AVL trees. This operation is destructive to both trees and | |
| 802 | * runs in O(log(m + n)) time. | |
| 803 | * | |
| 804 | * @param otherTree | |
| 805 | * the root of the AVL tree to merge with this one | |
| 806 | * @param currentSize | |
| 807 | * the number of elements in this AVL tree | |
| 808 | * @return the root of the new, merged AVL tree | |
| 809 | */ | |
| 810 | private AVLNode<E> addAll(AVLNode<E> otherTree, final int currentSize) { | |
| 811 | final AVLNode<E> maxNode = max(); | |
| 812 | final AVLNode<E> otherTreeMin = otherTree.min(); | |
| 813 | ||
| 814 | // We need to efficiently merge the two AVL trees while keeping them | |
| 815 | // balanced (or nearly balanced). To do this, we take the shorter | |
| 816 | // tree and combine it with a similar-height subtree of the taller | |
| 817 | // tree. There are two symmetric cases: | |
| 818 | // * this tree is taller, or | |
| 819 | // * otherTree is taller. | |
| 820 |
2
1. addAll : changed conditional boundary → NO_COVERAGE 2. addAll : negated conditional → NO_COVERAGE |
if (otherTree.height > height) { |
| 821 | // CASE 1: The other tree is taller than this one. We will thus | |
| 822 | // merge this tree into otherTree. | |
| 823 | ||
| 824 | // STEP 1: Remove the maximum element from this tree. | |
| 825 | final AVLNode<E> leftSubTree = removeMax(); | |
| 826 | ||
| 827 | // STEP 2: Navigate left from the root of otherTree until we | |
| 828 | // find a subtree, s, that is no taller than me. (While we are | |
| 829 | // navigating left, we store the nodes we encounter in a stack | |
| 830 | // so that we can re-balance them in step 4.) | |
| 831 | final ArrayStack<AVLNode<E>> sAncestors = new ArrayStack<AVLNode<E>>(); | |
| 832 | AVLNode<E> s = otherTree; | |
| 833 |
1
1. addAll : Replaced integer addition with subtraction → NO_COVERAGE |
int sAbsolutePosition = s.relativePosition + currentSize; |
| 834 | int sParentAbsolutePosition = 0; | |
| 835 |
3
1. addAll : changed conditional boundary → NO_COVERAGE 2. addAll : negated conditional → NO_COVERAGE 3. addAll : negated conditional → NO_COVERAGE |
while (s != null && s.height > getHeight(leftSubTree)) { |
| 836 | sParentAbsolutePosition = sAbsolutePosition; | |
| 837 | sAncestors.push(s); | |
| 838 | s = s.left; | |
| 839 |
1
1. addAll : negated conditional → NO_COVERAGE |
if (s != null) { |
| 840 |
1
1. addAll : Replaced integer addition with subtraction → NO_COVERAGE |
sAbsolutePosition += s.relativePosition; |
| 841 | } | |
| 842 | } | |
| 843 | ||
| 844 | // STEP 3: Replace s with a newly constructed subtree whose root | |
| 845 | // is maxNode, whose left subtree is leftSubTree, and whose right | |
| 846 | // subtree is s. | |
| 847 |
1
1. addAll : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setLeft → NO_COVERAGE |
maxNode.setLeft(leftSubTree, null); |
| 848 |
1
1. addAll : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setRight → NO_COVERAGE |
maxNode.setRight(s, otherTreeMin); |
| 849 |
1
1. addAll : negated conditional → NO_COVERAGE |
if (leftSubTree != null) { |
| 850 |
1
1. addAll : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setRight → NO_COVERAGE |
leftSubTree.max().setRight(null, maxNode); |
| 851 |
2
1. addAll : Replaced integer subtraction with addition → NO_COVERAGE 2. addAll : Replaced integer subtraction with addition → NO_COVERAGE |
leftSubTree.relativePosition -= currentSize - 1; |
| 852 | } | |
| 853 |
1
1. addAll : negated conditional → NO_COVERAGE |
if (s != null) { |
| 854 |
1
1. addAll : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setLeft → NO_COVERAGE |
s.min().setLeft(null, maxNode); |
| 855 |
2
1. addAll : Replaced integer subtraction with addition → NO_COVERAGE 2. addAll : Replaced integer addition with subtraction → NO_COVERAGE |
s.relativePosition = sAbsolutePosition - currentSize + 1; |
| 856 | } | |
| 857 |
2
1. addAll : Replaced integer subtraction with addition → NO_COVERAGE 2. addAll : Replaced integer subtraction with addition → NO_COVERAGE |
maxNode.relativePosition = currentSize - 1 - sParentAbsolutePosition; |
| 858 |
1
1. addAll : Replaced integer addition with subtraction → NO_COVERAGE |
otherTree.relativePosition += currentSize; |
| 859 | ||
| 860 | // STEP 4: Re-balance the tree and recalculate the heights of s's ancestors. | |
| 861 | s = maxNode; | |
| 862 |
1
1. addAll : negated conditional → NO_COVERAGE |
while (!sAncestors.isEmpty()) { |
| 863 | final AVLNode<E> sAncestor = sAncestors.pop(); | |
| 864 |
1
1. addAll : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setLeft → NO_COVERAGE |
sAncestor.setLeft(s, null); |
| 865 | s = sAncestor.balance(); | |
| 866 | } | |
| 867 |
1
1. addAll : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::addAll to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return s; |
| 868 | } else { | |
| 869 | // CASE 2: This tree is taller. This is symmetric to case 1. | |
| 870 | // We merge otherTree into this tree by finding a subtree s of this | |
| 871 | // tree that is of similar height to otherTree and replacing it | |
| 872 | // with a new subtree whose root is otherTreeMin and whose | |
| 873 | // children are otherTree and s. | |
| 874 | ||
| 875 | otherTree = otherTree.removeMin(); | |
| 876 | ||
| 877 | final ArrayStack<AVLNode<E>> sAncestors = new ArrayStack<AVLNode<E>>(); | |
| 878 | AVLNode<E> s = this; | |
| 879 | int sAbsolutePosition = s.relativePosition; | |
| 880 | int sParentAbsolutePosition = 0; | |
| 881 |
3
1. addAll : changed conditional boundary → NO_COVERAGE 2. addAll : negated conditional → NO_COVERAGE 3. addAll : negated conditional → NO_COVERAGE |
while (s != null && s.height > getHeight(otherTree)) { |
| 882 | sParentAbsolutePosition = sAbsolutePosition; | |
| 883 | sAncestors.push(s); | |
| 884 | s = s.right; | |
| 885 |
1
1. addAll : negated conditional → NO_COVERAGE |
if (s != null) { |
| 886 |
1
1. addAll : Replaced integer addition with subtraction → NO_COVERAGE |
sAbsolutePosition += s.relativePosition; |
| 887 | } | |
| 888 | } | |
| 889 | ||
| 890 |
1
1. addAll : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setRight → NO_COVERAGE |
otherTreeMin.setRight(otherTree, null); |
| 891 |
1
1. addAll : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setLeft → NO_COVERAGE |
otherTreeMin.setLeft(s, maxNode); |
| 892 |
1
1. addAll : negated conditional → NO_COVERAGE |
if (otherTree != null) { |
| 893 |
1
1. addAll : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setLeft → NO_COVERAGE |
otherTree.min().setLeft(null, otherTreeMin); |
| 894 |
1
1. addAll : Replaced integer addition with subtraction → NO_COVERAGE |
otherTree.relativePosition++; |
| 895 | } | |
| 896 |
1
1. addAll : negated conditional → NO_COVERAGE |
if (s != null) { |
| 897 |
1
1. addAll : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setRight → NO_COVERAGE |
s.max().setRight(null, otherTreeMin); |
| 898 |
1
1. addAll : Replaced integer subtraction with addition → NO_COVERAGE |
s.relativePosition = sAbsolutePosition - currentSize; |
| 899 | } | |
| 900 |
1
1. addAll : Replaced integer subtraction with addition → NO_COVERAGE |
otherTreeMin.relativePosition = currentSize - sParentAbsolutePosition; |
| 901 | ||
| 902 | s = otherTreeMin; | |
| 903 |
1
1. addAll : negated conditional → NO_COVERAGE |
while (!sAncestors.isEmpty()) { |
| 904 | final AVLNode<E> sAncestor = sAncestors.pop(); | |
| 905 |
1
1. addAll : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setRight → NO_COVERAGE |
sAncestor.setRight(s, null); |
| 906 | s = sAncestor.balance(); | |
| 907 | } | |
| 908 |
1
1. addAll : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::addAll to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return s; |
| 909 | } | |
| 910 | } | |
| 911 | ||
| 912 | // private void checkFaedelung() { | |
| 913 | // AVLNode maxNode = left.max(); | |
| 914 | // if (!maxNode.rightIsFaedelung || maxNode.right != this) { | |
| 915 | // throw new RuntimeException(maxNode + " should right-faedel to " + this); | |
| 916 | // } | |
| 917 | // AVLNode minNode = right.min(); | |
| 918 | // if (!minNode.leftIsFaedelung || minNode.left != this) { | |
| 919 | // throw new RuntimeException(maxNode + " should left-faedel to " + this); | |
| 920 | // } | |
| 921 | // } | |
| 922 | // | |
| 923 | // private int checkTreeDepth() { | |
| 924 | // int hright = (getRightSubTree() == null ? -1 : getRightSubTree().checkTreeDepth()); | |
| 925 | // // System.out.print("checkTreeDepth"); | |
| 926 | // // System.out.print(this); | |
| 927 | // // System.out.print(" left: "); | |
| 928 | // // System.out.print(_left); | |
| 929 | // // System.out.print(" right: "); | |
| 930 | // // System.out.println(_right); | |
| 931 | // | |
| 932 | // int hleft = (left == null ? -1 : left.checkTreeDepth()); | |
| 933 | // if (height != Math.max(hright, hleft) + 1) { | |
| 934 | // throw new RuntimeException( | |
| 935 | // "height should be max" + hleft + "," + hright + " but is " + height); | |
| 936 | // } | |
| 937 | // return height; | |
| 938 | // } | |
| 939 | // | |
| 940 | // private int checkLeftSubNode() { | |
| 941 | // if (getLeftSubTree() == null) { | |
| 942 | // return 0; | |
| 943 | // } | |
| 944 | // int count = 1 + left.checkRightSubNode(); | |
| 945 | // if (left.relativePosition != -count) { | |
| 946 | // throw new RuntimeException(); | |
| 947 | // } | |
| 948 | // return count + left.checkLeftSubNode(); | |
| 949 | // } | |
| 950 | // | |
| 951 | // private int checkRightSubNode() { | |
| 952 | // AVLNode right = getRightSubTree(); | |
| 953 | // if (right == null) { | |
| 954 | // return 0; | |
| 955 | // } | |
| 956 | // int count = 1; | |
| 957 | // count += right.checkLeftSubNode(); | |
| 958 | // if (right.relativePosition != count) { | |
| 959 | // throw new RuntimeException(); | |
| 960 | // } | |
| 961 | // return count + right.checkRightSubNode(); | |
| 962 | // } | |
| 963 | ||
| 964 | /** | |
| 965 | * Used for debugging. | |
| 966 | */ | |
| 967 | @Override | |
| 968 | public String toString() { | |
| 969 |
3
1. toString : negated conditional → NO_COVERAGE 2. toString : negated conditional → NO_COVERAGE 3. toString : mutated return of Object value for org/apache/commons/collections4/list/TreeList$AVLNode::toString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new StringBuilder() |
| 970 | .append("AVLNode(") | |
| 971 | .append(relativePosition) | |
| 972 | .append(',') | |
| 973 | .append(left != null) | |
| 974 | .append(',') | |
| 975 | .append(value) | |
| 976 | .append(',') | |
| 977 | .append(getRightSubTree() != null) | |
| 978 | .append(", faedelung ") | |
| 979 | .append(rightIsNext) | |
| 980 | .append(" )") | |
| 981 | .toString(); | |
| 982 | } | |
| 983 | } | |
| 984 | ||
| 985 | /** | |
| 986 | * A list iterator over the linked list. | |
| 987 | */ | |
| 988 | static class TreeListIterator<E> implements ListIterator<E>, OrderedIterator<E> { | |
| 989 | /** The parent list */ | |
| 990 | private final TreeList<E> parent; | |
| 991 | /** | |
| 992 | * Cache of the next node that will be returned by {@link #next()}. | |
| 993 | */ | |
| 994 | private AVLNode<E> next; | |
| 995 | /** | |
| 996 | * The index of the next node to be returned. | |
| 997 | */ | |
| 998 | private int nextIndex; | |
| 999 | /** | |
| 1000 | * Cache of the last node that was returned by {@link #next()} | |
| 1001 | * or {@link #previous()}. | |
| 1002 | */ | |
| 1003 | private AVLNode<E> current; | |
| 1004 | /** | |
| 1005 | * The index of the last node that was returned. | |
| 1006 | */ | |
| 1007 | private int currentIndex; | |
| 1008 | /** | |
| 1009 | * The modification count that the list is expected to have. If the list | |
| 1010 | * doesn't have this count, then a | |
| 1011 | * {@link java.util.ConcurrentModificationException} may be thrown by | |
| 1012 | * the operations. | |
| 1013 | */ | |
| 1014 | private int expectedModCount; | |
| 1015 | ||
| 1016 | /** | |
| 1017 | * Create a ListIterator for a list. | |
| 1018 | * | |
| 1019 | * @param parent the parent list | |
| 1020 | * @param fromIndex the index to start at | |
| 1021 | */ | |
| 1022 | protected TreeListIterator(final TreeList<E> parent, final int fromIndex) throws IndexOutOfBoundsException { | |
| 1023 | super(); | |
| 1024 | this.parent = parent; | |
| 1025 | this.expectedModCount = parent.modCount; | |
| 1026 |
1
1. |
this.next = parent.root == null ? null : parent.root.get(fromIndex); |
| 1027 | this.nextIndex = fromIndex; | |
| 1028 | this.currentIndex = -1; | |
| 1029 | } | |
| 1030 | ||
| 1031 | /** | |
| 1032 | * Checks the modification count of the list is the value that this | |
| 1033 | * object expects. | |
| 1034 | * | |
| 1035 | * @throws ConcurrentModificationException If the list's modification | |
| 1036 | * count isn't the value that was expected. | |
| 1037 | */ | |
| 1038 | protected void checkModCount() { | |
| 1039 |
1
1. checkModCount : negated conditional → NO_COVERAGE |
if (parent.modCount != expectedModCount) { |
| 1040 | throw new ConcurrentModificationException(); | |
| 1041 | } | |
| 1042 | } | |
| 1043 | ||
| 1044 | public boolean hasNext() { | |
| 1045 |
3
1. hasNext : changed conditional boundary → NO_COVERAGE 2. hasNext : negated conditional → NO_COVERAGE 3. hasNext : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return nextIndex < parent.size(); |
| 1046 | } | |
| 1047 | ||
| 1048 | public E next() { | |
| 1049 |
1
1. next : removed call to org/apache/commons/collections4/list/TreeList$TreeListIterator::checkModCount → NO_COVERAGE |
checkModCount(); |
| 1050 |
1
1. next : negated conditional → NO_COVERAGE |
if (!hasNext()) { |
| 1051 | throw new NoSuchElementException("No element at index " + nextIndex + "."); | |
| 1052 | } | |
| 1053 |
1
1. next : negated conditional → NO_COVERAGE |
if (next == null) { |
| 1054 | next = parent.root.get(nextIndex); | |
| 1055 | } | |
| 1056 | final E value = next.getValue(); | |
| 1057 | current = next; | |
| 1058 |
1
1. next : Replaced integer addition with subtraction → NO_COVERAGE |
currentIndex = nextIndex++; |
| 1059 | next = next.next(); | |
| 1060 |
1
1. next : mutated return of Object value for org/apache/commons/collections4/list/TreeList$TreeListIterator::next to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return value; |
| 1061 | } | |
| 1062 | ||
| 1063 | public boolean hasPrevious() { | |
| 1064 |
3
1. hasPrevious : changed conditional boundary → NO_COVERAGE 2. hasPrevious : negated conditional → NO_COVERAGE 3. hasPrevious : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return nextIndex > 0; |
| 1065 | } | |
| 1066 | ||
| 1067 | public E previous() { | |
| 1068 |
1
1. previous : removed call to org/apache/commons/collections4/list/TreeList$TreeListIterator::checkModCount → NO_COVERAGE |
checkModCount(); |
| 1069 |
1
1. previous : negated conditional → NO_COVERAGE |
if (!hasPrevious()) { |
| 1070 | throw new NoSuchElementException("Already at start of list."); | |
| 1071 | } | |
| 1072 |
1
1. previous : negated conditional → NO_COVERAGE |
if (next == null) { |
| 1073 |
1
1. previous : Replaced integer subtraction with addition → NO_COVERAGE |
next = parent.root.get(nextIndex - 1); |
| 1074 | } else { | |
| 1075 | next = next.previous(); | |
| 1076 | } | |
| 1077 | final E value = next.getValue(); | |
| 1078 | current = next; | |
| 1079 |
1
1. previous : Replaced integer subtraction with addition → NO_COVERAGE |
currentIndex = --nextIndex; |
| 1080 |
1
1. previous : mutated return of Object value for org/apache/commons/collections4/list/TreeList$TreeListIterator::previous to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return value; |
| 1081 | } | |
| 1082 | ||
| 1083 | public int nextIndex() { | |
| 1084 |
1
1. nextIndex : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return nextIndex; |
| 1085 | } | |
| 1086 | ||
| 1087 | public int previousIndex() { | |
| 1088 |
2
1. previousIndex : Replaced integer subtraction with addition → NO_COVERAGE 2. previousIndex : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return nextIndex() - 1; |
| 1089 | } | |
| 1090 | ||
| 1091 | public void remove() { | |
| 1092 |
1
1. remove : removed call to org/apache/commons/collections4/list/TreeList$TreeListIterator::checkModCount → NO_COVERAGE |
checkModCount(); |
| 1093 |
1
1. remove : negated conditional → NO_COVERAGE |
if (currentIndex == -1) { |
| 1094 | throw new IllegalStateException(); | |
| 1095 | } | |
| 1096 | parent.remove(currentIndex); | |
| 1097 |
1
1. remove : negated conditional → NO_COVERAGE |
if (nextIndex != currentIndex) { |
| 1098 | // remove() following next() | |
| 1099 |
1
1. remove : Replaced integer subtraction with addition → NO_COVERAGE |
nextIndex--; |
| 1100 | } | |
| 1101 | // the AVL node referenced by next may have become stale after a remove | |
| 1102 | // reset it now: will be retrieved by next call to next()/previous() via nextIndex | |
| 1103 | next = null; | |
| 1104 | current = null; | |
| 1105 | currentIndex = -1; | |
| 1106 |
1
1. remove : Replaced integer addition with subtraction → NO_COVERAGE |
expectedModCount++; |
| 1107 | } | |
| 1108 | ||
| 1109 | public void set(final E obj) { | |
| 1110 |
1
1. set : removed call to org/apache/commons/collections4/list/TreeList$TreeListIterator::checkModCount → NO_COVERAGE |
checkModCount(); |
| 1111 |
1
1. set : negated conditional → NO_COVERAGE |
if (current == null) { |
| 1112 | throw new IllegalStateException(); | |
| 1113 | } | |
| 1114 |
1
1. set : removed call to org/apache/commons/collections4/list/TreeList$AVLNode::setValue → NO_COVERAGE |
current.setValue(obj); |
| 1115 | } | |
| 1116 | ||
| 1117 | public void add(final E obj) { | |
| 1118 |
1
1. add : removed call to org/apache/commons/collections4/list/TreeList$TreeListIterator::checkModCount → NO_COVERAGE |
checkModCount(); |
| 1119 |
1
1. add : removed call to org/apache/commons/collections4/list/TreeList::add → NO_COVERAGE |
parent.add(nextIndex, obj); |
| 1120 | current = null; | |
| 1121 | currentIndex = -1; | |
| 1122 |
1
1. add : Replaced integer addition with subtraction → NO_COVERAGE |
nextIndex++; |
| 1123 |
1
1. add : Replaced integer addition with subtraction → NO_COVERAGE |
expectedModCount++; |
| 1124 | } | |
| 1125 | } | |
| 1126 | ||
| 1127 | } | |
Mutations | ||
| 86 |
1.1 |
|
| 101 |
1.1 2.2 |
|
| 102 |
1.1 |
|
| 112 |
1.1 |
|
| 123 |
1.1 |
|
| 134 |
1.1 |
|
| 147 |
1.1 |
|
| 148 |
1.1 |
|
| 160 |
1.1 |
|
| 161 |
1.1 |
|
| 163 |
1.1 |
|
| 174 |
1.1 2.2 3.3 |
|
| 186 |
1.1 |
|
| 187 |
1.1 |
|
| 189 |
1.1 |
|
| 201 |
1.1 |
|
| 202 |
1.1 |
|
| 203 |
1.1 |
|
| 208 |
1.1 |
|
| 224 |
1.1 |
|
| 225 |
1.1 |
|
| 227 |
1.1 |
|
| 229 |
1.1 |
|
| 230 |
1.1 |
|
| 231 |
1.1 |
|
| 244 |
1.1 2.2 |
|
| 247 |
1.1 |
|
| 248 |
1.1 |
|
| 259 |
1.1 |
|
| 260 |
1.1 2.2 |
|
| 263 |
1.1 |
|
| 264 |
1.1 |
|
| 272 |
1.1 |
|
| 287 |
1.1 2.2 3.3 4.4 |
|
| 347 |
1.1 |
|
| 373 |
1.1 2.2 3.3 |
|
| 374 |
1.1 2.2 |
|
| 375 |
1.1 |
|
| 381 |
1.1 |
|
| 382 |
1.1 2.2 |
|
| 383 |
1.1 |
|
| 388 |
1.1 |
|
| 397 |
1.1 |
|
| 414 |
1.1 |
|
| 416 |
1.1 |
|
| 417 |
1.1 |
|
| 420 |
1.1 2.2 |
|
| 421 |
1.1 |
|
| 422 |
1.1 |
|
| 424 |
1.1 |
|
| 431 |
1.1 |
|
| 432 |
1.1 |
|
| 433 |
1.1 |
|
| 434 |
1.1 |
|
| 437 |
1.1 2.2 3.3 |
|
| 438 |
1.1 |
|
| 440 |
1.1 |
|
| 441 |
1.1 2.2 |
|
| 443 |
1.1 |
|
| 454 |
1.1 |
|
| 455 |
1.1 2.2 |
|
| 457 |
1.1 |
|
| 458 |
1.1 2.2 |
|
| 468 |
1.1 2.2 |
|
| 469 |
1.1 |
|
| 471 |
1.1 |
|
| 480 |
1.1 2.2 |
|
| 481 |
1.1 |
|
| 483 |
1.1 |
|
| 494 |
1.1 |
|
| 496 |
1.1 2.2 |
|
| 497 |
1.1 |
|
| 499 |
1.1 |
|
| 503 |
1.1 |
|
| 504 |
1.1 |
|
| 506 |
1.1 |
|
| 509 |
1.1 2.2 |
|
| 510 |
1.1 |
|
| 513 |
1.1 |
|
| 514 |
1.1 |
|
| 518 |
1.1 |
|
| 519 |
1.1 |
|
| 521 |
1.1 |
|
| 523 |
1.1 2.2 |
|
| 524 |
1.1 |
|
| 527 |
1.1 |
|
| 528 |
1.1 |
|
| 536 |
1.1 2.2 |
|
| 543 |
1.1 2.2 |
|
| 552 |
1.1 2.2 |
|
| 561 |
1.1 2.2 |
|
| 571 |
1.1 |
|
| 573 |
1.1 |
|
| 574 |
1.1 |
|
| 576 |
1.1 2.2 |
|
| 577 |
1.1 |
|
| 578 |
1.1 2.2 |
|
| 579 |
1.1 |
|
| 582 |
1.1 |
|
| 583 |
1.1 2.2 |
|
| 584 |
1.1 |
|
| 587 |
1.1 |
|
| 588 |
1.1 |
|
| 592 |
1.1 |
|
| 593 |
1.1 |
|
| 595 |
1.1 |
|
| 596 |
1.1 2.2 |
|
| 597 |
1.1 |
|
| 599 |
1.1 |
|
| 600 |
1.1 |
|
| 604 |
1.1 |
|
| 605 |
1.1 |
|
| 607 |
1.1 |
|
| 608 |
1.1 2.2 |
|
| 609 |
1.1 |
|
| 611 |
1.1 |
|
| 612 |
1.1 |
|
| 621 |
1.1 2.2 |
|
| 622 |
1.1 |
|
| 624 |
1.1 |
|
| 625 |
1.1 2.2 |
|
| 626 |
1.1 2.2 3.3 4.4 |
|
| 628 |
1.1 |
|
| 629 |
1.1 |
|
| 631 |
1.1 |
|
| 632 |
1.1 2.2 3.3 4.4 |
|
| 633 |
1.1 |
|
| 634 |
1.1 |
|
| 637 |
1.1 2.2 |
|
| 641 |
1.1 |
|
| 645 |
1.1 2.2 |
|
| 646 |
1.1 |
|
| 652 |
1.1 |
|
| 657 |
1.1 |
|
| 663 |
1.1 2.2 |
|
| 664 |
1.1 |
|
| 667 |
1.1 |
|
| 668 |
1.1 |
|
| 680 |
1.1 |
|
| 682 |
1.1 2.2 |
|
| 683 |
1.1 |
|
| 685 |
1.1 |
|
| 687 |
1.1 2.2 |
|
| 688 |
1.1 |
|
| 690 |
1.1 |
|
| 700 |
1.1 |
|
| 701 |
1.1 |
|
| 703 |
1.1 |
|
| 710 |
1.1 |
|
| 711 |
1.1 |
|
| 715 |
1.1 |
|
| 722 |
1.1 2.2 3.3 |
|
| 731 |
1.1 2.2 |
|
| 738 |
1.1 2.2 |
|
| 745 |
1.1 |
|
| 746 |
1.1 |
|
| 747 |
1.1 |
|
| 749 |
1.1 |
|
| 750 |
1.1 |
|
| 755 |
1.1 |
|
| 762 |
1.1 |
|
| 763 |
1.1 |
|
| 764 |
1.1 |
|
| 766 |
1.1 |
|
| 767 |
1.1 |
|
| 772 |
1.1 |
|
| 782 |
1.1 |
|
| 783 |
1.1 |
|
| 784 |
1.1 |
|
| 794 |
1.1 |
|
| 795 |
1.1 |
|
| 796 |
1.1 |
|
| 820 |
1.1 2.2 |
|
| 833 |
1.1 |
|
| 835 |
1.1 2.2 3.3 |
|
| 839 |
1.1 |
|
| 840 |
1.1 |
|
| 847 |
1.1 |
|
| 848 |
1.1 |
|
| 849 |
1.1 |
|
| 850 |
1.1 |
|
| 851 |
1.1 2.2 |
|
| 853 |
1.1 |
|
| 854 |
1.1 |
|
| 855 |
1.1 2.2 |
|
| 857 |
1.1 2.2 |
|
| 858 |
1.1 |
|
| 862 |
1.1 |
|
| 864 |
1.1 |
|
| 867 |
1.1 |
|
| 881 |
1.1 2.2 3.3 |
|
| 885 |
1.1 |
|
| 886 |
1.1 |
|
| 890 |
1.1 |
|
| 891 |
1.1 |
|
| 892 |
1.1 |
|
| 893 |
1.1 |
|
| 894 |
1.1 |
|
| 896 |
1.1 |
|
| 897 |
1.1 |
|
| 898 |
1.1 |
|
| 900 |
1.1 |
|
| 903 |
1.1 |
|
| 905 |
1.1 |
|
| 908 |
1.1 |
|
| 969 |
1.1 2.2 3.3 |
|
| 1026 |
1.1 |
|
| 1039 |
1.1 |
|
| 1045 |
1.1 2.2 3.3 |
|
| 1049 |
1.1 |
|
| 1050 |
1.1 |
|
| 1053 |
1.1 |
|
| 1058 |
1.1 |
|
| 1060 |
1.1 |
|
| 1064 |
1.1 2.2 3.3 |
|
| 1068 |
1.1 |
|
| 1069 |
1.1 |
|
| 1072 |
1.1 |
|
| 1073 |
1.1 |
|
| 1079 |
1.1 |
|
| 1080 |
1.1 |
|
| 1084 |
1.1 |
|
| 1088 |
1.1 2.2 |
|
| 1092 |
1.1 |
|
| 1093 |
1.1 |
|
| 1097 |
1.1 |
|
| 1099 |
1.1 |
|
| 1106 |
1.1 |
|
| 1110 |
1.1 |
|
| 1111 |
1.1 |
|
| 1114 |
1.1 |
|
| 1118 |
1.1 |
|
| 1119 |
1.1 |
|
| 1122 |
1.1 |
|
| 1123 |
1.1 |


I am excited to start my career as a junior developer and provide my skills and fresh ideas to complete the job at hand. I have spent the last 4 months honing my skills in HTML, CSS, Javascript, Jquery, and many more libraries and frameworks. I am a natural born problem solver who is goal-oriented and loves the process of identifying problems and working to achieve efficient solutions.
I love working with different people and learning new things. I value integrity, hardwork, and dedication to profecting my craft. Please don't hesitate to contact me to learn more!
Here is a snapshot of my experience working with HTML, CSS, JAVASCRIPT and many other frameworks and libraries.
Projects by Gary Robinson
You will be playing the part of a freelance developer hired by a local company to create a responsive site from a low-fidelity mockup they put together. You will be required to exercise some creativity, or work with others with established design skills, to develop a nice looking web presence for the fictional company. Company Background Swamp Rabbit Cycling is the premier (fictional) cycling shop for the Greater Greenville area! We’ve been serving the area for over 25 years and are the number one source for all things bikes. We carry everything from mountain bike equipment to bike related clothing and safety gear. We are a family owned private business and take pride in our long standing tradition of providing the best service in the area. Scope and Purpose The purpose of this project is to create an online presence to help promote our unique family owned business. We understand the need for an online presence to serve as a way for our customers to connect with us. We also understand the need to keep up with current design trends to help market our business. We’ve currently been using the attached clipart to serve as our logo and realize how updating our look will help us grow.
While we do have plans to expand our website, we’re currently needing something up and running as soon as possible. Here are some of the items we’ll need by next week (also included in the wireframe): Single page where users are able to get our address + contact information Google Map of where we are located in Greenville Being in a mobile driven age, we understand the importance of being mobile friendly. We’ve created a second wireframe to display the mobile view of a website.
After completing this assignment, you should… Have solid understanding of HTML/CSS/SASS Understand principles of RWD and be able to effectively execute a solid flow of content from desktop to mobile. Be able to leverage developer tools to test on mobile devices. Performance Objectives After completing this assignment, you be able to effectively use From a low fidelity wireframe, you should be able to create an html prototype of said design. @media queries SASS HTML manually compile SASS => CSS
As a developer on the web, you will sometimes be tasked with creating an html page simply from an image file. In this assignment, you'll be taking an image and turning it into a functioning website.
Upon completion of this assignment, you should: Understand the proper use and function of html tags. Understand and able to leverage the many css properties to style content. Use CSS to create layout for the HTML page.
After completing this assignment, you should be able to Use sectioning html tags Effectively utilize some common css layout strategies (float or inline-block) Able to leverage and understand the use of absolute vs relative in context of positioning. Details Deliverables A repo containing at least: index.html 'styles.css' 'images/' Requirements Using the image located in assets/surf-and-paddle.png, create a html document using html and css to be a pixel perfect match with the image, but be a functioning website. The menu items, images, and buttons need to also have differing states based on a hover, and although not articulated in the provided image, they need to be styled. Use these fonts from Google Web Fonts in your implementation -- "Open Sans" for most copy, "Oswald" for headings Use the FontAwesome icons for the "Comments", "Read Later", and "Share This" elements placeholder text of your choice for all copy (not headings) placeholder images of your choosing
Without fail, a front-end developer will need to convert a wireframe into a fully functioning website, and responsive at that. For this assignment, you'll be creating this below wireframe and turning into a site that not only renders well from a normal desktop size, but also transitions and is very usable on smaller viewports.
After completing this assignment, you should… Have solid understanding of HTML/CSS/SASS Understand principles of RWD and be able to effectively execute a solid flow of content from desktop to mobile. Be able to leverage developer tools to test on mobile devices. Performance Objectives After completing this assignment, you be able to effectively use From a high fidelity wireframe, you should be able to, with a high degree of accuracy, create an html prototype of said design. @media queries SASS HTML manually compile SASS => CSS
I was assigned to create a full web application to display my skills of everything I have learned over the course of 12 weeks. Cashflow is a web application that allows you to predict you cashflow in the future. This application is just a prototype and is not set up to be fully functional to go live.


 Set yourself up for success with a supportive community and a fitness facility that offers the amenities and knowledge you need to become your best.
UFC GYM is the ultimate MMA-inspired fitness experience. Unlock your potential and elevate your performance in a highly-energized and supportive environment. Take advantage of the opportunity to step into the Octagon, roll on the Brazilian Jiu-Jitsu mats and hit the bags in a large bag room. Beat the boredom with access to numerous fitness classes, specialty equipment, weight and cardio rooms, and more.
We are more than a club, we are a community. Each club is a reflection of its members and their commitment to living through experiences. We Train Different together.


[POC]
OpenLayer + Spain cadaster (ref. 04006A02300607)
Single Img.
Parcel
Zoning
Full
Tile
Parcel
Full


Travelling is one of my dreams and is something I plan to do after college. I plan to spend at least a year abroad if I can as I feel everyone should go out and explore the world we live in. Some of the places I plan to visit are America,across Europe, Asia and Africa.
I also believe travelling and experiencing the world and other cultures is very important and allow people to fully experience life. To travel is to live, they say. Travelling not only teaches us the value of life, but also makes us learners and observers. It compels us to think about everything that is right and wrong with this world. Not to mention, it shows us just how beautiful this world can be, when you think there’s just no hope.