Package edu.jas.util

Class Counter

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Counter>

    class Counter
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Comparable<Counter>
    Class for holding the list index used as key in TreeMap. Implemented since Integer has no add() method. Must implement Comparable so that TreeMap works with correct ordering.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int value  
    • Constructor Summary

      Constructors 
      Constructor Description
      Counter()
      Counter.
      Counter​(int v)
      Counter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int v)
      add.
      int compareTo​(Counter c)
      compareTo.
      boolean equals​(java.lang.Object ob)
      equals.
      int hashCode()
      Hash code for this Counter.
      int intValue()
      intValue.
      java.lang.String toString()
      toString.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • value

        private int value
    • Constructor Detail

      • Counter

        public Counter()
        Counter.
      • Counter

        public Counter​(int v)
        Counter.
        Parameters:
        v -
    • Method Detail

      • intValue

        public int intValue()
        intValue.
        Returns:
        the value.
      • add

        public void add​(int v)
        add.
        Parameters:
        v -
      • equals

        public boolean equals​(java.lang.Object ob)
        equals.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        ob - an Object.
        Returns:
        true if this is equal to o, else false.
      • compareTo

        public int compareTo​(Counter c)
        compareTo.
        Specified by:
        compareTo in interface java.lang.Comparable<Counter>
        Parameters:
        c - a Counter.
        Returns:
        1 if (this < c), 0 if (this == c), -1 if (this > c).
      • hashCode

        public int hashCode()
        Hash code for this Counter.
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()
      • toString

        public java.lang.String toString()
        toString.
        Overrides:
        toString in class java.lang.Object