| | |
| | | */ |
| | | public String getAddress(int index) { |
| | | String[] stringdatas = this.startAddress.trim().split("\\."); |
| | | if (stringdatas.length < 2) |
| | | if (stringdatas.length < 2) { |
| | | return null; |
| | | } |
| | | int dbwindex = 0; |
| | | int bitindex = 0; |
| | | if (stringdatas.length == 3) { |
| | | dbwindex = Integer.parseInt(stringdatas[1]); |
| | | bitindex = Integer.parseInt(stringdatas[2]); |
| | | } else |
| | | { |
| | | return null; |
| | | } |
| | | dbwindex += index / 8; |
| | | bitindex += index % 8; |
| | | return stringdatas[0] + "." + dbwindex + "." + bitindex; |
| | | } |
| | | /** |
| | | * 获取地址 |
| | | * |
| | | */ |
| | | public String getAddress() { |
| | | return getAddress(this.addressIndex); |
| | | } |
| | | |
| | | |
| | | public void setAddressIndex(int addressindex) { |