Class TreeHeap<E>

  • All Implemented Interfaces:
    Heap<E>

    @Deprecated
    public class TreeHeap<E>
    extends java.lang.Object
    implements Heap<E>
    Deprecated.
    not used anymore, when there is need for a heap use ListHeap instead
    An implementation of the Heap interface based on SortedSet. This implementation will not allow multiple objects which are equal to be added to the heap. Only use this implementation when object in the heap can be totally ordered (no duplicates).
    • Constructor Summary

      Constructors 
      Constructor Description
      TreeHeap()
      Deprecated.
      Creates a new tree heap.
      TreeHeap​(int size)
      Deprecated.
      Creates a new tree heap of the specified size.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void add​(E o)
      Deprecated.
      Adds the specified object to the heap.
      void clear()
      Deprecated.
      Clears the contents of the heap.
      E extract()
      Deprecated.
      Removes the smallest element from the heap and returns it.
      E first()
      Deprecated.
      Returns the smallest element of the heap.
      boolean isEmpty()
      Deprecated.
      Returns whether the heap is empty.
      java.util.Iterator<E> iterator()
      Deprecated.
      Returns an iterator over the elements of the heap.
      E last()
      Deprecated.
      Returns the largest element of the heap.
      static void main​(java.lang.String[] args)
      Deprecated.
       
      int size()
      Deprecated.
      Returns the size of the heap.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TreeHeap

        public TreeHeap()
        Deprecated.
        Creates a new tree heap.
      • TreeHeap

        public TreeHeap​(int size)
        Deprecated.
        Creates a new tree heap of the specified size.
        Parameters:
        size - The size of the new tree heap.
    • Method Detail

      • extract

        public E extract()
        Deprecated.
        Description copied from interface: Heap
        Removes the smallest element from the heap and returns it.
        Specified by:
        extract in interface Heap<E>
        Returns:
        The smallest element from the heap.
      • first

        public E first()
        Deprecated.
        Description copied from interface: Heap
        Returns the smallest element of the heap.
        Specified by:
        first in interface Heap<E>
        Returns:
        The top element of the heap.
      • last

        public E last()
        Deprecated.
        Description copied from interface: Heap
        Returns the largest element of the heap.
        Specified by:
        last in interface Heap<E>
        Returns:
        The largest element of the heap.
      • iterator

        public java.util.Iterator<E> iterator()
        Deprecated.
        Description copied from interface: Heap
        Returns an iterator over the elements of the heap. No specific ordering of these elements is guaranteed.
        Specified by:
        iterator in interface Heap<E>
        Returns:
        An iterator over the elements of the heap.
      • add

        public void add​(E o)
        Deprecated.
        Description copied from interface: Heap
        Adds the specified object to the heap.
        Specified by:
        add in interface Heap<E>
        Parameters:
        o - The object to add to the heap.
      • size

        public int size()
        Deprecated.
        Description copied from interface: Heap
        Returns the size of the heap.
        Specified by:
        size in interface Heap<E>
        Returns:
        The size of the heap.
      • clear

        public void clear()
        Deprecated.
        Description copied from interface: Heap
        Clears the contents of the heap.
        Specified by:
        clear in interface Heap<E>
      • isEmpty

        public boolean isEmpty()
        Deprecated.
        Description copied from interface: Heap
        Returns whether the heap is empty.
        Specified by:
        isEmpty in interface Heap<E>
        Returns:
        true if the heap is empty; false otherwise.
      • main

        public static void main​(java.lang.String[] args)
        Deprecated.