// (c) MIT 2003.  All rights reserved.

package rec.agent;




import java.rmi.*;
import java.rmi.server.*;
import java.util.*;
import rec.util.*;
import rec.sys.*;

public class RemoteModuleImpl extends UnicastRemoteObject
  implements RemoteModule, Module
{
  protected ModuleListener parent = null;
  String name;
  Id id;
  boolean enabled;

  protected RemoteModuleImpl( ModuleListener parent ) throws RemoteException
  {
    this.parent = parent;
    this.id = new Id();
    this.name = "RM[" + id + "]";
    enabled = true;
  }

  public Id getId()
  {
    return id;
  }
	 
  public Id getIdRemotely()
  {
    return id;
  }

  public String getName()
  {
    return name.toString();
  }

  public String toString()
  {
    return "REMOTE:" + name;
  }

  public boolean isEnabled()
  {
    return enabled;
  }

  public void enable()
  {
    enable( null );
  }
    
  public void enable( Object o )
  {
    enabled = true;
  }

  public void disable()
  {
    enabled = false;
  }

  public boolean contains( Object o )
  {
    return false;
  }
  
  public Iterator getRecognizers( Widget w )
  {
    return ( new Vector() ).iterator();
  }

  public Iterator getFastRecognizers()
  {
    return ( new Vector() ).iterator();
  }

  public Iterator getReasoners()
  {
    return ( new Vector() ).iterator();
  }

  public boolean recognizeWidget( Surface s, Widget w )
  {
    return true;
  }

  public void reasonOnWidget( Surface s, Widget w1, SimpleGraph g ) 
  {
  }

  public void add( Reasoner r ) 
  {
    Assert.error( "Remote Module cannot have one." );
  }
  public void add( Recognizer r ) 
  {
    Assert.error( "Remote Module cannot have one." );
  }
  public void remove( Reasoner r ) 
  {
    Assert.error( "Remote Module cannot have one." );
  }
  public void remove( Recognizer r ) 
  {
    Assert.error( "Remote Module cannot have one." );
  }

  

  public Object query( Object q ) throws RemoteException
  {
    return null;
  }

}
