WangHan
2025-04-03 a1b85ef72062ca80db35546e4216dd564f3e0f57
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.iplatform.tcp;
 
/**
 * TCP通信引擎类型定义。
 * @author 时克英
 * @date 2023-04-17
 */
public enum EngineType {
 
    TcpEngine{
        public int getIndex(){
            return INDEX_TCP_ENGINE;
        }
    },
    WebsocketEngine{
        public int getIndex(){
            return INDEX_TCP_WEBSOCKET;
        }
    };
 
    public int getIndex(){
        throw new AbstractMethodError();
    }
 
    public EngineType getType(int index){
        if(index == INDEX_TCP_ENGINE){
            return TcpEngine;
        } else if(index == INDEX_TCP_WEBSOCKET){
            return WebsocketEngine;
        } else {
            throw new UnsupportedOperationException("不支持的通信引擎:" + index);
        }
    }
 
    public static final int INDEX_TCP_ENGINE = 1;
    public static final int INDEX_TCP_WEBSOCKET = 2;
}