@Override public void setValue(String value, int offset, SupArray array) throws Exception { this.offset = offset; int pos = value.indexOf(","); if (pos < 0) { throw new ExecutionException( "The value \"" + value + "\" for the mumber MCC/MNC field : \"" + this.name + "\" is not valid : format = [MCC],[MNC]"); } // process the MCC digits String mcc = value.substring(0, pos).trim(); if (mcc.length() != 3) { throw new ExecutionException( "The value \"" + value + "\" for the mumber MCC field : \"" + this.name + "\" is not valid : [MCC] should have [3..3] characters"); } // process the MNC digits String mnc = value.substring(pos + 1).trim(); if (mnc.length() < 2 || mnc.length() > 3) { throw new ExecutionException( "The value \"" + value + "\" for the mumber MNC field : \"" + this.name + "\" is not valid : [MNC] should have [2..3] characters"); } String mmc; if (mnc.length() == 2) { mmc = mcc + "f" + mnc.charAt(0) + mnc.charAt(1); } else { mmc = mcc + mnc.charAt(2) + mnc.charAt(0) + mnc.charAt(1); } // permute the octet 2 a 2 byte[] bytes = mmc.getBytes(); permuteByte(bytes); String mmcPermute = new String(bytes); Array valueArray = Array.fromHexString(mmcPermute); super.setValueFromArray(valueArray, offset, array); }
@Override public void parseFromXML(Element rootXML, boolean parseDico) { super.parseFromXML(rootXML, parseDico); this.length = 3 * 8; }