- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {Connection c =
DataSource dataSource;dataSource.getConnection()
String url;DriverManager.getConnection(url)
IdentityDatabaseUtil.getDBConnection()
- Smart code suggestions by Codota
}
/** * Gets the double representation of the GPS latitude or longitude * coordinate. * * @param coordinate an array of 3 Rationals representing the degrees, * minutes, and seconds of the GPS location as defined in the * exif specification. * @param reference a GPS reference reperesented by a String containing "N", * "S", "E", or "W". * @return the GPS coordinate represented as degrees + minutes/60 + * seconds/3600 */ public static double convertLatOrLongToDouble( Rational[] coordinate, String reference ) { try { double degrees = coordinate[0].toDouble(); double minutes = coordinate[1].toDouble(); double seconds = coordinate[2].toDouble(); double result = degrees + minutes / 60.0 + seconds / 3600.0; if( ( reference.startsWith( "S" ) || reference.startsWith( "W" ) ) ) { return - result; } return result; } catch( ArrayIndexOutOfBoundsException e ) { throw new IllegalArgumentException(); } }
/** * Return the aperture size, if present, 0 if missing */ public double getApertureSize() { Rational rational = getTagRationalValue( TAG_F_NUMBER ); if( null != rational && rational.toDouble() > 0 ) { return rational.toDouble(); } rational = getTagRationalValue( TAG_APERTURE_VALUE ); if( null != rational && rational.toDouble() > 0 ) { return Math.exp( rational.toDouble() * Math.log( 2 ) * 0.5 ); } return 0; }
/** * Return the aperture size, if present, 0 if missing */ public double getApertureSize() { Rational rational = getTagRationalValue( TAG_F_NUMBER ); if( null != rational && rational.toDouble() > 0 ) { return rational.toDouble(); } rational = getTagRationalValue( TAG_APERTURE_VALUE ); if( null != rational && rational.toDouble() > 0 ) { return Math.exp( rational.toDouble() * Math.log( 2 ) * 0.5 ); } return 0; }
private static String convertRationalLatLonToString( Rational[] coord, String ref ) { try { double degrees = coord[0].toDouble(); double minutes = coord[1].toDouble(); double seconds = coord[2].toDouble(); ref = ref.substring( 0, 1 ); return String.format( "%1$.0f° %2$.0f' %3$.0f\" %4$s", degrees, minutes, seconds, ref.toUpperCase( Locale.getDefault() ) ); } catch( NumberFormatException e ) { e.printStackTrace(); } catch( ArrayIndexOutOfBoundsException e ) { e.printStackTrace(); } return null; }
private static String convertRationalLatLonToString( Rational[] coord, String ref ) { try { double degrees = coord[0].toDouble(); double minutes = coord[1].toDouble(); double seconds = coord[2].toDouble(); ref = ref.substring( 0, 1 ); return String.format( "%1$.0f° %2$.0f' %3$.0f\" %4$s", degrees, minutes, seconds, ref.toUpperCase( Locale.getDefault() ) ); } catch( NumberFormatException e ) { e.printStackTrace(); } catch( ArrayIndexOutOfBoundsException e ) { e.printStackTrace(); } return null; }
public static String processLensSpecifications( Rational[] values ) { Rational min_focal = values[0]; Rational max_focal = values[1]; Rational min_f = values[2]; Rational max_f = values[3]; formatter.setMaximumFractionDigits(1); StringBuilder sb = new StringBuilder(); sb.append( formatter.format( min_focal.toDouble() ) ); sb.append( "-" ); sb.append( formatter.format( max_focal.toDouble() ) ); sb.append( "mm f/" ); sb.append( formatter.format( min_f.toDouble() ) ); sb.append( "-" ); sb.append( formatter.format( max_f.toDouble() ) ); return sb.toString(); }
/** * Gets the double representation of the GPS latitude or longitude * coordinate. * * @param coordinate an array of 3 Rationals representing the degrees, * minutes, and seconds of the GPS location as defined in the * exif specification. * @param reference a GPS reference reperesented by a String containing "N", * "S", "E", or "W". * @return the GPS coordinate represented as degrees + minutes/60 + * seconds/3600 */ public static double convertLatOrLongToDouble( Rational[] coordinate, String reference ) { try { double degrees = coordinate[0].toDouble(); double minutes = coordinate[1].toDouble(); double seconds = coordinate[2].toDouble(); double result = degrees + minutes / 60.0 + seconds / 3600.0; if( ( reference.startsWith( "S" ) || reference.startsWith( "W" ) ) ) { return - result; } return result; } catch( ArrayIndexOutOfBoundsException e ) { throw new IllegalArgumentException(); } }
public static String processLensSpecifications( Rational[] values ) { Rational min_focal = values[0]; Rational max_focal = values[1]; Rational min_f = values[2]; Rational max_f = values[3]; formatter.setMaximumFractionDigits(1); StringBuilder sb = new StringBuilder(); sb.append( formatter.format( min_focal.toDouble() ) ); sb.append( "-" ); sb.append( formatter.format( max_focal.toDouble() ) ); sb.append( "mm f/" ); sb.append( formatter.format( min_f.toDouble() ) ); sb.append( "-" ); sb.append( formatter.format( max_f.toDouble() ) ); return sb.toString(); }
/** * Return the altitude in meters. If the exif tag does not exist, return * <var>defaultValue</var>. * * @param defaultValue the value to return if the tag is not available. */ @SuppressWarnings( "unused" ) public double getAltitude( double defaultValue ) { Byte ref = getTagByteValue( TAG_GPS_ALTITUDE_REF ); Rational gpsAltitude = getTagRationalValue( TAG_GPS_ALTITUDE ); int seaLevel = 1; if( null != ref ) { seaLevel = ref.intValue() == 1 ? - 1 : 1; } if( gpsAltitude != null ) { return gpsAltitude.toDouble() * seaLevel; } return defaultValue; }
/** * Return the altitude in meters. If the exif tag does not exist, return * <var>defaultValue</var>. * * @param defaultValue the value to return if the tag is not available. */ @SuppressWarnings( "unused" ) public double getAltitude( double defaultValue ) { Byte ref = getTagByteValue( TAG_GPS_ALTITUDE_REF ); Rational gpsAltitude = getTagRationalValue( TAG_GPS_ALTITUDE ); int seaLevel = 1; if( null != ref ) { seaLevel = ref.intValue() == 1 ? - 1 : 1; } if( gpsAltitude != null ) { return gpsAltitude.toDouble() * seaLevel; } return defaultValue; }
/** * Gets a long representation of the value. * * @param defaultValue value to return if there is no value or value is a * rational with a denominator of 0. * @return the tag's value as a long, or defaultValue if no representation * exists. */ public long forceGetValueAsLong( long defaultValue ) { long[] l = getValueAsLongs(); if( l != null && l.length >= 1 ) { return l[0]; } byte[] b = getValueAsBytes(); if( b != null && b.length >= 1 ) { return b[0]; } Rational[] r = getValueAsRationals(); if( r != null && r.length >= 1 && r[0].getDenominator() != 0 ) { return (long) r[0].toDouble(); } return defaultValue; }
/** * Gets a long representation of the value. * * @param defaultValue value to return if there is no value or value is a * rational with a denominator of 0. * @return the tag's value as a long, or defaultValue if no representation * exists. */ public long forceGetValueAsLong( long defaultValue ) { long[] l = getValueAsLongs(); if( l != null && l.length >= 1 ) { return l[0]; } byte[] b = getValueAsBytes(); if( b != null && b.length >= 1 ) { return b[0]; } Rational[] r = getValueAsRationals(); if( r != null && r.length >= 1 && r[0].getDenominator() != 0 ) { return (long) r[0].toDouble(); } return defaultValue; }
double speed = shutterSpeed.getValueAsRational( 0 ).toDouble(); Log.d( LOG_TAG, "speed: " + speed );