Package soot.util

Class HashChain<E>

    • Field Detail

      • firstItem

        protected E firstItem
      • lastItem

        protected E lastItem
      • stateCount

        protected int stateCount
    • Constructor Detail

      • HashChain

        public HashChain()
        Constructs an empty HashChain.
      • HashChain

        public HashChain​(int initialCapacity)
        Constructs an empty HashChain with the given initial capacity.
      • HashChain

        public HashChain​(Chain<E> src)
        Constructs a HashChain filled with the contents of the src Chain.
    • Method Detail

      • emptyIterator

        protected static <X> Iterator<X> emptyIterator()
      • swapWith

        public void swapWith​(E out,
                             E in)
        Description copied from interface: Chain
        Replaces out in the Chain by in.
        Specified by:
        swapWith in interface Chain<E>
      • getElementsUnsorted

        public Collection<E> getElementsUnsorted()
        Gets all elements in the chain. There is no guarantee on sorting.
        Specified by:
        getElementsUnsorted in interface Chain<E>
        Returns:
        All elements in the chain in an unsorted collection
      • toList

        @Deprecated
        public static <E> List<E> toList​(Chain<E> c)
        Deprecated.
        you can use new ArrayList(c) instead
        Returns an unbacked list containing the contents of the given Chain.
      • follows

        public boolean follows​(E someObject,
                               E someReferenceObject)
        Description copied from interface: Chain
        Returns true if object someObject follows object someReferenceObject in the Chain, i.e. someReferenceObject comes first and then someObject.
        Specified by:
        follows in interface Chain<E>
      • insertAfter

        public void insertAfter​(E toInsert,
                                E point)
        Description copied from interface: Chain
        Inserts toInsert in the Chain after point.
        Specified by:
        insertAfter in interface Chain<E>
      • insertAfter

        public void insertAfter​(Collection<? extends E> toInsert,
                                E point)
        Description copied from interface: Chain
        Inserts toInsert in the Chain after point.
        Specified by:
        insertAfter in interface Chain<E>
      • insertAfter

        public void insertAfter​(List<E> toInsert,
                                E point)
        Description copied from interface: Chain
        Inserts toInsert in the Chain after point.
        Specified by:
        insertAfter in interface Chain<E>
      • insertAfter

        public void insertAfter​(Chain<E> toInsert,
                                E point)
        Description copied from interface: Chain
        Inserts toInsert in the Chain after point.
        Specified by:
        insertAfter in interface Chain<E>
      • insertBefore

        public void insertBefore​(E toInsert,
                                 E point)
        Description copied from interface: Chain
        Inserts toInsert in the Chain before point.
        Specified by:
        insertBefore in interface Chain<E>
      • insertBefore

        public void insertBefore​(Collection<? extends E> toInsert,
                                 E point)
        Description copied from interface: Chain
        Inserts toInsert in the Chain before point.
        Specified by:
        insertBefore in interface Chain<E>
      • insertBefore

        public void insertBefore​(List<E> toInsert,
                                 E point)
        Description copied from interface: Chain
        Inserts toInsert in the Chain before point.
        Specified by:
        insertBefore in interface Chain<E>
      • insertBefore

        public void insertBefore​(Chain<E> toInsert,
                                 E point)
        Description copied from interface: Chain
        Inserts toInsert in the Chain before point.
        Specified by:
        insertBefore in interface Chain<E>
      • listToHashChain

        public static <T> HashChain<T> listToHashChain​(List<T> list)
      • addFirst

        public void addFirst​(E item)
        Description copied from interface: Chain
        Adds the given object at the beginning of the Chain.
        Specified by:
        addFirst in interface Chain<E>
      • addLast

        public void addLast​(E item)
        Description copied from interface: Chain
        Adds the given object at the end of the Chain.
        Specified by:
        addLast in interface Chain<E>
      • removeFirst

        public void removeFirst()
        Description copied from interface: Chain
        Removes the first object contained in this Chain.
        Specified by:
        removeFirst in interface Chain<E>
      • removeLast

        public void removeLast()
        Description copied from interface: Chain
        Removes the last object contained in this Chain.
        Specified by:
        removeLast in interface Chain<E>
      • getFirst

        public E getFirst()
        Description copied from interface: Chain
        Returns the first object in this Chain.
        Specified by:
        getFirst in interface Chain<E>
      • getLast

        public E getLast()
        Description copied from interface: Chain
        Returns the last object in this Chain.
        Specified by:
        getLast in interface Chain<E>
      • snapshotIterator

        public Iterator<E> snapshotIterator()
        Description copied from interface: Chain
        Returns an iterator over a copy of this chain. This avoids ConcurrentModificationExceptions from being thrown if the underlying Chain is modified during iteration. Do not use this to remove elements which have not yet been iterated over!
        Specified by:
        snapshotIterator in interface Chain<E>
      • snapshotIterator

        public Iterator<E> snapshotIterator​(E from)
      • iterator

        public Iterator<E> iterator​(E from)
        Description copied from interface: Chain
        Returns an iterator over this Chain, starting at the given object.
        Specified by:
        iterator in interface Chain<E>
      • iterator

        public Iterator<E> iterator​(E head,
                                    E tail)

        Returns an iterator ranging from head to tail, inclusive.

        If tail is the element immediately preceding head in this HashChain, the returned iterator will iterate 0 times (a special case to allow the specification of an empty range of elements). Otherwise if tail is not one of the elements following head, the returned iterator will iterate past the end of the HashChain, provoking a NoSuchElementException.

        Specified by:
        iterator in interface Chain<E>
        Throws:
        NoSuchElementException - if head is not an element of the chain.
      • getModificationCount

        public long getModificationCount()
        Returns the number of times this chain has been modified.
        Specified by:
        getModificationCount in interface Chain<E>