├── A2LParser ├── .classpath ├── .gitignore ├── .project ├── .settings │ ├── .gitignore │ └── org.eclipse.jdt.core.prefs ├── SurfacePlotter.jar ├── images │ ├── A2L.png │ ├── ASCII.png │ ├── AXIS.png │ ├── COMPAR_A2L_24.png │ ├── COMPAR_VTAB_24.png │ ├── COMPU_METHOD.png │ ├── CONVERSION_TABLE.png │ ├── CURVE.png │ ├── FLAT_MAP_24.png │ ├── FUNCTION.png │ ├── INCONNU.png │ ├── INFO_24.png │ ├── IN_MEASUREMENT.png │ ├── LOC_MEASUREMENT.png │ ├── MAP.png │ ├── MEASUREMENT.png │ ├── OPEN_A2L_24.png │ ├── OPEN_DATA_24.png │ ├── OUT_MEASUREMENT.png │ ├── RECORD_LAYOUT.png │ ├── SCALAIRE.png │ ├── VALUEBLOCK.png │ └── WARNING_24.png └── src │ ├── a2l │ ├── A2l.java │ ├── A2lObject.java │ ├── A2lObjectParsingException.java │ ├── A2lStateListener.java │ ├── A2lUtils.java │ ├── AdjustableObject.java │ ├── Annotation.java │ ├── ArrayValue.java │ ├── AxisDescr.java │ ├── AxisPts.java │ ├── Characteristic.java │ ├── CompuMethod.java │ ├── CompuTab.java │ ├── CompuVTab.java │ ├── CompuVTabRange.java │ ├── ConversionTable.java │ ├── DataValue.java │ ├── DisplayIdentifier.java │ ├── FixAxisPar.java │ ├── FixAxisParDist.java │ ├── FixAxisParList.java │ ├── Format.java │ ├── Function.java │ ├── Group.java │ ├── Measurement.java │ ├── ModCommon.java │ ├── ModPar.java │ ├── OptionalParameterRL.java │ ├── RecordLayout.java │ ├── RecordLayout_old.java │ ├── SingleValue.java │ ├── SystemConstant.java │ ├── TableModelView.java │ └── Unit.java │ ├── constante │ ├── AdressType.java │ ├── ConversionType.java │ ├── DataSize.java │ ├── DataType.java │ ├── DepositMode.java │ ├── IndexMode.java │ ├── IndexOrder.java │ ├── PrimaryKeywords.java │ ├── SecondaryKeywords.java │ └── UnitType.java │ ├── data │ ├── DataCalibration.java │ ├── DataDecoder.java │ ├── IntelHex.java │ ├── Memory.java │ └── MotorolaS19.java │ ├── gui │ ├── A2lDisplayer.java │ ├── DisplayLog.java │ ├── DisplayLog_Bis.java │ ├── FilteredTree.java │ ├── FilteredTreeModel.java │ ├── Ihm.java │ ├── Main.java │ ├── SurfaceChart.java │ ├── TableView.java │ └── TextSearchTest.java │ └── utils │ ├── Converter.java │ ├── Interpolation.java │ ├── NumeralString.java │ └── ParserUtils.java └── README.md /A2LParser/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /A2LParser/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | -------------------------------------------------------------------------------- /A2LParser/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | AsamCalTool 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.sonarlint.eclipse.core.sonarlintBuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | 22 | 23 | -------------------------------------------------------------------------------- /A2LParser/.settings/.gitignore: -------------------------------------------------------------------------------- 1 | /org.sonarlint.eclipse.core.prefs 2 | -------------------------------------------------------------------------------- /A2LParser/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=1.8 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 12 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 13 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 14 | org.eclipse.jdt.core.compiler.release=enabled 15 | org.eclipse.jdt.core.compiler.source=1.8 16 | -------------------------------------------------------------------------------- /A2LParser/SurfacePlotter.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/SurfacePlotter.jar -------------------------------------------------------------------------------- /A2LParser/images/A2L.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/A2L.png -------------------------------------------------------------------------------- /A2LParser/images/ASCII.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/ASCII.png -------------------------------------------------------------------------------- /A2LParser/images/AXIS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/AXIS.png -------------------------------------------------------------------------------- /A2LParser/images/COMPAR_A2L_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/COMPAR_A2L_24.png -------------------------------------------------------------------------------- /A2LParser/images/COMPAR_VTAB_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/COMPAR_VTAB_24.png -------------------------------------------------------------------------------- /A2LParser/images/COMPU_METHOD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/COMPU_METHOD.png -------------------------------------------------------------------------------- /A2LParser/images/CONVERSION_TABLE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/CONVERSION_TABLE.png -------------------------------------------------------------------------------- /A2LParser/images/CURVE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/CURVE.png -------------------------------------------------------------------------------- /A2LParser/images/FLAT_MAP_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/FLAT_MAP_24.png -------------------------------------------------------------------------------- /A2LParser/images/FUNCTION.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/FUNCTION.png -------------------------------------------------------------------------------- /A2LParser/images/INCONNU.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/INCONNU.png -------------------------------------------------------------------------------- /A2LParser/images/INFO_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/INFO_24.png -------------------------------------------------------------------------------- /A2LParser/images/IN_MEASUREMENT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/IN_MEASUREMENT.png -------------------------------------------------------------------------------- /A2LParser/images/LOC_MEASUREMENT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/LOC_MEASUREMENT.png -------------------------------------------------------------------------------- /A2LParser/images/MAP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/MAP.png -------------------------------------------------------------------------------- /A2LParser/images/MEASUREMENT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/MEASUREMENT.png -------------------------------------------------------------------------------- /A2LParser/images/OPEN_A2L_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/OPEN_A2L_24.png -------------------------------------------------------------------------------- /A2LParser/images/OPEN_DATA_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/OPEN_DATA_24.png -------------------------------------------------------------------------------- /A2LParser/images/OUT_MEASUREMENT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/OUT_MEASUREMENT.png -------------------------------------------------------------------------------- /A2LParser/images/RECORD_LAYOUT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/RECORD_LAYOUT.png -------------------------------------------------------------------------------- /A2LParser/images/SCALAIRE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/SCALAIRE.png -------------------------------------------------------------------------------- /A2LParser/images/VALUEBLOCK.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/VALUEBLOCK.png -------------------------------------------------------------------------------- /A2LParser/images/WARNING_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanglinard26/AsamCalTool/abfb49a9c8e5825f4dfc7f2debb9616e58cfb6cb/A2LParser/images/WARNING_24.png -------------------------------------------------------------------------------- /A2LParser/src/a2l/A2lObject.java: -------------------------------------------------------------------------------- 1 | package a2l; 2 | 3 | import java.util.List; 4 | 5 | public interface A2lObject { 6 | 7 | void build(List parameters, int beginLine, int endLine) throws A2lObjectParsingException; 8 | 9 | boolean isValid(); 10 | 11 | String getProperties(); 12 | } 13 | -------------------------------------------------------------------------------- /A2LParser/src/a2l/A2lObjectParsingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Creation : 24 avr. 2019 3 | */ 4 | package a2l; 5 | 6 | public final class A2lObjectParsingException extends IllegalArgumentException { 7 | 8 | private static final long serialVersionUID = 1L; 9 | 10 | public A2lObjectParsingException(String message, int beginLine, int endLine) { 11 | super(String.format("%s between line %d and %d", message, beginLine, endLine)); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /A2LParser/src/a2l/A2lStateListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Creation : 14 janv. 2020 3 | */ 4 | package a2l; 5 | 6 | import java.util.EventListener; 7 | 8 | public interface A2lStateListener extends EventListener { 9 | 10 | void stateChange(String state); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /A2LParser/src/a2l/A2lUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Creation : 8 janv. 2020 3 | */ 4 | package a2l; 5 | 6 | import java.io.BufferedReader; 7 | import java.io.File; 8 | import java.io.FileNotFoundException; 9 | import java.io.FileReader; 10 | import java.io.IOException; 11 | import java.io.PrintWriter; 12 | import java.nio.file.Files; 13 | import java.util.ArrayList; 14 | import java.util.Arrays; 15 | import java.util.Collections; 16 | import java.util.List; 17 | import java.util.Vector; 18 | 19 | public final class A2lUtils { 20 | 21 | private static final String RAMCELL = "[RAMCELL]"; 22 | private static final String LABEL = "[Label]"; 23 | 24 | public static final void writeMeasurementLab(File file, Function function) { 25 | 26 | try (PrintWriter pw = new PrintWriter(file)) { 27 | 28 | final List listMeasurement = new ArrayList<>(); 29 | listMeasurement.addAll(function.getInMeasurement()); 30 | listMeasurement.addAll(function.getLocMeasurement()); 31 | listMeasurement.addAll(function.getOutMeasurement()); 32 | 33 | Collections.sort(listMeasurement); 34 | 35 | pw.println(RAMCELL); 36 | for (String measurementName : listMeasurement) { 37 | pw.println(measurementName); 38 | } 39 | 40 | } catch (FileNotFoundException e) { 41 | e.printStackTrace(); 42 | } 43 | } 44 | 45 | public static final void writeAllMeasurementLab(File file, A2l a2l) { 46 | 47 | try (PrintWriter pw = new PrintWriter(file)) { 48 | 49 | final Vector listMeasurement = a2l.getListMeasurement(); 50 | 51 | pw.println(RAMCELL); 52 | for (Measurement measurementName : listMeasurement) { 53 | pw.println(measurementName); 54 | } 55 | 56 | } catch (FileNotFoundException e) { 57 | e.printStackTrace(); 58 | } 59 | } 60 | 61 | public static final void writeCharacteristicLab(File file, A2l a2l, Function function) { 62 | 63 | try (PrintWriter pw = new PrintWriter(file)) { 64 | final Vector listCharacteristic = a2l.getAdjustableObjectNameByFunction(function.toString()); 65 | listCharacteristic.addAll(function.getRefCharacteristic()); 66 | 67 | Collections.sort(listCharacteristic); 68 | 69 | pw.println(LABEL); 70 | for (String characteristicName : listCharacteristic) { 71 | pw.println(characteristicName); 72 | } 73 | 74 | } catch (FileNotFoundException e) { 75 | e.printStackTrace(); 76 | } 77 | } 78 | 79 | public static final void linkPrototypeAxis(Object a2lObject, File selectedFile) { 80 | 81 | A2l a2l = (A2l) a2lObject; 82 | 83 | try (BufferedReader br = new BufferedReader(new FileReader(selectedFile))) { 84 | String line; 85 | Vector prototypeAxis = new Vector(); 86 | 87 | while ((line = br.readLine()) != null) { 88 | prototypeAxis.add(line.substring(0, line.length() - 1)); 89 | } 90 | 91 | Vector v = a2l.getAdjustableObjectFromList(prototypeAxis); 92 | System.out.println(v); 93 | 94 | File newFile = new File(selectedFile.getAbsolutePath().replace(".lab", "_Linked.lab")); 95 | 96 | try (PrintWriter pw = new PrintWriter(newFile)) { 97 | 98 | pw.println("[Label]"); 99 | 100 | for (AdjustableObject axis : v) { 101 | if (axis instanceof AxisPts) { 102 | pw.println(axis.toString() + "b"); 103 | for (Characteristic s : ((AxisPts) axis).getCharacteristicsDependency()) { 104 | pw.println(s + "b"); 105 | } 106 | } 107 | } 108 | 109 | } catch (FileNotFoundException e) { 110 | e.printStackTrace(); 111 | } 112 | 113 | } catch (FileNotFoundException e) { 114 | e.printStackTrace(); 115 | } catch (IOException e) { 116 | e.printStackTrace(); 117 | } 118 | } 119 | 120 | public static final List searchFId(Object a2lObject, String FIdName) { 121 | A2l a2l = (A2l) a2lObject; 122 | 123 | Vector objects = a2l.getListAdjustableObjects(); 124 | List foundObject = new ArrayList<>(); 125 | 126 | for (AdjustableObject object : objects) { 127 | if (object instanceof Characteristic) { 128 | Characteristic characteristic = (Characteristic) object; 129 | if (characteristic.hasData() && characteristic.name.startsWith("DINH_FId")) { 130 | ArrayValue values = (ArrayValue) characteristic.getValues(); 131 | int idx = Arrays.binarySearch(values.getValues(), FIdName); 132 | if (idx > -1) { 133 | foundObject.add(characteristic.name); 134 | } 135 | } 136 | } 137 | } 138 | 139 | return foundObject; 140 | } 141 | 142 | public static final void checkMEIBloc(Object a2lObject, File selectedFile) { 143 | 144 | A2l a2l = (A2l) a2lObject; 145 | 146 | try (BufferedReader br = new BufferedReader(new FileReader(selectedFile))) { 147 | String line; 148 | Vector measurements = new Vector(); 149 | Vector characteristics = new Vector(); 150 | 151 | boolean bMeasurement = true; 152 | 153 | while ((line = br.readLine()) != null) { 154 | if ("[MEASUREMENT]".equals(line) || "[CHARACTERISTIC]".equals(line)) { 155 | 156 | if ("[CHARACTERISTIC]".equals(line)) { 157 | bMeasurement = !bMeasurement; 158 | } 159 | 160 | line = br.readLine(); 161 | } 162 | 163 | if (bMeasurement) { 164 | measurements.add(line); 165 | } else { 166 | characteristics.add(line); 167 | } 168 | } 169 | 170 | Vector m = a2l.getMeasurementNameFromList(measurements); 171 | measurements.removeAll(m); 172 | 173 | Vector c = a2l.getAdjustableObjectNameFromList(characteristics); 174 | characteristics.removeAll(c); 175 | 176 | File newFile = new File(selectedFile.getAbsolutePath().replace(".txt", "_checked.txt")); 177 | 178 | try (PrintWriter pw = new PrintWriter(newFile)) { 179 | 180 | pw.println("[MEASUREMENT]"); 181 | for (String measure : measurements) { 182 | pw.println(measure); 183 | } 184 | 185 | pw.println("[CHARACTERISTIC]"); 186 | for (String characteristic : characteristics) { 187 | pw.println(characteristic); 188 | } 189 | 190 | } catch (FileNotFoundException e) { 191 | e.printStackTrace(); 192 | } 193 | 194 | } catch (FileNotFoundException e) { 195 | e.printStackTrace(); 196 | } catch (IOException e) { 197 | e.printStackTrace(); 198 | } 199 | 200 | } 201 | 202 | public static final File getZResolutionFromLab(Object a2lObject, File labFile) { 203 | A2l a2l = (A2l) a2lObject; 204 | 205 | try { 206 | List listLabel = Files.readAllLines(labFile.toPath()); 207 | Vector v = new Vector<>(listLabel); 208 | Vector listObj = a2l.getAdjustableObjectFromList(v); 209 | 210 | File newFile = new File(labFile.getAbsolutePath().replace(".lab", "_withResol.lab")); 211 | 212 | try (PrintWriter pw = new PrintWriter(newFile)) { 213 | 214 | for (AdjustableObject obj : listObj) { 215 | pw.println(obj.name + "\t" + obj.getZResolution()); 216 | } 217 | 218 | return newFile; 219 | 220 | } catch (FileNotFoundException e) { 221 | e.printStackTrace(); 222 | } 223 | 224 | } catch (IOException e) { 225 | // TODO Auto-generated catch block 226 | e.printStackTrace(); 227 | } 228 | return null; 229 | 230 | } 231 | 232 | public static void checkMeasurementFromLab(Object a2lObject, File selectedFile) { 233 | A2l a2l = (A2l) a2lObject; 234 | 235 | Vector measurements = a2l.getListMeasurement(); 236 | Vector a2lsupp = new Vector<>(); 237 | 238 | for (Measurement measurement : measurements) { 239 | a2lsupp.add(measurement.toString()); 240 | } 241 | 242 | try (BufferedReader br = new BufferedReader(new FileReader(selectedFile))) { 243 | String line; 244 | Vector slddMeasurements = new Vector(); 245 | 246 | while ((line = br.readLine()) != null) { 247 | if ("[RAMCELL]".equals(line)) { 248 | continue; 249 | } 250 | slddMeasurements.add(line); 251 | } 252 | 253 | // a2lsupp.removeAll(slddMeasurements); 254 | slddMeasurements.removeAll(a2lsupp); 255 | 256 | File newFile = new File(selectedFile.getAbsolutePath().replace(".lab", "_checked.txt")); 257 | 258 | try (PrintWriter pw = new PrintWriter(newFile)) { 259 | 260 | pw.println("Flux supplémentaires dans les SLDD:"); 261 | for (String measure : slddMeasurements) { 262 | pw.println(measure); 263 | } 264 | 265 | } catch (FileNotFoundException e) { 266 | e.printStackTrace(); 267 | } 268 | 269 | } catch (FileNotFoundException e) { 270 | e.printStackTrace(); 271 | } catch (IOException e) { 272 | e.printStackTrace(); 273 | } 274 | 275 | } 276 | 277 | } 278 | -------------------------------------------------------------------------------- /A2LParser/src/a2l/AdjustableObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Creation : 2 avr. 2019 3 | */ 4 | package a2l; 5 | 6 | import static constante.SecondaryKeywords.BYTE_ORDER; 7 | import static constante.SecondaryKeywords.DISPLAY_IDENTIFIER; 8 | import static constante.SecondaryKeywords.FORMAT; 9 | import static constante.SecondaryKeywords.READ_ONLY; 10 | 11 | import java.nio.ByteOrder; 12 | import java.text.DecimalFormat; 13 | import java.text.DecimalFormatSymbols; 14 | import java.util.HashMap; 15 | import java.util.Map; 16 | import java.util.Map.Entry; 17 | 18 | import a2l.AxisDescr.Attribute; 19 | import a2l.Characteristic.CharacteristicType; 20 | import constante.DataType; 21 | import constante.PrimaryKeywords; 22 | import constante.SecondaryKeywords; 23 | 24 | public abstract class AdjustableObject implements A2lObject, Comparable { 25 | 26 | protected String name; 27 | protected char[] longIdentifier; 28 | protected long adress; 29 | protected int depositId; 30 | protected float maxDiff; 31 | protected int conversionId; 32 | protected float lowerLimit; 33 | protected float upperLimit; 34 | 35 | protected boolean validParsing; 36 | 37 | protected String functionRef; 38 | 39 | protected DataValue values; 40 | 41 | protected Map optionalsParameters; 42 | 43 | protected CompuMethod compuMethod; 44 | protected RecordLayout recordLayout; 45 | 46 | @Override 47 | public final int compareTo(AdjustableObject o) { 48 | return this.name.compareToIgnoreCase(o.toString()); 49 | } 50 | 51 | public final int getID() { 52 | return this.name.hashCode(); 53 | } 54 | 55 | public final long getAdress() { 56 | return adress; 57 | } 58 | 59 | public final CompuMethod getCompuMethod() { 60 | return compuMethod; 61 | } 62 | 63 | public final String getConverionTable() { 64 | ConversionTable convTable = compuMethod.getConvTable(); 65 | 66 | if (convTable != null) { 67 | StringBuilder sb = new StringBuilder(); 68 | 69 | Map mapConv = convTable.getMap(); 70 | 71 | for (Entry entry : mapConv.entrySet()) { 72 | sb.append("
  • " + entry.getKey() + " => " + entry.getValue() + "\n"); 73 | } 74 | 75 | return sb.toString(); 76 | } 77 | return ""; 78 | } 79 | 80 | public final RecordLayout getRecordLayout() { 81 | return recordLayout; 82 | } 83 | 84 | public final String getFunction() { 85 | return this.functionRef; 86 | } 87 | 88 | public final boolean assignRecordLayout(HashMap recordLayouts) { 89 | this.recordLayout = recordLayouts.get(this.depositId); 90 | if (this.recordLayout != null) { 91 | return true; 92 | } 93 | return false; 94 | } 95 | 96 | public final byte getNbDecimal() { 97 | Object objectDisplayFormat = optionalsParameters.get(FORMAT); 98 | Format displayFormat; 99 | 100 | if (!compuMethod.isVerbal()) { 101 | if (objectDisplayFormat == null) { 102 | displayFormat = compuMethod.getFormat(); 103 | } else { 104 | displayFormat = (Format) objectDisplayFormat; 105 | } 106 | return displayFormat.getDecimalesPlace(); 107 | } 108 | return 0; 109 | } 110 | 111 | public final ByteOrder getByteOrder() { 112 | String sByteOrder = (String) optionalsParameters.get(BYTE_ORDER); 113 | if (sByteOrder != null) { 114 | if ("MSB_LAST".equals(sByteOrder) || "BIG_ENDIAN".equals(sByteOrder)) { 115 | return ByteOrder.LITTLE_ENDIAN; 116 | } 117 | return ByteOrder.BIG_ENDIAN; 118 | } 119 | return null; 120 | } 121 | 122 | public final String getDisplayIdentifier() { 123 | char[] dispIdentifier = (char[]) optionalsParameters.get(DISPLAY_IDENTIFIER); 124 | if (dispIdentifier != null) { 125 | return String.valueOf(dispIdentifier); 126 | } 127 | return ""; 128 | } 129 | 130 | public final String getDimension() { 131 | StringBuilder stringDimension = new StringBuilder(); 132 | if (this instanceof AxisPts) { 133 | stringDimension.append("[" + ((AxisPts) this).getMaxAxisPoints() + " x 1]"); 134 | } else { 135 | Characteristic characteristic = (Characteristic) this; 136 | 137 | stringDimension.append("["); 138 | if (values != null) { 139 | if (characteristic.getType().compareTo(CharacteristicType.VALUE) == 0) { 140 | stringDimension.append("1 x 1"); 141 | } else if (characteristic.getType().compareTo(CharacteristicType.CURVE) == 0) { 142 | stringDimension.append(values.getDimX() + " x 2"); 143 | } else { 144 | stringDimension.append((values.getDimX() - 1) + " x " + (values.getDimY() - 1)); 145 | } 146 | } else { 147 | stringDimension.append("? x ?"); 148 | } 149 | stringDimension.append("]"); 150 | 151 | if (characteristic.getType().compareTo(CharacteristicType.CURVE) == 0) { 152 | int dimMaxX = characteristic.getAxisDescrs()[0].getMaxAxisPoints(); 153 | stringDimension.append(" (Max : [" + dimMaxX + " x 2])"); 154 | } else if (characteristic.getType().compareTo(CharacteristicType.MAP) == 0) { 155 | int dimMaxX = characteristic.getAxisDescrs()[0].getMaxAxisPoints(); 156 | int dimMaxY = characteristic.getAxisDescrs()[1].getMaxAxisPoints(); 157 | stringDimension.append(" (Max : [" + dimMaxX + " x " + dimMaxY + "])"); 158 | } 159 | } 160 | return stringDimension.toString(); 161 | } 162 | 163 | public final Format getFormat() { 164 | Object oFormat = optionalsParameters.get(FORMAT); 165 | return oFormat != null ? (Format) oFormat : compuMethod.getFormat(); 166 | } 167 | 168 | protected static double formatValue(double value, byte nbDecimal) { 169 | final DecimalFormat df = new DecimalFormat(); 170 | DecimalFormatSymbols dfs = new DecimalFormatSymbols(); 171 | String separator = new String(new char[] { dfs.getGroupingSeparator() }); 172 | dfs.setDecimalSeparator('.'); 173 | df.setDecimalFormatSymbols(dfs); 174 | df.setMaximumFractionDigits(nbDecimal); 175 | try { 176 | return Double.parseDouble(df.format(value).replace(separator, "")); 177 | } catch (Exception e) { 178 | return Double.NaN; 179 | } 180 | 181 | } 182 | 183 | protected abstract void formatValues(); 184 | 185 | public final DataValue getValues() { 186 | formatValues(); 187 | return this.values; 188 | } 189 | 190 | public final DataValue getRawValues() { 191 | DataValue rawValues = null; 192 | DataValue physValues = getValues(); 193 | 194 | if (physValues instanceof SingleValue) { 195 | rawValues = new SingleValue(physValues.getValue(1, 1)); 196 | if (compuMethod.isVerbal()) { 197 | rawValues.setValue(compuMethod.computeStringToRaw(physValues.getValue(1, 1).toString()), null); 198 | System.out.println(rawValues.getValue(null)); 199 | System.out.println(compuMethod.getCompuVTab().getValuePairs()); 200 | } else { 201 | 202 | } 203 | } else { 204 | rawValues = new ArrayValue((ArrayValue) physValues); 205 | 206 | } 207 | 208 | return rawValues; 209 | } 210 | 211 | public final String getBinariesValues() { 212 | DataValue rawValues = getRawValues(); 213 | if (rawValues instanceof SingleValue) { 214 | DataType dataType = getDataType()[0]; 215 | if (dataType.isInteger()) { 216 | System.out.println(Integer.toUnsignedString(((Number) rawValues.getValue(null)).intValue(), dataType.getNbByte() * 8)); 217 | } 218 | } 219 | return "NaN"; 220 | } 221 | 222 | public final boolean hasData() { 223 | return this.values != null; 224 | } 225 | 226 | public final boolean isReadOnly() { 227 | Object readOnly = optionalsParameters.get(READ_ONLY); 228 | return readOnly != null ? (boolean) optionalsParameters.get(READ_ONLY) : false; 229 | } 230 | 231 | public final void setValues(DataValue values) { 232 | this.values = values; 233 | } 234 | 235 | public final void setFunction(String function) { 236 | this.functionRef = function == null ? "" : function; 237 | } 238 | 239 | public final void setValidity(boolean validity) { 240 | this.validParsing = validity; 241 | } 242 | 243 | public abstract void assignComputMethod(HashMap compuMethods); 244 | 245 | public abstract String[] getUnit(); 246 | 247 | public abstract DataType[] getDataType(); 248 | 249 | public abstract double[] getResolution(); 250 | 251 | public abstract double getZResolution(); 252 | 253 | public final String getTxtResolution() { 254 | StringBuilder sb = new StringBuilder(); 255 | 256 | for (double resol : getResolution()) { 257 | sb.append("[" + resol + "]"); 258 | } 259 | return sb.toString(); 260 | } 261 | 262 | public String getProperties() { 263 | StringBuilder sb = new StringBuilder("PROPERTIES :"); 264 | 265 | sb.append(""); 321 | 322 | sb.append("OPTIONALS PARAMETERS :\n"); 323 | sb.append("