public int compare(Object o1,Object o2){
  double diff;
  Message m1, m2;
  if (o1 instanceof Tuple) {
    m1=((Tuple<Message,Connection>)o1).getKey();
    m2=((Tuple<Message,Connection>)o2).getKey();
  }
 else   if (o1 instanceof Message) {
    m1=(Message)o1;
    m2=(Message)o2;
  }
 else {
    throw new SimError("Invalid type of objects in " + "the list");
  }
  diff=m1.getReceiveTime() - m2.getReceiveTime();
  if (diff == 0) {
    return 0;
  }
  return (diff < 0 ? -1 : 1);
}

public int compare ( Object o1 , Object o2 ) { double diff ; Message m1 , m2 ; if ( o1 instanceof Tuple ) { m1 = ( ( Tuple < Message , Connection > ) o1 ) . getKey ( ) ; m2 = ( ( Tuple < Message , Connection > ) o2 ) . getKey ( ) ; } else if ( o1 instanceof Message ) { m1 = ( Message ) o1 ; m2 = ( Message ) o2 ; } else { throw new SimError ( "Invalid type of objects in " + "the list" ) ; } diff = m1 . getReceiveTime ( ) - m2 . getReceiveTime ( ) ; if ( diff == 0 ) { return 0 ; } return ( diff < 0 ? - 1 : 1 ) ; }
compares two tuples by their messages ' receiving time
