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

📄 motesimobjectgenerator.java

📁 传感器网络中的嵌入式操作系统源代码
💻 JAVA
字号:
// $Id: MoteSimObjectGenerator.java,v 1.4.6.3 2003/08/26 09:08:11 cssharp Exp $/*									tab:2 * * * "Copyright (c) 2000 and The Regents of the University  * of California.  All rights reserved. * * Permission to use, copy, modify, and distribute this software and * its documentation for any purpose, without fee, and without written * agreement is hereby granted, provided that the above copyright * notice and the following two paragraphs appear in all copies of * this software. *  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS * DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, * UPDATES, ENHANCEMENTS, OR MODIFICATIONS." * * Authors:	Nelson Lee * Date:        December 05, 2002 * Desc:        Class that creates MoteSimObjects * *//** * @author Nelson Lee */package net.tinyos.sim;import java.lang.*;import java.util.*;import java.awt.event.*;import net.tinyos.sim.event.*;public class MoteSimObjectGenerator extends SimObjectGenerator {  SimState state;  private static int idCounter = 0;  public MoteSimObjectGenerator(TinyViz tv) {    super(tv);    this.state = tv.getSimState();  }  public void create(int id) {    double x = Math.random()*(cT.getMoteScaleWidth() * 0.8);    double y = Math.random()*(cT.getMoteScaleHeight() * 0.8);    x += (cT.getMoteScaleWidth() * 0.1);    y += (cT.getMoteScaleHeight() * 0.1);    // check to make sure that the mote does not already exist    if (state.getMoteSimObject(id) != null) return;    if (id >= idCounter) {      idCounter = id + 1;    }    create(x,y,id);  }  public void create(int x, int y) {    create(cT.guiXToSimX(x), cT.guiYToSimY(y), idCounter++);  }  public void create(double x, double y, int id) {    MoteSimObject m = new MoteSimObject(tv, x, y, id, popup);    m.setPower(true);  }  public void mouseAction(MouseEvent e) {}}

⌨️ 快捷键说明

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