Class PtidesReceiver.TagComparator

  • All Implemented Interfaces:
    java.util.Comparator
    Enclosing class:
    PtidesReceiver

    public static class PtidesReceiver.TagComparator
    extends java.lang.Object
    implements java.util.Comparator
    Compare two events according to - time stamp - value did not find a way to compare Tokens, therefore am comparing DoubleTokens and IntTokens here. If other kinds of Tokens are used, this Comparer needs to be extended.
    Author:
    Jia Zou, Slobodan Matic, Patricia Derler
    • Constructor Summary

      Constructors 
      Constructor Description
      TagComparator()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(java.lang.Object arg0, java.lang.Object arg1)
      Compare two events according to time stamps and values.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • TagComparator

        public TagComparator()
    • Method Detail

      • compare

        public int compare​(java.lang.Object arg0,
                           java.lang.Object arg1)
        Compare two events according to time stamps and values. FIXME Because there is no general compare method for tokens, I implemented the comparison for int and double tokens. A more general compare is required.
        Specified by:
        compare in interface java.util.Comparator
        Parameters:
        arg0 - First event.
        arg1 - Second event.
        Returns:
        -1 if event arg0 should be processed before event arg1, 0 if they should be processed at the same time, 1 if arg1 should be processed before arg0.