signature:
public class FeatureIndexer { /** * Index the feature rows in the cursor
 * @ param geoPackageId GeoPackage id
 * @ param cursor feature cursor
 * @ return count , - 1 if no results or canceled */
private int indexRows ( long geoPackageId , 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 ( geoPackageId , row , false ) ; if ( indexed ) { count ++ ; } if ( progress != null ) { progress . addProgress ( 1 ) ; } } } catch ( Exception e ) { Log . e ( FeatureIndexer . class . getSimpleName ( ) , "Failed to index feature. Table: " + featureDao . getTableName ( ) + ", Position: " + cursor . getPosition ( ) , e ) ; } } } finally { cursor . close ( ) ; } return count ;


signature:
public class FeatureIndexer { /** * Index the feature row
 * @ param geoPackageId GeoPackage id
 * @ param row feature row
 * @ param possibleUpdate possible update flag
 * @ return true if indexed */
private boolean index ( long geoPackageId , FeatureRow row , boolean possibleUpdate ) { } }

implementation:
boolean indexed = false ; GeoPackageGeometryData geomData = row . getGeometry ( ) ; if ( geomData != null ) { // Get the envelope
GeometryEnvelope envelope = geomData . getEnvelope ( ) ; // If no envelope , build one from the geometry
if ( envelope == null ) { Geometry geometry = geomData . getGeometry ( ) ; if ( geometry != null ) { envelope = GeometryEnvelopeBuilder . buildEnvelope ( geometry ) ; } } // Create the new index row
if ( envelope != null ) { GeometryMetadata metadata = geometryMetadataDataSource . populate ( geoPackageId , featureDao . getTableName ( ) , row . getId ( ) , envelope ) ; if ( possibleUpdate ) { geometryMetadataDataSource . createOrUpdate ( metadata ) ; } else { geometryMetadataDataSource . create ( metadata ) ; } indexed = true ; } } return indexed ;


signature:
public class FeatureIndexer { /** * Update the least indexed time
 * @ param db metadata db
 * @ param geoPackageId GeoPackage id */
private void updateLastIndexed ( GeoPackageMetadataDb db , long geoPackageId ) { } }

implementation: long indexedTime = ( new Date ( ) ) . getTime ( ) ; TableMetadataDataSource ds = new TableMetadataDataSource ( db ) ; if ( ! ds . updateLastIndexed ( geoPackageId , featureDao . getTableName ( ) , indexedTime ) ) { throw new GeoPackageException ( "Failed to update last indexed time. Table: GeoPackage Id: " + geoPackageId + ", Table: " + featureDao . getTableName ( ) + ", Last Indexed: " + indexedTime ) ; }


signature:
public class FeatureIndexer { /** * Delete the feature table index
 * @ return true if index deleted
 * @ since 1.1.0 */
public boolean deleteIndex ( ) { } }

implementation: TableMetadataDataSource tableMetadataDataSource = new TableMetadataDataSource ( db ) ; boolean deleted = tableMetadataDataSource . delete ( featureDao . getDatabase ( ) , featureDao . getTableName ( ) ) ; return deleted ;


signature:
public class FeatureIndexer { /** * Delete the index for the geometry id
 * @ param geomId geometry id
 * @ return true if deleted */
public boolean deleteIndex ( long geomId ) { } }

implementation: boolean deleted = geometryMetadataDataSource . delete ( featureDao . getDatabase ( ) , featureDao . getTableName ( ) , geomId ) ; return deleted ;


signature:
public class FeatureIndexer { /** * Determine if the database table is indexed after database modifications
 * @ return true if indexed */
public boolean isIndexed ( ) { } }

implementation: boolean indexed = false ; Date lastIndexed = getLastIndexed ( ) ; if ( lastIndexed != null ) { Contents contents = featureDao . getGeometryColumns ( ) . getContents ( ) ; Date lastChange = contents . getLastChange ( ) ; indexed = lastIndexed . equals ( lastChange ) || lastIndexed . after ( lastChange ) ; } return indexed ;


signature:
public class FeatureIndexer { /** * Get the date last indexed
 * @ return last indexed date or null
 * @ since 1.1.0 */
public Date getLastIndexed ( ) { } }

implementation: Date date = null ; TableMetadataDataSource ds = new TableMetadataDataSource ( db ) ; TableMetadata metadata = ds . get ( featureDao . getDatabase ( ) , featureDao . getTableName ( ) ) ; if ( metadata != null ) { Long lastIndexed = metadata . getLastIndexed ( ) ; if ( lastIndexed != null ) { date = new Date ( lastIndexed ) ; } } return date ;


signature:
public class FeatureIndexer { /** * Query for all Geometry Metadata
 * @ return geometry metadata cursor
 * @ since 1.1.0 */
public Cursor query ( ) { } }

implementation: Cursor cursor = geometryMetadataDataSource . query ( featureDao . getDatabase ( ) , featureDao . getTableName ( ) ) ; return cursor ;


signature:
public class FeatureIndexer { /** * Query for Geometry Metadata within the bounding box , projected
 * correctly
 * @ param boundingBox bounding box
 * @ return geometry metadata cursor
 * @ since 1.1.0 */
public Cursor query ( BoundingBox boundingBox ) { } }

implementation: Cursor cursor = geometryMetadataDataSource . query ( featureDao . getDatabase ( ) , featureDao . getTableName ( ) , boundingBox ) ; return cursor ;


signature:
public class FeatureIndexer { /** * Query for Geometry Metadata count within the bounding box , projected
 * correctly
 * @ param boundingBox bounding box
 * @ return count
 * @ since 1.1.0 */
public int count ( BoundingBox boundingBox ) { } }

implementation: int count = geometryMetadataDataSource . count ( featureDao . getDatabase ( ) , featureDao . getTableName ( ) , boundingBox ) ; return count ;


signature:
public class FeatureIndexer { /** * Query for Geometry Metadata within the Geometry Envelope
 * @ param envelope geometry envelope
 * @ return geometry metadata cursor
 * @ since 1.1.0 */
public Cursor query ( GeometryEnvelope envelope ) { } }

implementation: Cursor cursor = geometryMetadataDataSource . query ( featureDao . getDatabase ( ) , featureDao . getTableName ( ) , envelope ) ; return cursor ;


signature:
public class FeatureIndexer { /** * Query for Geometry Metadata count within the Geometry Envelope
 * @ param envelope geometry envelope
 * @ return count
 * @ since 1.1.0 */
public int count ( GeometryEnvelope envelope ) { } }

implementation: int count = geometryMetadataDataSource . count ( featureDao . getDatabase ( ) , featureDao . getTableName ( ) , envelope ) ; return count ;


signature:
public class FeatureIndexer { /** * Query for Geometry Metadata within the bounding box in
 * the provided projection
 * @ param boundingBox bounding box
 * @ param projection projection of the provided bounding box
 * @ return geometry metadata cursor
 * @ since 1.1.0 */
public Cursor query ( BoundingBox boundingBox , Projection projection ) { } }

implementation: BoundingBox featureBoundingBox = getFeatureBoundingBox ( boundingBox , projection ) ; Cursor cursor = query ( featureBoundingBox ) ; return cursor ;


signature:
public class FeatureIndexer { /** * Query for Geometry Metadata count within the bounding box in
 * the provided projection
 * @ param boundingBox bounding box
 * @ param projection projection of the provided bounding box
 * @ return count
 * @ since 1.1.0 */
public long count ( BoundingBox boundingBox , Projection projection ) { } }

implementation: BoundingBox featureBoundingBox = getFeatureBoundingBox ( boundingBox , projection ) ; long count = count ( featureBoundingBox ) ; return count ;


signature:
public class FeatureIndexer { /** * Get the bounding box in the feature projection from the bounding box in
 * the provided projection
 * @ param boundingBox bounding box
 * @ param projection projection
 * @ return feature projected bounding box */
private BoundingBox getFeatureBoundingBox ( BoundingBox boundingBox , Projection projection ) { } }

implementation: ProjectionTransform projectionTransform = projection . getTransformation ( featureDao . getProjection ( ) ) ; BoundingBox featureBoundingBox = boundingBox . transform ( projectionTransform ) ; return featureBoundingBox ;


signature:
public class FeatureIndexer { /** * Get the Geometry Metadata for the current place in the cursor
 * @ param cursor cursor
 * @ return geometry metadata
 * @ since 1.1.0 */
public GeometryMetadata getGeometryMetadata ( Cursor cursor ) { } }

implementation: GeometryMetadata geometryMetadata = GeometryMetadataDataSource . createGeometryMetadata ( cursor ) ; return geometryMetadata ;


signature:
public class FeatureIndexer { /** * Get the feature row for the current place in the cursor
 * @ param cursor cursor
 * @ return feature row
 * @ since 1.1.0 */
public FeatureRow getFeatureRow ( Cursor cursor ) { } }

implementation: GeometryMetadata geometryMetadata = getGeometryMetadata ( cursor ) ; FeatureRow featureRow = getFeatureRow ( geometryMetadata ) ; return featureRow ;


signature:
public class FeatureIndexer { /** * Get the feature row for the Geometry Metadata
 * @ param geometryMetadata geometry metadata
 * @ return feature row
 * @ since 1.1.0 */
public FeatureRow getFeatureRow ( GeometryMetadata geometryMetadata ) { } }

implementation:
long geomId = geometryMetadata . getId ( ) ; // 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 FeatureTileTableLinker { /** * Query for the tile tables linked to a feature table and return tile DAOs
 * to those tables
 * @ param featureTable feature table
 * @ return tiles DAOs */
public List < TileDao > getTileDaosForFeatureTable ( String featureTable ) { } }

implementation: List < TileDao > tileDaos = new ArrayList < TileDao > ( ) ; List < String > tileTables = getTileTablesForFeatureTable ( featureTable ) ; for ( String tileTable : tileTables ) { if ( geoPackage . isTileTable ( tileTable ) ) { TileDao tileDao = geoPackage . getTileDao ( tileTable ) ; tileDaos . add ( tileDao ) ; } } return tileDaos ;


signature:
public class FeatureTileTableLinker { /** * Query for the feature tables linked to a tile table and return feature
 * DAOs to those tables
 * @ param tileTable tile table
 * @ return feature DAOs */
public List < FeatureDao > getFeatureDaosForTileTable ( String tileTable ) { } }

implementation: List < FeatureDao > featureDaos = new ArrayList < FeatureDao > ( ) ; List < String > featureTables = getFeatureTablesForTileTable ( tileTable ) ; for ( String featureTable : featureTables ) { if ( geoPackage . isFeatureTable ( featureTable ) ) { FeatureDao featureDao = geoPackage . getFeatureDao ( featureTable ) ; featureDaos . add ( featureDao ) ; } } return featureDaos ;


signature:
public class FeatureTileGenerator { /** * Get the bounding box for the feature tile generator , from the provided
 * and from the feature table
 * @ param geoPackage GeoPackage
 * @ param featureTiles feature tiles
 * @ param boundingBox bounding box
 * @ param projection projection
 * @ return bounding box */
private static BoundingBox getBoundingBox ( GeoPackage geoPackage , FeatureTiles featureTiles , BoundingBox boundingBox , Projection projection ) { } }

implementation: String tableName = featureTiles . getFeatureDao ( ) . getTableName ( ) ; boolean manualQuery = boundingBox == null ; BoundingBox featureBoundingBox = geoPackage . getBoundingBox ( projection , tableName , manualQuery ) ; if ( featureBoundingBox != null ) { if ( boundingBox == null ) { boundingBox = featureBoundingBox ; } else { boundingBox = boundingBox . overlap ( featureBoundingBox ) ; } } if ( boundingBox != null ) { boundingBox = featureTiles . expandBoundingBox ( boundingBox , projection ) ; } return boundingBox ;


signature:
public class FeatureTileGenerator { /** * { @ inheritDoc } */
@ Override public BoundingBox getBoundingBox ( int zoom ) { } }

implementation: ProjectionTransform projectionToWebMercator = projection . getTransformation ( ProjectionConstants . EPSG_WEB_MERCATOR ) ; BoundingBox webMercatorBoundingBox = boundingBox . transform ( projectionToWebMercator ) ; TileGrid tileGrid = TileBoundingBoxUtils . getTileGrid ( webMercatorBoundingBox , zoom ) ; BoundingBox tileBoundingBox = TileBoundingBoxUtils . getWebMercatorBoundingBox ( tileGrid . getMinX ( ) , tileGrid . getMinY ( ) , zoom ) ; BoundingBox expandedBoundingBox = featureTiles . expandBoundingBox ( webMercatorBoundingBox , tileBoundingBox ) ; BoundingBox zoomBoundingBox = expandedBoundingBox . transform ( projectionToWebMercator . getInverseTransformation ( ) ) ; return zoomBoundingBox ;


