import java.util.*;

public class Compare implements Comparator

{

    public int compare(Object o1, Object o2)
    {
	Message obj1 = (Message)o1;
	Message obj2 = (Message)o2;
	if ( this.equals( ((Abcast)(obj1.getmessageobj())).getpriority() , ((Abcast)(obj2.getmessageobj())).getpriority() ) == 0 )
	    return this.equals(obj1.getmessagesource(),obj2.getmessagesource());
	else //change made by Mithun
	return  this.equals(((Abcast) (obj1.getmessageobj()) ).getpriority(), ((Abcast) obj2.getmessageobj()).getpriority() ) ;
    }

    public int equals(int x, int y)
    {  
	if (x==y) return 0  ;
	if(x<y)  return -1;
	return 1;
    }

    public boolean equals( Object ob)
    {
	return true;
    }
}







