import java.util.*;

public class SendPrimitives

{

	/**   dummy HashSet  ...   nedd to be changed later */
    public HashSet resolve(Gid gid)
    {

	HashSet g = new HashSet();    
	return g;

    }

    public void send(Object message , int destination)
    {


    }

    public void send(Object message , Gid gid)
    {

	HashSet s = resolve(gid);
	Iterator i = s.iterator();
	int dest;

	while(i.hasNext())
	    {
		dest = ((Integer )i.next()).intValue();
		send(message,dest);
	    }


    } 

    /**  resolve issues between Abstract set and Gid */

    public void send_abcast(Gid gid, String message_text , int operation)
  
    {
	int mid;
	int CLIENT_ID =0;  //  STATIC VARIABLE
	int ABCAST_TYPE =0;  //  STATIC VARIABLE

	AbstractSet abs ;
	abs = resolve(gid);
	Abcast a = new Abcast(abs,message_text,operation);
	mid = generate_id(gid);   //   generate_id has to be a static fn.
	Message m = new Message(CLIENT_ID,ABCAST_TYPE,mid,gid,a);
	send(m,gid);

    }

    /**  depending on gid, generate a unique message id, use vector clocks */


    public int generate_id(Gid gid)
    {
	return 0;

    }


    public void send_abcast2(Message m,int priority)
    {
	int mid;
	int CLIENT_ID =0;  //  STATIC VARIABLE
	int ABCAST_TYPE =0;  //  STATIC VARIABLE


	Abcast2  a = new Abcast2(priority);
	mid = generate_id( /* generate using an object  */ m.getgid());
	Message x = new Message(CLIENT_ID,ABCAST_TYPE,mid,m.getgid(),a);
	send(x,m.getgid());

    }



}










