parsedata.java~1~

来自「用java写编写的一个GPS源代码请大家多多指教」· JAVA~1~ 代码 · 共 65 行

JAVA~1~
65
字号
package com.gps.center.parsedata;


import java.util.LinkedList;
import java.util.Hashtable;
import com.gps.center.parsedata.MsgObj;

//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 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 + =
减小字号Ctrl + -
显示快捷键?