Package edu.jas.util

Class Counter

java.lang.Object
edu.jas.util.Counter
All Implemented Interfaces:
Serializable, Comparable<Counter>

class Counter extends Object implements Serializable, 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 Details

    • value

      private int value
  • Constructor Details

    • Counter

      public Counter()
      Counter.
    • Counter

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

    • intValue

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

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

      public boolean equals(Object ob)
      equals.
      Overrides:
      equals in class 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 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 Object
      See Also:
    • toString

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