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

📄 movementchangednotification.java

📁 linux下用于移动节点的移动活动生成工具
💻 JAVA
字号:
package de.uni_stuttgart.informatik.canu.mobisim.notifications;

import de.uni_stuttgart.informatik.canu.mobisim.core.*;
import de.uni_stuttgart.informatik.canu.mobisim.mobilitymodels.Movement;

/**
 * Title:        Canu Mobility Simulation Environment
 * Description:  
 * Copyright:    Copyright (c) 2001-2003
 * Company:      University of Stuttgart
 * @author Canu Research group
 * @version 1.1
 */

 /**
  * This class implements the notification about changing of movement parameters
  * @author Illya Stepanov
  */
public class MovementChangedNotification extends MovementNotification
{
  /**
   * Destination of movement
   */
  protected Position3D destination;
  /**
   * Speed of movement (in m/s)
   */
  protected float speed;

  /**
   * Constructor. <br>
   * <br>
   * @param sender notification's sender
   * @param receiver notification's receiver
   * @param destination destination
   * @param speed movement speed (in m/s)
   */
  public MovementChangedNotification(Object sender, Object receiver,
                                     Position3D destination, float speed)
  {
    super(sender, receiver);
    this.destination = destination;
    this.speed = speed;
  }

  /**
   * Gets the movement speed. <br>
   * <br>
   * @return movement speed
   */
  public float getSpeed()
  {
    return speed;
  }

  /**
   * Gets the destination of movement. <br>
   * <br>
   * @return destination of movement
   */
  public Position3D getDestination()
  {
    return destination;
  }

  /**
   * Returns a string representation of the object. <br>
   * <br>
   * @return string representation of the object
   */
  public String toString()
  {
    Universe u = Universe.getReference();
    Node node = (Node)((Movement)sender).getOwner();
    
    float t = (float)node.getPosition().getDistance(destination)/speed;
     
    return "at "+u.getTimeAsString()+" "+node.getID()+
        " started new movement from "+node.getPosition()+
        " to "+destination+" with speed "+speed+" m/s, estimated arrival in "+t+" s";
  }
}

⌨️ 快捷键说明

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