signature:
public class ReflectionUtils { /** * Helper method to execute a callback on a given member . This method encapsulates the error handling logic and the
 * handling of accessibility of the member . The difference to
 * { @ link ReflectionUtils # accessMember ( AccessibleObject , Callable , String ) } is that this method takes a callback that doesn ' t
 * return anything but only creates a sideeffect .
 * After the callback is executed the accessibility of the member will be reset to the originally state .
 * @ param member
 * the member that is made accessible to run the callback
 * @ param sideEffect
 * the callback that will be executed .
 * @ param errorMessage
 * the error message that is used in the exception when something went wrong .
 * @ throws IllegalStateException
 * when something went wrong . */
public static void accessMember ( final AccessibleObject member , final SideEffectWithException sideEffect , String errorMessage ) { } }

implementation: if ( sideEffect == null ) { return ; } AccessController . doPrivileged ( ( PrivilegedAction < ? > ) ( ) -> { boolean wasAccessible = member . isAccessible ( ) ; try { member . setAccessible ( true ) ; sideEffect . call ( ) ; } catch ( Exception exception ) { throw new IllegalStateException ( errorMessage , exception ) ; } finally { member . setAccessible ( wasAccessible ) ; } return null ; } ) ;


signature:
public class FxmlViewLoader { /** * Load the viewTuple by it ` s ViewType .
 * @ param viewType
 * the type of the view to be loaded .
 * @ param resourceBundle
 * the resourceBundle that is passed to the
 * { @ link javafx . fxml . FXMLLoader } .
 * @ param codeBehind
 * the controller instance that is passed to the
 * { @ link javafx . fxml . FXMLLoader }
 * @ param root
 * the root object that is passed to the
 * { @ link javafx . fxml . FXMLLoader }
 * @ param viewModel
 * the viewModel instance that is used when loading the
 * viewTuple .
 * @ param < ViewType >
 * the generic type of the view .
 * @ param < ViewModelType >
 * the generic type of the viewModel .
 * @ param builderFactories a list of custom builder factories . may be < code > null < / code >
 * @ return the loaded ViewTuple . */
public < ViewType extends View < ? extends ViewModelType > , ViewModelType extends ViewModel > ViewTuple < ViewType , ViewModelType > loadFxmlViewTuple ( Class < ? extends ViewType > viewType , ResourceBundle resourceBundle , ViewType codeBehind , Object root , ViewModelType viewModel , Context context , Collection < Scope > providedScopes , List < BuilderFactory > builderFactories ) { } }

implementation: final String pathToFXML = createFxmlPath ( viewType ) ; return loadFxmlViewTuple ( viewType , pathToFXML , resourceBundle , codeBehind , root , viewModel , context , providedScopes , builderFactories ) ;


signature:
public class FxmlViewLoader { /** * This method is used to create a String with the path to the FXML file for
 * a given View class .
 * This is done by taking the package of the view class ( if any ) and replace
 * " . " with " / " . After that the Name of the class and the file ending
 * " . fxml " is appended .
 * If the View class is annotated with @ FxmlPath then the String path supplied
 * in the annotation value will be used .
 * Example : de . saxsys . myapp . ui . MainView as view class will be transformed to
 * " / de / saxsys / myapp / ui / MainView . fxml "
 * Example 2 : MainView ( located in the default package ) will be transformed
 * to " / MainView . fxml "
 * @ param viewType
 * the view class type .
 * @ return the path to the fxml file as string . */
private String createFxmlPath ( Class < ? > viewType ) { } }

implementation:
final StringBuilder pathBuilder = new StringBuilder ( ) ; final FxmlPath pathAnnotation = viewType . getDeclaredAnnotation ( FxmlPath . class ) ; // Get annotation from view
final String fxmlPath = Optional . ofNullable ( pathAnnotation ) . map ( FxmlPath :: value ) . map ( String :: trim ) . orElse ( "" ) ; if ( fxmlPath . isEmpty ( ) ) { pathBuilder . append ( "/" ) ; if ( viewType . getPackage ( ) != null ) { pathBuilder . append ( viewType . getPackage ( ) . getName ( ) . replaceAll ( "\\." , "/" ) ) ; pathBuilder . append ( "/" ) ; } pathBuilder . append ( viewType . getSimpleName ( ) ) ; pathBuilder . append ( ".fxml" ) ; } else { pathBuilder . append ( fxmlPath ) ; } return pathBuilder . toString ( ) ;


signature:
public class FxmlViewLoader { /** * Load the viewTuple by the path of the fxml file .
 * @ param resource
 * the string path to the fxml file that is loaded .
 * @ param resourceBundle
 * the resourceBundle that is passed to the
 * { @ link javafx . fxml . FXMLLoader } .
 * @ param codeBehind
 * the controller instance that is passed to the
 * { @ link javafx . fxml . FXMLLoader }
 * @ param root
 * the root object that is passed to the
 * { @ link javafx . fxml . FXMLLoader }
 * @ param viewModel
 * the viewModel instance that is used when loading the
 * viewTuple .
 * @ param < ViewType >
 * the generic type of the view .
 * @ param < ViewModelType >
 * the generic type of the viewModel .
 * @ param builderFactories a list of custom builder factories . may be < code > null < / code >
 * @ return the loaded ViewTuple . */
public < ViewType extends View < ? extends ViewModelType > , ViewModelType extends ViewModel > ViewTuple < ViewType , ViewModelType > loadFxmlViewTuple ( final String resource , ResourceBundle resourceBundle , final ViewType codeBehind , final Object root , ViewModelType viewModel , Context parentContext , Collection < Scope > providedScopes , List < BuilderFactory > builderFactories ) { } }

implementation: return loadFxmlViewTuple ( null , resource , resourceBundle , codeBehind , root , viewModel , parentContext , providedScopes , builderFactories ) ;


signature:
public class FxmlViewLoader { /** * Load the viewTuple by the path of the fxml file .
 * @ param resourceLoader
 * class used to load resource . When null { @ link FxmlViewLoader } is used
 * @ param resource
 * the string path to the fxml file that is loaded .
 * @ param resourceBundle
 * the resourceBundle that is passed to the
 * { @ link javafx . fxml . FXMLLoader } .
 * @ param codeBehind
 * the controller instance that is passed to the
 * { @ link javafx . fxml . FXMLLoader }
 * @ param root
 * the root object that is passed to the
 * { @ link javafx . fxml . FXMLLoader }
 * @ param viewModel
 * the viewModel instance that is used when loading the
 * viewTuple .
 * @ param < ViewType >
 * the generic type of the view .
 * @ param < ViewModelType >
 * the generic type of the viewModel .
 * @ param builderFactories a list of custom builder factories . may be < code > null < / code >
 * @ return the loaded ViewTuple . */
private < ViewType extends View < ? extends ViewModelType > , ViewModelType extends ViewModel > ViewTuple < ViewType , ViewModelType > loadFxmlViewTuple ( final Class < ? > resourceLoader , final String resource , ResourceBundle resourceBundle , final ViewType codeBehind , final Object root , ViewModelType viewModel , Context parentContext , Collection < Scope > providedScopes , List < BuilderFactory > builderFactories ) { } }

implementation:
try { // FIXME Woanders hin ?
ContextImpl context = ViewLoaderScopeUtils . prepareContext ( parentContext , providedScopes ) ; // for the SceneLifecycle we need to know when the view is put into the scene
BooleanProperty viewInSceneProperty = new SimpleBooleanProperty ( ) ; final FXMLLoader loader = createFxmlLoader ( resourceLoader , resource , resourceBundle , codeBehind , root , viewModel , context , viewInSceneProperty , builderFactories ) ; loader . load ( ) ; final ViewType loadedController = loader . getController ( ) ; final Parent loadedRoot = loader . getRoot ( ) ; viewInSceneProperty . bind ( loadedRoot . sceneProperty ( ) . isNotNull ( ) ) ; if ( loadedController == null ) { throw new IOException ( "Could not load the controller for the View " + resource + " maybe your missed the fx:controller in your fxml?" ) ; } // the actually used ViewModel instance . We need this so we can
// return it in the ViewTuple
ViewModelType actualViewModel ; // FIXME CONTEXT
// if no existing viewModel was provided . . .
if ( viewModel == null ) { // . . . we try to find the created ViewModel from the codeBehind .
// this is only possible when the codeBehind has a field for the
// VM and the VM was injected
actualViewModel = ViewLoaderReflectionUtils . getExistingViewModel ( loadedController ) ; // otherwise we create a new ViewModel . This is needed because
// the ViewTuple has to contain a VM even if
// the codeBehind doesn ' t need one
if ( actualViewModel == null ) { actualViewModel = ViewLoaderReflectionUtils . createViewModel ( loadedController ) ; // it is possible that no viewModel could be created ( f . e .
// when no generic VM type was specified )
// otherwise we need to initialize the created ViewModel
// instance .
if ( actualViewModel != null ) { ViewLoaderReflectionUtils . initializeViewModel ( actualViewModel ) ; } } } else { actualViewModel = viewModel ; } if ( actualViewModel != null ) { // TODO : Create Testcase for this corner case :
// If this view is the root view ( the one that is loaded with
// the FluentViewLoader )
// but in the view there is no injection of the ViewModel
// only in this case the scope has to be injected here ,
// If the viewModel was already injected in the View , it has
// it ' s scopes already injected
// ViewLoaderReflectionUtils . createAndInjectScopes ( actualViewModel ,
// context ) ;
} return new ViewTuple < > ( loadedController , loadedRoot , actualViewModel ) ; } catch ( final IOException ex ) { throw new RuntimeException ( ex ) ; }


signature:
public class StyleDao { /** * Query for the style row from a style mapping row
 * @ param styleMappingRow style mapping row
 * @ return style row */
public StyleRow queryForRow ( StyleMappingRow styleMappingRow ) { } }

implementation: StyleRow styleRow = null ; AttributesRow attributesRow = queryForIdRow ( styleMappingRow . getRelatedId ( ) ) ; if ( attributesRow != null ) { styleRow = getRow ( attributesRow ) ; } return styleRow ;


signature:
public class FeatureRow { /** * { @ inheritDoc }
 * Handles geometry columns */
@ Override protected void columnToContentValue ( ContentValues contentValues , FeatureColumn column , Object value ) { } }

