1700481465
private ArrayList<String>paramList=new ArrayList<String>();
1700481466
1700481467
//操作数列表
1700481468
1700481469
private ArrayList<String>dataList=new ArrayList<String>();
1700481470
1700481471
//通过构造函数传递进来命令
1700481472
1700481473
public CommandVO(String commandStr){
1700481474
1700481475
//常规判断
1700481476
1700481477
if(commandStr!=null && commandStr.length()!=0){
1700481478
1700481479
//根据分隔符号拆分出执行符号
1700481480
1700481481
String[]complexStr=commandStr.split(CommandVO.DIVIDE_FLAG);
1700481482
1700481483
//第一个参数是执行符号
1700481484
1700481485
this.commandName=complexStr[0];
1700481486
1700481487
//把参数放到List中
1700481488
1700481489
for(int i=1;i<complexStr.length;i++){
1700481490
1700481491
String str=complexStr[i];
1700481492
1700481493
//包含前缀符号,认为是参数
1700481494
1700481495
if(str.indexOf(CommandVO.PREFIX)==0){
1700481496
1700481497
this.paramList.add(str.replace(CommandVO.PREFIX,””).trim());
1700481498
1700481499
}else{
1700481500
1700481501
this.dataList.add(str.trim());
1700481502
1700481503
}
1700481504
1700481505
}
1700481506
1700481507
}else{
1700481508
1700481509
//传递的命令错误
1700481510
1700481511
System.out.println(“命令解析失败,必须传递一个命令才能执行!”);
1700481512
1700481513
}
1700481514
[
上一页 ]
[ :1.700481465e+09 ]
[
下一页 ]