Java 如何将它们更改为有效的switch语句?
所以,我有从以前开发的类复制的switch语句,它们显然不是有效的语句。如何将它们更改为有效代码?详情如下:Java 如何将它们更改为有效的switch语句?,java,enums,switch-statement,Java,Enums,Switch Statement,所以,我有从以前开发的类复制的switch语句,它们显然不是有效的语句。如何将它们更改为有效代码?详情如下: switch($SWITCH_TABLE$hotsdk_a$communication$HotInterface$HotResultData$val_rcv_kind()[HotInterface.HotResultData.val_rcv_kind.valueOf(hotResultData.rcv_kind).ordinal()]){ case 1:
switch($SWITCH_TABLE$hotsdk_a$communication$HotInterface$HotResultData$val_rcv_kind()[HotInterface.HotResultData.val_rcv_kind.valueOf(hotResultData.rcv_kind).ordinal()]){
case 1:
case 2:
} //valueOf is a method in the enum
switch($SWITCH_TABLE$hotsdk_a$game$AppMessage()[AppMessage.valueOf(rSendMsg.what).ordinal()]){
case 1:
case 2:
} //rSendMsg.what is obtained from the Message returned by the first switch case above
switch($SWITCH_TABLE$hotsdk_a$communication$HOTDeviceInterface$DataFormat$Command()[command.ordinal()]){
case 1:
case 2:
}
,其中,AppMessage、val\u rcv\u kind和command是枚举
val\u rcv\u kind
public static enum val_rcv_kind {
rcv_Beacon(0),
rcv_Measuring(1),
rcv_FwVer(2),
rcv_AGC(3),
rcv_GetGain(4),
rcv_GetLed(5),
rcv_SetGain(6),
rcv_Stop(7);
private int value;
private val_rcv_kind(int i) {
this.value = i;
}
public int getValue() {
return this.value;
}
public static HotInterface.HotResultData.val_rcv_kind valueOf(int i) {
HotInterface.HotResultData.val_rcv_kind[] var4;
int var3 = (var4 = values()).length;
for(int var2 = 0; var2 < var3; ++var2) {
HotInterface.HotResultData.val_rcv_kind kind = var4[var2];
if (kind.getValue() == i) {
return kind;
}
}
return null;
}
}
public static enum Command {
ConfigureProbe("!AT C"),
ResetProbe("!AT D"),
StartAGC("!AT G"),
GetAGCParameter("!AT P"),
GetData("!AT R 0"),
GetDebugData("!AT R 1"),
StopData("!AT S"),
GetMGCParameter("!AT M"),
GetLEDParameter("!AT L");
private String value;
private Command(String command) {
this.value = command;
}
public String getValue() {
return this.value;
}
}
AppMessage
public enum AppMessage {
StartButtonClicked(0),
StopButtonClicked(1),
UpdateView(10),
BluetoothConnected(100),
BluetoothDisconnected(101),
BluetoothConnectionFailed(102),
BluetoothNotified(103),
DataReceived(111),
DebugDataReceived(112),
BeaconReceived(113),
BluetoothServiceConnected(500),
DebugPutError(900),
OnEnterWaiting(1000),
AGCStarted(1101),
AGCSucceeded(1102),
AGCFailed(1103),
AGCOnTheWay(1104),
AGCParameterReceived(1110),
ProbeCheckStarted(1201),
ProbeCheckSucceeded(1202),
ProbeCheckFailed(1203),
CalibrationStarted(1301),
CalibrationSucceeded(1302),
CalibrationFailed(1303),
MeasurementStarted(1401),
MeasurementStopped(1402),
OnMarkingEvent(1500),
SetGainSucceeded(1601),
SetGainFailed(1602),
GetGainReceived(1603),
SetLedSucceeded(1701),
SetLedFailed(1702),
GetLedReceived(1703),
StopMeasuring(1801),
SetGainEnd(1802),
LoginReceivedCallback(1900),
SessionReceivedCallback(1901),
DataReceivedCallback(1911),
CoinReceivedCallback(1921),
StartGame00(2000),
StartGame01(2001),
StartGame02(2002),
StartGame03(2003),
StartGame04(2004),
StartGame05(2005),
StartGame06(2006),
StartGame07(2007),
StartGame08(2008),
StartGame09(2009),
GetItem00(9000),
GetItem01(9001),
GetItem02(9002),
GetItem03(9003),
GetItem04(9004);
private final int value;
AppMessage(int i) {
this.value = i;
}
public int getValue() {
return this.value;
}
public static AppMessage valueOf(int i) {
AppMessage[] var4;
int var3 = (var4 = values()).length;
for(int var2 = 0; var2 < var3; ++var2) {
AppMessage event = var4[var2];
if (event.getValue() == i) {
return event;
}
}
return null;
}
}
public enum AppMessage{
开始按钮单击(0),
停止按钮(1),
更新视图(10),
蓝牙连接(100),
蓝牙(101),
蓝牙连接失败(102),
蓝牙(103),
收到的数据(111),
已接收调试数据(112),
信标号(113),
BluetoothServiceConnected(500),
调试错误(900),
一等一等(1000),
AGC启动(1101),
(1102),
agc失败(1103),
爱康道(1104),
收到的AGC参数(1110),
ProbeCheckStarted(1201),
Probechecksucceed(1202),
ProbeCheckFailed(1203),
校准开始(1301),
校准成功(1302),
校准失败(1303),
开始测量(1401),
测量值(1402),
在MarkingEvent(1500)上,
SetGainSucceed(1601年),
SetGainFailed(1602年),
GetGainReceived(1603年),
SetledSuccessed(1701年),
SetLedFailed(1702),
GetLedReceived(1703年),
停止测量(1801),
塞特盖内德(1802年),
LoginReceivedCallback(1900),
SessionReceivedCallback(1901年),
数据接收回调(1911年),
共同接收回调(1921年),
StartGame00(2000年),
StartGame01(2001年),
StartGame02(2002年),
StartGame03(2003年),
StartGame04(2004年),
StartGame05(2005年),
StartGame06(2006年),
StartGame07(2007年),
StartGame08(2008年),
StartGame09(2009年),
GetItem00(9000),
GetItem01(9001),
GetItem02(9002),
GetItem03(9003),
GetItem04(9004);
私有最终整数值;
应用信息(int i){
该值=i;
}
public int getValue(){
返回此.value;
}
公共静态AppMessage值(int i){
AppMessage[]var4;
int var3=(var4=values()).length;
for(int var2=0;var2
谁能帮我解决这个问题。我需要尽快完成我的项目。这看起来像是从一个不懂枚举的反汇编程序中反汇编的代码 我认为第一个应该从:
// ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
switch($SWITCH_TABLE$hotsdk_a$communication$HotInterface$HotResultData$val_rcv_kind()[HotInterface.HotResultData.val_rcv_kind.valueOf(hotResultData.rcv_kind).ordinal()]){
case 1:
case 2:
}
致:
其中,hotsultdata.rcv\u kind
是一个字符串
从这个例子中,你应该能够自己完成另外两个
switch (val_rcv_kind.valueOf(hotResultData.rcv_kind)) {
case rcv_Measuring:
case rcv_FwVer:
}