implementation: if ( column . isGeometry ( ) ) { String columnName = column . getName ( ) ; if ( value instanceof GeoPackageGeometryData ) { GeoPackageGeometryData geometryData = ( GeoPackageGeometryData ) value ; try { contentValues . put ( columnName , geometryData . toBytes ( ) ) ; } catch ( IOException e ) { throw new GeoPackageException ( "Failed to write Geometry Data bytes. column: " + columnName , e ) ; } } else if ( value instanceof byte [ ] ) { contentValues . put ( columnName , ( byte [ ] ) value ) ; } else { throw new GeoPackageException ( "Unsupported update geometry column value type. column: " + columnName + ", value type: " + value . getClass ( ) . getName ( ) ) ; }


signature:
public class CoverageDataPng { /** * { @ inheritDoc } */
@ Override public double getValue ( GriddedTile griddedTile , TileRow tileRow , int x , int y ) { } }

implementation: byte [ ] imageBytes = tileRow . getTileData ( ) ; double value = getValue ( griddedTile , imageBytes , x , y ) ; return value ;


signature:
public class CoverageDataPng { /** * { @ inheritDoc } */
@ Override public Double getValue ( GriddedTile griddedTile , CoverageDataPngImage image , int x , int y ) { } }

implementation: Double value = null ; if ( image . getReader ( ) != null ) { int pixelValue = image . getPixel ( x , y ) ; value = getValue ( griddedTile , pixelValue ) ; } else { value = getValue ( griddedTile , image . getImageBytes ( ) , x , y ) ; } return value ;


signature:
public class CoverageDataPng { /** * Get the pixel value as a 16 bit unsigned integer value
 * @ param imageBytes image bytes
 * @ param x x coordinate
 * @ param y y coordinate
 * @ return pixel value */
public int getPixelValue ( byte [ ] imageBytes , int x , int y ) { } }

implementation: PngReaderInt reader = new PngReaderInt ( new ByteArrayInputStream ( imageBytes ) ) ; validateImageType ( reader ) ; ImageLineInt row = ( ImageLineInt ) reader . readRow ( y ) ; int pixelValue = row . getScanline ( ) [ x ] ; reader . close ( ) ; return pixelValue ;


signature:
public class CoverageDataPng { /** * Get the pixel values of the image as 16 bit unsigned integer values
 * @ param imageBytes image bytes
 * @ return 16 bit unsigned integer pixel values */
public int [ ] getPixelValues ( byte [ ] imageBytes ) { } }

implementation: PngReaderInt reader = new PngReaderInt ( new ByteArrayInputStream ( imageBytes ) ) ; validateImageType ( reader ) ; int [ ] pixels = new int [ reader . imgInfo . cols * reader . imgInfo . rows ] ; int rowNumber = 0 ; while ( reader . hasMoreRows ( ) ) { ImageLineInt row = reader . readRowInt ( ) ; int [ ] rowValues = row . getScanline ( ) ; System . arraycopy ( rowValues , 0 , pixels , rowNumber * reader . imgInfo . cols , rowValues . length ) ; rowNumber ++ ; } reader . close ( ) ; return pixels ;


signature:
public class CoverageDataPng { /** * Validate that the image type is single channel 16 bit
 * @ param reader png reader */
public static void validateImageType ( PngReader reader ) { } }

implementation: if ( reader == null ) { throw new GeoPackageException ( "The image is null" ) ; } if ( reader . imgInfo . channels != 1 || reader . imgInfo . bitDepth != 16 ) { throw new GeoPackageException ( "The coverage data tile is expected to be a single channel 16 bit unsigned short, channels: " + reader . imgInfo . channels + ", bits: " + reader . imgInfo . bitDepth ) ; }


signature:
public class CoverageDataPng { /** * Draw a coverage data tile from the double array of " unsigned short " pixel
 * values formatted as short [ row ] [ width ]
 * @ param pixelValues " unsigned short " pixel values as [ row ] [ width ]
 * @ return coverage data image tile */
public CoverageDataPngImage drawTile ( short [ ] [ ] pixelValues ) { } }

implementation: int tileWidth = pixelValues [ 0 ] . length ; int tileHeight = pixelValues . length ; CoverageDataPngImage image = createImage ( tileWidth , tileHeight ) ; PngWriter writer = image . getWriter ( ) ; for ( int y = 0 ; y < tileHeight ; y ++ ) { ImageLineInt row = new ImageLineInt ( writer . imgInfo , new int [ tileWidth ] ) ; int [ ] rowLine = row . getScanline ( ) ; for ( int x = 0 ; x < tileWidth ; x ++ ) { short pixelValue = pixelValues [ y ] [ x ] ; setPixelValue ( rowLine , x , pixelValue ) ; } writer . writeRow ( row ) ; } writer . end ( ) ; image . flushStream ( ) ; return image ;


signature:
public class CoverageDataPng { /** * Draw a coverage data tile and format as PNG bytes from the double array of
 * " unsigned short " pixel values formatted as short [ row ] [ width ]
 * @ param pixelValues " unsigned short " pixel values as [ row ] [ width ]
 * @ return coverage data image tile bytes */
public byte [ ] drawTileData ( short [ ] [ ] pixelValues ) { } }

implementation: CoverageDataPngImage image = drawTile ( pixelValues ) ; byte [ ] bytes = image . getImageBytes ( ) ; return bytes ;


signature:
public class CoverageDataPng { /** * Draw a coverage data image tile and format as PNG bytes from the double
 * array of unsigned 16 bit integer pixel values formatted as
 * int [ row ] [ width ]
 * @ param unsignedPixelValues unsigned 16 bit integer pixel values as [ row ] [ width ]
 * @ return coverage data image tile bytes */
public byte [ ] drawTileData ( int [ ] [ ] unsignedPixelValues ) { } }

implementation: CoverageDataPngImage image = drawTile ( unsignedPixelValues ) ; byte [ ] bytes = image . getImageBytes ( ) ; return bytes ;


signature:
public class CoverageDataPng { /** * Draw a coverage data image tile from the double array of unsigned coverage data values
 * formatted as Double [ row ] [ width ]
 * @ param griddedTile gridded tile
 * @ param values coverage data values as [ row ] [ width ]
 * @ return coverage data image tile */
public CoverageDataPngImage drawTile ( GriddedTile griddedTile , Double [ ] [ ] values ) { } }

implementation: int tileWidth = values [ 0 ] . length ; int tileHeight = values . length ; CoverageDataPngImage image = createImage ( tileWidth , tileHeight ) ; PngWriter writer = image . getWriter ( ) ; for ( int y = 0 ; y < tileHeight ; y ++ ) { ImageLineInt row = new ImageLineInt ( writer . imgInfo , new int [ tileWidth ] ) ; int [ ] rowLine = row . getScanline ( ) ; for ( int x = 0 ; x < tileWidth ; x ++ ) { Double value = values [ y ] [ x ] ; short pixelValue = getPixelValue ( griddedTile , value ) ; setPixelValue ( rowLine , x , pixelValue ) ; } writer . writeRow ( row ) ; } writer . end ( ) ; image . flushStream ( ) ; return image ;


signature:
public class CoverageDataPng { /** * Create a new 16 bit single channel image
 * @ param tileWidth tile width
 * @ param tileHeight tile height
 * @ return image */
public CoverageDataPngImage createImage ( int tileWidth , int tileHeight ) { } }

implementation: ImageInfo imageInfo = new ImageInfo ( tileWidth , tileHeight , 16 , false , true , false ) ; CoverageDataPngImage image = new CoverageDataPngImage ( imageInfo ) ; return image ;


signature:
public class CoverageDataPng { /** * Set the pixel value
 * @ param row image line row
 * @ param x x coordinate
 * @ param pixelValue pixel value */
public void setPixelValue ( ImageLineInt row , int x , short pixelValue ) { } }

implementation: setPixelValue ( row . getScanline ( ) , x , pixelValue ) ;


signature:
public class CoverageDataPng { /** * Set the pixel value
 * @ param row image line row
 * @ param x x coordinate
 * @ param unsignedPixelValue unsigned pixel value */
public void setPixelValue ( ImageLineInt row , int x , int unsignedPixelValue ) { } }

implementation: short pixelValue = getPixelValue ( unsignedPixelValue ) ; setPixelValue ( row , x , pixelValue ) ;


signature:
public class CoverageDataPng { /** * Create the coverage data tile table with metadata and extension
 * @ param geoPackage GeoPackage
 * @ param tableName table name
 * @ param contentsBoundingBox contents bounding box
 * @ param contentsSrsId contents srs id
 * @ param tileMatrixSetBoundingBox tile matrix set bounding box
 * @ param tileMatrixSetSrsId tile matrix set srs id
 * @ return coverage data */
public static CoverageDataPng createTileTableWithMetadata ( GeoPackage geoPackage , String tableName , BoundingBox contentsBoundingBox , long contentsSrsId , BoundingBox tileMatrixSetBoundingBox , long tileMatrixSetSrsId ) { } }

implementation: CoverageDataPng coverageData = ( CoverageDataPng ) CoverageData . createTileTableWithMetadata ( geoPackage , tableName , contentsBoundingBox , contentsSrsId , tileMatrixSetBoundingBox , tileMatrixSetSrsId , GriddedCoverageDataType . INTEGER ) ; return coverageData ;


signature:
public class TileRow { /** * Set the tile data from a bitmap
 * @ param bitmap tile bitmap
 * @ param format compress format
 * @ param quality quality
 * @ throws IOException upon failure */
public void setTileData ( Bitmap bitmap , CompressFormat format , int quality ) throws IOException { } }

implementation: byte [ ] tileData = BitmapConverter . toBytes ( bitmap , format , quality ) ; setTileData ( tileData ) ;


signature:
public class GeoPackageConnection { /** * { @ inheritDoc } */
@ Override public int delete ( String table , String whereClause , String [ ] whereArgs ) { } }

implementation: return db . delete ( table , whereClause , whereArgs ) ;


signature:
public class GeoPackageConnection { /** * { @ inheritDoc } */
@ Override public int count ( String table , String where , String [ ] args ) { } }

implementation: StringBuilder countQuery = new StringBuilder ( ) ; countQuery . append ( "select count(*) from " ) . append ( CoreSQLUtils . quoteWrap ( table ) ) ; if ( where != null ) { countQuery . append ( " where " ) . append ( where ) ; } String sql = countQuery . toString ( ) ; int count = querySingleInteger ( sql , args , true ) ; return count ;


signature:
public class GeoPackageConnection { /** * { @ inheritDoc } */
@ Override public boolean columnExists ( String tableName , String columnName ) { } }

implementation: boolean exists = false ; Cursor cursor = rawQuery ( "PRAGMA table_info(" + CoreSQLUtils . quoteWrap ( tableName ) + ")" , null ) ; try { int nameIndex = cursor . getColumnIndex ( NAME_COLUMN ) ; while ( cursor . moveToNext ( ) ) { String name = cursor . getString ( nameIndex ) ; if ( columnName . equals ( name ) ) { exists = true ; break ; } } } finally { cursor . close ( ) ; } return exists ;


signature:
public class GeoPackageConnection { /** * { @ inheritDoc } */
@ Override public Object querySingleResult ( String sql , String [ ] args , int column , GeoPackageDataType dataType ) { } }

implementation: CursorResult result = wrapQuery ( sql , args ) ; Object value = ResultUtils . buildSingleResult ( result , column , dataType ) ; return value ;


signature:
public class GeoPackageConnection { /** * { @ inheritDoc } */
@ Override public List < Object > querySingleColumnResults ( String sql , String [ ] args , int column , GeoPackageDataType dataType , Integer limit ) { } }

implementation: CursorResult result = wrapQuery ( sql , args ) ; List < Object > results = ResultUtils . buildSingleColumnResults ( result , column , dataType , limit ) ; return results ;


signature:
public class GeoPackageConnection { /** * { @ inheritDoc } */
@ Override public List < List < Object > > queryResults ( String sql , String [ ] args , GeoPackageDataType [ ] dataTypes , Integer limit ) { } }

implementation: CursorResult result = wrapQuery ( sql , args ) ; List < List < Object > > results = ResultUtils . buildResults ( result , dataTypes , limit ) ; return results ;


signature:
public class GeoPackageConnection { /** * Perform a raw database query
 * @ param sql sql command
 * @ param args arguments
 * @ return cursor
 * @ since 1.2.1 */
public Cursor rawQuery ( String sql , String [ ] args ) { } }

implementation: return db . rawQuery ( sql , args ) ;


signature:
public class GeoPackageConnection { /** * Perform the query and wrap as a result
 * @ param sql sql statement
 * @ param selectionArgs selection arguments
 * @ return result
 * @ since 3.1.0 */
public CursorResult wrapQuery ( String sql , String [ ] selectionArgs ) { } }

implementation: return new CursorResult ( rawQuery ( sql , selectionArgs ) ) ;


signature:
public class UserConnection { /** * { @ inheritDoc } */
@ Override public TResult rawQuery ( String sql , String [ ] selectionArgs ) { } }

implementation: UserQuery query = new UserQuery ( sql , selectionArgs ) ; TResult result = query ( query ) ; return result ;


signature:
public class UserConnection { /** * { @ inheritDoc } */
@ Override public TResult query ( String table , String [ ] columns , String selection , String [ ] selectionArgs , String groupBy , String having , String orderBy ) { } }

implementation: UserQuery query = new UserQuery ( table , columns , selection , selectionArgs , groupBy , having , orderBy ) ; TResult result = query ( query ) ; return result ;


signature:
public class UserConnection { /** * Query using the query from a previous query result
 * @ param previousResult previous result
 * @ return result
 * @ since 2.0.0 */
public TResult query ( TResult previousResult ) { } }

implementation: UserQuery query = previousResult . getQuery ( ) ; TResult result = query ( query ) ; return result ;


signature:
public class UserConnection { /** * Query using the user query arguments
 * @ param query user query
 * @ return result
 * @ since 2.0.0 */
public TResult query ( UserQuery query ) { } }

implementation: Cursor cursor = null ; String [ ] selectionArgs = query . getSelectionArgs ( ) ; String sql = query . getSql ( ) ; if ( sql != null ) { cursor = database . rawQuery ( sql , selectionArgs ) ; } else { String table = query . getTable ( ) ; String [ ] columns = query . getColumns ( ) ; String selection = query . getSelection ( ) ; String groupBy = query . getGroupBy ( ) ; String having = query . getHaving ( ) ; String orderBy = query . getOrderBy ( ) ; String [ ] columnsAs = query . getColumnsAs ( ) ; String limit = query . getLimit ( ) ; if ( columnsAs != null && limit != null ) { cursor = database . query ( table , columns , columnsAs , selection , selectionArgs , groupBy , having , orderBy , limit ) ; } else if ( columnsAs != null ) { cursor = database . query ( table , columns , columnsAs , selection , selectionArgs , groupBy , having , orderBy ) ; } else if ( limit != null ) { cursor = database . query ( table , columns , selection , selectionArgs , groupBy , having , orderBy , limit ) ; } else { cursor = database . query ( table , columns , selection , selectionArgs , groupBy , having , orderBy ) ; } } TResult result = handleCursor ( cursor , query ) ; return result ;


signature:
public class UserConnection { /** * Convert the cursor to the result type cursor
 * @ param cursor cursor
 * @ param query user query
 * @ return result cursor */
private TResult handleCursor ( Cursor cursor , UserQuery query ) { } }

implementation: TResult result = convertCursor ( cursor ) ; result . setQuery ( query ) ; if ( table != null ) { result . setTable ( table ) ; } return result ;


signature:
public class FeatureTableIndex { /** * Index the feature row . This method assumes that indexing has been
 * completed and maintained as the last indexed time is updated .
 * @ param row feature row
 * @ return true if indexed */
public boolean index ( FeatureRow row ) { } }

implementation:
TableIndex tableIndex = getTableIndex ( ) ; if ( tableIndex == null ) { throw new GeoPackageException ( "GeoPackage table is not indexed. GeoPackage: " + getGeoPackage ( ) . getName ( ) + ", Table: " + getTableName ( ) ) ; } boolean indexed = index ( tableIndex , row . getId ( ) , row . getGeometry ( ) ) ; // Update the last indexed time
updateLastIndexed ( ) ; return indexed ;


signature:
public class FeatureTableIndex { /** * Index the feature rows in the cursor
 * @ param tableIndex table index
 * @ param cursor feature cursor
 * @ return count , - 1 if no results or canceled */
private int indexRows ( TableIndex tableIndex , FeatureCursor cursor ) { } }

implementation: int count = - 1 ; try { while ( ( progress == null || progress . isActive ( ) ) && cursor . moveToNext ( ) ) { if ( count < 0 ) { count ++ ; } try { FeatureRow row = cursor . getRow ( ) ; if ( row . isValid ( ) ) { boolean indexed = index ( tableIndex , row . getId ( ) , row . getGeometry ( ) ) ; if ( indexed ) { count ++ ; } if ( progress != null ) { progress . addProgress ( 1 ) ; } } } catch ( Exception e ) { Log . e ( FeatureTableIndex . class . getSimpleName ( ) , "Failed to index feature. Table: " + tableIndex . getTableName ( ) + ", Position: " + cursor . getPosition ( ) , e ) ; } } } finally { cursor . close ( ) ; } return count ;


signature:
public class FeatureTableIndex { /** * Get the feature row for the Geometry Index
 * @ param geometryIndex geometry index
 * @ return feature row */
public FeatureRow getFeatureRow ( GeometryIndex geometryIndex ) { } }

implementation:
long geomId = geometryIndex . getGeomId ( ) ; // Get the row or lock for reading
FeatureRow row = featureRowSync . getRowOrLock ( geomId ) ; if ( row == null ) { // Query for the row and set in the sync
try { row = featureDao . queryForIdRow ( geomId ) ; } finally { featureRowSync . setRow ( geomId , row ) ; } } return row ;


signature:
public class GeoPackageCursorFactory { /** * Register a cursor wrapper for the provided table name . Database queries
 * will wrap the returned cursor
 * @ param tableName
 * @ param cursorWrapper */
public void registerTable ( String tableName , GeoPackageCursorWrapper cursorWrapper ) { } }

implementation:
// Remove an existing cursor wrapper
tableCursors . remove ( tableName ) ; // Add the wrapper
tableCursors . put ( tableName , cursorWrapper ) ; String quotedTableName = CoreSQLUtils . quoteWrap ( tableName ) ; tableCursors . put ( quotedTableName , cursorWrapper ) ; // The Android android . database . sqlite . SQLiteDatabase findEditTable method
// finds the new cursor edit table name based upon the first space or comma .
// Fix ( hopefully temporary ) to wrap with the expected cursor type
int spacePosition = tableName . indexOf ( ' ' ) ; if ( spacePosition > 0 ) { tableCursors . put ( tableName . substring ( 0 , spacePosition ) , cursorWrapper ) ; tableCursors . put ( quotedTableName . substring ( 0 , quotedTableName . indexOf ( ' ' ) ) , cursorWrapper ) ; }


signature:
public class GeoPackageCursorFactory { /** * { @ inheritDoc } */
@ Override public Cursor newCursor ( SQLiteDatabase db , SQLiteCursorDriver driver , String editTable , SQLiteQuery query ) { } }

implementation:
// Create a standard cursor
Cursor cursor = new SQLiteCursor ( driver , editTable , query ) ; // Check if there is an edit table
if ( editTable != null ) { // Check if the table has a cursor wrapper
GeoPackageCursorWrapper cursorWrapper = tableCursors . get ( editTable ) ; if ( cursorWrapper != null ) { cursor = cursorWrapper . wrapCursor ( cursor ) ; } } return cursor ;


signature:
public class GoogleAPIGeoPackageTileRetriever { /** * { @ inheritDoc } */
@ Override public boolean hasTile ( int x , int y , int zoom ) { } }

implementation: return retrieveTileRow ( x , y , zoom ) != null ;


signature:
public class GoogleAPIGeoPackageTileRetriever { /** * { @ inheritDoc } */
@ Override public GeoPackageTile getTile ( int x , int y , int zoom ) { } }

implementation: GeoPackageTile tile = null ; TileRow tileRow = retrieveTileRow ( x , y , zoom ) ; if ( tileRow != null ) { TileMatrix tileMatrix = tileDao . getTileMatrix ( zoom ) ; int tileWidth = ( int ) tileMatrix . getTileWidth ( ) ; int tileHeight = ( int ) tileMatrix . getTileHeight ( ) ; tile = new GeoPackageTile ( tileWidth , tileHeight , tileRow . getTileData ( ) ) ; } return tile ;


signature:
public class GoogleAPIGeoPackageTileRetriever { /** * Retrieve the tile row
 * @ param x
 * @ param y
 * @ param zoom
 * @ return */
private TileRow retrieveTileRow ( int x , int y , int zoom ) { } }

implementation: return tileDao . queryForTile ( x , y , zoom ) ;


signature:
public class CoverageData { /** * Get a Tiled Gridded Coverage Data
 * @ param geoPackage GeoPackage
 * @ param tileDao tile dao
 * @ param width coverage data response width
 * @ param height coverage data response height
 * @ param requestProjection request projection
 * @ return coverage data */
public static CoverageData < ? > getCoverageData ( GeoPackage geoPackage , TileDao tileDao , Integer width , Integer height , Projection requestProjection ) { } }

implementation: TileMatrixSet tileMatrixSet = tileDao . getTileMatrixSet ( ) ; GriddedCoverageDao griddedCoverageDao = geoPackage . getGriddedCoverageDao ( ) ; GriddedCoverage griddedCoverage = null ; try { if ( griddedCoverageDao . isTableExists ( ) ) { griddedCoverage = griddedCoverageDao . query ( tileMatrixSet ) ; } } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to get Gridded Coverage for table name: " + tileMatrixSet . getTableName ( ) , e ) ; } CoverageData < ? > coverageData = null ; GriddedCoverageDataType dataType = griddedCoverage . getDataType ( ) ; switch ( dataType ) { case INTEGER : coverageData = new CoverageDataPng ( geoPackage , tileDao , width , height , requestProjection ) ; break ; case FLOAT : coverageData = new CoverageDataTiff ( geoPackage , tileDao , width , height , requestProjection ) ; break ; default : throw new GeoPackageException ( "Unsupported Gridded Coverage Data Type: " + dataType ) ; } return coverageData ;


signature:
public class CoverageData { /** * Get a Tiled Gridded Coverage Data , use the coverage data pixel tile size
 * as the request size width and height
 * @ param geoPackage GeoPackage
 * @ param tileDao tile dao
 * @ return coverage data */
public static CoverageData < ? > getCoverageData ( GeoPackage geoPackage , TileDao tileDao ) { } }

implementation: return getCoverageData ( geoPackage , tileDao , null , null , tileDao . getProjection ( ) ) ;


signature:
public class CoverageData { /** * Get a Tiled Gridded Coverage Data , use the coverage data pixel tile size
 * as the request size width and height , request as the specified projection
 * @ param geoPackage GeoPackage
 * @ param tileDao tile dao
 * @ param requestProjection request projection
 * @ return coverage data */
public static CoverageData < ? > getCoverageData ( GeoPackage geoPackage , TileDao tileDao , Projection requestProjection ) { } }

implementation: return getCoverageData ( geoPackage , tileDao , null , null , requestProjection ) ;


signature:
public class CoverageData { /** * Create the coverage data tile table with metadata and extension
 * @ param geoPackage GeoPackage
 * @ param tableName table name
 * @ param contentsBoundingBox contents bounding box
 * @ param contentsSrsId contents srs id
 * @ param tileMatrixSetBoundingBox tile matrix set bounding box
 * @ param tileMatrixSetSrsId tile matrix set srs id
 * @ param dataType gridded coverage data type
 * @ return coverage data */
public static CoverageData < ? > createTileTableWithMetadata ( GeoPackage geoPackage , String tableName , BoundingBox contentsBoundingBox , long contentsSrsId , BoundingBox tileMatrixSetBoundingBox , long tileMatrixSetSrsId , GriddedCoverageDataType dataType ) { } }

implementation: TileMatrixSet tileMatrixSet = CoverageDataCore . createTileTableWithMetadata ( geoPackage , tableName , contentsBoundingBox , contentsSrsId , tileMatrixSetBoundingBox , tileMatrixSetSrsId ) ; TileDao tileDao = geoPackage . getTileDao ( tileMatrixSet ) ; CoverageData < ? > coverageData = null ; switch ( dataType ) { case INTEGER : coverageData = new CoverageDataPng ( geoPackage , tileDao ) ; break ; case FLOAT : coverageData = new CoverageDataTiff ( geoPackage , tileDao ) ; break ; default : throw new GeoPackageException ( "Unsupported Gridded Coverage Data Type: " + dataType ) ; } coverageData . getOrCreate ( ) ; return coverageData ;


signature:
public class CoverageData { /** * { @ inheritDoc } */
@ Override public CoverageDataResults getValues ( CoverageDataRequest request , Integer width , Integer height ) { } }

implementation:
CoverageDataResults coverageDataResults = null ; // Transform to the projection of the coverage data tiles
ProjectionTransform transformRequestToCoverage = null ; BoundingBox requestProjectedBoundingBox = request . getBoundingBox ( ) ; if ( ! sameProjection ) { transformRequestToCoverage = requestProjection . getTransformation ( coverageProjection ) ; requestProjectedBoundingBox = requestProjectedBoundingBox . transform ( transformRequestToCoverage ) ; } request . setProjectedBoundingBox ( requestProjectedBoundingBox ) ; // Determine how many overlapping pixels to store based upon the
// algorithm
int overlappingPixels ; switch ( algorithm ) { case BICUBIC : overlappingPixels = 3 ; break ; default : overlappingPixels = 1 ; } // Find the tile matrix and results
CoverageDataTileMatrixResults results = getResults ( request , requestProjectedBoundingBox , overlappingPixels ) ; if ( results != null ) { TileMatrix tileMatrix = results . getTileMatrix ( ) ; TileCursor tileResults = results . getTileResults ( ) ; try { // Determine the requested coverage data dimensions , or use the
// dimensions of a single tile matrix coverage data tile
int requestedCoverageDataWidth = width != null ? width : ( int ) tileMatrix . getTileWidth ( ) ; int requestedCoverageDataHeight = height != null ? height : ( int ) tileMatrix . getTileHeight ( ) ; // Determine the size of the non projected coverage data results
int tileWidth = requestedCoverageDataWidth ; int tileHeight = requestedCoverageDataHeight ; if ( ! sameProjection ) { int projectedWidth = ( int ) Math . round ( ( requestProjectedBoundingBox . getMaxLongitude ( ) - requestProjectedBoundingBox . getMinLongitude ( ) ) / tileMatrix . getPixelXSize ( ) ) ; if ( projectedWidth > 0 ) { tileWidth = projectedWidth ; } int projectedHeight = ( int ) Math . round ( ( requestProjectedBoundingBox . getMaxLatitude ( ) - requestProjectedBoundingBox . getMinLatitude ( ) ) / tileMatrix . getPixelYSize ( ) ) ; if ( projectedHeight > 0 ) { tileHeight = projectedHeight ; } } // Retrieve the coverage data from the results
Double [ ] [ ] values = getValues ( tileMatrix , tileResults , request , tileWidth , tileHeight , overlappingPixels ) ; // Project the coverage data if needed
if ( values != null && ! sameProjection && ! request . isPoint ( ) ) { values = reprojectCoverageData ( values , requestedCoverageDataWidth , requestedCoverageDataHeight , request . getBoundingBox ( ) , transformRequestToCoverage , requestProjectedBoundingBox ) ; } // Create the results
if ( values != null ) { coverageDataResults = new CoverageDataResults ( values , tileMatrix ) ; } } finally { tileResults . close ( ) ; } } return coverageDataResults ;


signature:
public class CoverageData { /** * { @ inheritDoc } */
@ Override public CoverageDataResults getValuesUnbounded ( CoverageDataRequest request ) { } }

implementation:
CoverageDataResults coverageDataResults = null ; // Transform to the projection of the coverage data tiles
ProjectionTransform transformRequestToCoverage = null ; BoundingBox requestProjectedBoundingBox = request . getBoundingBox ( ) ; if ( ! sameProjection ) { transformRequestToCoverage = requestProjection . getTransformation ( coverageProjection ) ; requestProjectedBoundingBox = requestProjectedBoundingBox . transform ( transformRequestToCoverage ) ; } request . setProjectedBoundingBox ( requestProjectedBoundingBox ) ; // Find the tile matrix and results
CoverageDataTileMatrixResults results = getResults ( request , requestProjectedBoundingBox ) ; if ( results != null ) { TileMatrix tileMatrix = results . getTileMatrix ( ) ; TileCursor tileResults = results . getTileResults ( ) ; try { // Retrieve the coverage data values from the results
Double [ ] [ ] values = getValuesUnbounded ( tileMatrix , tileResults , request ) ; // Project the coverage data if needed
if ( values != null && ! sameProjection && ! request . isPoint ( ) ) { values = reprojectCoverageData ( values , values [ 0 ] . length , values . length , request . getBoundingBox ( ) , transformRequestToCoverage , requestProjectedBoundingBox ) ; } // Create the results
if ( values != null ) { coverageDataResults = new CoverageDataResults ( values , tileMatrix ) ; } } finally { tileResults . close ( ) ; } } return coverageDataResults ;


signature:
public class CoverageData { /** * Get the coverage data tile results by finding the tile matrix with values
 * @ param request coverage data request
 * @ param requestProjectedBoundingBox request projected bounding box
 * @ param overlappingPixels overlapping request pixels
 * @ return tile matrix results */
private CoverageDataTileMatrixResults getResults ( CoverageDataRequest request , BoundingBox requestProjectedBoundingBox , int overlappingPixels ) { } }

implementation:
// Try to get the coverage data from the current zoom level
TileMatrix tileMatrix = getTileMatrix ( request ) ; CoverageDataTileMatrixResults results = null ; if ( tileMatrix != null ) { results = getResults ( requestProjectedBoundingBox , tileMatrix , overlappingPixels ) ; // Try to zoom in or out to find a matching coverage data
if ( results == null ) { results = getResultsZoom ( requestProjectedBoundingBox , tileMatrix , overlappingPixels ) ; } } return results ;


signature:
public class CoverageData { /** * Get the coverage data tile results by zooming in or out as needed from the
 * provided tile matrix to find values
 * @ param requestProjectedBoundingBox request projected bounding box
 * @ param tileMatrix tile matrix
 * @ param overlappingPixels overlapping request pixels
 * @ return tile matrix results */
private CoverageDataTileMatrixResults getResultsZoom ( BoundingBox requestProjectedBoundingBox , TileMatrix tileMatrix , int overlappingPixels ) { } }

implementation: CoverageDataTileMatrixResults results = null ; if ( zoomIn && zoomInBeforeOut ) { results = getResultsZoomIn ( requestProjectedBoundingBox , tileMatrix , overlappingPixels ) ; } if ( results == null && zoomOut ) { results = getResultsZoomOut ( requestProjectedBoundingBox , tileMatrix , overlappingPixels ) ; } if ( results == null && zoomIn && ! zoomInBeforeOut ) { results = getResultsZoomIn ( requestProjectedBoundingBox , tileMatrix , overlappingPixels ) ; } return results ;


signature:
public class CoverageData { /** * Get the coverage data tile results by zooming in from the provided tile
 * matrix
 * @ param requestProjectedBoundingBox request projected bounding box
 * @ param tileMatrix tile matrix
 * @ param overlappingPixels overlapping request pixels
 * @ return tile matrix results */
private CoverageDataTileMatrixResults getResultsZoomIn ( BoundingBox requestProjectedBoundingBox , TileMatrix tileMatrix , int overlappingPixels ) { } }

implementation: CoverageDataTileMatrixResults results = null ; for ( long zoomLevel = tileMatrix . getZoomLevel ( ) + 1 ; zoomLevel <= tileDao . getMaxZoom ( ) ; zoomLevel ++ ) { TileMatrix zoomTileMatrix = tileDao . getTileMatrix ( zoomLevel ) ; if ( zoomTileMatrix != null ) { results = getResults ( requestProjectedBoundingBox , zoomTileMatrix , overlappingPixels ) ; if ( results != null ) { break ; } } } return results ;


signature:
public class CoverageData { /** * Get the coverage data tile results by zooming out from the provided tile
 * matrix
 * @ param requestProjectedBoundingBox request projected bounding box
 * @ param tileMatrix tile matrix
 * @ param overlappingPixels overlapping request pixels
 * @ return tile matrix results */
private CoverageDataTileMatrixResults getResultsZoomOut ( BoundingBox requestProjectedBoundingBox , TileMatrix tileMatrix , int overlappingPixels ) { } }

implementation: CoverageDataTileMatrixResults results = null ; for ( long zoomLevel = tileMatrix . getZoomLevel ( ) - 1 ; zoomLevel >= tileDao . getMinZoom ( ) ; zoomLevel -- ) { TileMatrix zoomTileMatrix = tileDao . getTileMatrix ( zoomLevel ) ; if ( zoomTileMatrix != null ) { results = getResults ( requestProjectedBoundingBox , zoomTileMatrix , overlappingPixels ) ; if ( results != null ) { break ; } } } return results ;


signature:
public class CoverageData { /** * Get the tile matrix for the zoom level as defined by the area of the
 * request
 * @ param request coverage data request
 * @ return tile matrix or null */
private TileMatrix getTileMatrix ( CoverageDataRequest request ) { } }

implementation:
TileMatrix tileMatrix = null ; // Check if the request overlaps coverage data bounding box
if ( request . overlap ( coverageBoundingBox ) != null ) { // Get the tile distance
BoundingBox projectedBoundingBox = request . getProjectedBoundingBox ( ) ; double distanceWidth = projectedBoundingBox . getMaxLongitude ( ) - projectedBoundingBox . getMinLongitude ( ) ; double distanceHeight = projectedBoundingBox . getMaxLatitude ( ) - projectedBoundingBox . getMinLatitude ( ) ; // Get the zoom level to request based upon the tile size
Long zoomLevel = tileDao . getClosestZoomLevel ( distanceWidth , distanceHeight ) ; // If there is a matching zoom level
if ( zoomLevel != null ) { tileMatrix = tileDao . getTileMatrix ( zoomLevel ) ; } } return tileMatrix ;


signature:
public class CoverageData { /** * Get the coverage data value of the pixel in the tile row image
 * @ param tileRow tile row
 * @ param x x coordinate
 * @ param y y coordinate
 * @ return coverage data value */
public double getValue ( TileRow tileRow , int x , int y ) { } }

implementation: GriddedTile griddedTile = getGriddedTile ( tileRow . getId ( ) ) ; double value = getValue ( griddedTile , tileRow , x , y ) ; return value ;


signature:
public class Icons { /** * Set the icon for the geometry type
 * @ param iconRow icon row
 * @ param geometryType geometry type */
public void setIcon ( IconRow iconRow , GeometryType geometryType ) { } }

implementation: if ( geometryType != null ) { if ( iconRow != null ) { icons . put ( geometryType , iconRow ) ; } else { icons . remove ( geometryType ) ; } } else { defaultIcon = iconRow ; }


signature:
public class Icons { /** * Get the icon for the geometry type
 * @ param geometryType geometry type
 * @ return icon */
public IconRow getIcon ( GeometryType geometryType ) { } }

implementation: IconRow iconRow = null ; if ( geometryType != null && ! icons . isEmpty ( ) ) { List < GeometryType > geometryTypes = GeometryUtils . parentHierarchy ( geometryType ) ; geometryTypes . add ( 0 , geometryType ) ; for ( GeometryType type : geometryTypes ) { iconRow = icons . get ( type ) ; if ( iconRow != null ) { break ; } } } if ( iconRow == null ) { iconRow = defaultIcon ; } if ( iconRow == null && geometryType == null && icons . size ( ) == 1 ) { iconRow = icons . values ( ) . iterator ( ) . next ( ) ; } return iconRow ;


signature:
public class UserCustomCursor { /** * { @ inheritDoc } */
@ Override public UserCustomRow getRow ( int [ ] columnTypes , Object [ ] values ) { } }

implementation: return new UserCustomRow ( getTable ( ) , columnTypes , values ) ;


signature:
public class UserCustomCursor { /** * { @ inheritDoc } */
@ Override protected UserInvalidCursor < UserCustomColumn , UserCustomTable , UserCustomRow , ? extends UserCursor < UserCustomColumn , UserCustomTable , UserCustomRow > , ? extends UserDao < UserCustomColumn , UserCustomTable , UserCustomRow , ? extends UserCursor < UserCustomColumn , UserCustomTable , UserCustomRow > > > createInvalidCursor ( UserDao dao , UserCursor cursor , List < Integer > invalidPositions , List < UserCustomColumn > blobColumns ) { } }

implementation: return new UserCustomInvalidCursor ( ( UserCustomDao ) dao , ( UserCustomCursor ) cursor , invalidPositions , blobColumns ) ;


signature:
public class GeoPackageDatabase { /** * Open or get a connection using the SQLite Android Bindings connection
 * @ return bindings connection */
public org . sqlite . database . sqlite . SQLiteDatabase openOrGetBindingsDb ( ) { } }

implementation: if ( bindingsDb == null ) { synchronized ( db ) { if ( bindingsDb == null ) { System . loadLibrary ( "sqliteX" ) ; bindingsDb = org . sqlite . database . sqlite . SQLiteDatabase . openDatabase ( db . getPath ( ) , null , org . sqlite . database . sqlite . SQLiteDatabase . OPEN_READWRITE ) ; } } } return bindingsDb ;


signature:
public class BitmapConverter { /** * Decode the bytes to a bitmap , with options
 * @ param bytes image bytes
 * @ param options decode options
 * @ return image bitmap */
public static Bitmap toBitmap ( byte [ ] bytes , Options options ) { } }

implementation: Bitmap bitmap = BitmapFactory . decodeByteArray ( bytes , 0 , bytes . length , options ) ; return bitmap ;


signature:
public class BitmapConverter { /** * Compress the bitmap to a byte array
 * @ param bitmap bitmap image
 * @ param format compress format
 * @ param quality quality
 * @ return image bytes
 * @ throws IOException upon failure */
public static byte [ ] toBytes ( Bitmap bitmap , CompressFormat format , int quality ) throws IOException { } }

implementation: byte [ ] bytes = null ; ByteArrayOutputStream byteStream = new ByteArrayOutputStream ( ) ; try { bitmap . compress ( format , quality , byteStream ) ; bytes = byteStream . toByteArray ( ) ; } finally { byteStream . close ( ) ; } return bytes ;


signature:
public class TableMetadataDataSource { /** * Create a new table metadata
 * @ param metadata table metadata */
public void create ( TableMetadata metadata ) { } }

implementation: ContentValues values = new ContentValues ( ) ; values . put ( TableMetadata . COLUMN_GEOPACKAGE_ID , metadata . getGeoPackageId ( ) ) ; values . put ( TableMetadata . COLUMN_TABLE_NAME , metadata . getTableName ( ) ) ; values . put ( TableMetadata . COLUMN_LAST_INDEXED , metadata . getLastIndexed ( ) ) ; long insertId = db . insert ( TableMetadata . TABLE_NAME , null , values ) ; if ( insertId == - 1 ) { throw new GeoPackageException ( "Failed to insert table metadata. GeoPackage Id: " + metadata . getGeoPackageId ( ) + ", Table Name: " + metadata . getTableName ( ) + ", Last Indexed: " + metadata . getLastIndexed ( ) ) ; }


signature:
public class TableMetadataDataSource { /** * Delete the database table name
 * @ param geoPackageId GeoPackage id
 * @ param tableName table name
 * @ return deleted flag */
public boolean delete ( long geoPackageId , String tableName ) { } }

implementation: GeometryMetadataDataSource geomDs = new GeometryMetadataDataSource ( db ) ; geomDs . delete ( geoPackageId , tableName ) ; String whereClause = TableMetadata . COLUMN_GEOPACKAGE_ID + " = ? AND " + TableMetadata . COLUMN_TABLE_NAME + " = ?" ; String [ ] whereArgs = new String [ ] { String . valueOf ( geoPackageId ) , tableName } ; int deleteCount = db . delete ( TableMetadata . TABLE_NAME , whereClause , whereArgs ) ; return deleteCount > 0 ;


signature:
public class TableMetadataDataSource { /** * Update the last indexed time
 * @ param metadata table metadata
 * @ param lastIndexed last indexed
 * @ return updated flag */
public boolean updateLastIndexed ( TableMetadata metadata , long lastIndexed ) { } }

implementation: boolean updated = updateLastIndexed ( metadata . getGeoPackageId ( ) , metadata . getTableName ( ) , lastIndexed ) ; if ( updated ) { metadata . setLastIndexed ( lastIndexed ) ; } return updated ;


signature:
public class TableMetadataDataSource { /** * Update the last indexed time
 * @ param geoPackage GeoPackage name
 * @ param tableName table name
 * @ param lastIndexed last indexed
 * @ return updated flag */
public boolean updateLastIndexed ( String geoPackage , String tableName , long lastIndexed ) { } }

implementation: return updateLastIndexed ( getGeoPackageId ( geoPackage ) , tableName , lastIndexed ) ;


signature:
public class TableMetadataDataSource { /** * Update the last indexed time
 * @ param geoPackageId GeoPackage id
 * @ param tableName table name
 * @ param lastIndexed last indexed
 * @ return updated flag */
public boolean updateLastIndexed ( long geoPackageId , String tableName , long lastIndexed ) { } }

implementation: String whereClause = TableMetadata . COLUMN_GEOPACKAGE_ID + " = ? AND " + TableMetadata . COLUMN_TABLE_NAME + " = ?" ; String [ ] whereArgs = new String [ ] { String . valueOf ( geoPackageId ) , tableName } ; ContentValues values = new ContentValues ( ) ; values . put ( TableMetadata . COLUMN_LAST_INDEXED , lastIndexed ) ; int updateCount = db . update ( TableMetadata . TABLE_NAME , values , whereClause , whereArgs ) ; return updateCount > 0 ;


signature:
public class TableMetadataDataSource { /** * Get a table metadata
 * @ param geoPackage GeoPackage name
 * @ param tableName table name
 * @ return table metadata */
public TableMetadata get ( String geoPackage , String tableName ) { } }

implementation: return get ( getGeoPackageId ( geoPackage ) , tableName ) ;


signature:
public class TableMetadataDataSource { /** * Get a table metadata
 * @ param geoPackageId GeoPackage id
 * @ param tableName table name
 * @ return table metadata */
public TableMetadata get ( long geoPackageId , String tableName ) { } }

implementation: String selection = TableMetadata . COLUMN_GEOPACKAGE_ID + " = ? AND " + TableMetadata . COLUMN_TABLE_NAME + " = ?" ; String [ ] selectionArgs = new String [ ] { String . valueOf ( geoPackageId ) , tableName } ; Cursor cursor = db . query ( TableMetadata . TABLE_NAME , TableMetadata . COLUMNS , selection , selectionArgs , null , null , null ) ; TableMetadata metadata = null ; try { if ( cursor . moveToNext ( ) ) { metadata = createTableMetadata ( cursor ) ; } } finally { cursor . close ( ) ; } return metadata ;


signature:
public class TableMetadataDataSource { /** * Get a table metadata or create if it does not exist
 * @ param geoPackage GeoPackage name
 * @ param tableName table name
 * @ return table metadata */
public TableMetadata getOrCreate ( String geoPackage , String tableName ) { } }

implementation: GeoPackageMetadataDataSource ds = new GeoPackageMetadataDataSource ( db ) ; GeoPackageMetadata geoPackageMetadata = ds . getOrCreate ( geoPackage ) ; TableMetadata metadata = get ( geoPackageMetadata . getId ( ) , tableName ) ; if ( metadata == null ) { metadata = new TableMetadata ( ) ; metadata . setGeoPackageId ( geoPackageMetadata . getId ( ) ) ; metadata . setTableName ( tableName ) ; create ( metadata ) ; } return metadata ;


signature:
public class TableMetadataDataSource { /** * Get a GeoPackage id from the name
 * @ param geoPackage GeoPackage name
 * @ return id */
public long getGeoPackageId ( String geoPackage ) { } }

implementation: long id = - 1 ; GeoPackageMetadataDataSource ds = new GeoPackageMetadataDataSource ( db ) ; GeoPackageMetadata metadata = ds . get ( geoPackage ) ; if ( metadata != null ) { id = metadata . getId ( ) ; } return id ;


signature:
public class TableMetadataDataSource { /** * Create a table metadata from the current cursor location
 * @ param cursor cursor
 * @ return table metadata */
private TableMetadata createTableMetadata ( Cursor cursor ) { } }

implementation: TableMetadata metadata = new TableMetadata ( ) ; metadata . setGeoPackageId ( cursor . getLong ( 0 ) ) ; metadata . setTableName ( cursor . getString ( 1 ) ) ; if ( ! cursor . isNull ( 2 ) ) { metadata . setLastIndexed ( cursor . getLong ( 2 ) ) ; } return metadata ;


signature:
public class RTreeIndexTableDao { /** * Create the RTree extension for the feature table
 * @ return extension */
public Extensions create ( ) { } }

implementation: Extensions extension = null ; if ( ! has ( ) ) { extension = rTree . create ( featureDao . getTable ( ) ) ; if ( progress != null ) { progress . addProgress ( count ( ) ) ; } } return extension ;


signature:
public class RTreeIndexTableDao { /** * Get the feature row from the RTree Index Table row
 * @ param cursor result cursor
 * @ return feature row */
public FeatureRow getFeatureRow ( UserCustomCursor cursor ) { } }

implementation: RTreeIndexTableRow row = getRow ( cursor ) ; return getFeatureRow ( row ) ;


signature:
public class RTreeIndexTableDao { /** * Perform a raw query
 * @ param sql sql statement
 * @ param selectionArgs selection arguments
 * @ return result cursor */
public UserCustomCursor rawQuery ( String sql , String [ ] selectionArgs ) { } }

implementation: validateRTree ( ) ; Cursor cursor = database . rawQuery ( sql , selectionArgs ) ; UserCustomCursor customCursor = new UserCustomCursor ( getTable ( ) , cursor ) ; return customCursor ;


signature:
public class RTreeIndexTableDao { /** * { @ inheritDoc } */
@ Override public UserCustomCursor query ( String where , String [ ] whereArgs ) { } }

implementation: StringBuilder query = new StringBuilder ( ) ; query . append ( "select * from " ) . append ( CoreSQLUtils . quoteWrap ( getTableName ( ) ) ) ; if ( where != null ) { query . append ( " where " ) . append ( where ) ; } String sql = query . toString ( ) ; UserCustomCursor customCursor = rawQuery ( sql , whereArgs ) ; return customCursor ;


signature:
public class RTreeIndexTableDao { /** * { @ inheritDoc } */
@ Override public int count ( String where , String [ ] args ) { } }

implementation: int count = 0 ; StringBuilder countQuery = new StringBuilder ( ) ; countQuery . append ( "select count(*) from " ) . append ( CoreSQLUtils . quoteWrap ( getTableName ( ) ) ) ; if ( where != null ) { countQuery . append ( " where " ) . append ( where ) ; } String sql = countQuery . toString ( ) ; UserCustomCursor customCursor = rawQuery ( sql , args ) ; Object value = ResultUtils . buildSingleResult ( customCursor , 0 , GeoPackageDataType . MEDIUMINT ) ; if ( value != null ) { count = ( ( Number ) value ) . intValue ( ) ; } return count ;


signature:
public class RTreeIndexTableDao { /** * { @ inheritDoc } */
@ Override public BoundingBox getBoundingBox ( ) { } }

implementation: BoundingBox boundingBox = null ; String sql = "SELECT MIN(" + RTreeIndexExtension . COLUMN_MIN_X + "), MIN(" + RTreeIndexExtension . COLUMN_MIN_Y + "), MAX(" + RTreeIndexExtension . COLUMN_MAX_X + "), MAX(" + RTreeIndexExtension . COLUMN_MAX_Y + ") FROM " + CoreSQLUtils . quoteWrap ( getTableName ( ) ) ; UserCustomCursor customCursor = rawQuery ( sql , null ) ; List < List < Object > > results = ResultUtils . buildResults ( customCursor , new GeoPackageDataType [ ] { GeoPackageDataType . DOUBLE , GeoPackageDataType . DOUBLE , GeoPackageDataType . DOUBLE , GeoPackageDataType . DOUBLE } , 1 ) ; if ( ! results . isEmpty ( ) ) { List < Object > resultRow = results . get ( 0 ) ; boundingBox = new BoundingBox ( ( Double ) resultRow . get ( 0 ) , ( Double ) resultRow . get ( 1 ) , ( Double ) resultRow . get ( 2 ) , ( Double ) resultRow . get ( 3 ) ) ; } return boundingBox ;


signature:
public class RTreeIndexTableDao { /** * Query for rows within the bounding box in the provided projection
 * @ param boundingBox bounding box
 * @ param projection projection
 * @ return cursor results */
public UserCustomCursor query ( BoundingBox boundingBox , Projection projection ) { } }

implementation: BoundingBox featureBoundingBox = projectBoundingBox ( boundingBox , projection ) ; return query ( featureBoundingBox ) ;


signature:
public class RTreeIndexTableDao { /** * Query for rows within the geometry envelope
 * @ param envelope geometry envelope
 * @ return cursor results */
public UserCustomCursor query ( GeometryEnvelope envelope ) { } }

implementation: return query ( envelope . getMinX ( ) , envelope . getMinY ( ) , envelope . getMaxX ( ) , envelope . getMaxY ( ) ) ;


signature:
public class RTreeIndexTableDao { /** * Count the rows within the geometry envelope
 * @ param envelope geometry envelope
 * @ return count */
public long count ( GeometryEnvelope envelope ) { } }

implementation: return count ( envelope . getMinX ( ) , envelope . getMinY ( ) , envelope . getMaxX ( ) , envelope . getMaxY ( ) ) ;


signature:
public class RTreeIndexTableDao { /** * Query for rows within the bounds
 * @ param minX min x
 * @ param minY min y
 * @ param maxX max x
 * @ param maxY max y
 * @ return cursor results */
public UserCustomCursor query ( double minX , double minY , double maxX , double maxY ) { } }

implementation: String where = buildWhere ( minX , minY , maxX , maxY ) ; String [ ] whereArgs = buildWhereArgs ( minX , minY , maxX , maxY ) ; return query ( where , whereArgs ) ;


signature:
public class RTreeIndexTableDao { /** * Build a where clause from the bounds for overlapping ranges
 * @ param minX min x
 * @ param minY min y
 * @ param maxX max x
 * @ param maxY max y
 * @ return where clause */
private String buildWhere ( double minX , double minY , double maxX , double maxY ) { } }

implementation: StringBuilder where = new StringBuilder ( ) ; where . append ( buildWhere ( RTreeIndexExtension . COLUMN_MIN_X , maxX , "<=" ) ) ; where . append ( " AND " ) ; where . append ( buildWhere ( RTreeIndexExtension . COLUMN_MIN_Y , maxY , "<=" ) ) ; where . append ( " AND " ) ; where . append ( buildWhere ( RTreeIndexExtension . COLUMN_MAX_X , minX , ">=" ) ) ; where . append ( " AND " ) ; where . append ( buildWhere ( RTreeIndexExtension . COLUMN_MAX_Y , minY , ">=" ) ) ; return where . toString ( ) ;


signature:
public class RTreeIndexTableDao { /** * Build where arguments from the bounds to match the order in
 * { @ link # buildWhereArgs ( double , double , double , double ) }
 * @ param minX min x
 * @ param minY min y
 * @ param maxX max x
 * @ param maxY max y
 * @ return where clause args */
private String [ ] buildWhereArgs ( double minX , double minY , double maxX , double maxY ) { } }

implementation: minX -= tolerance ; maxX += tolerance ; minY -= tolerance ; maxY += tolerance ; return buildWhereArgs ( new Object [ ] { maxX , maxY , minX , minY } ) ;


signature:
public class ManualFeatureQuery { /** * Manually query for rows within the bounding box in the provided
 * projection
 * @ param boundingBox bounding box
 * @ param projection projection
 * @ return results */
public ManualFeatureQueryResults query ( BoundingBox boundingBox , Projection projection ) { } }

implementation: BoundingBox featureBoundingBox = featureDao . projectBoundingBox ( boundingBox , projection ) ; return query ( featureBoundingBox ) ;


signature:
public class ManualFeatureQuery { /** * Manually count the rows within the bounding box in the provided
 * projection
 * @ param boundingBox bounding box
 * @ param projection projection
 * @ return count */
public long count ( BoundingBox boundingBox , Projection projection ) { } }

implementation: BoundingBox featureBoundingBox = featureDao . projectBoundingBox ( boundingBox , projection ) ; return count ( featureBoundingBox ) ;


signature:
public class ManualFeatureQuery { /** * Manually query for rows within the geometry envelope
 * @ param envelope geometry envelope
 * @ return results */
public ManualFeatureQueryResults query ( GeometryEnvelope envelope ) { } }


signature:
public class ManualFeatureQuery { /** * Manually query for rows within the bounds
 * @ param minX min x
 * @ param minY min y
 * @ param maxX max x
 * @ param maxY max y
 * @ return results */
public ManualFeatureQueryResults query ( double minX , double minY , double maxX , double maxY ) { } }

implementation: List < Long > featureIds = new ArrayList < > ( ) ; long offset = 0 ; boolean hasResults = true ; minX -= tolerance ; maxX += tolerance ; minY -= tolerance ; maxY += tolerance ; while ( hasResults ) { hasResults = false ; FeatureCursor featureCursor = featureDao . queryForChunk ( chunkLimit , offset ) ; try { while ( featureCursor . moveToNext ( ) ) { hasResults = true ; FeatureRow featureRow = featureCursor . getRow ( ) ; GeometryEnvelope envelope = featureRow . getGeometryEnvelope ( ) ; if ( envelope != null ) { double minXMax = Math . max ( minX , envelope . getMinX ( ) ) ; double maxXMin = Math . min ( maxX , envelope . getMaxX ( ) ) ; double minYMax = Math . max ( minY , envelope . getMinY ( ) ) ; double maxYMin = Math . min ( maxY , envelope . getMaxY ( ) ) ; if ( minXMax <= maxXMin && minYMax <= maxYMin ) { featureIds . add ( featureRow . getId ( ) ) ; } } } } finally { featureCursor . close ( ) ; } offset += chunkLimit ; } ManualFeatureQueryResults results = new ManualFeatureQueryResults ( featureDao , featureIds ) ; return results ;


signature:
public class ManualFeatureQuery { /** * Manually count the rows within the bounds
 * @ param minX min x
 * @ param minY min y
 * @ param maxX max x
 * @ param maxY max y
 * @ return count */
public long count ( double minX , double minY , double maxX , double maxY ) { } }

implementation: return query ( minX , minY , maxX , maxY ) . count ( ) ;


signature:
public class MediaRow { /** * Read the data bounds without allocating pixel memory .
 * Access values using :
 * { @ link BitmapFactory . Options # outWidth } ,
 * { @ link BitmapFactory . Options # outHeight } ,
 * { @ link BitmapFactory . Options # outMimeType } ,
 * { @ link BitmapFactory . Options # outColorSpace } ,
 * and { @ link BitmapFactory . Options # outConfig }
 * @ return bounds options
 * @ since 3.2.0 */
public BitmapFactory . Options getDataBounds ( ) { } }

implementation: BitmapFactory . Options options = new BitmapFactory . Options ( ) ; options . inJustDecodeBounds = true ; byte [ ] data = getData ( ) ; BitmapFactory . decodeByteArray ( data , 0 , data . length , options ) ; return options ;


signature:
public class MediaRow { /** * Set the data from a full quality bitmap
 * @ param bitmap bitmap
 * @ param format compress format
 * @ throws IOException upon failure
 * @ since 3.2.0 */
public void setData ( Bitmap bitmap , Bitmap . CompressFormat format ) throws IOException { } }

implementation: setData ( bitmap , format , 100 ) ;


signature:
public class MediaRow { /** * Set the data from a bitmap
 * @ param bitmap bitmap
 * @ param format compress format
 * @ param quality quality
 * @ throws IOException upon failure
 * @ since 3.2.0 */
public void setData ( Bitmap bitmap , Bitmap . CompressFormat format , int quality ) throws IOException { } }

implementation: setData ( BitmapConverter . toBytes ( bitmap , format , quality ) ) ;


signature:
public class TileGenerator { /** * Set the Bitmap Compress Config
 * @ param config bitmap config */
public void setBitmapCompressionConfig ( Config config ) { } }

implementation: if ( options == null ) { options = new Options ( ) ; } options . inPreferredConfig = config ;


signature:
public class TileGenerator { /** * Get the tile count of tiles to be generated
 * @ return tile count */
public int getTileCount ( ) { } }

implementation:
if ( tileCount == null ) { long count = 0 ; boolean degrees = projection . isUnit ( Units . DEGREES ) ; ProjectionTransform transformToWebMercator = null ; if ( ! degrees ) { transformToWebMercator = projection . getTransformation ( ProjectionConstants . EPSG_WEB_MERCATOR ) ; } for ( int zoom = minZoom ; zoom <= maxZoom ; zoom ++ ) { BoundingBox expandedBoundingBox = getBoundingBox ( zoom ) ; // Get the tile grid that includes the entire bounding box
TileGrid tileGrid = null ; if ( degrees ) { tileGrid = TileBoundingBoxUtils . getTileGridWGS84 ( expandedBoundingBox , zoom ) ; } else { tileGrid = TileBoundingBoxUtils . getTileGrid ( expandedBoundingBox . transform ( transformToWebMercator ) , zoom ) ; } count += tileGrid . count ( ) ; tileGrids . put ( zoom , tileGrid ) ; tileBounds . put ( zoom , expandedBoundingBox ) ; } tileCount = ( int ) Math . min ( count , Integer . MAX_VALUE ) ; } return tileCount ;


signature:
public class TileGenerator { /** * Adjust the tile matrix set and bounds
 * @ param boundingBox bounding box
 * @ param zoom zoom */
private void adjustBounds ( BoundingBox boundingBox , int zoom ) { } }

implementation:
// Google Tile Format
if ( googleTiles ) { adjustGoogleBounds ( ) ; } else if ( projection . isUnit ( Units . DEGREES ) ) { adjustGeoPackageBoundsWGS84 ( boundingBox , zoom ) ; } else { adjustGeoPackageBounds ( boundingBox , zoom ) ; }


signature:
public class TileGenerator { /** * Adjust the tile matrix set and web mercator bounds for Google tile format */
private void adjustGoogleBounds ( ) { } }

implementation:
// Set the tile matrix set bounding box to be the world
BoundingBox standardWgs84Box = new BoundingBox ( - ProjectionConstants . WGS84_HALF_WORLD_LON_WIDTH , ProjectionConstants . WEB_MERCATOR_MIN_LAT_RANGE , ProjectionConstants . WGS84_HALF_WORLD_LON_WIDTH , ProjectionConstants . WEB_MERCATOR_MAX_LAT_RANGE ) ; ProjectionTransform wgs84ToWebMercatorTransform = ProjectionFactory . getProjection ( ProjectionConstants . EPSG_WORLD_GEODETIC_SYSTEM ) . getTransformation ( ProjectionConstants . EPSG_WEB_MERCATOR ) ; tileGridBoundingBox = standardWgs84Box . transform ( wgs84ToWebMercatorTransform ) ;


signature:
public class TileGenerator { /** * Adjust the tile matrix set and WGS84 bounds for GeoPackage format .
 * Determine the tile grid width and height
 * @ param boundingBox
 * @ param zoom */
private void adjustGeoPackageBoundsWGS84 ( BoundingBox boundingBox , int zoom ) { } }

implementation:
// Get the fitting tile grid and determine the bounding box that fits it
TileGrid tileGrid = TileBoundingBoxUtils . getTileGridWGS84 ( boundingBox , zoom ) ; tileGridBoundingBox = TileBoundingBoxUtils . getWGS84BoundingBox ( tileGrid , zoom ) ; matrixWidth = tileGrid . getMaxX ( ) + 1 - tileGrid . getMinX ( ) ; matrixHeight = tileGrid . getMaxY ( ) + 1 - tileGrid . getMinY ( ) ;


signature:
public class TileGenerator { /** * Adjust the tile matrix set and web mercator bounds for GeoPackage format .
 * Determine the tile grid width and height
 * @ param requestWebMercatorBoundingBox
 * @ param zoom */
private void adjustGeoPackageBounds ( BoundingBox requestWebMercatorBoundingBox , int zoom ) { } }

implementation:
// Get the fitting tile grid and determine the bounding box that
// fits it
TileGrid tileGrid = TileBoundingBoxUtils . getTileGrid ( requestWebMercatorBoundingBox , zoom ) ; tileGridBoundingBox = TileBoundingBoxUtils . getWebMercatorBoundingBox ( tileGrid , zoom ) ; matrixWidth = tileGrid . getMaxX ( ) + 1 - tileGrid . getMinX ( ) ; matrixHeight = tileGrid . getMaxY ( ) + 1 - tileGrid . getMinY ( ) ;


signature:
public class TileDao { /** * Get the bounding box of tiles
 * @ param zoomLevel zoom level
 * @ return bounding box of zoom level , or null if no tiles
 * @ since 1.1.1 */
public BoundingBox getBoundingBox ( long zoomLevel ) { } }

implementation: BoundingBox boundingBox = null ; TileMatrix tileMatrix = getTileMatrix ( zoomLevel ) ; if ( tileMatrix != null ) { TileGrid tileGrid = queryForTileGrid ( zoomLevel ) ; if ( tileGrid != null ) { BoundingBox matrixSetBoundingBox = getBoundingBox ( ) ; boundingBox = TileBoundingBoxUtils . getBoundingBox ( matrixSetBoundingBox , tileMatrix , tileGrid ) ; } } return boundingBox ;


signature:
public class TileDao { /** * Get the tile grid of the zoom level
 * @ param zoomLevel zoom level
 * @ return tile grid at zoom level , null if not tile matrix at zoom level
 * @ since 1.1.1 */
public TileGrid getTileGrid ( long zoomLevel ) { } }

implementation: TileGrid tileGrid = null ; TileMatrix tileMatrix = getTileMatrix ( zoomLevel ) ; if ( tileMatrix != null ) { tileGrid = new TileGrid ( 0 , 0 , tileMatrix . getMatrixWidth ( ) - 1 , tileMatrix . getMatrixHeight ( ) - 1 ) ; } return tileGrid ;


signature:
public class TileDao { /** * Query for a Tile
 * @ param column column
 * @ param row row
 * @ param zoomLevel zoom level
 * @ return tile row */
public TileRow queryForTile ( long column , long row , long zoomLevel ) { } }

implementation: Map < String , Object > fieldValues = new HashMap < String , Object > ( ) ; fieldValues . put ( TileTable . COLUMN_TILE_COLUMN , column ) ; fieldValues . put ( TileTable . COLUMN_TILE_ROW , row ) ; fieldValues . put ( TileTable . COLUMN_ZOOM_LEVEL , zoomLevel ) ; TileCursor cursor = queryForFieldValues ( fieldValues ) ; TileRow tileRow = null ; try { if ( cursor . moveToNext ( ) ) { tileRow = cursor . getRow ( ) ; } } finally { cursor . close ( ) ; } return tileRow ;


signature:
public class TileDao { /** * Query for Tiles at a zoom level in descending row and column order
 * @ param zoomLevel zoom level
 * @ return tile cursor , should be closed */
public TileCursor queryForTileDescending ( long zoomLevel ) { } }

implementation: return queryForEq ( TileTable . COLUMN_ZOOM_LEVEL , zoomLevel , null , null , TileTable . COLUMN_TILE_ROW + " DESC, " + TileTable . COLUMN_TILE_COLUMN + " DESC" ) ;


signature:
public class TileDao { /** * Get the zoom level for the provided width and height in the default units
 * @ param length in default units
 * @ return zoom level */
public Long getZoomLevel ( double length ) { } }

implementation: Long zoomLevel = TileDaoUtils . getZoomLevel ( widths , heights , tileMatrices , length ) ; return zoomLevel ;


signature:
public class TileDao { /** * Get the zoom level for the provided width and height in the default units
 * @ param width in default units
 * @ param height in default units
 * @ return zoom level
 * @ since 1.3.1 */
public Long getZoomLevel ( double width , double height ) { } }

implementation: Long zoomLevel = TileDaoUtils . getZoomLevel ( widths , heights , tileMatrices , width , height ) ; return zoomLevel ;


signature:
public class TileDao { /** * Get the closest zoom level for the provided width and height in the
 * default units
 * @ param length in default units
 * @ return zoom level
 * @ since 1.3.1 */
public Long getClosestZoomLevel ( double length ) { } }

implementation: Long zoomLevel = TileDaoUtils . getClosestZoomLevel ( widths , heights , tileMatrices , length ) ; return zoomLevel ;


signature:
public class TileDao { /** * Get the approximate zoom level for the provided length in the default
 * units . Tiles may or may not exist for the returned zoom level . The
 * approximate zoom level is determined using a factor of 2 from the zoom
 * levels with tiles .
 * @ param length length in default units
 * @ return approximate zoom level
 * @ since 2.0.2 */
public Long getApproximateZoomLevel ( double length ) { } }

implementation: Long zoomLevel = TileDaoUtils . getApproximateZoomLevel ( widths , heights , tileMatrices , length ) ; return zoomLevel ;


signature:
public class TileDao { /** * Query for the bounding
 * @ param zoomLevel zoom level
 * @ return tile grid of tiles at the zoom level
 * @ since 1.1.1 */
public TileGrid queryForTileGrid ( long zoomLevel ) { } }

implementation: String where = buildWhere ( TileTable . COLUMN_ZOOM_LEVEL , zoomLevel ) ; String [ ] whereArgs = buildWhereArgs ( new Object [ ] { zoomLevel } ) ; Integer minX = min ( TileTable . COLUMN_TILE_COLUMN , where , whereArgs ) ; Integer maxX = max ( TileTable . COLUMN_TILE_COLUMN , where , whereArgs ) ; Integer minY = min ( TileTable . COLUMN_TILE_ROW , where , whereArgs ) ; Integer maxY = max ( TileTable . COLUMN_TILE_ROW , where , whereArgs ) ; TileGrid tileGrid = null ; if ( minX != null && maxX != null && minY != null && maxY != null ) { tileGrid = new TileGrid ( minX , minY , maxX , maxY ) ; } return tileGrid ;


signature:
public class TileDao { /** * Delete a Tile
 * @ param column column
 * @ param row row
 * @ param zoomLevel zoom level
 * @ return number deleted , should be 0 or 1 */
public int deleteTile ( long column , long row , long zoomLevel ) { } }

implementation: StringBuilder where = new StringBuilder ( ) ; where . append ( buildWhere ( TileTable . COLUMN_ZOOM_LEVEL , zoomLevel ) ) ; where . append ( " AND " ) ; where . append ( buildWhere ( TileTable . COLUMN_TILE_COLUMN , column ) ) ; where . append ( " AND " ) ; where . append ( buildWhere ( TileTable . COLUMN_TILE_ROW , row ) ) ; String [ ] whereArgs = buildWhereArgs ( new Object [ ] { zoomLevel , column , row } ) ; int deleted = delete ( where . toString ( ) , whereArgs ) ; return deleted ;


signature:
public class TileDao { /** * Count of Tiles at a zoom level
 * @ param zoomLevel zoom level
 * @ return count */
public int count ( long zoomLevel ) { } }

implementation: String where = buildWhere ( TileTable . COLUMN_ZOOM_LEVEL , zoomLevel ) ; String [ ] whereArgs = buildWhereArgs ( zoomLevel ) ; return count ( where , whereArgs ) ;


signature:
public class TileDao { /** * Determine if the tiles are in the Google tile coordinate format
 * @ return google tiles flag */
public boolean isGoogleTiles ( ) { } }

implementation:
// Convert the bounding box to wgs84
BoundingBox boundingBox = tileMatrixSet . getBoundingBox ( ) ; BoundingBox wgs84BoundingBox = boundingBox . transform ( projection . getTransformation ( ProjectionConstants . EPSG_WORLD_GEODETIC_SYSTEM ) ) ; boolean googleTiles = false ; // Verify the bounds are the entire world
if ( wgs84BoundingBox . getMinLatitude ( ) <= ProjectionConstants . WEB_MERCATOR_MIN_LAT_RANGE && wgs84BoundingBox . getMaxLatitude ( ) >= ProjectionConstants . WEB_MERCATOR_MAX_LAT_RANGE && wgs84BoundingBox . getMinLongitude ( ) <= - ProjectionConstants . WGS84_HALF_WORLD_LON_WIDTH && wgs84BoundingBox . getMaxLongitude ( ) >= ProjectionConstants . WGS84_HALF_WORLD_LON_WIDTH ) { googleTiles = true ; // Verify each tile matrix is the correct width and height
for ( TileMatrix tileMatrix : tileMatrices ) { long zoomLevel = tileMatrix . getZoomLevel ( ) ; long tilesPerSide = TileBoundingBoxUtils . tilesPerSide ( ( int ) zoomLevel ) ; if ( tileMatrix . getMatrixWidth ( ) != tilesPerSide || tileMatrix . getMatrixHeight ( ) != tilesPerSide ) { googleTiles = false ; break ; } } } return googleTiles ;


signature:
public class CoverageDataTiff { /** * { @ inheritDoc } */
@ Override public Double getValue ( GriddedTile griddedTile , CoverageDataTiffImage image , int x , int y ) { } }

implementation: Double value = null ; if ( image . getDirectory ( ) != null ) { float pixelValue = image . getPixel ( x , y ) ; value = getValue ( griddedTile , pixelValue ) ; } else { value = getValue ( griddedTile , image . getImageBytes ( ) , x , y ) ; } return value ;


signature:
public class CoverageDataTiff { /** * Get the pixel value as a float from the image and the coordinate
 * @ param imageBytes image bytes
 * @ param x x coordinate
 * @ param y y coordinate
 * @ return float pixel value */
public float getPixelValue ( byte [ ] imageBytes , int x , int y ) { } }

implementation: TIFFImage tiffImage = TiffReader . readTiff ( imageBytes ) ; FileDirectory directory = tiffImage . getFileDirectory ( ) ; validateImageType ( directory ) ; Rasters rasters = directory . readRasters ( ) ; float pixelValue = rasters . getFirstPixelSample ( x , y ) . floatValue ( ) ; return pixelValue ;


signature:
public class CoverageDataTiff { /** * Get the pixel values of the image as floats
 * @ param imageBytes image bytes
 * @ return float pixel values */
public float [ ] getPixelValues ( byte [ ] imageBytes ) { } }

implementation: TIFFImage tiffImage = TiffReader . readTiff ( imageBytes ) ; FileDirectory directory = tiffImage . getFileDirectory ( ) ; validateImageType ( directory ) ; Rasters rasters = directory . readRasters ( ) ; float [ ] pixels = new float [ rasters . getWidth ( ) * rasters . getHeight ( ) ] ; for ( int y = 0 ; y < rasters . getHeight ( ) ; y ++ ) { for ( int x = 0 ; x < rasters . getWidth ( ) ; x ++ ) { int index = rasters . getSampleIndex ( x , y ) ; pixels [ index ] = rasters . getPixelSample ( 0 , x , y ) . floatValue ( ) ; } } return pixels ;


signature:
public class CoverageDataTiff { /** * Validate that the image type
 * @ param directory file directory */
public static void validateImageType ( FileDirectory directory ) { } }

implementation: if ( directory == null ) { throw new GeoPackageException ( "The image is null" ) ; } int samplesPerPixel = directory . getSamplesPerPixel ( ) ; Integer bitsPerSample = null ; if ( directory . getBitsPerSample ( ) != null && ! directory . getBitsPerSample ( ) . isEmpty ( ) ) { bitsPerSample = directory . getBitsPerSample ( ) . get ( 0 ) ; } Integer sampleFormat = null ; if ( directory . getSampleFormat ( ) != null && ! directory . getSampleFormat ( ) . isEmpty ( ) ) { sampleFormat = directory . getSampleFormat ( ) . get ( 0 ) ; } if ( samplesPerPixel != SAMPLES_PER_PIXEL || bitsPerSample == null || bitsPerSample != BITS_PER_SAMPLE || sampleFormat == null || sampleFormat != TiffConstants . SAMPLE_FORMAT_FLOAT ) { throw new GeoPackageException ( "The coverage data tile is expected to be a single sample 32 bit float. Samples Per Pixel: " + samplesPerPixel + ", Bits Per Sample: " + bitsPerSample + ", Sample Format: " + sampleFormat ) ; }


signature:
public class CoverageDataTiff { /** * { @ inheritDoc } */
@ Override public Double getValue ( GriddedTile griddedTile , byte [ ] imageBytes , int x , int y ) { } }

implementation: float pixelValue = getPixelValue ( imageBytes , x , y ) ; Double value = getValue ( griddedTile , pixelValue ) ; return value ;


signature:
public class CoverageDataTiff { /** * { @ inheritDoc } */
@ Override public Double [ ] getValues ( GriddedTile griddedTile , byte [ ] imageBytes ) { } }

implementation: float [ ] pixelValues = getPixelValues ( imageBytes ) ; Double [ ] values = getValues ( griddedTile , pixelValues ) ; return values ;


signature:
public class CoverageDataTiff { /** * Draw a coverage data image tile from the flat array of float pixel values of
 * length tileWidth * tileHeight where each pixel is at : ( y * tileWidth ) + x
 * @ param pixelValues float pixel values of length tileWidth * tileHeight
 * @ param tileWidth tile width
 * @ param tileHeight tile height
 * @ return coverage data image tile */
public CoverageDataTiffImage drawTile ( float [ ] pixelValues , int tileWidth , int tileHeight ) { } }

implementation: CoverageDataTiffImage image = createImage ( tileWidth , tileHeight ) ; for ( int y = 0 ; y < tileHeight ; y ++ ) { for ( int x = 0 ; x < tileWidth ; x ++ ) { float pixelValue = pixelValues [ ( y * tileWidth ) + x ] ; setPixelValue ( image , x , y , pixelValue ) ; } } image . writeTiff ( ) ; return image ;


signature:
public class CoverageDataTiff { /** * Draw a coverage data image tile and format as TIFF bytes from the double
 * array of float pixel values formatted as float [ row ] [ width ]
 * @ param pixelValues float pixel values as [ row ] [ width ]
 * @ return coverage data image tile bytes */
public byte [ ] drawTileData ( float [ ] [ ] pixelValues ) { } }

implementation: CoverageDataTiffImage image = drawTile ( pixelValues ) ; byte [ ] bytes = image . getImageBytes ( ) ; return bytes ;


signature:
public class CoverageDataTiff { /** * Draw a coverage data image tile from the flat array of coverage data values of length
 * tileWidth * tileHeight where each coverage data value is at : ( y * tileWidth ) + x
 * @ param griddedTile gridded tile
 * @ param values coverage data values of length tileWidth * tileHeight
 * @ param tileWidth tile width
 * @ param tileHeight tile height
 * @ return coverage data image tile */
public CoverageDataTiffImage drawTile ( GriddedTile griddedTile , Double [ ] values , int tileWidth , int tileHeight ) { } }

implementation: CoverageDataTiffImage image = createImage ( tileWidth , tileHeight ) ; for ( int x = 0 ; x < tileWidth ; x ++ ) { for ( int y = 0 ; y < tileHeight ; y ++ ) { Double value = values [ ( y * tileWidth ) + x ] ; float pixelValue = getPixelValue ( griddedTile , value ) ; setPixelValue ( image , x , y , pixelValue ) ; } } image . writeTiff ( ) ; return image ;


signature:
public class CoverageDataTiff { /** * { @ inheritDoc } */
@ Override public byte [ ] drawTileData ( GriddedTile griddedTile , Double [ ] values , int tileWidth , int tileHeight ) { } }

implementation: CoverageDataTiffImage image = drawTile ( griddedTile , values , tileWidth , tileHeight ) ; byte [ ] bytes = image . getImageBytes ( ) ; return bytes ;


signature:
public class CoverageDataTiff { /** * Create a new image
 * @ param tileWidth tile width
 * @ param tileHeight tile height
 * @ return image */
public CoverageDataTiffImage createImage ( int tileWidth , int tileHeight ) { } }

implementation: Rasters rasters = new Rasters ( tileWidth , tileHeight , 1 , BITS_PER_SAMPLE , TiffConstants . SAMPLE_FORMAT_FLOAT ) ; int rowsPerStrip = rasters . calculateRowsPerStrip ( TiffConstants . PLANAR_CONFIGURATION_CHUNKY ) ; FileDirectory fileDirectory = new FileDirectory ( ) ; fileDirectory . setImageWidth ( tileWidth ) ; fileDirectory . setImageHeight ( tileHeight ) ; fileDirectory . setBitsPerSample ( BITS_PER_SAMPLE ) ; fileDirectory . setCompression ( TiffConstants . COMPRESSION_NO ) ; fileDirectory . setPhotometricInterpretation ( TiffConstants . PHOTOMETRIC_INTERPRETATION_BLACK_IS_ZERO ) ; fileDirectory . setSamplesPerPixel ( SAMPLES_PER_PIXEL ) ; fileDirectory . setRowsPerStrip ( rowsPerStrip ) ; fileDirectory . setPlanarConfiguration ( TiffConstants . PLANAR_CONFIGURATION_CHUNKY ) ; fileDirectory . setSampleFormat ( TiffConstants . SAMPLE_FORMAT_FLOAT ) ; fileDirectory . setWriteRasters ( rasters ) ; CoverageDataTiffImage image = new CoverageDataTiffImage ( fileDirectory ) ; return image ;


signature:
public class CoverageDataTiff { /** * Set the pixel value into the image
 * @ param image image
 * @ param x x coordinate
 * @ param y y coordinate
 * @ param pixelValue pixel value */
public void setPixelValue ( CoverageDataTiffImage image , int x , int y , float pixelValue ) { } }

implementation: image . getRasters ( ) . setFirstPixelSample ( x , y , pixelValue ) ;


signature:
public class CoverageDataTiff { /** * Create the coverage data tile table with metadata and extension
 * @ param geoPackage GeoPackage
 * @ param tableName table name
 * @ param contentsBoundingBox contents bounding box
 * @ param contentsSrsId contents srs id
 * @ param tileMatrixSetBoundingBox tile matrix set bounding box
 * @ param tileMatrixSetSrsId tile matrix set srs id
 * @ return coverage data */
public static CoverageDataTiff createTileTableWithMetadata ( GeoPackage geoPackage , String tableName , BoundingBox contentsBoundingBox , long contentsSrsId , BoundingBox tileMatrixSetBoundingBox , long tileMatrixSetSrsId ) { } }

implementation: CoverageDataTiff coverageData = ( CoverageDataTiff ) CoverageData . createTileTableWithMetadata ( geoPackage , tableName , contentsBoundingBox , contentsSrsId , tileMatrixSetBoundingBox , tileMatrixSetSrsId , GriddedCoverageDataType . FLOAT ) ; return coverageData ;


signature:
public class FeatureRowData { /** * Build a JSON compatible object
 * @ param includePoints true to include point geometries , ignored if includeGeometries is true
 * @ param includeGeometries true to include all geometry types
 * @ return JSON compatible object */
public Object jsonCompatible ( boolean includePoints , boolean includeGeometries ) { } }

implementation: Map < String , Object > jsonValues = new HashMap < > ( ) ; for ( String key : values . keySet ( ) ) { Object jsonValue = null ; Object value = values . get ( key ) ; if ( key . equals ( geometryColumn ) ) { GeoPackageGeometryData geometryData = ( GeoPackageGeometryData ) value ; if ( geometryData . getGeometry ( ) != null ) { if ( includeGeometries || ( includePoints && geometryData . getGeometry ( ) . getGeometryType ( ) == GeometryType . POINT ) ) { jsonValue = FeatureConverter . toMap ( geometryData . getGeometry ( ) ) ; } } else { jsonValue = value ; } if ( jsonValue != null ) { jsonValues . put ( key , jsonValue ) ; } } } return jsonValues ;


signature:
public class GeoPackageCache { /** * Get the cached GeoPackage or open and cache the GeoPackage
 * @ param name GeoPackage name
 * @ param writable writable true to open as writable , false as read only
 * @ param cache true to cache opened GeoPackages
 * @ return GeoPackage */
private GeoPackage getOrOpen ( String name , boolean writable , boolean cache ) { } }

implementation: GeoPackage geoPackage = get ( name ) ; if ( geoPackage == null ) { geoPackage = manager . open ( name , writable ) ; if ( cache ) { add ( geoPackage ) ; } } return geoPackage ;


signature:
public class UserCursor { /** * { @ inheritDoc } */
@ Override public Object getValue ( TColumn column ) { } }

implementation: return getValue ( column . getIndex ( ) , column . getDataType ( ) ) ;


signature:
public class UserCursor { /** * { @ inheritDoc } */
@ Override public TRow getRow ( ) { } }

implementation: TRow row ; if ( invalidCursor == null ) { row = getCurrentRow ( ) ; } else { row = invalidCursor . getRow ( ) ; } return row ;


signature:
public class UserCursor { /** * Get the current row
 * @ return row */
private TRow getCurrentRow ( ) { } }

implementation: TRow row = null ; if ( table != null ) { int [ ] columnTypes = new int [ table . columnCount ( ) ] ; Object [ ] values = new Object [ table . columnCount ( ) ] ; boolean valid = true ; for ( TColumn column : table . getColumns ( ) ) { int index = column . getIndex ( ) ; int columnType = getType ( index ) ; if ( column . isPrimaryKey ( ) && columnType == FIELD_TYPE_NULL ) { valid = false ; } columnTypes [ index ] = columnType ; values [ index ] = getValue ( column ) ; } row = getRow ( columnTypes , values ) ; if ( ! valid ) { invalidPositions . add ( getPosition ( ) ) ; row . setValid ( false ) ; } } return row ;


signature:
public class UserCursor { /** * { @ inheritDoc } */
@ Override public Object getValue ( int index , GeoPackageDataType dataType ) { } }

implementation: return ResultUtils . getValue ( invalidCursor == null ? this : invalidCursor , index , dataType ) ;


signature:
public class UserCursor { /** * Enable requery attempt of invalid rows after iterating through original query rows .
 * Only supported for { @ link # moveToNext ( ) } and { @ link # getRow ( ) } usage .
 * @ param dao data access object used to perform requery
 * @ since 2.0.0 */
protected void enableInvalidRequery ( UserDao < TColumn , TTable , TRow , ? extends UserCursor < TColumn , TTable , TRow > > dao ) { } }

implementation: this . dao = dao ;


signature:
public class UserCursor { /** * Move to the next position of invalid rows to requery . Perform the requery the first time .
 * @ return true if invalid rows are left */
private boolean moveToNextInvalid ( ) { } }

implementation:
boolean hasNext = false ; // If requery has not been performed , a requery dao has been set , and there are invalid positions
if ( invalidCursor == null && dao != null && hasInvalidPositions ( ) ) { // Close the original cursor when performing an invalid cursor query
super . close ( ) ; // Set the blob columns to return as null
List < TColumn > blobColumns = dao . getTable ( ) . columnsOfType ( GeoPackageDataType . BLOB ) ; String [ ] columnsAs = dao . buildColumnsAsNull ( blobColumns ) ; query . set ( UserQueryParamType . COLUMNS_AS , columnsAs ) ; // Query without blob columns and create an invalid cursor
UserCursor < TColumn , TTable , TRow > requeryCursor = dao . query ( query ) ; invalidCursor = createInvalidCursor ( dao , requeryCursor , getInvalidPositions ( ) , blobColumns ) ; } if ( invalidCursor != null ) { hasNext = invalidCursor . moveToNext ( ) ; } return hasNext ;


signature:
public class FeatureDao { /** * { @ inheritDoc } */
@ Override public BoundingBox getBoundingBox ( Projection projection ) { } }

implementation: Contents contents = geometryColumns . getContents ( ) ; BoundingBox boundingBox = contents . getBoundingBox ( projection ) ; return boundingBox ;


signature:
public class FeatureTableData { /** * Build a JSON compatible object
 * @ param includePoints true to include point geometries , ignored if includeGeometries is true
 * @ param includeGeometries true to include all geometry types
 * @ return JSON compatible object */
public Object jsonCompatible ( boolean includePoints , boolean includeGeometries ) { } }

implementation: Object jsonObject = null ; if ( rows == null || rows . isEmpty ( ) ) { jsonObject = count ; } else { List < Object > jsonRows = new ArrayList < > ( ) ; for ( FeatureRowData row : rows ) { jsonRows . add ( row . jsonCompatible ( includePoints , includeGeometries ) ) ; } jsonObject = jsonRows ; } return jsonObject ;


signature:
public class StyleMappingDao { /** * Query for style mappings by base id
 * @ param id base id , feature contents id or feature geometry id
 * @ return style mappings rows */
public List < StyleMappingRow > queryByBaseFeatureId ( long id ) { } }

implementation: List < StyleMappingRow > rows = new ArrayList < > ( ) ; UserCustomCursor cursor = queryByBaseId ( id ) ; try { while ( cursor . moveToNext ( ) ) { rows . add ( getRow ( cursor ) ) ; } } finally { cursor . close ( ) ; } return rows ;


signature:
public class StyleMappingDao { /** * Delete by base is and geometry type
 * @ param id base id
 * @ param geometryType geometry type
 * @ return rows deleted */
public int deleteByBaseId ( long id , GeometryType geometryType ) { } }

implementation: String geometryTypeName = null ; if ( geometryType != null ) { geometryTypeName = geometryType . getName ( ) ; } StringBuilder where = new StringBuilder ( ) ; where . append ( buildWhere ( StyleMappingTable . COLUMN_BASE_ID , id ) ) ; where . append ( " AND " ) ; where . append ( buildWhere ( StyleMappingTable . COLUMN_GEOMETRY_TYPE_NAME , geometryTypeName ) ) ; List < Object > whereArguments = new ArrayList < > ( ) ; whereArguments . add ( id ) ; if ( geometryTypeName != null ) { whereArguments . add ( geometryTypeName ) ; } String [ ] whereArgs = buildWhereArgs ( whereArguments ) ; int deleted = delete ( where . toString ( ) , whereArgs ) ; return deleted ;


signature:
public class TileBoundingBoxAndroidUtils { /** * Get a rectangle using the tile width , height , bounding box , and the
 * bounding box section within the outer box to build the rectangle from
 * @ param width width
 * @ param height height
 * @ param boundingBox full bounding box
 * @ param boundingBoxSection rectangle bounding box section
 * @ return rectangle */
public static Rect getRectangle ( long width , long height , BoundingBox boundingBox , BoundingBox boundingBoxSection ) { } }

implementation: RectF rectF = getFloatRectangle ( width , height , boundingBox , boundingBoxSection ) ; Rect rect = new Rect ( Math . round ( rectF . left ) , Math . round ( rectF . top ) , Math . round ( rectF . right ) , Math . round ( rectF . bottom ) ) ; return rect ;


signature:
public class TileBoundingBoxAndroidUtils { /** * Get a rectangle with rounded floating point boundaries using the tile width ,
 * height , bounding box , and the bounding box section within the outer box
 * to build the rectangle from
 * @ param width width
 * @ param height height
 * @ param boundingBox full bounding box
 * @ param boundingBoxSection rectangle bounding box section
 * @ return floating point rectangle
 * @ since 1.3.0 */
public static RectF getRoundedFloatRectangle ( long width , long height , BoundingBox boundingBox , BoundingBox boundingBoxSection ) { } }

implementation: Rect rect = getRectangle ( width , height , boundingBox , boundingBoxSection ) ; RectF rectF = new RectF ( rect ) ; return rectF ;


signature:
public class TileBoundingBoxAndroidUtils { /** * Check if the rectangle is valid
 * @ param rect rectangle
 * @ return true if valid
 * @ since 1.3.1 */
public static boolean isValid ( Rect rect ) { } }

implementation: return rect . left < rect . right && rect . top < rect . bottom ;


signature:
public class TileBoundingBoxAndroidUtils { /** * Check if the rectangle is valid allowing empty ranges
 * @ param rect rectangle
 * @ return true if valid
 * @ since 1.3.1 */
public static boolean isValidAllowEmpty ( Rect rect ) { } }

implementation: return rect . left <= rect . right && rect . top <= rect . bottom ;


signature:
public class TileBoundingBoxAndroidUtils { /** * Check if the rectangle is valid
 * @ param rectF rectangle
 * @ return true if valid
 * @ since 1.3.1 */
public static boolean isValid ( RectF rectF ) { } }

implementation: return rectF . left < rectF . right && rectF . top < rectF . bottom ;


signature:
public class TileBoundingBoxAndroidUtils { /** * Check if the rectangle is valid allowing empty ranges
 * @ param rectF rectangle
 * @ return true if valid
 * @ since 1.3.1 */
public static boolean isValidAllowEmpty ( RectF rectF ) { } }

implementation: return rectF . left <= rectF . right && rectF . top <= rectF . bottom ;


signature:
public class GeoPackageManagerImpl { /** * { @ inheritDoc } */
@ Override public List < String > databases ( ) { } }

implementation: Set < String > sortedDatabases = new TreeSet < String > ( ) ; addDatabases ( sortedDatabases ) ; List < String > databases = new ArrayList < String > ( ) ; databases . addAll ( sortedDatabases ) ; return databases ;


signature:
public class GeoPackageManagerImpl { /** * { @ inheritDoc } */
@ Override public List < String > databasesLike ( String like ) { } }

implementation: List < String > databases = null ; GeoPackageMetadataDb metadataDb = new GeoPackageMetadataDb ( context ) ; metadataDb . open ( ) ; try { GeoPackageMetadataDataSource dataSource = new GeoPackageMetadataDataSource ( metadataDb ) ; databases = dataSource . getMetadataWhereNameLike ( like , GeoPackageMetadata . COLUMN_NAME ) ; } finally { metadataDb . close ( ) ; } databases = deleteMissingDatabases ( databases ) ; return databases ;


signature:
public class GeoPackageManagerImpl { /** * { @ inheritDoc } */
@ Override public List < String > databasesNotLike ( String notLike ) { } }

implementation: List < String > databases = null ; GeoPackageMetadataDb metadataDb = new GeoPackageMetadataDb ( context ) ; metadataDb . open ( ) ; try { GeoPackageMetadataDataSource dataSource = new GeoPackageMetadataDataSource ( metadataDb ) ; databases = dataSource . getMetadataWhereNameNotLike ( notLike , GeoPackageMetadata . COLUMN_NAME ) ; } finally { metadataDb . close ( ) ; } databases = deleteMissingDatabases ( databases ) ; return databases ;


signature:
public class GeoPackageManagerImpl { /** * Delete all databases that do not exist or the database file does not exist
 * @ param databases list of databases
 * @ return databases that exist */
private List < String > deleteMissingDatabases ( List < String > databases ) { } }

implementation: List < String > filesExist = new ArrayList < > ( ) ; for ( String database : databases ) { if ( exists ( database ) ) { filesExist . add ( database ) ; } } return filesExist ;


signature:
public class GeoPackageManagerImpl { /** * { @ inheritDoc } */
@ Override public List < String > internalDatabases ( ) { } }

implementation: Set < String > sortedDatabases = new TreeSet < String > ( ) ; addInternalDatabases ( sortedDatabases ) ; List < String > databases = new ArrayList < String > ( ) ; databases . addAll ( sortedDatabases ) ; return databases ;


signature:
public class GeoPackageManagerImpl { /** * { @ inheritDoc } */
@ Override public List < String > externalDatabases ( ) { } }

implementation: Set < String > sortedDatabases = new TreeSet < String > ( ) ; addExternalDatabases ( sortedDatabases ) ; List < String > databases = new ArrayList < String > ( ) ; databases . addAll ( sortedDatabases ) ; return databases ;


signature:
public class GeoPackageManagerImpl { /** * { @ inheritDoc } */
@ Override public Set < String > databaseSet ( ) { } }

implementation: Set < String > databases = new HashSet < String > ( ) ; addDatabases ( databases ) ; return databases ;


signature:
public class GeoPackageManagerImpl { /** * { @ inheritDoc } */
@ Override public Set < String > internalDatabaseSet ( ) { } }

implementation: Set < String > databases = new HashSet < String > ( ) ; addInternalDatabases ( databases ) ; return databases ;


signature:
public class GeoPackageManagerImpl { /** * { @ inheritDoc } */
@ Override public Set < String > externalDatabaseSet ( ) { } }

implementation: Set < String > databases = new HashSet < String > ( ) ; addExternalDatabases ( databases ) ; return databases ;


signature:
public class GeoPackageManagerImpl { /** * { @ inheritDoc } */
@ Override public boolean exists ( String database ) { } }

implementation: boolean exists = internalDatabaseSet ( ) . contains ( database ) ; if ( ! exists ) { GeoPackageMetadataDb metadataDb = new GeoPackageMetadataDb ( context ) ; metadataDb . open ( ) ; try { GeoPackageMetadataDataSource dataSource = new GeoPackageMetadataDataSource ( metadataDb ) ; GeoPackageMetadata metadata = dataSource . get ( database ) ; if ( metadata != null ) { if ( metadata . getExternalPath ( ) != null && ! new File ( metadata . getExternalPath ( ) ) . exists ( ) ) { delete ( database ) ; } else { exists = true ; } } } finally { metadataDb . close ( ) ; } } return exists ;


signature:
public class GeoPackageManagerImpl { /** * { @ inheritDoc } */
@ Override public long size ( String database ) { } }

implementation: File dbFile = getFile ( database ) ; long size = dbFile . length ( ) ; return size ;


signature:
public class GeoPackageManagerImpl { /** * { @ inheritDoc } */
@ Override public boolean isExternal ( String database ) { } }

implementation: boolean external = false ; GeoPackageMetadataDb metadataDb = new GeoPackageMetadataDb ( context ) ; metadataDb . open ( ) ; try { GeoPackageMetadataDataSource dataSource = new GeoPackageMetadataDataSource ( metadataDb ) ; external = dataSource . isExternal ( database ) ; } finally { metadataDb . close ( ) ; } return external ;