📄 parsedata.java
字号:
package com.gps.center.baseclass;
import java.util.LinkedList;
import java.util.Hashtable;
import com.gps.center.baseclass.MsgObj;
/*
父类:
定义:两个Hashtable,centerMap存贮索引车台号码,值为终端TCP-KEY,
classMap存贮索引类名,值为对应类的实例
两个LinkedList:recieveQueue接收消息的队列,sendQueue发送消息的队列
String型中心IP和端口,final int型消息类型标识,
方法:对队列的添加,删除,获取
cMsgtype:1--TCPMSG,2--DEVICEUDPMSG,3--SMSMSG
4--TCPSENDTODEVICE,5--UDPSENDTODEVICE,6--SMSSENDTODEVICE,7--TCPSENDTOTERMINAL,8--TCPRETURNTERMINAL
*/
public class ParseData {
public static Hashtable centerMap = new Hashtable();
public static Hashtable classMap = new Hashtable();
public static LinkedList recieveQueue = new LinkedList();
public static LinkedList sendQueue = new LinkedList();
public static String[][] DeviceIdType;
public static String centerIp = null;
public static String centerPort = null;
public static boolean openservice = true;
public static final int TCPMSG = 1;
public static final int DEVICEUDPMSG = 2;
public static final int SMSMSG = 3;
public static final int TCPSENDTODEVICE = 4;
public static final int UDPSENDTODEVICE = 5;
public static final int SMSSENDTODEVICE = 6;
public static final int TCPSENDTOTERMINAL = 7;
public static final int TCPRETURNTERMINAL = 8;
public static final int SENDTODBSERVER = 9;
public ParseData() {
}
//synchronized
public static void addSendMsg(MsgObj msg) {//添加发送队列
sendQueue.addLast(msg);
}
public static MsgObj getSendMsg() {//得到发送队列
MsgObj msg = (MsgObj) sendQueue.getFirst();
sendQueue.removeFirst();
return msg;
}
public static void removeSendMsg(MsgObj msg) {//从发送队列删除消息
if (!sendQueue.isEmpty()) {
sendQueue.remove(msg);
}
}
public static void addRecieveMsg(MsgObj msg) {//添加消息到接收队列
recieveQueue.addLast(msg);
}
public static MsgObj getRecieveMsg() {//从接收队列得到消息
MsgObj msg = (MsgObj) recieveQueue.getFirst();
recieveQueue.removeFirst();
return msg;
}
public static void removeRecieveMsg(MsgObj msg) {//从接收队列删除消息
if (!recieveQueue.isEmpty()) {
recieveQueue.remove(msg);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -