⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 statemulticasterambassador.java

📁 Java游戏高级编程!!很不错的!!!Java游戏高级编程!!很不错的
💻 JAVA
字号:
     package com.croftsoft.core.util.state;

     import java.io.Serializable;
     import java.rmi.*;

     import com.croftsoft.core.lang.ex.*;

     /*********************************************************************
     *
     * An ambassador proxy for StateMulticasterRemote objects.
     *
     * @author
     *   <A HREF="http://www.alumni.caltech.edu/~croft/">David W. Croft</A>
     * @version
     *   1998-12-05
     *********************************************************************/

     public class  StateMulticasterAmbassador
       implements StateMulticaster, Serializable
     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////
     {

     private StateMulticasterRemote  stateMulticasterRemote;

     private transient ExceptionListener  exceptionListener;

     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////

     public  StateMulticasterAmbassador (
       StateMulticasterRemote  stateMulticasterRemote,
       ExceptionListener       exceptionListener )
     //////////////////////////////////////////////////////////////////////
     {
       this.stateMulticasterRemote = stateMulticasterRemote;
       this.exceptionListener      = exceptionListener;
     }

     public  StateMulticasterAmbassador (
       StateMulticasterRemote  stateMulticasterRemote )
     //////////////////////////////////////////////////////////////////////
     {
       this ( stateMulticasterRemote, new PrintExceptionListener ( ) );
     }

     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////

     public void  update ( State  state )
     //////////////////////////////////////////////////////////////////////
     {
       try
       {
         stateMulticasterRemote.update ( state );
       }
       catch ( Exception  ex )
       {
         if ( exceptionListener != null )
         {
           exceptionListener.threwException ( this, ex );
         }
       }
     }

     public boolean  addStateListener ( StateListener  stateListener )
     //////////////////////////////////////////////////////////////////////
     {
       try
       {
         return stateMulticasterRemote.addStateListener ( stateListener );
       }
       catch ( Exception  ex )
       {
         if ( exceptionListener != null )
         {
           exceptionListener.threwException ( this, ex );
         }
         return false;
       }
     }

     public boolean  removeStateListener ( StateListener  stateListener )
     //////////////////////////////////////////////////////////////////////
     {
       try
       {
         return
           stateMulticasterRemote.removeStateListener ( stateListener );
       }
       catch ( Exception  ex )
       {
         if ( exceptionListener != null )
         {
           exceptionListener.threwException ( this, ex );
         }
         return false;
       }
     }

     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////
     }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -