/** * Returns the value of the specified number as a <code>byte</code>. * This may involve rounding or truncation. This implementation simply * casts the result of {@link Rational#doubleValue} to <code>byte</code>. * * @return the numeric value represented by this object after conversion * to type <code>byte</code>. */ @Override public final byte byteValue() { return (byte) doubleValue(); }
private String getDurationDescription() { Rational duration = _directory.getRational(TAG_DURATION_SECONDS); if (duration == null) return null; double value = duration.doubleValue(); Integer hours = (int)(value / (Math.pow(60, 2))); Integer minutes = (int)((value / (Math.pow(60, 1))) - (hours * 60)); Integer seconds = (int)Math.ceil((value / (Math.pow(60, 0))) - (minutes * 60)); return String.format("%1$02d:%2$02d:%3$02d", hours, minutes, seconds); } }
@Nullable public String getFocalPlaneDiagonalDescription() { Rational value = _directory.getRational(TAG_FOCAL_PLANE_DIAGONAL); if (value == null) return null; DecimalFormat format = new DecimalFormat("0.###"); return format.format(value.doubleValue()) + " mm"; }
@Nullable public String getGpsDopDescription() { final Rational value = _directory.getRational(TAG_DOP); return value == null ? null : new DecimalFormat("0.##").format(value.doubleValue()); }
@Nullable public String getGpsAltitudeDescription() { final Rational value = _directory.getRational(TAG_ALTITUDE); return value == null ? null : new DecimalFormat("0.##").format(value.doubleValue()) + " metres"; }
@Nullable public String getGpsHPositioningErrorDescription() { final Rational value = _directory.getRational(TAG_H_POSITIONING_ERROR); return value == null ? null : new DecimalFormat("0.##").format(value.doubleValue()) + " metres"; }
@Nullable public String getGpsDirectionDescription(int tagType) { Rational angle = _directory.getRational(tagType); // provide a decimal version of rational numbers in the description, to avoid strings like "35334/199 degrees" String value = angle != null ? new DecimalFormat("0.##").format(angle.doubleValue()) : _directory.getString(tagType); return value == null || value.trim().length() == 0 ? null : value.trim() + " degrees"; }
@Nullable protected String getDecimalRational(final int tagType, final int decimalPlaces) { Rational value = _directory.getRational(tagType); if (value == null) return null; return String.format("%." + decimalPlaces + "f", value.doubleValue()); }
@Nullable public String getGpsDestDistanceDescription() { final Rational value = _directory.getRational(TAG_DEST_DISTANCE); if (value == null) return null; final String unit = getGpsDestinationReferenceDescription(); return String.format("%s %s", new DecimalFormat("0.##").format(value.doubleValue()), unit == null ? "unit" : unit.toLowerCase()); }
@Nullable public String getGpsSpeedDescription() { final Rational value = _directory.getRational(TAG_SPEED); if (value == null) return null; final String unit = getGpsSpeedRefDescription(); return String.format("%s %s", new DecimalFormat("0.##").format(value.doubleValue()), unit == null ? "unit" : unit.toLowerCase()); }
@Nullable public String getWaterDepthDescription() { Rational value = _directory.getRational(TAG_WATER_DEPTH); if (value == null) return null; if (value.getDenominator() == 0xFFFFFFFFL) return "Unknown"; DecimalFormat formatter = new DecimalFormat("0.0##"); return formatter.format(value.doubleValue()) + " metres"; }
@Nullable public String getAccelerationDescription() { Rational value = _directory.getRational(TAG_ACCELERATION); if (value == null) return null; if (value.getDenominator() == 0xFFFFFFFFL) return "Unknown"; DecimalFormat formatter = new DecimalFormat("0.0##"); return formatter.format(value.doubleValue()) + " mGal"; }
@Nullable public String getBrightnessValueDescription() { Rational value = _directory.getRational(TAG_BRIGHTNESS_VALUE); if (value == null) return null; if (value.getNumerator() == 0xFFFFFFFFL) return "Unknown"; DecimalFormat formatter = new DecimalFormat("0.0##"); return formatter.format(value.doubleValue()); }
@Nullable public String getTemperatureDescription() { Rational value = _directory.getRational(TAG_TEMPERATURE); if (value == null) return null; if (value.getDenominator() == 0xFFFFFFFFL) return "Unknown"; DecimalFormat formatter = new DecimalFormat("0.0"); return formatter.format(value.doubleValue()) + " °C"; }
@Nullable public String getHumidityDescription() { Rational value = _directory.getRational(TAG_HUMIDITY); if (value == null) return null; if (value.getDenominator() == 0xFFFFFFFFL) return "Unknown"; DecimalFormat formatter = new DecimalFormat("0.0"); return formatter.format(value.doubleValue()) + " %"; }
@Nullable public String getPressureDescription() { Rational value = _directory.getRational(TAG_PRESSURE); if (value == null) return null; if (value.getDenominator() == 0xFFFFFFFFL) return "Unknown"; DecimalFormat formatter = new DecimalFormat("0.0"); return formatter.format(value.doubleValue()) + " hPa"; }
@Nullable public String getCameraElevationAngleDescription() { Rational value = _directory.getRational(TAG_CAMERA_ELEVATION_ANGLE); if (value == null) return null; if (value.getDenominator() == 0xFFFFFFFFL) return "Unknown"; DecimalFormat formatter = new DecimalFormat("0.##"); return formatter.format(value.doubleValue()) + " degrees"; }
@Nullable public String getDigitalZoomRatioDescription() { Rational value = _directory.getRational(TAG_DIGITAL_ZOOM_RATIO); return value == null ? null : value.getNumerator() == 0 ? "Digital zoom not used" : new DecimalFormat("0.#").format(value.doubleValue()); }
@Nullable public String getFocalLengthDescription() { Rational value = _directory.getRational(TAG_FOCAL_LENGTH); return value == null ? null : getFocalLengthDescription(value.doubleValue()); }
@Nullable public String getFNumberDescription() { Rational value = _directory.getRational(TAG_FNUMBER); if (value == null) return null; return getFStopDescription(value.doubleValue()); }