mappin.java
来自「基于J2ME的手机地图客户端源码」· Java 代码 · 共 42 行
JAVA
42 行
package org.sreid.j2me.gmapviewer;import org.sreid.j2me.util.Util;class MapPin { final int x, y; String text = ""; int rmsID = -1; boolean isPermanent = true; // false for search results MapPin(int x, int y) { this.x = x; this.y = y; } MapPin(byte[] data, int off, int len) { this.x = Util.bytesToInt(data, off+0); this.y = Util.bytesToInt(data, off+4); this.text = new String(data, off+8, len-8); } int toBytes(byte[] data, int off) { Util.intToBytes(x, data, off+0); Util.intToBytes(y, data, off+4); byte[] tmp = text.getBytes(); System.arraycopy(tmp, 0, data, off+8, tmp.length); return 8 + tmp.length; } public String toString() { return "MapPin[" + x + "x" + y + ": " + text + "]"; } public boolean equals(Object o) { if (o == this) return true; if (o == null || !(o instanceof MapPin)) return false; MapPin mp = (MapPin)o; return mp.x == x && mp.y == y && mp.text.equals(text); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?