signature:
public class FeatureTileGenerator { /** * { @ inheritDoc } */
@ Override protected void preTileGeneration ( ) { } }

implementation:
// Link the feature and tile table if they are in the same GeoPackage
GeoPackage geoPackage = getGeoPackage ( ) ; String featureTable = featureTiles . getFeatureDao ( ) . getTableName ( ) ; String tileTable = getTableName ( ) ; if ( linkTables && geoPackage . isFeatureTable ( featureTable ) && geoPackage . isTileTable ( tileTable ) ) { FeatureTileTableLinker linker = new FeatureTileTableLinker ( geoPackage ) ; linker . link ( featureTable , tileTable ) ; }


signature:
public class FeatureTileGenerator { /** * { @ inheritDoc } */
@ Override protected byte [ ] createTile ( int z , long x , long y ) { } }

implementation: byte [ ] tileData = featureTiles . drawTileBytes ( ( int ) x , ( int ) y , z ) ; return tileData ;


signature:
public class UserMappingDao { /** * Query by both base id and related id
 * @ param baseId base id
 * @ param relatedId related id
 * @ return cursor */
public UserCustomCursor queryByIds ( long baseId , long relatedId ) { } }

implementation: return query ( buildWhereIds ( baseId , relatedId ) , buildWhereIdsArgs ( baseId , relatedId ) ) ;


signature:
public class UserMappingDao { /** * Get the unique base ids
 * @ return list of unique base ids
 * @ since 3.2.0 */
public List < Long > uniqueBaseIds ( ) { } }

implementation: return querySingleColumnTypedResults ( "SELECT DISTINCT " + CoreSQLUtils . quoteWrap ( UserMappingTable . COLUMN_BASE_ID ) + " FROM " + CoreSQLUtils . quoteWrap ( getTableName ( ) ) , null ) ;


signature:
public class UserMappingDao { /** * Get the unique related ids
 * @ return list of unique related ids
 * @ since 3.2.0 */
public List < Long > uniqueRelatedIds ( ) { } }

implementation: return querySingleColumnTypedResults ( "SELECT DISTINCT " + CoreSQLUtils . quoteWrap ( UserMappingTable . COLUMN_RELATED_ID ) + " FROM " + CoreSQLUtils . quoteWrap ( getTableName ( ) ) , null ) ;


signature:
public class UserMappingDao { /** * Delete user mappings by base id
 * @ param baseId base id
 * @ return rows deleted */
public int deleteByBaseId ( long baseId ) { } }

implementation: StringBuilder where = new StringBuilder ( ) ; where . append ( buildWhere ( UserMappingTable . COLUMN_BASE_ID , baseId ) ) ; String [ ] whereArgs = buildWhereArgs ( new Object [ ] { baseId } ) ; int deleted = delete ( where . toString ( ) , whereArgs ) ; return deleted ;


signature:
public class UserMappingDao { /** * Delete user mappings by related id
 * @ param relatedId related id
 * @ return rows deleted */
public int deleteByRelatedId ( long relatedId ) { } }

implementation: StringBuilder where = new StringBuilder ( ) ; where . append ( buildWhere ( UserMappingTable . COLUMN_RELATED_ID , relatedId ) ) ; String [ ] whereArgs = buildWhereArgs ( new Object [ ] { relatedId } ) ; int deleted = delete ( where . toString ( ) , whereArgs ) ; return deleted ;


signature:
public class UserMappingDao { /** * Delete user mappings by both base id and related id
 * @ param baseId base id
 * @ param relatedId related id
 * @ return rows deleted */
public int deleteByIds ( long baseId , long relatedId ) { } }

implementation: return delete ( buildWhereIds ( baseId , relatedId ) , buildWhereIdsArgs ( baseId , relatedId ) ) ;


signature:
public class UserMappingDao { /** * Build the where ids clause
 * @ param baseId base id
 * @ param relatedId related id
 * @ return where clause */
private String buildWhereIds ( long baseId , long relatedId ) { } }

implementation: StringBuilder where = new StringBuilder ( ) ; where . append ( buildWhere ( UserMappingTable . COLUMN_BASE_ID , baseId ) ) ; where . append ( " AND " ) ; where . append ( buildWhere ( UserMappingTable . COLUMN_RELATED_ID , relatedId ) ) ; return where . toString ( ) ;


signature:
public class GeoPackageMetadataDataSource { /** * Create a new GeoPackage metadata
 * @ param metadata GeoPackage metadata */
public void create ( GeoPackageMetadata metadata ) { } }

implementation: ContentValues values = new ContentValues ( ) ; values . put ( GeoPackageMetadata . COLUMN_NAME , metadata . getName ( ) ) ; values . put ( GeoPackageMetadata . COLUMN_EXTERNAL_PATH , metadata . getExternalPath ( ) ) ; long insertId = db . insert ( GeoPackageMetadata . TABLE_NAME , null , values ) ; if ( insertId == - 1 ) { throw new GeoPackageException ( "Failed to insert GeoPackage metadata. Name: " + metadata . getName ( ) + ", External Path: " + metadata . getExternalPath ( ) ) ; } metadata . setId ( insertId ) ;


signature:
public class GeoPackageMetadataDataSource { /** * Delete the database
 * @ param database database name
 * @ return deleted flag */
public boolean delete ( String database ) { } }

implementation: GeoPackageMetadata metadata = get ( database ) ; if ( metadata != null ) { TableMetadataDataSource tableDs = new TableMetadataDataSource ( db ) ; tableDs . delete ( metadata . getId ( ) ) ; } String whereClause = GeoPackageMetadata . COLUMN_NAME + " = ?" ; String [ ] whereArgs = new String [ ] { database } ; int deleteCount = db . delete ( GeoPackageMetadata . TABLE_NAME , whereClause , whereArgs ) ; return deleteCount > 0 ;


signature:
public class GeoPackageMetadataDataSource { /** * Rename the GeoPackage metadata to the new name
 * @ param metadata GeoPackage metadata
 * @ param newName new name
 * @ return renamed flag */
public boolean rename ( GeoPackageMetadata metadata , String newName ) { } }

implementation: boolean renamed = rename ( metadata . getName ( ) , newName ) ; if ( renamed ) { metadata . setName ( newName ) ; } return renamed ;


signature:
public class GeoPackageMetadataDataSource { /** * Rename the GeoPackage name to the new name
 * @ param name GeoPackage name
 * @ param newName new name
 * @ return renamed flag */
public boolean rename ( String name , String newName ) { } }

implementation: String whereClause = GeoPackageMetadata . COLUMN_NAME + " = ?" ; String [ ] whereArgs = new String [ ] { name } ; ContentValues values = new ContentValues ( ) ; values . put ( GeoPackageMetadata . COLUMN_NAME , newName ) ; int updateCount = db . update ( GeoPackageMetadata . TABLE_NAME , values , whereClause , whereArgs ) ; return updateCount > 0 ;


signature:
public class GeoPackageMetadataDataSource { /** * Get all GeoPackage metadata
 * @ return all GeoPackage metadata */
public List < GeoPackageMetadata > getAll ( ) { } }

implementation: List < GeoPackageMetadata > allMetadata = new ArrayList < GeoPackageMetadata > ( ) ; Cursor cursor = db . query ( GeoPackageMetadata . TABLE_NAME , GeoPackageMetadata . COLUMNS , null , null , null , null , null ) ; try { while ( cursor . moveToNext ( ) ) { GeoPackageMetadata metadata = createGeoPackageMetadata ( cursor ) ; allMetadata . add ( metadata ) ; } } finally { cursor . close ( ) ; } return allMetadata ;


signature:
public class GeoPackageMetadataDataSource { /** * Get all external GeoPackage metadata
 * @ return external GeoPackage metadata */
public List < GeoPackageMetadata > getAllExternal ( ) { } }

implementation: List < GeoPackageMetadata > allMetadata = new ArrayList < GeoPackageMetadata > ( ) ; String selection = GeoPackageMetadata . COLUMN_EXTERNAL_PATH + " IS NOT NULL" ; Cursor cursor = db . query ( GeoPackageMetadata . TABLE_NAME , GeoPackageMetadata . COLUMNS , selection , null , null , null , null ) ; try { while ( cursor . moveToNext ( ) ) { GeoPackageMetadata metadata = createGeoPackageMetadata ( cursor ) ; allMetadata . add ( metadata ) ; } } finally { cursor . close ( ) ; } return allMetadata ;


signature:
public class GeoPackageMetadataDataSource { /** * Get GeoPackage metadata by name
 * @ param database database name
 * @ return GeoPackage metadata */
public GeoPackageMetadata get ( String database ) { } }

implementation: GeoPackageMetadata metadata = null ; String selection = GeoPackageMetadata . COLUMN_NAME + " = ?" ; String [ ] selectionArgs = new String [ ] { database } ; Cursor cursor = db . query ( GeoPackageMetadata . TABLE_NAME , GeoPackageMetadata . COLUMNS , selection , selectionArgs , null , null , null ) ; try { if ( cursor . moveToNext ( ) ) { metadata = createGeoPackageMetadata ( cursor ) ; } } finally { cursor . close ( ) ; } return metadata ;


signature:
public class GeoPackageMetadataDataSource { /** * Get GeoPackage metadata by id
 * @ param id id
 * @ return GeoPackage metadata */
public GeoPackageMetadata get ( long id ) { } }

implementation: GeoPackageMetadata metadata = null ; String selection = GeoPackageMetadata . COLUMN_ID + " = ?" ; String [ ] selectionArgs = new String [ ] { String . valueOf ( id ) } ; Cursor cursor = db . query ( GeoPackageMetadata . TABLE_NAME , GeoPackageMetadata . COLUMNS , selection , selectionArgs , null , null , null ) ; try { if ( cursor . moveToNext ( ) ) { metadata = createGeoPackageMetadata ( cursor ) ; } } finally { cursor . close ( ) ; } return metadata ;


signature:
public class GeoPackageMetadataDataSource { /** * Get GeoPackage metadata or create it if it does not exist
 * @ param geoPackage GeoPackage name
 * @ return GeoPackage metadata */
public GeoPackageMetadata getOrCreate ( String geoPackage ) { } }

implementation: GeoPackageMetadata metadata = get ( geoPackage ) ; if ( metadata == null ) { metadata = new GeoPackageMetadata ( ) ; metadata . setName ( geoPackage ) ; create ( metadata ) ; } return metadata ;


signature:
public class GeoPackageMetadataDataSource { /** * Determine if the GeoPackage is external
 * @ param database database name
 * @ return external flag */
public boolean isExternal ( String database ) { } }

implementation: GeoPackageMetadata metadata = get ( database ) ; return get ( database ) != null && metadata . getExternalPath ( ) != null ;


signature:
public class GeoPackageMetadataDataSource { /** * Get external GeoPackage metadata by external path
 * @ param path path
 * @ return GeoPackage metadata */
public GeoPackageMetadata getExternalAtPath ( String path ) { } }

implementation: GeoPackageMetadata metadata = null ; String selection = GeoPackageMetadata . COLUMN_EXTERNAL_PATH + " = ?" ; String [ ] selectionArgs = new String [ ] { path } ; Cursor cursor = db . query ( GeoPackageMetadata . TABLE_NAME , GeoPackageMetadata . COLUMNS , selection , selectionArgs , null , null , null ) ; try { if ( cursor . moveToNext ( ) ) { metadata = createGeoPackageMetadata ( cursor ) ; } } finally { cursor . close ( ) ; } return metadata ;


signature:
public class GeoPackageMetadataDataSource { /** * Get metadata where the name is like
 * @ param like like argument
 * @ param sortColumn sort by column
 * @ return metadata names
 * @ since 1.2.7 */
public List < String > getMetadataWhereNameLike ( String like , String sortColumn ) { } }

implementation: return getMetadataWhereNameLike ( like , sortColumn , false ) ;


signature:
public class GeoPackageMetadataDataSource { /** * Get metadata where the name is not like
 * @ param notLike not like argument
 * @ param sortColumn sort by column
 * @ return metadata names
 * @ since 1.2.7 */
public List < String > getMetadataWhereNameNotLike ( String notLike , String sortColumn ) { } }

implementation: return getMetadataWhereNameLike ( notLike , sortColumn , true ) ;


signature:
public class GeoPackageMetadataDataSource { /** * Get metadata where the name is like or not like
 * @ param like like or not like argument
 * @ param sortColumn sort by column
 * @ param notLike true if a not like query
 * @ return metadata names */
private List < String > getMetadataWhereNameLike ( String like , String sortColumn , boolean notLike ) { } }

