Class ListParser.Entry

  • All Implemented Interfaces:
    java.lang.Comparable<ListParser.Entry>
    Enclosing class:
    ListParser<T>

    private class ListParser.Entry
    extends java.lang.Object
    implements java.lang.Comparable<ListParser.Entry>
    The Entry object provides a comparable object to insert in to a priority queue. This will sort the value using the quality value parameter parsed from the list. If there are values with the same quality value this this will sort the values by a secondary order parameter.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int order
      This is the secondary order value used to sort entries.
      private long priority
      This is the priority value that is used to sort entries.
      private T value
      This is the value that is represented by this entry.
    • Constructor Summary

      Constructors 
      Constructor Description
      Entry​(T value, long priority, int order)
      Constructor for the Entry object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(ListParser.Entry entry)
      This is used to sort the entries within the priority queue using the provided priority of specified.
      T getValue()
      This acquires the value represented by this entry.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • value

        private final T value
        This is the value that is represented by this entry.
      • priority

        private final long priority
        This is the priority value that is used to sort entries.
      • order

        private final int order
        This is the secondary order value used to sort entries.
    • Constructor Detail

      • Entry

        public Entry​(T value,
                     long priority,
                     int order)
        Constructor for the Entry object. This is used to create a comparable value that can be inserted in to a priority queue and extracted in order of the priority value.
        Parameters:
        value - this is the value that is represented by this
        priority - this is the priority value for sorting
        order - this is the secondary priority value used
    • Method Detail

      • getValue

        public T getValue()
        This acquires the value represented by this entry. This is can be used to place the value within a list as it is taken from the priority queue. Acquiring the values in this way facilitates a priority ordered list of values.
        Returns:
        this returns the value represented by this
      • compareTo

        public int compareTo​(ListParser.Entry entry)
        This is used to sort the entries within the priority queue using the provided priority of specified. If the entries have the same priority value then they are sorted using a secondary order value, which is the insertion index.
        Specified by:
        compareTo in interface java.lang.Comparable<ListParser.Entry>
        Parameters:
        entry - this is the entry to be compared to
        Returns:
        this returns the result of the entry comparison