mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-03 11:35:29 -04:00
Some minor code clean-up.
This commit is contained in:
parent
0d5577a9a4
commit
4adc60a6c6
@ -30,12 +30,12 @@
|
|||||||
|
|
||||||
package com.twelvemonkeys.imageio.metadata;
|
package com.twelvemonkeys.imageio.metadata;
|
||||||
|
|
||||||
import com.twelvemonkeys.lang.Validate;
|
|
||||||
import com.twelvemonkeys.util.CollectionUtil;
|
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import com.twelvemonkeys.lang.Validate;
|
||||||
|
import com.twelvemonkeys.util.CollectionUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractEntry
|
* AbstractEntry
|
||||||
*
|
*
|
||||||
@ -84,17 +84,21 @@ public abstract class AbstractEntry implements Entry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getValueAsString() {
|
public String getValueAsString() {
|
||||||
if (valueCount() > 1) {
|
int count = valueCount();
|
||||||
if (valueCount() < 16) {
|
|
||||||
|
if (count == 0 && value != null && value.getClass().isArray() && Array.getLength(value) == 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (count > 1) {
|
||||||
|
if (count < 16) {
|
||||||
return arrayToString(value);
|
return arrayToString(value);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
String first = arrayToString(CollectionUtil.subArray(value, 0, 4));
|
String first = arrayToString(CollectionUtil.subArray(value, 0, 4));
|
||||||
String last = arrayToString(CollectionUtil.subArray(value, valueCount() - 4, 4));
|
String last = arrayToString(CollectionUtil.subArray(value, count - 4, 4));
|
||||||
return String.format("%s ... %s (%d)", first.substring(0, first.length() - 1), last.substring(1), valueCount());
|
return String.format("%s ... %s (%d)", first.substring(0, first.length() - 1), last.substring(1), count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value != null && value.getClass().isArray() && Array.getLength(value) == 1) {
|
if (value != null && value.getClass().isArray() && Array.getLength(value) == 1) {
|
||||||
return String.valueOf(Array.get(value, 0));
|
return String.valueOf(Array.get(value, 0));
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,6 @@ package com.twelvemonkeys.imageio.metadata.exif;
|
|||||||
*
|
*
|
||||||
* @deprecated Use com.twelvemonkeys.imageio.metadata.tiff.Rational instead.
|
* @deprecated Use com.twelvemonkeys.imageio.metadata.tiff.Rational instead.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public final class Rational extends Number implements Comparable<Rational> {
|
public final class Rational extends Number implements Comparable<Rational> {
|
||||||
private final com.twelvemonkeys.imageio.metadata.tiff.Rational delegate;
|
private final com.twelvemonkeys.imageio.metadata.tiff.Rational delegate;
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ public final class Rational extends Number implements Comparable<Rational> {
|
|||||||
double thisVal = doubleValue();
|
double thisVal = doubleValue();
|
||||||
double otherVal = pOther.doubleValue();
|
double otherVal = pOther.doubleValue();
|
||||||
|
|
||||||
return thisVal < otherVal ? -1 : thisVal == otherVal ? 0 : 1;
|
return Double.compare(thisVal, otherVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Object overrides
|
/// Object overrides
|
||||||
|
Loading…
x
Reference in New Issue
Block a user