implementation: List < String > names = new ArrayList < > ( ) ; StringBuilder where = new StringBuilder ( GeoPackageMetadata . COLUMN_NAME ) ; if ( notLike ) { where . append ( " not" ) ; } where . append ( " like ?" ) ; String [ ] whereArgs = new String [ ] { like } ; Cursor cursor = db . query ( GeoPackageMetadata . TABLE_NAME , new String [ ] { GeoPackageMetadata . COLUMN_NAME } , where . toString ( ) , whereArgs , null , null , sortColumn ) ; try { while ( cursor . moveToNext ( ) ) { names . add ( cursor . getString ( 0 ) ) ; } } finally { cursor . close ( ) ; } return names ;


signature:
public class GeoPackageMetadataDataSource { /** * Create a GeoPackage metadata from the current cursor location
 * @ param cursor cursor
 * @ return GeoPackage metadata */
private GeoPackageMetadata createGeoPackageMetadata ( Cursor cursor ) { } }

implementation: GeoPackageMetadata metadata = new GeoPackageMetadata ( ) ; metadata . setId ( cursor . getLong ( 0 ) ) ; metadata . setName ( cursor . getString ( 1 ) ) ; metadata . setExternalPath ( cursor . getString ( 2 ) ) ; return metadata ;


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

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


signature:
public class AttributesCursor { /** * { @ inheritDoc } */
@ Override protected UserInvalidCursor < AttributesColumn , AttributesTable , AttributesRow , ? extends UserCursor < AttributesColumn , AttributesTable , AttributesRow > , ? extends UserDao < AttributesColumn , AttributesTable , AttributesRow , ? extends UserCursor < AttributesColumn , AttributesTable , AttributesRow > > > createInvalidCursor ( UserDao dao , UserCursor cursor , List < Integer > invalidPositions , List < AttributesColumn > blobColumns ) { } }

implementation: return new AttributesInvalidCursor ( ( AttributesDao ) dao , ( AttributesCursor ) cursor , invalidPositions , blobColumns ) ;


signature:
public class ParallaxFactory { /** * Handle the created view
 * @ param view nullable .
 * @ param context shouldn ' t be null .
 * @ param attrs shouldn ' t be null .
 * @ return null if null is passed in . */
public View onViewCreated ( View view , Context context , AttributeSet attrs ) { } }

implementation: if ( view == null ) { return null ; } view = onViewCreatedInternal ( view , context , attrs ) ; for ( OnViewCreatedListener listener : otherListeners ) { if ( listener != null ) { view = listener . onViewCreated ( view , context , attrs ) ; } } return view ;


signature:
public class ParallaxContainer { /** * Sets the { @ link ViewPager . OnPageChangeListener } to the embedded { @ link ViewPager }
 * created by the container .
 * This method can be overridden to add an page indicator to the parallax view . If
 * this method is overriden , make sure that the listener methods are called on this
 * class as well . */
@ Deprecated protected void attachOnPageChangeListener ( ViewPager viewPager , ViewPager . OnPageChangeListener listener ) { } }

implementation: viewPager . setOnPageChangeListener ( listener ) ;


signature:
public class ParallaxContainer { /** * attach attributes in tag */
private void addParallaxView ( View view , int pageIndex ) { } }

implementation:
if ( view instanceof ViewGroup ) { // recurse children
ViewGroup viewGroup = ( ViewGroup ) view ; for ( int i = 0 , childCount = viewGroup . getChildCount ( ) ; i < childCount ; i ++ ) { addParallaxView ( viewGroup . getChildAt ( i ) , pageIndex ) ; } } ParallaxViewTag tag = ( ParallaxViewTag ) view . getTag ( R . id . parallax_view_tag ) ; if ( tag != null ) { // only track view if it has a parallax tag
tag . index = pageIndex ; parallaxViews . add ( view ) ; }


signature:
public class ParallaxLayoutInflater { /** * The LayoutInflater onCreateView is the fourth port of call for LayoutInflation .
 * BUT only for none CustomViews .
 * Basically if this method doesn ' t inflate the View nothing probably will . */
@ Override protected View onCreateView ( String name , AttributeSet attrs ) throws ClassNotFoundException { } }

implementation:
// This mimics the { @ code PhoneLayoutInflater } in the way it tries to inflate the base
// classes , if this fails its pretty certain the app will fail at this point .
View view = null ; for ( String prefix : sClassPrefixList ) { try { view = createView ( name , prefix , attrs ) ; } catch ( ClassNotFoundException ignored ) { } } // In this case we want to let the base class take a crack
// at it .
if ( view == null ) { view = super . onCreateView ( name , attrs ) ; } return mParallaxFactory . onViewCreated ( view , view . getContext ( ) , attrs ) ;


signature:
public class ParallaxLayoutInflater { /** * Nasty method to inflate custom layouts that haven ' t been handled else where . If this fails it
 * will fall back through to the PhoneLayoutInflater method of inflating custom views where
 * Calligraphy will NOT have a hook into .
 * @ param parent parent view
 * @ param view view if it has been inflated by this point , if this is not null this method
 * just returns this value .
 * @ param name name of the thing to inflate .
 * @ param context Context to inflate by if parent is null
 * @ param attrs Attr for this view which we can steal fontPath from too .
 * @ return view or the View we inflate in here . */
private View createCustomViewInternal ( View parent , View view , String name , Context context , AttributeSet attrs ) { } }

implementation:
// I by no means advise anyone to do this normally , but Google have locked down access to
// the createView ( ) method , so we never get a callback with attributes at the end of the
// createViewFromTag chain ( which would solve all this unnecessary rubbish ) .
// We at the very least try to optimise this as much as possible .
// We only call for customViews ( As they are the ones that never go through onCreateView ( . . . ) ) .
// We also maintain the Field reference and make it accessible which will make a pretty
// significant difference to performance on Android 4.0 + .
// If CustomViewCreation is off skip this .
if ( view == null && name . indexOf ( '.' ) > - 1 ) { if ( mConstructorArgs == null ) { mConstructorArgs = ReflectionUtils . getField ( LayoutInflater . class , "mConstructorArgs" ) ; } final Object [ ] mConstructorArgsArr = ( Object [ ] ) ReflectionUtils . getValue ( mConstructorArgs , this ) ; final Object lastContext = mConstructorArgsArr [ 0 ] ; mConstructorArgsArr [ 0 ] = parent != null ? parent . getContext ( ) : context ; ReflectionUtils . setValue ( mConstructorArgs , this , mConstructorArgsArr ) ; try { view = createView ( name , null , attrs ) ; } catch ( ClassNotFoundException ignored ) { } finally { mConstructorArgsArr [ 0 ] = lastContext ; ReflectionUtils . setValue ( mConstructorArgs , this , mConstructorArgsArr ) ; } } return view ;


signature: public class ParallaxActivity { @ Override protected void onCreate ( Bundle savedInstanceState ) { } }

implementation: super . onCreate ( savedInstanceState ) ; setContentView ( R . layout . activity_parallax ) ; if ( savedInstanceState == null ) { getSupportFragmentManager ( ) . beginTransaction ( ) . add ( R . id . content , new ParallaxFragment ( ) ) . commit ( ) ; }


signature:
public class LevelToSyslogSeverity { /** * Convert a level to equivalent syslog severity . Only levels for printing
 * methods i . e TRACE , DEBUG , WARN , INFO and ERROR are converted . */
static public int convert ( ILoggingEvent event ) { } }

implementation: Level level = event . getLevel ( ) ; switch ( level . levelInt ) { case Level . ERROR_INT : return SyslogConstants . ERROR_SEVERITY ; case Level . WARN_INT : return SyslogConstants . WARNING_SEVERITY ; case Level . INFO_INT : return SyslogConstants . INFO_SEVERITY ; case Level . DEBUG_INT : case Level . TRACE_INT : return SyslogConstants . DEBUG_SEVERITY ; default : throw new IllegalArgumentException ( "Level " + level + " is not a valid level for a printing method" ) ; }


signature:
public class ObjectWriterFactory { /** * Creates a new { @ link ch . qos . logback . core . net . AutoFlushingObjectWriter } instance .
 * @ param outputStream the underlying { @ link java . io . OutputStream } to write to
 * @ return a new { @ link ch . qos . logback . core . net . AutoFlushingObjectWriter } instance
 * @ throws IOException if an I / O error occurs while writing stream header */
public AutoFlushingObjectWriter newAutoFlushingObjectWriter ( OutputStream outputStream ) throws IOException { } }

implementation: return new AutoFlushingObjectWriter ( new ObjectOutputStream ( outputStream ) , CoreConstants . OOS_RESET_FREQUENCY ) ;


signature:
public class SMTPAppender { /** * Perform SMTPAppender specific appending actions , mainly adding the event to
 * a cyclic buffer . */
protected void subAppend ( CyclicBuffer < ILoggingEvent > cb , ILoggingEvent event ) { } }

implementation: if ( includeCallerData ) { event . getCallerData ( ) ; } event . prepareForDeferredProcessing ( ) ; cb . add ( event ) ;


signature:
public class ContextInitializer { /** * Finds a configuration file by system property
 * @ return the file ; or { @ code null } if not found */
private URL findConfigFileFromSystemProperties ( boolean updateStatus ) { } }

implementation:
String logbackConfigFile = OptionHelper . getSystemProperty ( CONFIG_FILE_PROPERTY ) ; if ( logbackConfigFile != null ) { URL result = null ; try { File file = new File ( logbackConfigFile ) ; if ( file . exists ( ) && file . isFile ( ) ) { if ( updateStatus ) { statusOnResourceSearch ( logbackConfigFile , this . classLoader , logbackConfigFile ) ; } result = file . toURI ( ) . toURL ( ) ; } else { result = new URL ( logbackConfigFile ) ; } return result ; } catch ( MalformedURLException e ) { // so , resource is not a URL :
// attempt to get the resource from the class path
result = Loader . getResource ( logbackConfigFile , this . classLoader ) ; if ( result != null ) { return result ; } } finally { if ( updateStatus ) { statusOnResourceSearch ( logbackConfigFile , this . classLoader , result != null ? result . toString ( ) : null ) ; } } } return null ;


signature:
public class ContextInitializer { /** * Uses the given classloader to search for a resource
 * @ return the URL to the resource ; or { @ code null } if not found */
private URL getResource ( String filename , ClassLoader myClassLoader , boolean updateStatus ) { } }

implementation: URL url = myClassLoader . getResource ( filename ) ; if ( updateStatus ) { String resourcePath = null ; if ( url != null ) { resourcePath = filename ; } statusOnResourceSearch ( filename , myClassLoader , resourcePath ) ; } return url ;


signature:
public class ContextInitializer { /** * Configures logback with the first configuration found in the following search path .
 * If no configuration found , nothing is done and logging is disabled .
 * < ol >
 * < li > $ { logback . configurationFile } ( a system property ) < / li >
 * < li > jar : file : / / assets / logback . xml < / li >
 * < / ol > */
public void autoConfig ( ) throws JoranException { } }

implementation:
StatusListenerConfigHelper . installIfAsked ( loggerContext ) ; new AndroidContextUtil ( ) . setupProperties ( loggerContext ) ; boolean verbose = true ; boolean configured = false ; JoranConfigurator configurator = new JoranConfigurator ( ) ; configurator . setContext ( loggerContext ) ; // search system property
if ( ! configured ) { URL url = findConfigFileFromSystemProperties ( verbose ) ; if ( url != null ) { configurator . doConfigure ( url ) ; configured = true ; } } // search assets
if ( ! configured ) { URL assetsConfigUrl = findConfigFileURLFromAssets ( verbose ) ; if ( assetsConfigUrl != null ) { configurator . doConfigure ( assetsConfigUrl ) ; configured = true ; } }


signature:
public class ContextInitializer { /** * Adds a status message for the result of the resource search */
private void statusOnResourceSearch ( String resourceName , ClassLoader classLoader , String path ) { } }

implementation: StatusManager sm = loggerContext . getStatusManager ( ) ; if ( path == null ) { sm . add ( new InfoStatus ( "Could NOT find resource [" + resourceName + "]" , loggerContext ) ) ; } else { sm . add ( new InfoStatus ( "Found resource [" + resourceName + "] at [" + path + "]" , loggerContext ) ) ; }


signature:
public class ServerSocketListener { /** * { @ inheritDoc } */
public T acceptClient ( ) throws IOException { } }

implementation: Socket socket = serverSocket . accept ( ) ; return createClient ( socketAddressToString ( socket . getRemoteSocketAddress ( ) ) , socket ) ;


signature:
public class ServerSocketListener { /** * Converts a socket address to a reasonable display string .
 * @ param address the subject socket address
 * @ return display string */
private String socketAddressToString ( SocketAddress address ) { } }

implementation: String addr = address . toString ( ) ; int i = addr . indexOf ( "/" ) ; if ( i >= 0 ) { addr = addr . substring ( i + 1 ) ; } return addr ;


signature:
public class ExecutorServiceUtil { /** * Creates an executor service suitable for use by logback components .
 * @ return executor service */
static public ExecutorService newExecutorService ( ) { } }

implementation: return new ThreadPoolExecutor ( CoreConstants . CORE_POOL_SIZE , CoreConstants . MAX_POOL_SIZE , 0L , TimeUnit . MILLISECONDS , new SynchronousQueue < Runnable > ( ) , THREAD_FACTORY ) ;


signature:
public class ConverterUtil { /** * Start converters in the chain of converters .
 * @ param head head node of converter chain
 * @ param < E > type of log event object */
public static < E > void startConverters ( Converter < E > head ) { } }

implementation:
Converter < E > c = head ; while ( c != null ) { // CompositeConverter is a subclass of DynamicConverter
if ( c instanceof CompositeConverter ) { CompositeConverter < E > cc = ( CompositeConverter < E > ) c ; Converter < E > childConverter = cc . childConverter ; startConverters ( childConverter ) ; cc . start ( ) ; } else if ( c instanceof DynamicConverter ) { DynamicConverter < E > dc = ( DynamicConverter < E > ) c ; dc . start ( ) ; } c = c . getNext ( ) ; }


signature:
public class RollingFileAppender { /** * This method differentiates RollingFileAppender from its super class . */
@ Override protected void subAppend ( E event ) { } }

implementation:
// The roll - over check must precede actual writing . This is the
// only correct behavior for time driven triggers .
// We need to synchronize on triggeringPolicy so that only one rollover
// occurs at a time
synchronized ( triggeringPolicy ) { if ( triggeringPolicy . isTriggeringEvent ( currentlyActiveFile , event ) ) { rollover ( ) ; } } super . subAppend ( event ) ;


signature:
public class RollingFileAppender { /** * Sets the rolling policy . In case the ' policy ' argument also implements
 * { @ link TriggeringPolicy } , then the triggering policy for this appender is
 * automatically set to be the policy argument .
 * @ param policy the desired rolling policy */
@ SuppressWarnings ( "unchecked" ) public void setRollingPolicy ( RollingPolicy policy ) { } }

implementation: rollingPolicy = policy ; if ( rollingPolicy instanceof TriggeringPolicy ) { triggeringPolicy = ( TriggeringPolicy < E > ) policy ; }


signature:
public class InterpretationContext { /** * Add a property to the properties of this execution context . If the property
 * exists already , it is overwritten .
 * @ param key the property ' s key
 * @ param value the value associated with the key */
public void addSubstitutionProperty ( String key , String value ) { } }

implementation:
if ( key == null || value == null ) { return ; } // values with leading or trailing spaces are bad . We remove them now .
value = value . trim ( ) ; propertiesMap . put ( key , value ) ;


signature:
public class InterpretationContext { /** * If a key is found in propertiesMap then return it . Otherwise , delegate to
 * the context . */
public String getProperty ( String key ) { } }

implementation: String v = propertiesMap . get ( key ) ; if ( v != null ) { return v ; } else { return context . getProperty ( key ) ; }


signature:
public class SSLServerSocketReceiver { /** * { @ inheritDoc } */
@ Override protected ServerSocketFactory getServerSocketFactory ( ) throws Exception { } }

implementation: if ( socketFactory == null ) { SSLContext sslContext = getSsl ( ) . createContext ( this ) ; SSLParametersConfiguration parameters = getSsl ( ) . getParameters ( ) ; parameters . setContext ( getContext ( ) ) ; socketFactory = new ConfigurableSSLServerSocketFactory ( parameters , sslContext . getServerSocketFactory ( ) ) ; } return socketFactory ;


signature:
public class Transform { /** * This method takes a string which may contain HTML tags ( ie , & lt ; b & gt ; ,
 * & lt ; table & gt ; , etc ) and replaces any ' & lt ; ' , ' & gt ; ' . . . characters with
 * respective predefined entity references .
 * @ param input
 * The text to be converted .
 * @ return the string with the tags escaped */
public static String escapeTags ( final String input ) { } }

implementation: if ( input == null || input . length ( ) == 0 || ! UNSAFE_XML_CHARS . matcher ( input ) . find ( ) ) { return input ; } StringBuffer buf = new StringBuffer ( input ) ; return escapeTags ( buf ) ;


signature:
public class Transform { /** * This method takes a StringBuilder which may contain HTML tags ( ie , & lt ; b & gt ; ,
 * & lt ; table & gt ; , etc ) and replaces any ' & lt ; ' and ' & gt ; ' characters with
 * respective predefined entity references .
 * @ param buf StringBuffer to transform
 * @ return the string with the tags escaped */
public static String escapeTags ( final StringBuffer buf ) { } }

