Changeset 15217 in josm for trunk/src/com/drew/metadata/Directory.java
- Timestamp:
- 2019-07-07T01:56:46+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/drew/metadata/Directory.java
r13061 r15217 1 1 /* 2 * Copyright 2002-201 7 Drew Noakes2 * Copyright 2002-2019 Drew Noakes and contributors 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); … … 757 757 if (o == null) 758 758 return null; 759 if (o instanceof Number) 760 return ((Number)o).longValue(); 759 761 if (o instanceof String || o instanceof StringValue) { 760 762 try { … … 763 765 return null; 764 766 } 765 } 766 if (o instanceof Number) 767 return ((Number)o).longValue(); 767 } else if (o instanceof Rational[]) { 768 Rational[] rationals = (Rational[])o; 769 if (rationals.length == 1) 770 return rationals[0].longValue(); 771 } else if (o instanceof byte[]) { 772 byte[] bytes = (byte[])o; 773 if (bytes.length == 1) 774 return (long)bytes[0]; 775 } else if (o instanceof int[]) { 776 int[] ints = (int[])o; 777 if (ints.length == 1) 778 return (long)ints[0]; 779 } else if (o instanceof short[]) { 780 short[] shorts = (short[])o; 781 if (shorts.length == 1) 782 return (long)shorts[0]; 783 } 768 784 return null; 769 785 } … … 1009 1025 } 1010 1026 } else if (componentType.getName().equals("float")) { 1027 DecimalFormat format = new DecimalFormat(_floatFormatPattern); 1011 1028 for (int i = 0; i < arrayLength; i++) { 1012 1029 if (i != 0) 1013 1030 string.append(' '); 1014 string.append(new DecimalFormat(_floatFormatPattern).format(Array.getFloat(o, i))); 1031 String s = format.format(Array.getFloat(o, i)); 1032 string.append(s.equals("-0") ? "0" : s); 1015 1033 } 1016 1034 } else if (componentType.getName().equals("double")) { 1035 DecimalFormat format = new DecimalFormat(_floatFormatPattern); 1017 1036 for (int i = 0; i < arrayLength; i++) { 1018 1037 if (i != 0) 1019 1038 string.append(' '); 1020 string.append(new DecimalFormat(_floatFormatPattern).format(Array.getDouble(o, i))); 1039 String s = format.format(Array.getDouble(o, i)); 1040 string.append(s.equals("-0") ? "0" : s); 1021 1041 } 1022 1042 } else if (componentType.getName().equals("byte")) {
Note:
See TracChangeset
for help on using the changeset viewer.