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

📄 agentpositionstore.java

📁 一个agent 工具包,可以开发移动设备应用,考虑了安全措施
💻 JAVA
字号:
package SOMA.agent.mobility;

import SOMA.naming.*;

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

/** Struttura dati che contiene le posizioni degli agenti traceable.
*
* @author Livio Profiri (metodo aggiuntivo di Luigi Antenucci)
*/
public class AgentPositionStore implements Serializable
{
  private Hashtable positions = new Hashtable();

  public PlaceID get( AgentID agentID )
  {
    return (PlaceID)positions.get( agentID );
  }

  public PlaceID put( AgentID agentID, PlaceID position )
  {
    return (PlaceID)positions.put( agentID, position );
  }

  public PlaceID remove( AgentID agentID )
  {
    return (PlaceID)positions.remove( agentID );
  }

  public void printPositions( PrintStream out )
  {
    Iterator i = positions.entrySet().iterator();

    for( int j = 1; i.hasNext(); j++ )
    {
      Map.Entry e = (Map.Entry)i.next();
      out.println( "  " + j + ") " + e.getKey() + " --> " + e.getValue() );
    }
  }

  /**
   *  Rende un array di AgentID corrispondente all'elenco di tutti gli agenti 
   *  "rintracciabli" creati nel place corrente.
   *  Metodo aggiunto da Luigi Antenucci per la "PosizioneAgenti".
   */
  public AgentID[] cheElencoAgenti () {
    Set elencoAgID = positions.keySet();
    return (AgentID[]) elencoAgID.toArray (new AgentID[positions.size()]);
  } //cheElencoAgenti
}

⌨️ 快捷键说明

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