implementation:
for ( int i = 0 ; i < buf . length ( ) ; i ++ ) { char ch = buf . charAt ( i ) ; switch ( ch ) { case '\t' : case '\n' : case '\r' : // These characters are below ' \ u0020 ' but are allowed :
break ; case '&' : buf . replace ( i , i + 1 , "&" ) ; break ; case '<' : buf . replace ( i , i + 1 , "<" ) ; break ; case '>' : buf . replace ( i , i + 1 , ">" ) ; break ; case '"' : buf . replace ( i , i + 1 , """ ) ; break ; case '\'' : buf . replace ( i , i + 1 , "'" ) ; break ; default : if ( ch < '\u0020' ) { // These characters are not allowed ,
// replace them with " Object replacement character " :
buf . replace ( i , i + 1 , "\uFFFD" ) ; } break ; } } return buf . toString ( ) ;


signature:
public class Transform { /** * Ensures that embedded CDEnd strings ( ] ] & gt ; ) are handled properly within
 * message , NDC and throwable tag text .
 * @ param output
 * Writer . The initial CDSutart ( & lt ; ! [ CDATA [ ) and final CDEnd ( ] ] & gt ; ) of
 * the CDATA section are the responsibility of the calling method .
 * @ param str
 * The String that is inserted into an existing CDATA Section . */
public static void appendEscapingCDATA ( StringBuilder output , String str ) { } }

implementation: if ( str == null ) { return ; } int end = str . indexOf ( CDATA_END ) ; if ( end < 0 ) { output . append ( str ) ; return ; } int start = 0 ; while ( end > - 1 ) { output . append ( str . substring ( start , end ) ) ; output . append ( CDATA_EMBEDED_END ) ; start = end + CDATA_END_LEN ; if ( start < str . length ( ) ) { end = str . indexOf ( CDATA_END , start ) ; } else { return ; } } output . append ( str . substring ( start ) ) ;


signature:
public class StringCollectionUtil { /** * Retains all values in the subject collection that are matched by
 * at least one of a collection of regular expressions .
 * This method is a convenience overload for
 * { @ link # retainMatching ( Collection , Collection ) } .
 * @ param values subject value collection
 * @ param patterns patterns to match */
public static void retainMatching ( Collection < String > values , String ... patterns ) { } }

implementation: retainMatching ( values , Arrays . asList ( patterns ) ) ;


signature:
public class StringCollectionUtil { /** * Retains all values in the subject collection that are matched by
 * at least one of a collection of regular expressions .
 * The semantics of this method are conceptually similar to
 * { @ link Collection # retainAll ( Collection ) } , but uses pattern matching
 * instead of exact matching .
 * @ param values subject value collection
 * @ param patterns patterns to match */
public static void retainMatching ( Collection < String > values , Collection < String > patterns ) { } }

implementation: if ( patterns . isEmpty ( ) ) return ; List < String > matches = new ArrayList < String > ( values . size ( ) ) ; for ( String p : patterns ) { Pattern pattern = Pattern . compile ( p ) ; for ( String value : values ) { if ( pattern . matcher ( value ) . matches ( ) ) { matches . add ( value ) ; } } } values . retainAll ( matches ) ;


signature:
public class StringCollectionUtil { /** * Removes all values in the subject collection that are matched by
 * at least one of a collection of regular expressions .
 * This method is a convenience overload for
 * { @ link # removeMatching ( Collection , Collection ) } .
 * @ param values subject value collection
 * @ param patterns patterns to match */
public static void removeMatching ( Collection < String > values , String ... patterns ) { } }

implementation: removeMatching ( values , Arrays . asList ( patterns ) ) ;


signature:
public class StringCollectionUtil { /** * Removes all values in the subject collection that are matched by
 * at least one of a collection of regular expressions .
 * The semantics of this method are conceptually similar to
 * { @ link Collection # removeAll ( Collection ) } , but uses pattern matching
 * instead of exact matching .
 * @ param values subject value collection
 * @ param patterns patterns to match */
public static void removeMatching ( Collection < String > values , Collection < String > patterns ) { } }

implementation: List < String > matches = new ArrayList < String > ( values . size ( ) ) ; for ( String p : patterns ) { Pattern pattern = Pattern . compile ( p ) ; for ( String value : values ) { if ( pattern . matcher ( value ) . matches ( ) ) { matches . add ( value ) ; } } } values . removeAll ( matches ) ;


signature:
public class ByteArrayUtil { /** * big - endian */
static void writeInt ( byte [ ] byteArray , int offset , int i ) { } }

implementation: for ( int j = 0 ; j < 4 ; j ++ ) { int shift = 24 - j * 8 ; byteArray [ offset + j ] = ( byte ) ( i >>> shift ) ; }


signature:
public class ByteArrayUtil { /** * big - endian */
static int readInt ( byte [ ] byteArray , int offset ) { } }

implementation: int i = 0 ; for ( int j = 0 ; j < 4 ; j ++ ) { int shift = 24 - j * 8 ; i += ( byteArray [ offset + j ] & 0xFF ) << shift ; } return i ;


signature:
public class Parser { /** * When the parsing step is done , the Node list can be transformed into a
 * converter chain .
 * @ param top the top node
 * @ param converterMap converter map
 * @ return the converter chain */
public Converter < E > compile ( final Node top , Map < String , String > converterMap ) { } }

implementation:
Compiler < E > compiler = new Compiler < E > ( top , converterMap ) ; compiler . setContext ( context ) ; // compiler . setStatusManager ( statusManager ) ;
return compiler . compile ( ) ;


signature:
public class Parser { /** * E = TEopt */
Node E ( ) throws ScanException { } }

implementation: Node t = T ( ) ; if ( t == null ) { return null ; } Node eOpt = Eopt ( ) ; if ( eOpt != null ) { t . setNext ( eOpt ) ; } return t ;


signature:
public class Parser { /** * Eopt = E | ~ */
Node Eopt ( ) throws ScanException { } }

implementation:
// System . out . println ( " in Eopt ( ) " ) ;
Token next = getCurentToken ( ) ; // System . out . println ( " Current token is " + next ) ;
if ( next == null ) { return null ; } else { return E ( ) ; }


signature:
public class Parser { /** * T = LITERAL | ' % ' C | ' % ' FORMAT _ MODIFIER C */
Node T ( ) throws ScanException { } }

implementation:
Token t = getCurentToken ( ) ; expectNotNull ( t , "a LITERAL or '%'" ) ; switch ( t . getType ( ) ) { case Token . LITERAL : advanceTokenPointer ( ) ; return new Node ( Node . LITERAL , t . getValue ( ) ) ; case Token . PERCENT : advanceTokenPointer ( ) ; // System . out . println ( " % token found " ) ;
FormatInfo fi ; Token u = getCurentToken ( ) ; FormattingNode c ; expectNotNull ( u , "a FORMAT_MODIFIER, SIMPLE_KEYWORD or COMPOUND_KEYWORD" ) ; if ( u . getType ( ) == Token . FORMAT_MODIFIER ) { fi = FormatInfo . valueOf ( ( String ) u . getValue ( ) ) ; advanceTokenPointer ( ) ; c = C ( ) ; c . setFormatInfo ( fi ) ; } else { c = C ( ) ; } return c ; default : return null ; }


signature:
public class XMLLayout { /** * Formats a { @ link ILoggingEvent } in conformity with the log4j . dtd . */
public String doLayout ( ILoggingEvent event ) { } }

implementation:
// Reset working buffer . If the buffer is too large , then we need a new
// one in order to avoid the penalty of creating a large array .
if ( buf . capacity ( ) > UPPER_LIMIT ) { buf = new StringBuilder ( DEFAULT_SIZE ) ; } else { buf . setLength ( 0 ) ; } // We yield to the \ r \ n heresy .
buf . append ( "<log4j:event logger=\"" ) ; buf . append ( Transform . escapeTags ( event . getLoggerName ( ) ) ) ; buf . append ( "\"\r\n" ) ; buf . append ( "             timestamp=\"" ) ; buf . append ( event . getTimeStamp ( ) ) ; buf . append ( "\" level=\"" ) ; buf . append ( event . getLevel ( ) ) ; buf . append ( "\" thread=\"" ) ; buf . append ( Transform . escapeTags ( event . getThreadName ( ) ) ) ; buf . append ( "\">\r\n" ) ; buf . append ( "  <log4j:message>" ) ; buf . append ( Transform . escapeTags ( event . getFormattedMessage ( ) ) ) ; buf . append ( "</log4j:message>\r\n" ) ; // logback does not support NDC
// String ndc = event . getNDC ( ) ;
IThrowableProxy tp = event . getThrowableProxy ( ) ; if ( tp != null ) { StackTraceElementProxy [ ] stepArray = tp . getStackTraceElementProxyArray ( ) ; buf . append ( "  <log4j:throwable><![CDATA[" ) ; for ( StackTraceElementProxy step : stepArray ) { buf . append ( CoreConstants . TAB ) ; buf . append ( step . toString ( ) ) ; buf . append ( "\r\n" ) ; } buf . append ( "]]></log4j:throwable>\r\n" ) ; } if ( locationInfo ) { StackTraceElement [ ] callerDataArray = event . getCallerData ( ) ; if ( callerDataArray != null && callerDataArray . length > 0 ) { StackTraceElement immediateCallerData = callerDataArray [ 0 ] ; buf . append ( "  <log4j:locationInfo class=\"" ) ; buf . append ( immediateCallerData . getClassName ( ) ) ; buf . append ( "\"\r\n" ) ; buf . append ( "                      method=\"" ) ; buf . append ( Transform . escapeTags ( immediateCallerData . getMethodName ( ) ) ) ; buf . append ( "\" file=\"" ) ; buf . append ( Transform . escapeTags ( immediateCallerData . getFileName ( ) ) ) ; buf . append ( "\" line=\"" ) ; buf . append ( immediateCallerData . getLineNumber ( ) ) ; buf . append ( "\"/>\r\n" ) ; } } /* * < log4j : properties > < log4j : data name = " name " value = " value " / >
 * < / log4j : properties > */
if ( this . getProperties ( ) ) { Map < String , String > propertyMap = event . getMDCPropertyMap ( ) ; if ( ( propertyMap != null ) && ( propertyMap . size ( ) != 0 ) ) { Set < Entry < String , String > > entrySet = propertyMap . entrySet ( ) ; buf . append ( "  <log4j:properties>" ) ; for ( Entry < String , String > entry : entrySet ) { buf . append ( "\r\n    <log4j:data" ) ; buf . append ( " name=\"" + Transform . escapeTags ( entry . getKey ( ) ) + "\"" ) ; buf . append ( " value=\"" + Transform . escapeTags ( entry . getValue ( ) ) + "\"" ) ; buf . append ( " />" ) ; } buf . append ( "\r\n  </log4j:properties>" ) ; } } buf . append ( "\r\n</log4j:event>\r\n\r\n" ) ; return buf . toString ( ) ;


signature:
public class AlmostAsIsEscapeUtil { /** * Do not perform any character escaping , except for ' % ' , and ' ) ' .
 * Here is the rationale . First , filename patterns do not include escape
 * combinations such as \ r or \ n . Moreover , characters which have special
 * meaning in logback parsers , such as ' { ' , or ' } ' cannot be part of file
 * names ( so me thinks ) . The left parenthesis character has special meaning
 * only if it is preceded by % . Thus , the only characters that needs escaping
 * are ' % ' and ' ) ' .
 * Note that this method assumes that it is called after the escape character
 * has been consumed . */
public void escape ( String escapeChars , StringBuffer buf , char next , int pointer ) { } }

implementation: super . escape ( "" + CoreConstants . PERCENT_CHAR + CoreConstants . RIGHT_PARENTHESIS_CHAR , buf , next , pointer ) ;


signature:
public class FileNamePattern { /** * Given date , convert this instance to a regular expression .
 * Used to compute sub - regex when the pattern has both % d and % i , and the
 * date is known .
 * @ param date - date to be converted */
public String toRegexForFixedDate ( Date date ) { } }

implementation: StringBuilder buf = new StringBuilder ( ) ; Converter < Object > p = headTokenConverter ; while ( p != null ) { if ( p instanceof LiteralConverter ) { buf . append ( p . convert ( null ) ) ; } else if ( p instanceof IntegerTokenConverter ) { buf . append ( FileFinder . regexEscapePath ( "(\\d+)" ) ) ; } else if ( p instanceof DateTokenConverter ) { DateTokenConverter < Object > dtc = ( DateTokenConverter < Object > ) p ; if ( dtc . isPrimary ( ) ) { buf . append ( p . convert ( date ) ) ; } else { buf . append ( FileFinder . regexEscapePath ( dtc . toRegex ( ) ) ) ; } } p = p . getNext ( ) ; } return buf . toString ( ) ;


signature:
public class ConfigurableSSLServerSocketFactory { /** * { @ inheritDoc } */
@ Override public ServerSocket createServerSocket ( int port , int backlog ) throws IOException { } }

implementation: SSLServerSocket socket = ( SSLServerSocket ) delegate . createServerSocket ( port , backlog ) ; parameters . configure ( new SSLConfigurableServerSocket ( socket ) ) ; return socket ;


signature:
public class AbstractEventEvaluatorAction { /** * Instantiates an evaluator of the given class and sets its name . */
public void begin ( InterpretationContext ec , String name , Attributes attributes ) { } }

implementation:
// Let us forget about previous errors ( in this instance )
inError = false ; evaluator = null ; String className = attributes . getValue ( CLASS_ATTRIBUTE ) ; if ( OptionHelper . isEmpty ( className ) ) { className = defaultClassName ( ) ; addInfo ( "Assuming default evaluator class [" + className + "]" ) ; } if ( OptionHelper . isEmpty ( className ) ) { className = defaultClassName ( ) ; inError = true ; addError ( "Mandatory \"" + CLASS_ATTRIBUTE + "\" attribute not set for <evaluator>" ) ; return ; } String evaluatorName = attributes . getValue ( Action . NAME_ATTRIBUTE ) ; if ( OptionHelper . isEmpty ( evaluatorName ) ) { inError = true ; addError ( "Mandatory \"" + NAME_ATTRIBUTE + "\" attribute not set for <evaluator>" ) ; return ; } try { evaluator = ( EventEvaluator < ? > ) OptionHelper . instantiateByClassName ( className , ch . qos . logback . core . boolex . EventEvaluator . class , context ) ; evaluator . setContext ( this . context ) ; evaluator . setName ( evaluatorName ) ; ec . pushObject ( evaluator ) ; addInfo ( "Adding evaluator named [" + evaluatorName + "] to the object stack" ) ; } catch ( Exception oops ) { inError = true ; addError ( "Could not create evaluator of type " + className + "]." , oops ) ; }


signature:
public class AbstractEventEvaluatorAction { /** * Once the children elements are also parsed , now is the time to activate the
 * evaluator options . */
@ SuppressWarnings ( "unchecked" ) public void end ( InterpretationContext ec , String e ) { } }

implementation: if ( inError ) { return ; } if ( evaluator instanceof LifeCycle ) { ( ( LifeCycle ) evaluator ) . start ( ) ; addInfo ( "Starting evaluator named [" + evaluator . getName ( ) + "]" ) ; } Object o = ec . peekObject ( ) ; if ( o != evaluator ) { addWarn ( "The object on the top the of the stack is not the evaluator pushed earlier." ) ; } else { ec . popObject ( ) ; try { Map < String , EventEvaluator < ? > > evaluatorMap = ( Map < String , EventEvaluator < ? > > ) context . getObject ( CoreConstants . EVALUATOR_MAP ) ; if ( evaluatorMap == null ) { addError ( "Could not find EvaluatorMap" ) ; } else { evaluatorMap . put ( evaluator . getName ( ) , evaluator ) ; } } catch ( Exception ex ) { addError ( "Could not set evaluator named [" + evaluator + "]." , ex ) ; } }


signature:
public class ContextSelectorStaticBinder { /** * FOR INTERNAL USE . This method is intended for use by StaticLoggerBinder .
 * @ param defaultLoggerContext
 * @ throws ClassNotFoundException
 * @ throws NoSuchMethodException
 * @ throws InstantiationException
 * @ throws IllegalAccessException
 * @ throws InvocationTargetException */
public void init ( LoggerContext defaultLoggerContext , Object key ) throws ClassNotFoundException , NoSuchMethodException , InstantiationException , IllegalAccessException , InvocationTargetException { } }

implementation: if ( this . key == null ) { this . key = key ; } else if ( this . key != key ) { throw new IllegalAccessException ( "Only certain classes can access this method." ) ; } String contextSelectorStr = OptionHelper . getSystemProperty ( ClassicConstants . LOGBACK_CONTEXT_SELECTOR ) ; if ( contextSelectorStr == null ) { contextSelector = new DefaultContextSelector ( defaultLoggerContext ) ; } else if ( contextSelectorStr . equals ( "JNDI" ) ) { throw new RuntimeException ( "JNDI not supported" ) ; } else { contextSelector = dynamicalContextSelector ( defaultLoggerContext , contextSelectorStr ) ; }


signature:
public class ContextSelectorStaticBinder { /** * Instantiate the context selector class designated by the user . The selector
 * must have a constructor taking a LoggerContext instance as an argument .
 * @ param defaultLoggerContext
 * @ param contextSelectorStr
 * @ return an instance of the designated context selector class
 * @ throws ClassNotFoundException
 * @ throws SecurityException
 * @ throws NoSuchMethodException
 * @ throws IllegalArgumentException
 * @ throws InstantiationException
 * @ throws IllegalAccessException
 * @ throws InvocationTargetException */
static ContextSelector dynamicalContextSelector ( LoggerContext defaultLoggerContext , String contextSelectorStr ) throws ClassNotFoundException , SecurityException , NoSuchMethodException , IllegalArgumentException , InstantiationException , IllegalAccessException , InvocationTargetException { } }

implementation: Class < ? > contextSelectorClass = Loader . loadClass ( contextSelectorStr ) ; Constructor cons = contextSelectorClass . getConstructor ( new Class [ ] { LoggerContext . class } ) ; return ( ContextSelector ) cons . newInstance ( defaultLoggerContext ) ;


signature:
public class AndroidContextUtil { /** * Sets properties for use in configs
 * @ param context logger context whose property map is updated */
public void setupProperties ( LoggerContext context ) { } }

implementation:
// legacy properties
Properties props = new Properties ( ) ; props . setProperty ( CoreConstants . DATA_DIR_KEY , getFilesDirectoryPath ( ) ) ; final String extDir = getMountedExternalStorageDirectoryPath ( ) ; if ( extDir != null ) { props . setProperty ( CoreConstants . EXT_DIR_KEY , extDir ) ; } props . setProperty ( CoreConstants . PACKAGE_NAME_KEY , getPackageName ( ) ) ; props . setProperty ( CoreConstants . VERSION_CODE_KEY , getVersionCode ( ) ) ; props . setProperty ( CoreConstants . VERSION_NAME_KEY , getVersionName ( ) ) ; context . putProperties ( props ) ;


signature:
public class AndroidContextUtil { /** * Gets the path to the external storage directory only if
 * mounted .
 * @ return the absolute path to the external storage directory ;
 * or { @ code null } if not mounted . */
public String getMountedExternalStorageDirectoryPath ( ) { } }

implementation: String path = null ; String state = Environment . getExternalStorageState ( ) ; if ( state . equals ( Environment . MEDIA_MOUNTED ) || state . equals ( Environment . MEDIA_MOUNTED_READ_ONLY ) ) { path = absPath ( Environment . getExternalStorageDirectory ( ) ) ; } return path ;


signature:
public class AndroidContextUtil { /** * Returns the absolute path to the directory on the Android
 * filesystem similar to { @ link # getFilesDirectoryPath ( ) } .
 * The difference is these files are excluded from automatic
 * backup to remote storage by { @ code android . app . backup . BackupAgent } .
 * This API is only available on SDK 21 + . On older versions ,
 * this function returns an empty string .
 * @ return the absolute path to the files directory
 * ( example : " / data / data / com . example / nobackup / files " ) */
@ TargetApi ( 21 ) public String getNoBackupFilesDirectoryPath ( ) { } }

implementation: return Build . VERSION . SDK_INT >= 21 && this . context != null ? absPath ( this . context . getNoBackupFilesDir ( ) ) : "" ;


signature:
public class AndroidContextUtil { /** * Returns the absolute path to the directory on the Android
 * filesystem where databases are stored for the current application .
 * @ return the absolute path to the databases directory
 * ( example : " / data / data / com . example / databases " ) */
public String getDatabaseDirectoryPath ( ) { } }

implementation: return this . context != null && this . context . getDatabasePath ( "x" ) != null ? this . context . getDatabasePath ( "x" ) . getParent ( ) : "" ;


signature:
public class FileAppender { /** * The < b > File < / b > property takes a string value which should be the name of
 * the file to append to .
 * @ param file path to destination log file */
public void setFile ( String file ) { } }

implementation:
if ( file == null ) { fileName = null ; } else { // Trim spaces from both ends . The users probably does not want
// trailing spaces in file names .
fileName = file . trim ( ) ; }


signature:
public class FileAppender { /** * If the value of < b > File < / b > is not < code > null < / code > , then
 * { @ link # openFile } is called with the values of < b > File < / b > and
 * < b > Append < / b > properties . */
public void start ( ) { } }

implementation:
int errors = 0 ; // Use getFile ( ) instead of direct access to fileName because
// the function is overridden in RollingFileAppender , which
// returns a value that doesn ' t necessarily match fileName .
String file = getFile ( ) ; if ( file != null ) { file = getAbsoluteFilePath ( file ) ; addInfo ( "File property is set to [" + file + "]" ) ; if ( prudent ) { if ( ! isAppend ( ) ) { setAppend ( true ) ; addWarn ( "Setting \"Append\" property to true on account of \"Prudent\" mode" ) ; } } if ( ! lazyInit ) { if ( checkForFileCollisionInPreviousFileAppenders ( ) ) { addError ( "Collisions detected with FileAppender/RollingAppender instances defined earlier. Aborting." ) ; addError ( COLLISION_WITH_EARLIER_APPENDER_URL ) ; errors ++ ; } else { // file should be opened only if collision free
try { openFile ( file ) ; } catch ( IOException e ) { errors ++ ; addError ( "openFile(" + file + "," + append + ") failed" , e ) ; } } } else { // We ' ll initialize the file output stream later . Use a dummy for now
// to satisfy OutputStreamAppender . start ( ) .
setOutputStream ( new NOPOutputStream ( ) ) ; } } else { errors ++ ; addError ( "\"File\" property not set for appender named [" + name + "]" ) ; } if ( errors == 0 ) { super . start ( ) ; }


signature:
public class FileAppender { /** * Sets and < i > opens < / i > the file where the log output will go . The specified
 * file must be writable .
 * If there was already an opened file , then the previous file is closed
 * first .
 * < b > Do not use this method directly . To configure a FileAppender or one of
 * its subclasses , set its properties one by one and then call start ( ) . < / b >
 * @ param filename
 * The path to the log file .
 * @ return true if successful ; false otherwise
 * @ throws IOException file could not be opened */
protected boolean openFile ( String filename ) throws IOException { } }

implementation: boolean successful = false ; filename = getAbsoluteFilePath ( filename ) ; lock . lock ( ) ; try { File file = new File ( filename ) ; boolean result = FileUtil . createMissingParentDirectories ( file ) ; if ( ! result ) { addError ( "Failed to create parent directories for [" + file . getAbsolutePath ( ) + "]" ) ; } ResilientFileOutputStream resilientFos = new ResilientFileOutputStream ( file , append , bufferSize . getSize ( ) ) ; resilientFos . setContext ( context ) ; setOutputStream ( resilientFos ) ; successful = true ; } finally { lock . unlock ( ) ; } return successful ;


signature:
public class FileAppender { /** * Gets the absolute path to the filename , starting from the app ' s
 * " files " directory , if it is not already an absolute path
 * @ param filename filename to evaluate
 * @ return absolute path to the filename */
private String getAbsoluteFilePath ( String filename ) { } }

implementation:
// In Android , relative paths created with File ( ) are relative
// to root , so fix it by prefixing the path to the app ' s " files "
// directory .
// This transformation is rather expensive , since it involves loading the
// Android manifest from the APK ( which is a ZIP file ) , and parsing it to
// retrieve the application package name . This should be avoided if
// possible as it may perceptibly delay the app launch time .
if ( EnvUtil . isAndroidOS ( ) && ! new File ( filename ) . isAbsolute ( ) ) { String dataDir = context . getProperty ( CoreConstants . DATA_DIR_KEY ) ; filename = FileUtil . prefixRelativePath ( dataDir , filename ) ; } return filename ;


signature:
public class OnErrorEvaluator { /** * Return true if event passed as parameter has level ERROR or higher , returns
 * false otherwise . */
public boolean evaluate ( ILoggingEvent event ) throws NullPointerException , EvaluationException { } }

implementation: return event . getLevel ( ) . levelInt >= Level . ERROR_INT ;


signature:
public class MDCBasedDiscriminator { /** * Return the value associated with an MDC entry designated by the Key
 * property . If that value is null , then return the value assigned to the
 * DefaultValue property . */
public String getDiscriminatingValue ( ILoggingEvent event ) { } }

implementation:
// http : / / jira . qos . ch / browse / LBCLASSIC - 213
Map < String , String > mdcMap = event . getMDCPropertyMap ( ) ; if ( mdcMap == null ) { return defaultValue ; } String mdcValue = mdcMap . get ( key ) ; if ( mdcValue == null ) { return defaultValue ; } else { return mdcValue ; }


signature:
public class ReconfigureOnChangeFilter { /** * update the mask so as to execute change detection code about once every 100 to 8000 milliseconds . */
private void updateMaskIfNecessary ( long now ) { } }

implementation: final long timeElapsedSinceLastMaskUpdateCheck = now - lastMaskCheck ; lastMaskCheck = now ; if ( timeElapsedSinceLastMaskUpdateCheck < MASK_INCREASE_THRESHOLD && ( mask < MAX_MASK ) ) { mask = ( mask << 1 ) | 1 ; } else if ( timeElapsedSinceLastMaskUpdateCheck > MASK_DECREASE_THRESHOLD ) { mask = mask >>> 2 ; }


signature:
public class FilterAttachableImpl { /** * Loop through the filters in the list . As soon as a filter decides on
 * ACCEPT or DENY , then that value is returned . If all of the filters return
 * NEUTRAL , then NEUTRAL is returned . */
public FilterReply getFilterChainDecision ( E event ) { } }

implementation:
final Filter < E > [ ] filterArrray = filterList . asTypedArray ( ) ; final int len = filterArrray . length ; for ( int i = 0 ; i < len ; i ++ ) { final FilterReply r = filterArrray [ i ] . decide ( event ) ; if ( r == FilterReply . DENY || r == FilterReply . ACCEPT ) { return r ; } } // no decision
return FilterReply . NEUTRAL ;


signature:
public class RemoteReceiverStreamClient { /** * { @ inheritDoc } */
public void run ( ) { } }

implementation:
addInfo ( clientId + "connected" ) ; ObjectOutputStream oos = null ; try { int counter = 0 ; oos = createObjectOutputStream ( ) ; while ( ! Thread . currentThread ( ) . isInterrupted ( ) ) { try { Serializable event = queue . take ( ) ; oos . writeObject ( event ) ; oos . flush ( ) ; if ( ++ counter >= CoreConstants . OOS_RESET_FREQUENCY ) { // failing to reset the stream periodically will result in a
// serious memory leak ( as noted in AbstractSocketAppender )
counter = 0 ; oos . reset ( ) ; } } catch ( InterruptedException ex ) { Thread . currentThread ( ) . interrupt ( ) ; } } } catch ( SocketException ex ) { addInfo ( clientId + ex ) ; } catch ( IOException ex ) { addError ( clientId + ex ) ; } catch ( RuntimeException ex ) { addError ( clientId + ex ) ; } finally { if ( oos != null ) { CloseUtil . closeQuietly ( oos ) ; } close ( ) ; addInfo ( clientId + "connection closed" ) ; }


signature:
public class SecureRandomFactoryBean { /** * Creates a new { @ link SecureRandom } generator using the receiver ' s
 * configuration .
 * @ return secure random generator instance
 * @ throws NoSuchProviderException if the provider name specified by
 * { @ link # setProvider ( String ) } is not known to the platform
 * @ throws NoSuchAlgorithmException if the algorithm name specified by
 * { @ link # setAlgorithm ( String ) } is not recognized by the specified
 * provider ( or the platform ' s default provider if the provider isn ' t
 * specified ) */
public SecureRandom createSecureRandom ( ) throws NoSuchProviderException , NoSuchAlgorithmException { } }

implementation: try { return getProvider ( ) != null ? SecureRandom . getInstance ( getAlgorithm ( ) , getProvider ( ) ) : SecureRandom . getInstance ( getAlgorithm ( ) ) ; } catch ( NoSuchProviderException ex ) { throw new NoSuchProviderException ( "no such secure random provider: " + getProvider ( ) ) ; } catch ( NoSuchAlgorithmException ex ) { throw new NoSuchAlgorithmException ( "no such secure random algorithm: " + getAlgorithm ( ) ) ; }


signature:
public class NewRuleAction { /** * Instantiates an layout of the given class and sets its name . */
public void begin ( InterpretationContext ec , String localName , Attributes attributes ) { } }

implementation:
// Let us forget about previous errors ( in this object )
inError = false ; String errorMsg ; String pattern = attributes . getValue ( Action . PATTERN_ATTRIBUTE ) ; String actionClass = attributes . getValue ( Action . ACTION_CLASS_ATTRIBUTE ) ; if ( OptionHelper . isEmpty ( pattern ) ) { inError = true ; errorMsg = "No 'pattern' attribute in <newRule>" ; addError ( errorMsg ) ; return ; } if ( OptionHelper . isEmpty ( actionClass ) ) { inError = true ; errorMsg = "No 'actionClass' attribute in <newRule>" ; addError ( errorMsg ) ; return ; } try { addInfo ( "About to add new Joran parsing rule [" + pattern + "," + actionClass + "]." ) ; ec . getJoranInterpreter ( ) . getRuleStore ( ) . addRule ( new ElementSelector ( pattern ) , actionClass ) ; } catch ( Exception oops ) { inError = true ; errorMsg = "Could not add new Joran parsing rule [" + pattern + "," + actionClass + "]" ; addError ( errorMsg ) ; }


signature:
public class SSLContextFactoryBean { /** * Creates a new { @ link SSLContext } using the receiver ' s configuration .
 * @ param context context for status messages
 * @ return { @ link SSLContext } object
 * @ throws NoSuchProviderException if a provider specified for one of the
 * JCA or JSSE components utilized in creating the context is not
 * known to the platform
 * @ throws NoSuchAlgorithmException if a JCA or JSSE algorithm , protocol ,
 * or type name specified for one of the context ' s components is not
 * known to a given provider ( or platform default provider for the
 * component )
 * @ throws KeyManagementException if an error occurs in creating a
 * { @ link KeyManager } for the context
 * @ throws UnrecoverableKeyException if a private key needed by a
 * { @ link KeyManager } cannot be obtained from a key store
 * @ throws KeyStoreException if an error occurs in reading the
 * contents of a key store
 * @ throws CertificateException if an error occurs in reading the
 * contents of a certificate */
public SSLContext createContext ( ContextAware context ) throws NoSuchProviderException , NoSuchAlgorithmException , KeyManagementException , UnrecoverableKeyException , KeyStoreException , CertificateException { } }

implementation: SSLContext sslContext = getProvider ( ) != null ? SSLContext . getInstance ( getProtocol ( ) , getProvider ( ) ) : SSLContext . getInstance ( getProtocol ( ) ) ; context . addInfo ( "SSL protocol '" + sslContext . getProtocol ( ) + "' provider '" + sslContext . getProvider ( ) + "'" ) ; KeyManager [ ] keyManagers = createKeyManagers ( context ) ; TrustManager [ ] trustManagers = createTrustManagers ( context ) ; SecureRandom secureRandom = createSecureRandom ( context ) ; sslContext . init ( keyManagers , trustManagers , secureRandom ) ; return sslContext ;


signature:
public class SSLContextFactoryBean { /** * Creates key managers using the receiver ' s key store configuration .
 * @ param context context for status messages
 * @ return an array of key managers or { @ code null } if no key store
 * configuration was provided
 * @ throws NoSuchProviderException if a provider specified for one
 * of the key manager components is not known to the platform
 * @ throws NoSuchAlgorithmException if an algorithm specified for
 * one of the key manager components is not known to the relevant
 * provider
 * @ throws KeyStoreException if an error occurs in reading a key store */
private KeyManager [ ] createKeyManagers ( ContextAware context ) throws NoSuchProviderException , NoSuchAlgorithmException , UnrecoverableKeyException , KeyStoreException { } }

implementation: if ( getKeyStore ( ) == null ) return null ; KeyStore keyStore = getKeyStore ( ) . createKeyStore ( ) ; context . addInfo ( "key store of type '" + keyStore . getType ( ) + "' provider '" + keyStore . getProvider ( ) + "': " + getKeyStore ( ) . getLocation ( ) ) ; KeyManagerFactory kmf = getKeyManagerFactory ( ) . createKeyManagerFactory ( ) ; context . addInfo ( "key manager algorithm '" + kmf . getAlgorithm ( ) + "' provider '" + kmf . getProvider ( ) + "'" ) ; char [ ] passphrase = getKeyStore ( ) . getPassword ( ) . toCharArray ( ) ; kmf . init ( keyStore , passphrase ) ; return kmf . getKeyManagers ( ) ;


signature:
public class SSLContextFactoryBean { /** * Creates trust managers using the receiver ' s trust store configuration .
 * @ param context context for status messages
 * @ return an array of trust managers or { @ code null } if no trust store
 * configuration was provided
 * @ throws NoSuchProviderException if a provider specified for one
 * of the trust manager components is not known to the platform
 * @ throws NoSuchAlgorithmException if an algorithm specified for
 * one of the trust manager components is not known to the relevant
 * provider
 * @ throws KeyStoreException if an error occurs in reading a key
 * store containing trust anchors */
private TrustManager [ ] createTrustManagers ( ContextAware context ) throws NoSuchProviderException , NoSuchAlgorithmException , KeyStoreException { } }

implementation: if ( getTrustStore ( ) == null ) return null ; KeyStore trustStore = getTrustStore ( ) . createKeyStore ( ) ; context . addInfo ( "trust store of type '" + trustStore . getType ( ) + "' provider '" + trustStore . getProvider ( ) + "': " + getTrustStore ( ) . getLocation ( ) ) ; TrustManagerFactory tmf = getTrustManagerFactory ( ) . createTrustManagerFactory ( ) ; context . addInfo ( "trust manager algorithm '" + tmf . getAlgorithm ( ) + "' provider '" + tmf . getProvider ( ) + "'" ) ; tmf . init ( trustStore ) ; return tmf . getTrustManagers ( ) ;


signature:
public class SSLContextFactoryBean { /** * Constructs a key store factory bean using JSSE system properties .
 * @ param property base property name ( e . g . { @ code javax . net . ssl . keyStore } )
 * @ return key store or { @ code null } if no value is defined for the
 * base system property name */
private KeyStoreFactoryBean keyStoreFromSystemProperties ( String property ) { } }

implementation: if ( System . getProperty ( property ) == null ) return null ; KeyStoreFactoryBean keyStore = new KeyStoreFactoryBean ( ) ; keyStore . setLocation ( locationFromSystemProperty ( property ) ) ; keyStore . setProvider ( System . getProperty ( property + "Provider" ) ) ; keyStore . setPassword ( System . getProperty ( property + "Password" ) ) ; keyStore . setType ( System . getProperty ( property + "Type" ) ) ; return keyStore ;


signature:
public class SSLContextFactoryBean { /** * Constructs a resource location from a JSSE system property .
 * @ param name property name ( e . g . { @ code javax . net . ssl . keyStore } )
 * @ return URL for the location specified in the property or { @ code null }
 * if no value is defined for the property */
private String locationFromSystemProperty ( String name ) { } }

implementation: String location = System . getProperty ( name ) ; if ( location != null && ! location . startsWith ( "file:" ) ) { location = "file:" + location ; } return location ;


signature:
public class LocationUtil { /** * Converts a string describing the location of a resource into a URL object .
 * @ param location String describing the location
 * @ return URL object that refers to { @ code location }
 * @ throws MalformedURLException if { @ code location } is not a syntatically
 * valid URL
 * @ throws FileNotFoundException if { @ code location } specifies a non - existent
 * classpath resource
 * @ throws NullPointerException if { @ code location } is { @ code null } */
public static URL urlForResource ( String location ) throws MalformedURLException , FileNotFoundException { } }

implementation: if ( location == null ) { throw new NullPointerException ( "location is required" ) ; } URL url = null ; if ( ! location . matches ( SCHEME_PATTERN ) ) { url = Loader . getResourceBySelfClassLoader ( location ) ; } else if ( location . startsWith ( CLASSPATH_SCHEME ) ) { String path = location . substring ( CLASSPATH_SCHEME . length ( ) ) ; if ( path . startsWith ( "/" ) ) { path = path . substring ( 1 ) ; } if ( path . length ( ) == 0 ) { throw new MalformedURLException ( "path is required" ) ; } url = Loader . getResourceBySelfClassLoader ( path ) ; } else { url = new URL ( location ) ; } if ( url == null ) { throw new FileNotFoundException ( location ) ; } return url ;


signature:
public class ConversionRuleAction { /** * Instantiates an layout of the given class and sets its name . */
@ SuppressWarnings ( "unchecked" ) public void begin ( InterpretationContext ec , String localName , Attributes attributes ) { } }

implementation:
// Let us forget about previous errors ( in this object )
inError = false ; String errorMsg ; String conversionWord = attributes . getValue ( ActionConst . CONVERSION_WORD_ATTRIBUTE ) ; String converterClass = attributes . getValue ( ActionConst . CONVERTER_CLASS_ATTRIBUTE ) ; if ( OptionHelper . isEmpty ( conversionWord ) ) { inError = true ; errorMsg = "No 'conversionWord' attribute in <conversionRule>" ; addError ( errorMsg ) ; return ; } if ( OptionHelper . isEmpty ( converterClass ) ) { inError = true ; errorMsg = "No 'converterClass' attribute in <conversionRule>" ; ec . addError ( errorMsg ) ; return ; } try { Map < String , String > ruleRegistry = ( Map < String , String > ) context . getObject ( CoreConstants . PATTERN_RULE_REGISTRY ) ; if ( ruleRegistry == null ) { ruleRegistry = new HashMap < String , String > ( ) ; context . putObject ( CoreConstants . PATTERN_RULE_REGISTRY , ruleRegistry ) ; } // put the new rule into the rule registry
addInfo ( "registering conversion word " + conversionWord + " with class [" + converterClass + "]" ) ; ruleRegistry . put ( conversionWord , converterClass ) ; } catch ( Exception oops ) { inError = true ; errorMsg = "Could not add conversion rule to PatternLayout." ; addError ( errorMsg ) ; }


signature:
public class EnsureExceptionHandling { /** * This implementation checks if any of the converters in the chain handles
 * exceptions . If not , then this method adds a
 * { @ link ThrowableProxyConverter } instance to the end of the chain .
 * This allows appenders using this layout to output exception information
 * event if the user forgets to add % ex to the pattern . Note that the
 * appenders defined in the Core package are not aware of exceptions nor
 * LoggingEvents .
 * If for some reason the user wishes to NOT print exceptions , then she can
 * add % nopex to the pattern . */
public void process ( Context context , Converter < ILoggingEvent > head ) { } }

implementation:
if ( head == null ) { // this should never happen
throw new IllegalArgumentException ( "cannot process empty chain" ) ; } if ( ! chainHandlesThrowable ( head ) ) { Converter < ILoggingEvent > tail = ConverterUtil . findTail ( head ) ; Converter < ILoggingEvent > exConverter = null ; LoggerContext loggerContext = ( LoggerContext ) context ; if ( loggerContext . isPackagingDataEnabled ( ) ) { exConverter = new ExtendedThrowableProxyConverter ( ) ; } else { exConverter = new ThrowableProxyConverter ( ) ; } tail . setNext ( exConverter ) ; }


signature:
public class EnsureExceptionHandling { /** * This method computes whether a chain of converters handles exceptions or
 * not .
 * @ param head
 * The first element of the chain
 * @ return true if can handle throwables contained in logging events */
public boolean chainHandlesThrowable ( Converter < ILoggingEvent > head ) { } }

implementation: Converter < ILoggingEvent > c = head ; while ( c != null ) { if ( c instanceof ThrowableHandlingConverter ) { return true ; } c = c . getNext ( ) ; } return false ;


signature:
public class ShutdownHookBase { /** * Default method for stopping the Logback context */
protected void stop ( ) { } }

implementation: addInfo ( "Logback context being closed via shutdown hook" ) ; Context hookContext = getContext ( ) ; if ( hookContext instanceof ContextBase ) { ContextBase context = ( ContextBase ) hookContext ; context . stop ( ) ; }


signature:
public class StatusPrinter { /** * Print the contents of the context status , but only if they contain
 * warnings or errors occurring later then the threshold .
 * @ param context */
public static void printInCaseOfErrorsOrWarnings ( Context context , long threshold ) { } }

implementation: if ( context == null ) { throw new IllegalArgumentException ( "Context argument cannot be null" ) ; } StatusManager sm = context . getStatusManager ( ) ; if ( sm == null ) { ps . println ( "WARN: Context named \"" + context . getName ( ) + "\" has no status manager" ) ; } else { StatusUtil statusUtil = new StatusUtil ( context ) ; if ( statusUtil . getHighestLevel ( threshold ) >= ErrorStatus . WARN ) { print ( sm , threshold ) ; } }


signature:
public class StatusPrinter { /** * Print the contents of the context statuses , but only if they contain
 * errors .
 * @ param context */
public static void printIfErrorsOccured ( Context context ) { } }

implementation: if ( context == null ) { throw new IllegalArgumentException ( "Context argument cannot be null" ) ; } StatusManager sm = context . getStatusManager ( ) ; if ( sm == null ) { ps . println ( "WARN: Context named \"" + context . getName ( ) + "\" has no status manager" ) ; } else { StatusUtil statusUtil = new StatusUtil ( context ) ; if ( statusUtil . getHighestLevel ( 0 ) == ErrorStatus . ERROR ) { print ( sm ) ; } }


signature:
public class StatusPrinter { /** * Print context ' s status data with a timestamp higher than the threshold .
 * @ param context */
public static void print ( Context context , long threshold ) { } }

implementation: if ( context == null ) { throw new IllegalArgumentException ( "Context argument cannot be null" ) ; } StatusManager sm = context . getStatusManager ( ) ; if ( sm == null ) { ps . println ( "WARN: Context named \"" + context . getName ( ) + "\" has no status manager" ) ; } else { print ( sm , threshold ) ; }


signature: public class StatusPrinter { private static void appendThrowable ( StringBuilder sb , Throwable t ) { } }

implementation:
String [ ] stringRep = ThrowableToStringArray . convert ( t ) ; for ( String s : stringRep ) { if ( s . startsWith ( CoreConstants . CAUSED_BY ) ) { // nothing
} else if ( Character . isDigit ( s . charAt ( 0 ) ) ) { // if line resembles " 48 common frames omitted "
sb . append ( "\t... " ) ; } else { // most of the time . just add a tab + " at "
sb . append ( "\tat " ) ; } sb . append ( s ) . append ( CoreConstants . LINE_SEPARATOR ) ; }


signature:
public class AbstractSocketAppender { /** * { @ inheritDoc } */
public void start ( ) { } }

implementation: if ( isStarted ( ) ) return ; int errorCount = 0 ; if ( port <= 0 ) { errorCount ++ ; addError ( "No port was configured for appender" + name + " For more information, please visit http://logback.qos.ch/codes.html#socket_no_port" ) ; } if ( remoteHost == null ) { errorCount ++ ; addError ( "No remote host was configured for appender" + name + " For more information, please visit http://logback.qos.ch/codes.html#socket_no_host" ) ; } if ( queueSize == 0 ) { addWarn ( "Queue size of zero is deprecated, use a size of one to indicate synchronous processing" ) ; } if ( queueSize < 0 ) { errorCount ++ ; addError ( "Queue size must be greater than zero" ) ; } if ( errorCount == 0 ) { try { address = InetAddress . getByName ( remoteHost ) ; } catch ( UnknownHostException ex ) { addError ( "unknown host: " + remoteHost ) ; errorCount ++ ; } } if ( errorCount == 0 ) { deque = queueFactory . newLinkedBlockingDeque ( queueSize ) ; peerId = "remote peer " + remoteHost + ":" + port + ": " ; connector = createConnector ( address , port , 0 , reconnectionDelay . getMilliseconds ( ) ) ; task = getContext ( ) . getScheduledExecutorService ( ) . submit ( new Runnable ( ) { public void run ( ) { connectSocketAndDispatchEvents ( ) ; } } ) ; super . start ( ) ; }


signature:
public class AbstractSocketAppender { /** * { @ inheritDoc } */
@ Override public void stop ( ) { } }

implementation: if ( ! isStarted ( ) ) return ; CloseUtil . closeQuietly ( socket ) ; task . cancel ( true ) ; super . stop ( ) ;


signature:
public class AbstractSocketAppender { /** * { @ inheritDoc } */
@ Override protected void append ( E event ) { } }

implementation: if ( event == null || ! isStarted ( ) ) return ; try { final boolean inserted = deque . offer ( event , eventDelayLimit . getMilliseconds ( ) , TimeUnit . MILLISECONDS ) ; if ( ! inserted ) { addInfo ( "Dropping event due to timeout limit of [" + eventDelayLimit + "] being exceeded" ) ; } } catch ( InterruptedException e ) { addError ( "Interrupted while appending event to SocketAppender" , e ) ; }


signature:
public class AbstractSocketAppender { /** * { @ inheritDoc } */
public void connectionFailed ( SocketConnector connector , Exception ex ) { } }

implementation: if ( ex instanceof InterruptedException ) { addInfo ( "connector interrupted" ) ; } else if ( ex instanceof ConnectException ) { addInfo ( peerId + "connection refused" ) ; } else { addInfo ( peerId + ex ) ; }


signature:
public class SyslogAppender { /** * Convert a level to equivalent syslog severity . Only levels for printing
 * methods i . e DEBUG , WARN , INFO and ERROR are converted .
 * @ see ch . qos . logback . core . net . SyslogAppenderBase # getSeverityForEvent ( java . lang . Object ) */
@ Override public int getSeverityForEvent ( Object eventObject ) { } }

implementation: ILoggingEvent event = ( ILoggingEvent ) eventObject ; return LevelToSyslogSeverity . convert ( event ) ;


signature:
public class SyslogAppender { /** * LOGBACK - 411 and LOGBACK - 750 */
private void handleThrowableFirstLine ( OutputStream sw , IThrowableProxy tp , String stackTracePrefix , boolean isRootException ) throws IOException { } }

implementation: StringBuilder sb = new StringBuilder ( ) . append ( stackTracePrefix ) ; if ( ! isRootException ) { sb . append ( CoreConstants . CAUSED_BY ) ; } sb . append ( tp . getClassName ( ) ) . append ( ": " ) . append ( tp . getMessage ( ) ) ; sw . write ( sb . toString ( ) . getBytes ( ) ) ; sw . flush ( ) ;


signature:
public class AbstractComponentTracker { /** * Get an entry from the liveMap , if not found search the lingerersMap .
 * @ param key
 * @ return */
private Entry < C > getFromEitherMap ( String key ) { } }

implementation: Entry < C > entry = liveMap . get ( key ) ; if ( entry != null ) return entry ; else { return lingerersMap . get ( key ) ; }


signature:
public class AbstractComponentTracker { /** * { @ inheritDoc }
 * < p > Note that this method is synchronized . < / p >
 * @ param key { @ inheritDoc }
 * @ return { @ inheritDoc } */
public synchronized C find ( String key ) { } }

implementation: Entry < C > entry = getFromEitherMap ( key ) ; if ( entry == null ) return null ; else return entry . component ;


signature:
public class AbstractComponentTracker { /** * { @ inheritDoc }
 * < p > Note that this method is atomic , i . e . synchronized . < / p >
 * @ param key { @ inheritDoc }
 * @ param timestamp { @ inheritDoc }
 * @ return { @ inheritDoc } */
public synchronized C getOrCreate ( String key , long timestamp ) { } }

implementation:
Entry < C > entry = getFromEitherMap ( key ) ; if ( entry == null ) { C c = buildComponent ( key ) ; entry = new Entry < C > ( key , c , timestamp ) ; // new entries go into the main map
liveMap . put ( key , entry ) ; } else { entry . setTimestamp ( timestamp ) ; } return entry . component ;


signature:
public class AbstractComponentTracker { /** * Mark component identified by ' key ' as having reached its end - of - life .
 * @ param key */
public void endOfLife ( String key ) { } }

implementation: Entry < C > entry = liveMap . remove ( key ) ; if ( entry == null ) return ; lingerersMap . put ( key , entry ) ;


signature:
public class FormatInfo { /** * This method is used to parse a string such as " 5 " , " . 7 " , " 5.7 " or " - 5.7 " into
 * a FormatInfo .
 * @ param str A String to convert into a FormatInfo object
 * @ return A newly created and appropriately initialized FormatInfo object .
 * @ throws IllegalArgumentException string is null or ends with ' . ' */
public static FormatInfo valueOf ( String str ) throws IllegalArgumentException { } }

implementation: if ( str == null ) { throw new NullPointerException ( "Argument cannot be null" ) ; } FormatInfo fi = new FormatInfo ( ) ; int indexOfDot = str . indexOf ( '.' ) ; String minPart = null ; String maxPart = null ; if ( indexOfDot != - 1 ) { minPart = str . substring ( 0 , indexOfDot ) ; if ( indexOfDot + 1 == str . length ( ) ) { throw new IllegalArgumentException ( "Formatting string [" + str + "] should not end with '.'" ) ; } else { maxPart = str . substring ( indexOfDot + 1 ) ; } } else { minPart = str ; } if ( minPart != null && minPart . length ( ) > 0 ) { int min = Integer . parseInt ( minPart ) ; if ( min >= 0 ) { fi . min = min ; } else { fi . min = - min ; fi . leftPad = false ; } } if ( maxPart != null && maxPart . length ( ) > 0 ) { int max = Integer . parseInt ( maxPart ) ; if ( max >= 0 ) { fi . max = max ; } else { fi . max = - max ; fi . leftTruncate = false ; } } return fi ;


signature:
public class RenameUtil { /** * A relatively robust file renaming method which in case of failure due to
 * src and target being on different volumes , falls back onto
 * renaming by copying .
 * @ param src
 * @ param target
 * @ throws RolloverFailure */
public void rename ( String src , String target ) throws RolloverFailure { } }

implementation: if ( src . equals ( target ) ) { addWarn ( "Source and target files are the same [" + src + "]. Skipping." ) ; return ; } File srcFile = new File ( src ) ; if ( srcFile . exists ( ) ) { File targetFile = new File ( target ) ; createMissingTargetDirsIfNecessary ( targetFile ) ; addInfo ( "Renaming file [" + srcFile + "] to [" + targetFile + "]" ) ; boolean result = srcFile . renameTo ( targetFile ) ; if ( ! result ) { addWarn ( "Failed to rename file [" + srcFile + "] as [" + targetFile + "]." ) ; Boolean areOnDifferentVolumes = areOnDifferentVolumes ( srcFile , targetFile ) ; if ( Boolean . TRUE . equals ( areOnDifferentVolumes ) ) { addWarn ( "Detected different file systems for source [" + src + "] and target [" + target + "]. Attempting rename by copying." ) ; renameByCopying ( src , target ) ; return ; } else { addWarn ( "Please consider leaving the [file] option of " + RollingFileAppender . class . getSimpleName ( ) + " empty." ) ; addWarn ( "See also " + RENAMING_ERROR_URL ) ; } } } else { throw new RolloverFailure ( "File [" + src + "] does not exist." ) ; }


signature:
public class RenameUtil { /** * Attempts tp determine whether both files are on different volumes . Returns true if we could determine that
 * the files are on different volumes . Returns false otherwise or if an error occurred while doing the check .
 * @ param srcFile
 * @ param targetFile
 * @ return true if on different volumes , false otherwise or if an error occurred */
Boolean areOnDifferentVolumes ( File srcFile , File targetFile ) throws RolloverFailure { } }

implementation:
if ( ! EnvUtil . isJDK7OrHigher ( ) ) { return false ; } // target file is not certain to exist but its parent has to exist given the call hierarchy of this method
File parentOfTarget = targetFile . getAbsoluteFile ( ) . getParentFile ( ) ; if ( parentOfTarget == null ) { addWarn ( "Parent of target file [" + targetFile + "] is null" ) ; return null ; } if ( ! parentOfTarget . exists ( ) ) { addWarn ( "Parent of target file [" + targetFile + "] does not exist" ) ; return null ; } try { boolean onSameFileStore = FileStoreUtil . areOnSameFileStore ( srcFile , parentOfTarget ) ; return ! onSameFileStore ; } catch ( RolloverFailure rf ) { addWarn ( "Error while checking file store equality" , rf ) ; return null ; }


signature:
public class OptionHelper { /** * See http : / / logback . qos . ch / manual / configuration . html # variableSubstitution
 * @ param input string to be evaluated
 * @ param pc0 primary property container
 * @ param pc1 secondary property container
 * @ return the substituted string */
public static String substVars ( String input , PropertyContainer pc0 , PropertyContainer pc1 ) { } }

implementation: try { return NodeToStringTransformer . substituteVariable ( input , pc0 , pc1 ) ; } catch ( ScanException e ) { throw new IllegalArgumentException ( "Failed to parse input [" + input + "]" , e ) ; }


signature:
public class OptionHelper { /** * Very similar to < code > System . getProperty < / code > except that the
 * { @ link SecurityException } is absorbed .
 * @ param key The key to search for .
 * @ param def The default value to return .
 * @ return the string value of the system property , or the default value if
 * there is no property with that key . */
public static String getSystemProperty ( String key , String def ) { } }

implementation: try { return System . getProperty ( key , def ) ; } catch ( SecurityException e ) { return def ; }


signature:
public class OptionHelper { /** * Lookup a key from the environment .
 * @ param key the environment variable ' s key
 * @ return value corresponding to key from the OS environment */
public static String getEnv ( String key ) { } }

implementation: try { return System . getenv ( key ) ; } catch ( SecurityException e ) { return null ; }


signature:
public class OptionHelper { /** * Gets an Android system property
 * @ param key The key to search for
 * @ return the string value of the system property */
public static String getAndroidSystemProperty ( String key ) { } }

implementation: try { return SystemPropertiesProxy . getInstance ( ) . get ( key , null ) ; } catch ( IllegalArgumentException e ) { return null ; }


signature:
public class OptionHelper { /** * Very similar to < code > System . getProperty < / code > except that the
 * { @ link SecurityException } is absorbed . Also checks Android
 * system properties as a fallback .
 * @ param key The key to search for .
 * @ return the string value of the system property . */
public static String getSystemProperty ( String key ) { } }

implementation: try { String prop = System . getProperty ( key ) ; return ( prop == null ) ? getAndroidSystemProperty ( key ) : prop ; } catch ( SecurityException e ) { return null ; }


signature:
public class OptionHelper { /** * Return a String [ ] of size two . The first item containing the key part and the second item
 * containing a default value specified by the user . The second item will be null if no default value
 * is specified .
 * @ param key
 * @ return array , where item 0 is the key , and item 1 is the default value */
static public String [ ] extractDefaultReplacement ( String key ) { } }

implementation: String [ ] result = new String [ 2 ] ; if ( key == null ) return result ; result [ 0 ] = key ; int d = key . indexOf ( DELIM_DEFAULT ) ; if ( d != - 1 ) { result [ 0 ] = key . substring ( 0 , d ) ; result [ 1 ] = key . substring ( d + DELIM_DEFAULT_LEN ) ; } return result ;


signature:
public class OptionHelper { /** * If < code > value < / code > is " true " , then < code > true < / code > is returned . If
 * < code > value < / code > is " false " , then < code > true < / code > is returned .
 * Otherwise , < code > default < / code > is returned .
 * Case of value is unimportant .
 * @ param value string to be evaluated
 * @ param defaultValue default value if value could not be converted
 * @ return the equivalent boolean value */
public static boolean toBoolean ( String value , boolean defaultValue ) { } }

implementation: if ( value == null ) { return defaultValue ; } String trimmedVal = value . trim ( ) ; if ( "true" . equalsIgnoreCase ( trimmedVal ) ) { return true ; } if ( "false" . equalsIgnoreCase ( trimmedVal ) ) { return false ; } return defaultValue ;


signature:
public class LoggerContext { /** * This method clears all internal properties , except internal status messages ,
 * closes all appenders , removes any turboFilters , fires an OnReset event ,
 * removes all status listeners , removes all context listeners
 * ( except those which are reset resistant ) .
 * As mentioned above , internal status messages survive resets . */
@ Override public void reset ( ) { } }

implementation: resetCount ++ ; super . reset ( ) ; initEvaluatorMap ( ) ; initCollisionMaps ( ) ; root . recursiveReset ( ) ; resetTurboFilterList ( ) ; cancelScheduledTasks ( ) ; fireOnReset ( ) ; resetListenersExceptResetResistant ( ) ; resetStatusListeners ( ) ;