Coverage Report - org.as3collections.IListMapIterator
 
Classes in this File Line Coverage Branch Coverage Complexity
IListMapIterator
0%
0/1
N/A
0
 
 1  
 /*
 2  
  * Licensed under the MIT License
 3  
  * 
 4  
  * Copyright 2010 (c) Flávio Silva, http://flsilva.com
 5  
  *
 6  
  * Permission is hereby granted, free of charge, to any person
 7  
  * obtaining a copy of this software and associated documentation
 8  
  * files (the "Software"), to deal in the Software without
 9  
  * restriction, including without limitation the rights to use,
 10  
  * copy, modify, merge, publish, distribute, sublicense, and/or sell
 11  
  * copies of the Software, and to permit persons to whom the
 12  
  * Software is furnished to do so, subject to the following
 13  
  * conditions:
 14  
  *
 15  
  * The above copyright notice and this permission notice shall be
 16  
  * included in all copies or substantial portions of the Software.
 17  
  *
 18  
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 19  
  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 20  
  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 21  
  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 22  
  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 23  
  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 24  
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 25  
  * OTHER DEALINGS IN THE SOFTWARE.
 26  
  * 
 27  
  * http://www.opensource.org/licenses/mit-license.php
 28  
  */
 29  
 
 30  0
 package org.as3collections
 31  
 {
 32  
         import org.as3collections.IIterator;
 33  
 
 34  
         /**
 35  
          * An iterator for maps that allows the programmer to traverse the map in either direction, modify the map during iteration, and obtain the iterator's current position in the map.
 36  
          * <p>Note that the <code>remove</code> and <code>set</code> methods are defined to operate on the last mapping returned by a call to <code>next</code> or <code>previous</code>.</p>
 37  
          * 
 38  
          * @author Flávio Silva
 39  
          */
 40  
         public interface IListMapIterator extends IIterator
 41  
         {
 42  
 
 43  
                 /**
 44  
                  * Returns <code>true</code> if the iteration has more mappings when traversing the map in the reverse direction.
 45  
                  * 
 46  
                  * @return         <code>true</code> if the iteration has more mappings when traversing the map in the reverse direction.
 47  
                   */
 48  
                 function hasPrevious(): Boolean;
 49  
 
 50  
                 /**
 51  
                  * Returns the index of the mapping that would be returned by a subsequent call to <code>next</code>.
 52  
                  * (Returns map size if the map iterator is at the end of the map.) 
 53  
                  * 
 54  
                  * @return         the index of the mapping that would be returned by a subsequent call to <code>next</code>, or map size if map iterator is at end of map.
 55  
                   */
 56  
                 function nextIndex(): int;
 57  
 
 58  
                 /**
 59  
                  * Returns the previous mapping in the iteration.
 60  
                  * 
 61  
                  * @throws         org.as3collections.errors.NoSuchElementError                         if the iteration has no previous mappings.
 62  
                  * @throws         org.as3collections.errors.ConcurrentModificationError         if the map was changed directly (without using the iterator) during iteration.
 63  
                  * @return         the previous mapping in the iteration.
 64  
                   */
 65  
                 function previous(): *;
 66  
 
 67  
                 /**
 68  
                  * Returns the index of the mapping that would be returned by a subsequent call to <code>previous</code>.
 69  
                  * (Returns -1 if the map iterator is at the beginning of the map.) 
 70  
                  * 
 71  
                  * @return         the index of the mapping that would be returned by a subsequent call to <code>previous</code>, or -1 if map iterator is at beginning of map.
 72  
                   */
 73  
                 function previousIndex(): int;
 74  
                 
 75  
                 /**
 76  
                  * Associates the specified value with the specified key in this map. (optional operation)
 77  
                  * The mapping is inserted immediately before the next mapping that would be returned by <code>next</code>, if any, and after the next mapping that would be returned by <code>previous</code>, if any.
 78  
                  * (If the map contains no mappings, the new mapping becomes the sole mapping on the map.)
 79  
                  * The new mapping is inserted before the implicit cursor: a subsequent call to <code>next</code> would be unaffected, and a subsequent call to <code>previous</code> would return the new mapping.
 80  
                  * (This call increases by one the value that would be returned by a call to <code>nextIndex</code> or <code>previousIndex</code>.) 
 81  
                  * 
 82  
                  * @param          key         key with which the specified value is to be associated.
 83  
                  * @param          value         value to be associated with the specified key.
 84  
                  * @throws         org.as3collections.errors.ConcurrentModificationError         if the map was changed directly (without using the iterator) during iteration.
 85  
                  * @throws         ArgumentError                                                                                          if the map already contains the specified key.
 86  
                  */
 87  
                 function put(key:*, value:*): void;
 88  
                 
 89  
                 /**
 90  
                  * Replaces the last mapping returned by <code>next</code> or <code>previous</code> with the specified mapping (optional operation).
 91  
                  * This call can be made only if neither <code>IListMapIterator.remove</code> nor <code>IListMapIterator.add</code> have been called after the last call to <code>next</code> or <code>previous</code>. 
 92  
                  * 
 93  
                  * @param          key         key with which the specified value is to be associated.
 94  
                  * @param          value         value to be associated with the specified key. 
 95  
                  * @throws         org.as3coreaddendum.errors.UnsupportedOperationError          if the <code>set</code> operation is not supported by this iterator.
 96  
                  * @throws         org.as3coreaddendum.errors.ClassCastError                                  if the class of the specified element prevents it from being added to this list.
 97  
                  * @throws         org.as3coreaddendum.errors.IllegalStateError                          if neither <code>next</code> or <code>previous</code> have been called, or <code>remove</code> or <code>add</code> have been called after the last call to <code>next</code> or <code>previous</code>.
 98  
                  * @throws         ArgumentError                                                                                          if the map already contains the specified key and it is not the replaced key.
 99  
                  */
 100  
                 function set(key:*, value:*): void;
 101  
         }
 102  
 
 103  
 }