idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
127,400 | public StyleRow getStyle ( GeometryType geometryType ) { StyleRow styleRow = null ; if ( geometryType != null && ! styles . isEmpty ( ) ) { List < GeometryType > geometryTypes = GeometryUtils . parentHierarchy ( geometryType ) ; geometryTypes . add ( 0 , geometryType ) ; for ( GeometryType type : geometryTypes ) { styl... | Get the style for the geometry type |
127,401 | protected int count ( UserCustomResultSet resultSet ) { int count = 0 ; try { count = resultSet . getCount ( ) ; } finally { resultSet . close ( ) ; } return count ; } | Get the count of the result set and close it |
127,402 | public static UserCustomDao readTable ( String database , GeoPackageConnection connection , String tableName ) { UserCustomConnection userDb = new UserCustomConnection ( connection ) ; UserCustomTable userCustomTable = UserCustomTableReader . readTable ( userDb , tableName ) ; UserCustomDao dao = new UserCustomDao ( da... | Read the database table and create a DAO |
127,403 | private ResultSet integrityCheck ( ResultSet resultSet ) { try { if ( resultSet . next ( ) ) { String value = resultSet . getString ( 1 ) ; if ( value . equals ( "ok" ) ) { resultSet . close ( ) ; resultSet = null ; } } } catch ( SQLException e ) { throw new GeoPackageException ( "Integrity check failed on database: " ... | Check the result set returned from the integrity check to see if things are ok |
127,404 | public void setTileFormat ( TileFormatType tileFormat ) { if ( tileFormat == null ) { tileFormat = TileFormatType . STANDARD ; } else { switch ( tileFormat ) { case STANDARD : case TMS : this . tileFormat = tileFormat ; break ; default : throw new GeoPackageException ( "Unsupported Tile Format Type for URL Tile Generat... | Set the tile format |
127,405 | private String replaceXYZ ( String url , int z , long x , long y ) { url = url . replaceAll ( Z_VARIABLE , String . valueOf ( z ) ) ; url = url . replaceAll ( X_VARIABLE , String . valueOf ( x ) ) ; url = url . replaceAll ( Y_VARIABLE , String . valueOf ( y ) ) ; return url ; } | Replace x y and z in the url |
127,406 | private String replaceBoundingBox ( String url , BoundingBox boundingBox ) { url = url . replaceAll ( MIN_LAT_VARIABLE , String . valueOf ( boundingBox . getMinLatitude ( ) ) ) ; url = url . replaceAll ( MAX_LAT_VARIABLE , String . valueOf ( boundingBox . getMaxLatitude ( ) ) ) ; url = url . replaceAll ( MIN_LON_VARIAB... | Replace the url parts with the bounding box |
127,407 | private byte [ ] downloadTile ( String zoomUrl , URL url , int z , long x , long y ) { byte [ ] bytes = null ; HttpURLConnection connection = null ; try { connection = ( HttpURLConnection ) url . openConnection ( ) ; connection . connect ( ) ; int responseCode = connection . getResponseCode ( ) ; if ( responseCode == H... | Download the tile from the URL |
127,408 | private boolean drawFeature ( int zoom , BoundingBox boundingBox , BoundingBox expandedBoundingBox , ProjectionTransform transform , FeatureTileGraphics graphics , FeatureRow row ) { boolean drawn = false ; try { GeoPackageGeometryData geomData = row . getGeometry ( ) ; if ( geomData != null ) { Geometry geometry = geo... | Draw the feature |
127,409 | private boolean drawLineString ( double simplifyTolerance , BoundingBox boundingBox , ProjectionTransform transform , FeatureTileGraphics graphics , LineString lineString , FeatureStyle featureStyle ) { Path2D path = getPath ( simplifyTolerance , boundingBox , transform , lineString ) ; return drawLine ( graphics , pat... | Draw a LineString |
127,410 | private boolean drawPolygon ( double simplifyTolerance , BoundingBox boundingBox , ProjectionTransform transform , FeatureTileGraphics graphics , Polygon polygon , FeatureStyle featureStyle ) { Area polygonArea = getArea ( simplifyTolerance , boundingBox , transform , polygon ) ; return drawPolygon ( graphics , polygon... | Draw a Polygon |
127,411 | private Path2D getPath ( double simplifyTolerance , BoundingBox boundingBox , ProjectionTransform transform , LineString lineString ) { Path2D path = null ; List < Point > lineStringPoints = simplifyPoints ( simplifyTolerance , lineString . getPoints ( ) ) ; for ( Point point : lineStringPoints ) { Point projectedPoint... | Get the path of the line string |
127,412 | private boolean drawLine ( FeatureTileGraphics graphics , Path2D line , FeatureStyle featureStyle ) { Graphics2D lineGraphics = graphics . getLineGraphics ( ) ; Paint paint = getLinePaint ( featureStyle ) ; lineGraphics . setColor ( paint . getColor ( ) ) ; lineGraphics . setStroke ( paint . getStroke ( ) ) ; boolean d... | Draw the line |
127,413 | private Area getArea ( double simplifyTolerance , BoundingBox boundingBox , ProjectionTransform transform , Polygon polygon ) { Area area = null ; for ( LineString ring : polygon . getRings ( ) ) { Path2D path = getPath ( simplifyTolerance , boundingBox , transform , ring ) ; Area ringArea = new Area ( path ) ; if ( ar... | Get the area of the polygon |
127,414 | private boolean drawPolygon ( FeatureTileGraphics graphics , Area polygon , FeatureStyle featureStyle ) { Graphics2D polygonGraphics = graphics . getPolygonGraphics ( ) ; Paint fillPaint = getPolygonFillPaint ( featureStyle ) ; if ( fillPaint != null ) { polygonGraphics . setColor ( fillPaint . getColor ( ) ) ; polygon... | Draw the polygon |
127,415 | public FeatureRow getFeatureRow ( UserCustomResultSet resultSet ) { RTreeIndexTableRow row = getRow ( resultSet ) ; return getFeatureRow ( row ) ; } | Get the feature row from the RTree Index Table row |
127,416 | public UserCustomResultSet query ( BoundingBox boundingBox , Projection projection ) { BoundingBox featureBoundingBox = projectBoundingBox ( boundingBox , projection ) ; return query ( featureBoundingBox ) ; } | Query for rows within the bounding box in the provided projection |
127,417 | public UserCustomResultSet query ( GeometryEnvelope envelope ) { return query ( envelope . getMinX ( ) , envelope . getMinY ( ) , envelope . getMaxX ( ) , envelope . getMaxY ( ) ) ; } | Query for rows within the geometry envelope |
127,418 | public UserCustomResultSet query ( double minX , double minY , double maxX , double maxY ) { validateRTree ( ) ; String where = buildWhere ( minX , minY , maxX , maxY ) ; String [ ] whereArgs = buildWhereArgs ( minX , minY , maxX , maxY ) ; return query ( where , whereArgs ) ; } | Query for rows within the bounds |
127,419 | public long count ( double minX , double minY , double maxX , double maxY ) { validateRTree ( ) ; String where = buildWhere ( minX , minY , maxX , maxY ) ; String [ ] whereArgs = buildWhereArgs ( minX , minY , maxX , maxY ) ; return count ( where , whereArgs ) ; } | Count the rows within the bounds |
127,420 | public void setData ( BufferedImage image , String imageFormat ) throws IOException { setData ( image , imageFormat , null ) ; } | Set the data from an image |
127,421 | public void setData ( BufferedImage image , String imageFormat , Float quality ) throws IOException { setData ( ImageUtils . writeImageToBytes ( image , imageFormat , quality ) ) ; } | Set the data from an image with optional quality |
127,422 | public TileResultSet queryForTilesInColumn ( long column , long zoomLevel ) { Map < String , Object > fieldValues = new HashMap < String , Object > ( ) ; fieldValues . put ( TileTable . COLUMN_TILE_COLUMN , column ) ; fieldValues . put ( TileTable . COLUMN_ZOOM_LEVEL , zoomLevel ) ; return queryForFieldValues ( fieldVa... | Query for Tiles at a zoom level and column |
127,423 | public TileResultSet queryForTilesInRow ( long row , long zoomLevel ) { Map < String , Object > fieldValues = new HashMap < String , Object > ( ) ; fieldValues . put ( TileTable . COLUMN_TILE_ROW , row ) ; fieldValues . put ( TileTable . COLUMN_ZOOM_LEVEL , zoomLevel ) ; return queryForFieldValues ( fieldValues ) ; } | Query for Tiles at a zoom level and row |
127,424 | public TileResultSet queryByTileGrid ( TileGrid tileGrid , long zoomLevel , String orderBy ) { TileResultSet tileCursor = null ; if ( tileGrid != null ) { StringBuilder where = new StringBuilder ( ) ; where . append ( buildWhere ( TileTable . COLUMN_ZOOM_LEVEL , zoomLevel ) ) ; where . append ( " AND " ) ; where . appe... | Query by tile grid and zoom level |
127,425 | public BufferedImage put ( IconRow iconRow , BufferedImage image ) { return put ( iconRow . getId ( ) , image ) ; } | Cache the icon image for the icon row |
127,426 | public static BufferedImage createIcon ( IconRow icon , float scale , IconCache iconCache ) { BufferedImage iconImage = null ; if ( icon != null ) { if ( iconCache != null ) { iconImage = iconCache . get ( icon . getId ( ) ) ; } if ( iconImage == null ) { try { iconImage = icon . getDataImage ( ) ; } catch ( IOExceptio... | Create or retrieve from cache an icon image for the icon row |
127,427 | private int indexRows ( TableIndex tableIndex , FeatureResultSet resultSet ) { int count = - 1 ; try { while ( ( progress == null || progress . isActive ( ) ) && resultSet . moveToNext ( ) ) { if ( count < 0 ) { count ++ ; } try { FeatureRow row = resultSet . getRow ( ) ; boolean indexed = index ( tableIndex , row . ge... | Index the feature rows in the cursor |
127,428 | public UserCustomDao getUserDao ( String tableName ) { return UserCustomDao . readTable ( getGeoPackage ( ) . getName ( ) , connection , tableName ) ; } | Get a User Custom DAO from a table name |
127,429 | public MediaDao getMediaDao ( String tableName ) { MediaDao mediaDao = new MediaDao ( getUserDao ( tableName ) ) ; setContents ( mediaDao . getTable ( ) ) ; return mediaDao ; } | Get a related media table DAO |
127,430 | public List < Long > getMappingsForBase ( String tableName , long baseId ) { List < Long > relatedIds = new ArrayList < > ( ) ; UserMappingDao userMappingDao = getMappingDao ( tableName ) ; UserCustomResultSet resultSet = userMappingDao . queryByBaseId ( baseId ) ; try { while ( resultSet . moveToNext ( ) ) { UserMappi... | Get the related id mappings for the base id |
127,431 | public List < Long > getMappingsForRelated ( String tableName , long relatedId ) { List < Long > baseIds = new ArrayList < > ( ) ; UserMappingDao userMappingDao = getMappingDao ( tableName ) ; UserCustomResultSet resultSet = userMappingDao . queryByRelatedId ( relatedId ) ; try { while ( resultSet . moveToNext ( ) ) { ... | Get the base id mappings for the related id |
127,432 | public boolean hasMapping ( String tableName , long baseId , long relatedId ) { UserMappingDao userMappingDao = getMappingDao ( tableName ) ; return userMappingDao . countByIds ( baseId , relatedId ) > 0 ; } | Determine if the base id and related id mapping exists |
127,433 | public static void execSQL ( Connection connection , String sql ) { Statement statement = null ; try { statement = connection . createStatement ( ) ; statement . execute ( sql ) ; } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to execute SQL statement: " + sql , e ) ; } finally { closeStatement ( ... | Execute the SQL |
127,434 | public static ResultSet query ( Connection connection , String sql , String [ ] selectionArgs ) { PreparedStatement statement = null ; ResultSet resultSet = null ; try { statement = connection . prepareStatement ( sql ) ; setArguments ( statement , selectionArgs ) ; resultSet = statement . executeQuery ( ) ; } catch ( ... | Query for results |
127,435 | public static int count ( Connection connection , String sql , String [ ] selectionArgs ) { if ( ! sql . toLowerCase ( ) . contains ( " count(*) " ) ) { int index = sql . toLowerCase ( ) . indexOf ( " from " ) ; if ( index == - 1 ) { return - 1 ; } sql = "select count(*)" + sql . substring ( index ) ; } int count = que... | Attempt to count the results of the query |
127,436 | public static Integer max ( Connection connection , String table , String column , String where , String [ ] args ) { Integer max = null ; if ( count ( connection , table , where , args ) > 0 ) { StringBuilder maxQuery = new StringBuilder ( ) ; maxQuery . append ( "select max(" ) . append ( CoreSQLUtils . quoteWrap ( c... | Get the max query result |
127,437 | private static int querySingleInteger ( Connection connection , String sql , String [ ] args , boolean allowEmptyResults ) { int result = 0 ; Object value = querySingleResult ( connection , sql , args , 0 , GeoPackageDataType . MEDIUMINT ) ; if ( value != null ) { result = ( ( Number ) value ) . intValue ( ) ; } else i... | Query the SQL for a single integer result |
127,438 | public static List < Object > querySingleColumnResults ( Connection connection , String sql , String [ ] args , int column , GeoPackageDataType dataType , Integer limit ) { ResultSetResult result = wrapQuery ( connection , sql , args ) ; List < Object > results = ResultUtils . buildSingleColumnResults ( result , column... | Query for values from a single column up to the limit |
127,439 | public static List < List < Object > > queryResults ( Connection connection , String sql , String [ ] args , GeoPackageDataType [ ] dataTypes , Integer limit ) { ResultSetResult result = wrapQuery ( connection , sql , args ) ; List < List < Object > > results = ResultUtils . buildResults ( result , dataTypes , limit ) ... | Query for values up to the limit |
127,440 | public static int delete ( Connection connection , String table , String where , String [ ] args ) { StringBuilder delete = new StringBuilder ( ) ; delete . append ( "delete from " ) . append ( CoreSQLUtils . quoteWrap ( table ) ) ; if ( where != null ) { delete . append ( " where " ) . append ( where ) ; } String sql ... | Execute a deletion |
127,441 | public static int update ( Connection connection , String table , ContentValues values , String whereClause , String [ ] whereArgs ) { StringBuilder update = new StringBuilder ( ) ; update . append ( "update " ) . append ( CoreSQLUtils . quoteWrap ( table ) ) . append ( " set " ) ; int setValuesSize = values . size ( )... | Update table rows |
127,442 | public static void setArguments ( PreparedStatement statement , Object [ ] selectionArgs ) throws SQLException { if ( selectionArgs != null ) { for ( int i = 0 ; i < selectionArgs . length ; i ++ ) { statement . setObject ( i + 1 , selectionArgs [ i ] ) ; } } } | Set the prepared statement arguments |
127,443 | public static void closeStatement ( Statement statement , String sql ) { if ( statement != null ) { try { statement . close ( ) ; } catch ( SQLException e ) { log . log ( Level . WARNING , "Failed to close SQL Statement: " + sql , e ) ; } } } | Close the statement |
127,444 | public static void closeResultSet ( ResultSet resultSet , String sql ) { if ( resultSet != null ) { try { resultSet . close ( ) ; } catch ( SQLException e ) { log . log ( Level . WARNING , "Failed to close SQL ResultSet: " + sql , e ) ; } } } | Close the ResultSet |
127,445 | public static void closeResultSetStatement ( ResultSet resultSet , String sql ) { if ( resultSet != null ) { try { resultSet . getStatement ( ) . close ( ) ; } catch ( SQLException e ) { log . log ( Level . WARNING , "Failed to close SQL ResultSet: " + sql , e ) ; } } } | Close the ResultSet Statement from which it was created which closes all ResultSets as well |
127,446 | public static ResultSetResult wrapQuery ( Connection connection , String sql , String [ ] selectionArgs ) { return new ResultSetResult ( query ( connection , sql , selectionArgs ) ) ; } | Perform the query and wrap as a result |
127,447 | public double [ ] getDerivedDimensions ( ) { Double width = getWidth ( ) ; Double height = getHeight ( ) ; if ( width == null || height == null ) { int dataWidth ; int dataHeight ; try { BufferedImage image = getDataImage ( ) ; dataWidth = image . getWidth ( ) ; dataHeight = image . getHeight ( ) ; } catch ( IOExceptio... | Get the derived width and height from the values and icon data scaled as needed |
127,448 | public static void main ( String [ ] args ) throws Exception { boolean valid = true ; boolean requiredArguments = false ; String imageFormat = null ; boolean rawImage = false ; File inputDirectory = null ; TileFormatType tileType = null ; File geoPackageFile = null ; String tileTable = null ; for ( int i = 0 ; valid &&... | Main method to read tiles from the file system into a GeoPackage |
127,449 | public int update ( ContentValues values , String whereClause , String [ ] whereArgs ) { return SQLUtils . update ( connection , getTableName ( ) , values , whereClause , whereArgs ) ; } | Update all rows matching the where clause with the provided values |
127,450 | private static void finish ( ) { if ( progress . getMax ( ) != null ) { StringBuilder output = new StringBuilder ( ) ; output . append ( "\nTile Generation: " ) . append ( progress . getProgress ( ) ) . append ( " of " ) . append ( progress . getMax ( ) ) ; if ( geoPackage != null ) { try { GeoPackageTextOutput textOut... | Finish tile generation |
127,451 | public short getPixelValue ( BufferedImage image , int x , int y ) { validateImageType ( image ) ; WritableRaster raster = image . getRaster ( ) ; short pixelValue = getPixelValue ( raster , x , y ) ; return pixelValue ; } | Get the pixel value as an unsigned short |
127,452 | public short getPixelValue ( WritableRaster raster , int x , int y ) { Object pixelData = raster . getDataElements ( x , y , null ) ; short sdata [ ] = ( short [ ] ) pixelData ; if ( sdata . length != 1 ) { throw new UnsupportedOperationException ( "This method is not supported by this color model" ) ; } short pixelVal... | Get the pixel value as an unsigned short from the raster and the coordinate |
127,453 | public short [ ] getPixelValues ( BufferedImage image ) { validateImageType ( image ) ; WritableRaster raster = image . getRaster ( ) ; short [ ] pixelValues = getPixelValues ( raster ) ; return pixelValues ; } | Get the pixel values of the buffered image as unsigned shorts |
127,454 | public int [ ] getUnsignedPixelValues ( BufferedImage image ) { short [ ] pixelValues = getPixelValues ( image ) ; int [ ] unsignedPixelValues = getUnsignedPixelValues ( pixelValues ) ; return unsignedPixelValues ; } | Get the pixel values of the buffered image as 16 bit unsigned integer values |
127,455 | public short [ ] getPixelValues ( WritableRaster raster ) { DataBufferUShort buffer = ( DataBufferUShort ) raster . getDataBuffer ( ) ; short [ ] pixelValues = buffer . getData ( ) ; return pixelValues ; } | Get the pixel values of the raster as unsigned shorts |
127,456 | public int [ ] getUnsignedPixelValues ( WritableRaster raster ) { short [ ] pixelValues = getPixelValues ( raster ) ; int [ ] unsignedPixelValues = getUnsignedPixelValues ( pixelValues ) ; return unsignedPixelValues ; } | Get the pixel values of the raster as 16 bit unsigned integer values |
127,457 | public void validateImageType ( BufferedImage image ) { if ( image == null ) { throw new GeoPackageException ( "The image is null" ) ; } if ( image . getColorModel ( ) . getTransferType ( ) != DataBuffer . TYPE_USHORT ) { throw new GeoPackageException ( "The coverage data tile is expected to be a 16 bit unsigned short,... | Validate that the image type is an unsigned short |
127,458 | public byte [ ] getImageBytes ( BufferedImage image ) { byte [ ] bytes = null ; try { bytes = ImageUtils . writeImageToBytes ( image , ImageUtils . IMAGE_FORMAT_PNG ) ; } catch ( IOException e ) { throw new GeoPackageException ( "Failed to write image to " + ImageUtils . IMAGE_FORMAT_PNG + " bytes" , e ) ; } return byt... | Get the image as PNG bytes |
127,459 | public void setPixelValue ( WritableRaster raster , int x , int y , short pixelValue ) { short data [ ] = new short [ ] { pixelValue } ; raster . setDataElements ( x , y , data ) ; } | Set the unsigned short pixel value into the image raster |
127,460 | public void setPixelValue ( WritableRaster raster , int x , int y , int unsignedPixelValue ) { short pixelValue = getPixelValue ( unsignedPixelValue ) ; setPixelValue ( raster , x , y , pixelValue ) ; } | Set the unsigned 16 bit integer pixel value into the image raster |
127,461 | public Stroke getStroke ( ) { Stroke theStroke = stroke ; if ( theStroke == null ) { theStroke = new BasicStroke ( strokeWidth ) ; stroke = theStroke ; } return theStroke ; } | Get the stroke created from the stroke width |
127,462 | public List < StyleMappingRow > queryByBaseFeatureId ( long id ) { List < StyleMappingRow > rows = new ArrayList < > ( ) ; UserCustomResultSet resultSet = queryByBaseId ( id ) ; try { while ( resultSet . moveToNext ( ) ) { rows . add ( getRow ( resultSet ) ) ; } } finally { resultSet . close ( ) ; } return rows ; } | Query for style mappings by base id |
127,463 | public ImageRectangle round ( ) { return new ImageRectangle ( Math . round ( left ) , Math . round ( top ) , Math . round ( right ) , Math . round ( bottom ) ) ; } | Round the floating point rectangle to an integer rectangle |
127,464 | private static int writeGeoPackageFormatTiles ( TileDao tileDao , File directory , String imageFormat , Integer width , Integer height , boolean rawImage ) throws IOException { int tileCount = 0 ; for ( long zoomLevel = tileDao . getMinZoom ( ) ; zoomLevel <= tileDao . getMaxZoom ( ) ; zoomLevel ++ ) { TileMatrix tileM... | Write GeoPackage formatted tiles |
127,465 | private static double getLength ( BoundingBox boundingBox , ProjectionTransform toWebMercatorTransform ) { BoundingBox transformedBoundingBox = boundingBox . transform ( toWebMercatorTransform ) ; return getLength ( transformedBoundingBox ) ; } | Get the length of the bounding box projected using the transformation |
127,466 | private static double getLength ( BoundingBox boundingBox ) { double width = boundingBox . getMaxLongitude ( ) - boundingBox . getMinLongitude ( ) ; double height = boundingBox . getMaxLatitude ( ) - boundingBox . getMinLatitude ( ) ; double length = Math . min ( width , height ) ; return length ; } | Get the length of the bounding box |
127,467 | public GeoPackage getOrOpen ( String name , File file ) { return getOrOpen ( name , file , true ) ; } | Get the cached GeoPackage or open and cache the GeoPackage file |
127,468 | public static ImageRectangle getRectangle ( long width , long height , BoundingBox boundingBox , BoundingBox boundingBoxSection ) { ImageRectangleF rectF = getFloatRectangle ( width , height , boundingBox , boundingBoxSection ) ; ImageRectangle rect = rectF . round ( ) ; return rect ; } | Get a rectangle using the tile width height bounding box and the bounding box section within the outer box to build the rectangle from |
127,469 | public static ImageRectangleF getRoundedFloatRectangle ( long width , long height , BoundingBox boundingBox , BoundingBox boundingBoxSection ) { ImageRectangle rect = getRectangle ( width , height , boundingBox , boundingBoxSection ) ; ImageRectangleF rectF = new ImageRectangleF ( rect ) ; return rectF ; } | 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 |
127,470 | public static ImageRectangleF getFloatRectangle ( long width , long height , BoundingBox boundingBox , BoundingBox boundingBoxSection ) { float left = TileBoundingBoxUtils . getXPixel ( width , boundingBox , boundingBoxSection . getMinLongitude ( ) ) ; float right = TileBoundingBoxUtils . getXPixel ( width , boundingBo... | Get a rectangle with floating point boundaries using the tile width height bounding box and the bounding box section within the outer box to build the rectangle from |
127,471 | public static synchronized String getProperty ( String key , boolean required ) { if ( mProperties == null ) { mProperties = initializeConfigurationProperties ( ) ; } String value = mProperties . getProperty ( key ) ; if ( value == null && required ) { throw new RuntimeException ( "Property not found: " + key ) ; } ret... | Get a property by key |
127,472 | public static String getProperty ( String base , String property ) { return getProperty ( base , property , true ) ; } | Get a required property by base property and property name |
127,473 | public static Integer getIntegerProperty ( String key , boolean required ) { Integer value = null ; String stringValue = getProperty ( key , required ) ; if ( stringValue != null ) { value = Integer . valueOf ( stringValue ) ; } return value ; } | Get an integer property by key |
127,474 | public static Float getFloatProperty ( String key , boolean required ) { Float value = null ; String stringValue = getProperty ( key , required ) ; if ( stringValue != null ) { value = Float . valueOf ( stringValue ) ; } return value ; } | Get a float by key |
127,475 | public static Boolean getBooleanProperty ( String key , boolean required ) { Boolean value = null ; String stringValue = getProperty ( key , required ) ; if ( stringValue != null ) { value = Boolean . valueOf ( stringValue ) ; } return value ; } | Get a boolean by key |
127,476 | public static Boolean getBooleanProperty ( String base , String property , boolean required ) { return getBooleanProperty ( base + JavaPropertyConstants . PROPERTY_DIVIDER + property , required ) ; } | Get a boolean property by base property and property name |
127,477 | public static Color getColorProperty ( String key , boolean required ) { Color value = null ; String redProperty = key + JavaPropertyConstants . PROPERTY_DIVIDER + JavaPropertyConstants . COLOR_RED ; String greenProperty = key + JavaPropertyConstants . PROPERTY_DIVIDER + JavaPropertyConstants . COLOR_GREEN ; String blu... | Get a color by key |
127,478 | public static Color getColorProperty ( String base , String property ) { return getColorProperty ( base , property , true ) ; } | Get a required color property by base property and property name |
127,479 | public void resize ( int maxCacheSize ) { setMaxCacheSize ( maxCacheSize ) ; for ( FeatureCache cache : tableCache . values ( ) ) { cache . resize ( maxCacheSize ) ; } } | Resize all caches and update the max cache size |
127,480 | public void setFlag ( CodecFlag flag ) throws JavaAVException { if ( flag == null ) throw new JavaAVException ( "Could not set codec flag. Null provided." ) ; flags . add ( flag ) ; } | Set a codec flag . |
127,481 | private void createImageBuffer ( ) throws JavaAVException { int format = pixelFormat . value ( ) ; int width = avContext . width ( ) ; int height = avContext . height ( ) ; picture = new AVPicture ( ) ; if ( avpicture_alloc ( picture , format , width , height ) < 0 ) throw new JavaAVException ( "Could not allocate pict... | Create resampled picture buffer . This is only needed if the decoded picture format differs from the desired format . |
127,482 | public static Codec getEncoderById ( CodecID codecId ) throws JavaAVException { if ( codecId == null ) throw new NullPointerException ( "CodecID is null." ) ; AVCodec avCodec = avcodec_find_encoder ( codecId . value ( ) ) ; if ( avCodec == null || avCodec . isNull ( ) ) throw new JavaAVException ( "Encoder not found: "... | Create a new encoder with specified codec id . |
127,483 | public static Codec getDecoderById ( CodecID codecId ) throws JavaAVException { if ( codecId == null ) throw new NullPointerException ( "CodecID is null." ) ; AVCodec avCodec = avcodec_find_decoder ( codecId . value ( ) ) ; if ( avCodec == null || avCodec . isNull ( ) ) throw new JavaAVException ( "Decoder not found: "... | Create a new decoder with specified codec id . |
127,484 | public static Codec getEncoderByName ( String avCodecName ) throws JavaAVException { if ( avCodecName == null || avCodecName . isEmpty ( ) ) throw new NullPointerException ( "Codec name is null or empty." ) ; AVCodec avCodec = avcodec_find_encoder_by_name ( avCodecName ) ; if ( avCodec == null || avCodec . isNull ( ) )... | Create a new encoder with specified codec name . |
127,485 | public static Codec getDecoderByName ( String avCodecName ) throws JavaAVException { if ( avCodecName == null || avCodecName . isEmpty ( ) ) throw new NullPointerException ( "Codec name is null or empty." ) ; AVCodec avCodec = avcodec_find_decoder_by_name ( avCodecName ) ; if ( avCodec == null || avCodec . isNull ( ) )... | Create a new decoder with specified codec name . |
127,486 | public static String [ ] getInstalledCodecs ( ) { Set < String > names = new TreeSet < String > ( ) ; AVCodec codec = null ; while ( ( codec = av_codec_next ( codec ) ) != null ) { String shortName = codec . name ( ) . getString ( ) ; String type = MediaType . byId ( codec . type ( ) ) . toString ( ) . substring ( 0 , ... | Get all names of codecs that are compiled into FFmpeg . |
127,487 | public MediaFrame readFrame ( ) throws JavaAVException { MediaFrame mediaFrame = new MediaFrame ( ) ; while ( mediaFrame != null && ! mediaFrame . hasFrame ( ) ) { if ( av_read_frame ( formatContext , avPacket ) < 0 ) { if ( videoDecoders . get ( avPacket . stream_index ( ) ) != null ) { avPacket . data ( null ) ; avPa... | Consecutively retrieves media frames from previously specified input source . The media type of the returned frame may alter between consecutive calls . One call may return an audio frame and the next call may return a video frame . |
127,488 | public static int getFormatDepth ( SampleFormat format ) { switch ( format ) { case U8 : case U8P : return 1 ; case S16 : case S16P : return 2 ; case S32 : case S32P : return 4 ; case FLT : case FLTP : return 4 ; case DBL : case DBLP : return 8 ; default : return 0 ; } } | Get number of bytes per sample for specified sample format . |
127,489 | public synchronized void clear ( ) { for ( int i = 0 ; i < planes ; i ++ ) { readPointer [ i ] = writePointer [ i ] = 0 ; bytesToRead [ i ] = 0 ; bytesToWrite [ i ] = buffer [ i ] . capacity ( ) ; } } | Resets the read and write pointers . The internal buffer remains unaffected . |
127,490 | public synchronized int read ( int plane , byte data [ ] , int offset , int length ) throws IOException { if ( offset < 0 || length < 0 || length > data . length - offset ) throw new IndexOutOfBoundsException ( ) ; if ( bytesToRead [ plane ] == 0 ) return 0 ; if ( bytesToRead [ plane ] < length ) length = bytesToRead [... | Read as much data as possible from this buffer . |
127,491 | public void clear ( ) { if ( planePointers != null ) { for ( int i = 0 ; i < getPlaneCount ( ) ; i ++ ) { av_free ( planePointers [ i ] . position ( 0 ) ) ; } planePointers = null ; } } | Free the memory of sample buffers . |
127,492 | public void open ( int width , int height , double frameRate ) throws JavaAVException { if ( ! open . get ( ) ) { String input = "video=" + device ; demuxer = new Demuxer ( ) ; demuxer . setInputFormat ( format ) ; demuxer . setImageWidth ( width ) ; demuxer . setImageHeight ( height ) ; demuxer . setFramerate ( frameR... | Open the camera with specified image size and capture frame rate . |
127,493 | public void visit ( ASTNode [ ] nodes , SourceUnit sourceUnit ) { if ( ! ( nodes [ 0 ] instanceof AnnotationNode ) || ! ( nodes [ 1 ] instanceof AnnotatedNode ) ) { throw new IllegalArgumentException ( "Internal error: wrong types: " + nodes [ 0 ] . getClass ( ) . getName ( ) + " / " + nodes [ 1 ] . getClass ( ) . getN... | This ASTTransformation method is called when the compiler encounters our annotation . |
127,494 | private void addJavaFXPropertyToClass ( SourceUnit source , AnnotationNode node , ClassNode classNode ) { for ( PropertyNode propertyNode : classNode . getProperties ( ) ) { FieldNode field = propertyNode . getField ( ) ; if ( hasFXBindableAnnotation ( field ) || ( ( field . getModifiers ( ) & Modifier . FINAL ) != 0 )... | Iterate through the properties of the class and convert each eligible property to a JavaFX property . |
127,495 | protected void createGetterMethod ( ClassNode declaringClass , PropertyNode propertyNode , String getterName , Statement getterBlock , List < AnnotationNode > annotations ) { int mod = propertyNode . getModifiers ( ) | Modifier . FINAL ; MethodNode getter = new MethodNode ( getterName , mod , propertyNode . getType ( )... | Creates a getter method and adds it to the declaring class . |
127,496 | private void generateSyntaxErrorMessage ( SourceUnit sourceUnit , AnnotationNode node , String msg ) { SyntaxException error = new SyntaxException ( msg , node . getLineNumber ( ) , node . getColumnNumber ( ) ) ; sourceUnit . getErrorCollector ( ) . addErrorAndContinue ( new SyntaxErrorMessage ( error , sourceUnit ) ) ... | Generates a SyntaxErrorMessage based on the current SourceUnit AnnotationNode and a specified error message . |
127,497 | private FieldNode createFieldNodeCopy ( String newName , ClassNode newType , FieldNode f ) { if ( newType == null ) newType = f . getType ( ) ; newType = newType . getPlainNodeReference ( ) ; return new FieldNode ( newName , f . getModifiers ( ) , newType , f . getOwner ( ) , f . getInitialValueExpression ( ) ) ; } | Creates a copy of a FieldNode with a new name and optionally a new type . |
127,498 | protected void onLayout ( boolean changed , int l , int t , int r , int b ) { super . onLayout ( changed , l , t , r , b ) ; if ( mAdjustViewSize ) { if ( ! ( getParent ( ) instanceof RelativeLayout ) ) { throw new IllegalStateException ( "Only RelativeLayout is supported as parent of this view" ) ; } final int sWidth ... | Adjusts size of this view to match the underlying button menu . This allows a smooth transition between this view and the close button behind it . |
127,499 | public View getMenuButton ( MenuButton button ) { switch ( button ) { case MID : return mMidContainer ; case LEFT : return mLeftContainer ; case RIGHT : return mRightContainer ; } return null ; } | Returns the menu button container . The first child of the container is a TextView the second - an ImageButton |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.