📄 positionparticle.java
字号:
package org.placelab.particlefilter.beacon;import org.placelab.core.TwoDCoordinate;import org.placelab.particlefilter.Particle;/** * * */public class PositionParticle extends Particle { private TwoDCoordinate position; public PositionParticle(PositionParticle p) { super(p); position = new TwoDCoordinate(p.position); } public PositionParticle(TwoDCoordinate pos) { super(); if (pos==TwoDCoordinate.NULL) pos = new TwoDCoordinate(pos); position = pos; } public boolean equals(Object o) { if (!(o instanceof PositionParticle)) { return super.equals(o); } PositionParticle other = (PositionParticle)o; return position.equals(other.position); } public Particle createClone() { return new PositionParticle(this); } //// public static int countOccupancy(double gridSize, ParticleList pList) {// Hashtable support=new Hashtable();// Object UNUSED=new Object();// // for (int i=0; i<pList.size();++i) {// TwoDimParticle p=(TwoDimParticle)pList.get(i);// double gridCellX=p.x/gridSize;// double gridCellY=p.y/gridSize;// double xTrunc=Math.floor(gridCellX);// double yTrunc=Math.floor(gridCellY);// String gridCell=""+xTrunc+","+yTrunc;// support.put(gridCell,UNUSED);// }// return support.size();// }//// public int countSupport(double gridSize, ParticleList pList) {// //I do this to emphasize that this is JUST to get the types// //to work out, we don't depend on the state of this object// return countOccupancy(gridSize,pList);// } /** * @return Returns the position. */ public TwoDCoordinate getPosition() { return position; } /** * @param position The position to set. */ public void setPosition(TwoDCoordinate position) { this.position = position; } public void moveBy(double x, double y) { position.moveBy(x, y); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -