mobileplacemanagerexploreritem.java

来自「一个agent 工具包,可以开发移动设备应用,考虑了安全措施」· Java 代码 · 共 59 行

JAVA
59
字号
package SOMA.mobilePlace;

import java.io.*;
import java.util.*;

import SOMA.explorer.*;

/** Voce di menu per la gestione di un {@link MobilePlaceManager MPM}.
* @author Livio Profiri
*/
public class MobilePlaceManagerExplorerItem extends ExplorerItem
{
  /** @serial*/
  MobilePlaceManager mpm;

  /** Costruttore. */
  public MobilePlaceManagerExplorerItem( MobilePlaceManager mpm )
  {
    super( "[remove \"MobilePlaceID\"]" );
    this.mpm = mpm;
    //Syntax = "{list | put <place> <host> <port> | del <place> | register <host> <port> | refresh {<host> <port>} }";
  }

  public Object Execute( Collection Parameters, PrintStream out )
  {
    Iterator i = Parameters.iterator();

    if( !i.hasNext() )
    {
      mpm.printStatus( out );
      return mpm;
    }

    try
    {
      String Param = (String)i.next();

      if( Param.equals( "remove" ) )
      {
        MobilePlaceID aPlaceID = new MobilePlaceID( (String)i.next() );

        Object result = mpm.removePosition( aPlaceID );

        if( result != null )
          out.println( "  Place (" + aPlaceID + " --> " + result + ") REMOVED" );
        else
          out.println( "  Place " + aPlaceID + " NOT FOUND" );

        return result;
      }
    }
    catch( Exception e )
    {
      e.printStackTrace( out );
    }

    return null;
  }
}

⌨️ 快捷键说明

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