package tim.prune.jpeg;
import java.io.File;
-
import javax.swing.JOptionPane;
-
import tim.prune.I18nManager;
/**
* to the external libmetadata-extractor-java library
* instead of the included modified routines.
*
- * To use the internal routines, set the USE_INTERNAL_LIBRARY flag to true
- * and include the internal classes in the compiled jar.
- * To use the external library, set the USE_INTERNAL_LIBRARY flag to false
- * and do not export the internal classes.
+ * Switching between internal and external libraries is
+ * handled by the ExifLibrarySwitch
*/
public abstract class ExifGateway
{
return data;
}
}
- catch (LinkageError nolib) {}
+ catch (LinkageError nolib) {
+ System.err.println("Link: " + nolib.getMessage());
+ nolib.printStackTrace();
+ }
// Not successful - warn if necessary
if (!_exifFailWarned)
{
if (_exifLibrary == null || !_exifLibrary.looksOK()) {key = key + ".failed";}
return key;
}
+
+
+ /**
+ * @param inNumerator numerator from Rational
+ * @param inDenominator denominator from Rational
+ * @return the value of the specified number as a positive <code>double</code>.
+ * Prevents interpretation of 32 bit numbers as negative, and forces a positive answer
+ */
+ public static final double convertToPositiveValue(int inNumerator, int inDenominator)
+ {
+ if (inDenominator == 0) return 0.0;
+ double numeratorDbl = inNumerator;
+ double denomDbl = inDenominator;
+ if (inNumerator >= 0)
+ return numeratorDbl / denomDbl;
+ final double correction = Math.pow(2.0, 32);
+ numeratorDbl += correction;
+ if (inDenominator < 0) denomDbl += correction;
+ return numeratorDbl / denomDbl;
+ }
+
+
+ /**
+ * @param inNumerator numerator from Rational
+ * @param inDenominator denominator from Rational
+ * @return the value of the specified number as a positive <code>double</code>.
+ * Forces a positive answer
+ */
+ public static final double convertToPositiveValue(long inNumerator, long inDenominator)
+ {
+ if (inDenominator == 0L) return 0.0;
+ final double numeratorDbl = inNumerator;
+ final double denomDbl = inDenominator;
+ return numeratorDbl / denomDbl;
+ }
}