idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
7,600 | public List < M > findNear ( double latitude , double longitude , int numImages ) { return getDatastore ( ) . find ( clazz ) . field ( "location.coordinates" ) . near ( latitude , longitude ) . limit ( numImages ) . asList ( ) ; } | Returns a list of media items that are geographically near the specified coordinates |
7,601 | public List < M > search ( String datefield , Date date , int width , int height , int count , int offset , UserAccount account , String query , List < String > sources ) { List < Criteria > l = new ArrayList < > ( ) ; Query < M > q = getDatastore ( ) . createQuery ( clazz ) ; if ( query != null ) { Pattern p = Pattern... | A search function |
7,602 | @ SuppressWarnings ( "deprecation" ) public static void setBackground ( final View view , final Drawable background ) { Condition . INSTANCE . ensureNotNull ( view , "The view may not be null" ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN ) { view . setBackground ( background ) ; } else { vie... | Sets the background of a view . Depending on the device s API level different methods are used for setting the background . |
7,603 | @ SuppressWarnings ( "deprecation" ) public static void removeOnGlobalLayoutListener ( final ViewTreeObserver observer , final OnGlobalLayoutListener listener ) { Condition . INSTANCE . ensureNotNull ( observer , "The view tree observer may not be null" ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELL... | Removes a previous registered global layout listener from a view tree observer . Depending on the device s API level different methods are used for removing the listener . |
7,604 | public static void removeFromParent ( final View view ) { Condition . INSTANCE . ensureNotNull ( view , "The view may not be null" ) ; ViewParent parent = view . getParent ( ) ; if ( parent instanceof ViewGroup ) { ( ( ViewGroup ) parent ) . removeView ( view ) ; } } | Removes a specific view from its parent if there is any . |
7,605 | private void obtainScaledEdge ( final TypedArray typedArray ) { int defaultValue = Edge . VERTICAL . getValue ( ) ; Edge scaledEdge = Edge . fromValue ( typedArray . getInt ( R . styleable . SquareImageView_scaledEdge , defaultValue ) ) ; setScaledEdge ( scaledEdge ) ; } | Obtains the scaled edge from a specific typed array . |
7,606 | private static boolean _isValidForCycle ( final Holiday aHoliday , final int nYear ) { final String sEvery = aHoliday . getEvery ( ) ; if ( sEvery != null && ! "EVERY_YEAR" . equals ( sEvery ) ) { if ( "ODD_YEARS" . equals ( sEvery ) ) return nYear % 2 != 0 ; if ( "EVEN_YEARS" . equals ( sEvery ) ) return nYear % 2 == ... | Checks cyclic holidays and checks if the requested year is hit within the cycles . |
7,607 | private static boolean _isValidInYear ( final Holiday aHoliday , final int nYear ) { return ( aHoliday . getValidFrom ( ) == null || aHoliday . getValidFrom ( ) . intValue ( ) <= nYear ) && ( aHoliday . getValidTo ( ) == null || aHoliday . getValidTo ( ) . intValue ( ) >= nYear ) ; } | Checks whether the holiday is within the valid date range . |
7,608 | protected static final boolean shallBeMoved ( final LocalDate aFixed , final MovingCondition aMoveCond ) { return aFixed . getDayOfWeek ( ) == XMLHolidayHelper . getWeekday ( aMoveCond . getSubstitute ( ) ) ; } | Determines if the provided date shall be substituted . |
7,609 | private static LocalDate _moveDate ( final MovingCondition aMoveCond , final LocalDate aDate ) { final DayOfWeek nWeekday = XMLHolidayHelper . getWeekday ( aMoveCond . getWeekday ( ) ) ; final int nDirection = aMoveCond . getWith ( ) == With . NEXT ? 1 : - 1 ; LocalDate aMovedDate = aDate ; while ( aMovedDate . getDayO... | Moves the date using the FixedMoving information |
7,610 | protected static final LocalDate moveDate ( final MoveableHoliday aMoveableHoliday , final LocalDate aFixed ) { for ( final MovingCondition aMoveCond : aMoveableHoliday . getMovingCondition ( ) ) if ( shallBeMoved ( aFixed , aMoveCond ) ) return _moveDate ( aMoveCond , aFixed ) ; return aFixed ; } | Moves a date if there are any moving conditions for this holiday and any of them fit . |
7,611 | protected final void setCurrentParentView ( final View currentParentView ) { Condition . INSTANCE . ensureNotNull ( currentParentView , "The parent view may not be null" ) ; this . currentParentView = currentParentView ; } | Sets the parent view whose appearance should currently be customized by the decorator . This method should never be called or overridden by any custom adapter implementation . |
7,612 | @ SuppressWarnings ( "unchecked" ) protected final < ViewType extends View > ViewType findViewById ( final int viewId ) { Condition . INSTANCE . ensureNotNull ( currentParentView , "No parent view set" , IllegalStateException . class ) ; ViewHolder viewHolder = ( ViewHolder ) currentParentView . getTag ( ) ; if ( viewH... | References the view which belongs to a specific resource ID by using the view holder pattern . The view is implicitly casted to the type of the field it is assigned to . |
7,613 | private void writeSlot ( T data , Throwable error ) { dataLock . lock ( ) ; try { this . error = error ; this . data = data ; availableCondition . signalAll ( ) ; } finally { dataLock . unlock ( ) ; } } | either data or error should be non - null |
7,614 | private T getAndClearUnderLock ( ) throws Throwable { if ( error != null ) { throw error ; } else { T retValue = data ; data = null ; return retValue ; } } | Get and clear the slot - MUST be called while holding the lock!! |
7,615 | public T take ( ) throws Throwable { dataLock . lock ( ) ; try { while ( data == null && error == null ) { try { availableCondition . await ( ) ; } catch ( InterruptedException e ) { } } return getAndClearUnderLock ( ) ; } finally { dataLock . unlock ( ) ; } } | Blocking read and remove . If the thread was interrupted by the producer due to an error the producer s error will be thrown . |
7,616 | public Object yyparse ( yyInput yyLex , Object yydebug ) throws java . io . IOException { return yyparse ( yyLex ) ; } | the generated parser with debugging messages . Maintains a dynamic state and value stack . |
7,617 | private HttpClient createPooledClient ( ) { HttpParams connMgrParams = new BasicHttpParams ( ) ; SchemeRegistry schemeRegistry = new SchemeRegistry ( ) ; schemeRegistry . register ( new Scheme ( HTTP_SCHEME , PlainSocketFactory . getSocketFactory ( ) , HTTP_PORT ) ) ; schemeRegistry . register ( new Scheme ( HTTPS_SCHE... | Creates a new thread - safe HTTP connection pool for use with a data source . |
7,618 | public void addTransition ( DuzztAction action , DuzztState succ ) { transitions . put ( action , new DuzztTransition ( action , succ ) ) ; } | Adds a transition to this state . |
7,619 | public static ObjectNode getObj ( ObjectNode obj , String fieldName ) { return obj != null ? obj ( obj . get ( fieldName ) ) : null ; } | Returns the field from a ObjectNode as ObjectNode |
7,620 | public static ObjectNode getObjAndRemove ( ObjectNode obj , String fieldName ) { ObjectNode result = null ; if ( obj != null ) { result = obj ( remove ( obj , fieldName ) ) ; } return result ; } | Removes the field from a ObjectNode and returns it as ObjectNode |
7,621 | public static ArrayNode createArray ( boolean fallbackToEmptyArray , JsonNode ... nodes ) { ArrayNode array = null ; for ( JsonNode element : nodes ) { if ( element != null ) { if ( array == null ) { array = new ArrayNode ( JsonNodeFactory . instance ) ; } array . add ( element ) ; } } if ( ( array == null ) && fallbac... | Creates an ArrayNode from the given nodes . Returns an empty ArrayNode if no elements are provided and fallbackToEmptyArray is true null if false . |
7,622 | public static ArrayNode getArray ( ObjectNode obj , String fieldName ) { return obj == null ? null : array ( obj . get ( fieldName ) ) ; } | Returns the field from a ObjectNode as ArrayNode |
7,623 | public static ArrayNode getArrayAndRemove ( ObjectNode obj , String fieldName ) { ArrayNode result = null ; if ( obj != null ) { result = array ( remove ( obj , fieldName ) ) ; } return result ; } | Removes the field from a ObjectNode and returns it as ArrayNode |
7,624 | public static JsonNode remove ( ObjectNode obj , String fieldName ) { JsonNode result = null ; if ( obj != null ) { result = obj . remove ( fieldName ) ; } return result ; } | Removes the field with the given name from the given ObjectNode |
7,625 | public static void rename ( ObjectNode obj , String oldFieldName , String newFieldName ) { if ( obj != null && isNotBlank ( oldFieldName ) && isNotBlank ( newFieldName ) ) { JsonNode node = remove ( obj , oldFieldName ) ; if ( node != null ) { obj . set ( newFieldName , node ) ; } } } | Renames a field in a ObjectNode from the oldFieldName to the newFieldName |
7,626 | private static final String stripParams ( String mediaType ) { int sc = mediaType . indexOf ( ';' ) ; if ( sc >= 0 ) mediaType = mediaType . substring ( 0 , sc ) ; return mediaType ; } | Strips the parameters from the end of a mediaType description . |
7,627 | public static String getDefaultMediaType ( ResultType expectedType ) { ResponseFormat format = ( expectedType != null ) ? defaultTypeFormats . get ( expectedType ) : null ; return ( format != null ) ? format . mimeText : null ; } | Gets the default content type to use when sending a query request with the given expected result type . |
7,628 | private static final ResultParser findParser ( String mediaType , ResultType expectedType ) { ResponseFormat format = null ; if ( mediaType != null ) { mediaType = stripParams ( mediaType ) ; format = mimeFormats . get ( mediaType ) ; if ( format == null ) { logger . warn ( "Unrecognized media type ({}) in SPARQL serve... | Find a parser to handle the protocol response body based on the content type found in the response and the expected result type specified by the user ; if one or both fields is missing then attempts to choose a sensible default . |
7,629 | public static Filter equalsFilter ( String column , Object operand ) { return new Filter ( column , FilterOperator . EQUALS , operand ) ; } | Builds an EqualsFilter |
7,630 | public static Filter inFilter ( String column , Object operand ) { return new Filter ( column , FilterOperator . IN , operand ) ; } | Builds an InFilter |
7,631 | protected final View inflatePlaceholderView ( final View convertView , final int height ) { View view = convertView ; if ( ! ( view instanceof PlaceholderView ) ) { view = new PlaceholderView ( getContext ( ) ) ; } view . setMinimumHeight ( height ) ; return view ; } | Inflates an invisible placeholder view with a specific height . |
7,632 | protected final int getViewHeight ( final ListAdapter adapter , final int position ) { View view = adapter . getView ( position , null , this ) ; LayoutParams layoutParams = ( LayoutParams ) view . getLayoutParams ( ) ; if ( layoutParams == null ) { layoutParams = new LayoutParams ( LayoutParams . MATCH_PARENT , Layout... | Returns the height of the view which corresponds to a specific position of an adapter . |
7,633 | private OnItemClickListener createItemClickListener ( final OnItemClickListener encapsulatedListener ) { return new OnItemClickListener ( ) { public void onItemClick ( final AdapterView < ? > parent , final View view , final int position , final long id ) { encapsulatedListener . onItemClick ( parent , view , getItemPo... | Creates and returns a listener which encapsulates another listener in order to be able to adapt the position of the item which has been clicked . |
7,634 | private OnItemLongClickListener createItemLongClickListener ( final OnItemLongClickListener encapsulatedListener ) { return new OnItemLongClickListener ( ) { public boolean onItemLongClick ( final AdapterView < ? > parent , final View view , final int position , final long id ) { return encapsulatedListener . onItemLon... | Creates and returns a listener which encapsulates another listener in order to be able to adapt the position of the item which has been long - clicked . |
7,635 | private int getItemPosition ( final int position ) { int numColumns = getNumColumnsCompatible ( ) ; int headerItemCount = getHeaderViewsCount ( ) * numColumns ; int adapterCount = adapter . getEncapsulatedAdapter ( ) . getCount ( ) ; if ( position < headerItemCount ) { return position / numColumns ; } else if ( positio... | Returns the index of the item which corresponds to a specific flattened position . |
7,636 | private int getNumberOfPlaceholderViews ( ) { int numColumns = getNumColumnsCompatible ( ) ; int adapterCount = adapter . getEncapsulatedAdapter ( ) . getCount ( ) ; int lastLineCount = adapterCount % numColumns ; return lastLineCount > 0 ? numColumns - lastLineCount : 0 ; } | Returns the number of placeholder views which are necessary to complement the items of the encapsulated adapter in order to fill up all columns .. |
7,637 | public final void addHeaderView ( final View view , final Object data , final boolean selectable ) { Condition . INSTANCE . ensureNotNull ( view , "The view may not be null" ) ; headers . add ( new FullWidthItem ( view , data , selectable ) ) ; notifyDataSetChanged ( ) ; } | Adds a fixed view to appear at the top of the adapter view . If this method is called more than once the views will appear in the order they were added . |
7,638 | public final void addFooterView ( final View view , final Object data , final boolean selectable ) { Condition . INSTANCE . ensureNotNull ( view , "The view may not be null" ) ; footers . add ( new FullWidthItem ( view , data , selectable ) ) ; notifyDataSetChanged ( ) ; } | Adds a fixed view to appear at the bottom of the adapter view . If this method is called more than once the views will appear in the order they were added . |
7,639 | private void asyncMoreRequest ( int startRow ) { try { DataRequest moreRequest = new DataRequest ( ) ; moreRequest . queryId = queryId ; moreRequest . startRow = startRow ; moreRequest . maxSize = maxBatchSize ; logger . debug ( "Client requesting {} .. {}" , startRow , ( startRow + maxBatchSize - 1 ) ) ; DataResponse ... | Send request for more data for this query . |
7,640 | private static final String encode ( String s ) { try { return URLEncoder . encode ( s , UTF_8 ) ; } catch ( UnsupportedEncodingException e ) { throw new Error ( "JVM unable to handle UTF-8" ) ; } } | URL - encode a string as UTF - 8 catching any thrown UnsupportedEncodingException . |
7,641 | @ SuppressWarnings ( "unused" ) private static final void dump ( HttpClient client , HttpUriRequest req ) { if ( logger . isTraceEnabled ( ) ) { StringBuilder sb = new StringBuilder ( "\n=== Request ===" ) ; sb . append ( "\n" ) . append ( req . getRequestLine ( ) ) ; for ( Header h : req . getAllHeaders ( ) ) { sb . a... | Logs a request executes it and dumps the response to the logger . For development use only . |
7,642 | static HttpResponse executeRequest ( ProtocolCommand command , String mimeType ) { HttpClient client = ( ( ProtocolConnection ) command . getConnection ( ) ) . getHttpClient ( ) ; URL url = ( ( ProtocolDataSource ) command . getConnection ( ) . getDataSource ( ) ) . getUrl ( ) ; HttpUriRequest req ; try { String params... | Executes a SPARQL HTTP protocol request for the given command and returns the response . |
7,643 | static void addHeaders ( HttpUriRequest req , String mimeType ) { if ( POST . equalsIgnoreCase ( req . getMethod ( ) ) ) { req . addHeader ( CONTENT_TYPE , FORM_ENCODED ) ; } if ( mimeType != null ) req . setHeader ( ACCEPT , mimeType ) ; } | Add headers to a request . |
7,644 | public HolidayMap getHolidays ( final int nYear , final String ... aArgs ) { final HolidayMap aHolidays = super . getHolidays ( nYear , aArgs ) ; final HolidayMap aAdditionalHolidays = new HolidayMap ( ) ; for ( final Map . Entry < LocalDate , ISingleHoliday > aEntry : aHolidays . getMap ( ) . entrySet ( ) ) { final Lo... | Implements the rule which requests if two holidays have one non holiday between each other than this day is also a holiday . |
7,645 | public final void setLogLevel ( final LogLevel logLevel ) { Condition . INSTANCE . ensureNotNull ( logLevel , "The log level may not be null" ) ; this . logLevel = logLevel ; } | Sets the log level . Only log messages with a rank greater or equal than the rank of the currently applied log level are written to the output . |
7,646 | public final void logVerbose ( final Class < ? > tag , final String message ) { Condition . INSTANCE . ensureNotNull ( tag , "The tag may not be null" ) ; Condition . INSTANCE . ensureNotNull ( message , "The message may not be null" ) ; Condition . INSTANCE . ensureNotEmpty ( message , "The message may not be empty" )... | Logs a specific message on the log level VERBOSE . |
7,647 | public final void logDebug ( final Class < ? > tag , final String message ) { Condition . INSTANCE . ensureNotNull ( tag , "The tag may not be null" ) ; Condition . INSTANCE . ensureNotNull ( message , "The message may not be null" ) ; Condition . INSTANCE . ensureNotEmpty ( message , "The message may not be empty" ) ;... | Logs a specific message on the log level DEBUG . |
7,648 | public final void logInfo ( final Class < ? > tag , final String message ) { Condition . INSTANCE . ensureNotNull ( tag , "The tag may not be null" ) ; Condition . INSTANCE . ensureNotNull ( message , "The message may not be null" ) ; Condition . INSTANCE . ensureNotEmpty ( message , "The message may not be empty" ) ; ... | Logs a specific message on the log level INFO . |
7,649 | public final void logWarn ( final Class < ? > tag , final String message , final Throwable cause ) { Condition . INSTANCE . ensureNotNull ( tag , "The tag may not be null" ) ; Condition . INSTANCE . ensureNotNull ( message , "The message may not be null" ) ; Condition . INSTANCE . ensureNotEmpty ( message , "The messag... | Logs a specific message and exception on the log level WARN . |
7,650 | public final void logError ( final Class < ? > tag , final String message ) { Condition . INSTANCE . ensureNotNull ( tag , "The tag may not be null" ) ; Condition . INSTANCE . ensureNotNull ( message , "The message may not be null" ) ; Condition . INSTANCE . ensureNotEmpty ( message , "The message may not be empty" ) ;... | Logs a specific message on the log level ERROR . |
7,651 | public static Orientation getOrientation ( final Context context ) { Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; int orientation = context . getResources ( ) . getConfiguration ( ) . orientation ; if ( orientation == Configuration . ORIENTATION_UNDEFINED ) { int width = getDisplay... | Returns the orientation of the device . |
7,652 | public static DeviceType getDeviceType ( final Context context ) { Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; return DeviceType . fromValue ( context . getString ( R . string . device_type ) ) ; } | Returns the type of the device depending on its display size . |
7,653 | public static int getDisplayWidth ( final Context context ) { Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; return context . getResources ( ) . getDisplayMetrics ( ) . widthPixels ; } | Returns the width of the device s display . |
7,654 | public static int getDisplayHeight ( final Context context ) { Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; return context . getResources ( ) . getDisplayMetrics ( ) . heightPixels ; } | Returns the height of the device s display . |
7,655 | public static Driver createDriver ( FeedPartition feedPartition , Plan plan , MetricRegistry metricRegistry ) { populateFeedMetricInfo ( plan , feedPartition , metricRegistry ) ; OperatorDesc desc = plan . getRootOperator ( ) ; Operator oper = buildOperator ( desc , metricRegistry , plan . getName ( ) , feedPartition )... | Given a FeedParition and Plan create a Driver that will consume from the feed partition and execute the plan . |
7,656 | private static NitDesc nitDescFromDynamic ( DynamicInstantiatable d ) { NitDesc nd = new NitDesc ( ) ; nd . setScript ( d . getScript ( ) ) ; nd . setTheClass ( d . getTheClass ( ) ) ; if ( d . getSpec ( ) == null || "java" . equals ( d . getSpec ( ) ) ) { nd . setSpec ( NitDesc . NitSpec . JAVA_LOCAL_CLASSPATH ) ; } e... | DynamicInstantiatable has some pre - nit strings it uses as for spec that do not match nit - compiler . Here we correct these and return a new object |
7,657 | public static Operator buildOperator ( OperatorDesc operatorDesc , MetricRegistry metricRegistry , String planPath , FeedPartition feedPartition ) { Operator operator = null ; NitFactory nitFactory = new NitFactory ( ) ; NitDesc nitDesc = nitDescFromDynamic ( operatorDesc ) ; try { if ( nitDesc . getSpec ( ) == NitDesc... | OperatorDesc can describe local reasources URL loaded resources and dynamic resources like groovy code . This method instantiates an Operator based on the OperatorDesc . |
7,658 | public static Feed buildFeed ( FeedDesc feedDesc ) { Feed feed = null ; NitFactory nitFactory = new NitFactory ( ) ; NitDesc nitDesc = nitDescFromDynamic ( feedDesc ) ; nitDesc . setConstructorParameters ( new Class [ ] { Map . class } ) ; nitDesc . setConstructorArguments ( new Object [ ] { feedDesc . getProperties ( ... | Build a feed using reflection |
7,659 | private static int getSampleSize ( final Pair < Integer , Integer > imageDimensions , final int maxWidth , final int maxHeight ) { Condition . INSTANCE . ensureNotNull ( imageDimensions , "The image dimensions may not be null" ) ; Condition . INSTANCE . ensureAtLeast ( maxWidth , 1 , "The maximum width must be at least... | Calculates the sample size which should be used to downsample an image to a maximum width and height . |
7,660 | public static Bitmap clipCircle ( final Bitmap bitmap , final int size ) { Bitmap squareBitmap = clipSquare ( bitmap , size ) ; int squareSize = squareBitmap . getWidth ( ) ; float radius = ( float ) squareSize / 2.0f ; Bitmap clippedBitmap = Bitmap . createBitmap ( squareSize , squareSize , Bitmap . Config . ARGB_8888... | Clips the corners of a bitmap in order to transform it into a round shape . Additionally the bitmap is resized to a specific size . Bitmaps whose width and height are not equal will be clipped to a square beforehand . |
7,661 | public static Bitmap clipCircle ( final Bitmap bitmap , final int size , final int borderWidth , final int borderColor ) { Condition . INSTANCE . ensureAtLeast ( borderWidth , 0 , "The border width must be at least 0" ) ; Bitmap clippedBitmap = clipCircle ( bitmap , size ) ; Bitmap result = Bitmap . createBitmap ( clip... | Clips the corners of a bitmap in order to transform it into a round shape . Additionally the bitmap is resized to a specific size and a border will be added . Bitmaps whose width and height are not equal will be clipped to a square beforehand . |
7,662 | public static Bitmap clipSquare ( final Bitmap bitmap ) { Condition . INSTANCE . ensureNotNull ( bitmap , "The bitmap may not be null" ) ; return clipSquare ( bitmap , bitmap . getWidth ( ) >= bitmap . getHeight ( ) ? bitmap . getHeight ( ) : bitmap . getWidth ( ) ) ; } | Clips the long edge of a bitmap if its width and height are not equal in order to form it into a square . |
7,663 | @ SuppressWarnings ( "SuspiciousNameCombination" ) public static Bitmap clipSquare ( final Bitmap bitmap , final int size ) { Condition . INSTANCE . ensureNotNull ( bitmap , "The bitmap may not be null" ) ; Condition . INSTANCE . ensureAtLeast ( size , 1 , "The size must be at least 1" ) ; Bitmap clippedBitmap = bitmap... | Clips the long edge of a bitmap if its width and height are not equal in order to form it into a square . Additionally the bitmap is resized to a specific size . |
7,664 | public static Bitmap clipSquare ( final Bitmap bitmap , final int borderWidth , final int borderColor ) { Condition . INSTANCE . ensureNotNull ( bitmap , "The bitmap may not be null" ) ; return clipSquare ( bitmap , bitmap . getWidth ( ) >= bitmap . getHeight ( ) ? bitmap . getHeight ( ) : bitmap . getWidth ( ) , borde... | Clips the long edge of a bitmap if its width and height are not equal in order to transform it into a square . Additionally a border will be added . |
7,665 | public static Bitmap clipSquare ( final Bitmap bitmap , final int size , final int borderWidth , final int borderColor ) { Condition . INSTANCE . ensureAtLeast ( borderWidth , 0 , "The border width must be at least 0" ) ; Bitmap clippedBitmap = clipSquare ( bitmap , size ) ; Bitmap result = Bitmap . createBitmap ( clip... | Clips the long edge of a bitmap if its width and height are not equal in order to transform it into a square . Additionally the bitmap is resized to a specific size and a border will be added . |
7,666 | public static Bitmap resize ( final Bitmap bitmap , final int width , final int height ) { Condition . INSTANCE . ensureNotNull ( bitmap , "The bitmap may not be null" ) ; Condition . INSTANCE . ensureAtLeast ( width , 1 , "The width must be at least 1" ) ; Condition . INSTANCE . ensureAtLeast ( height , 1 , "The heigh... | Resizes a bitmap to a specific width and height . If the ratio between width and height differs from the bitmap s original ratio the bitmap is stretched . |
7,667 | public static Pair < Bitmap , Bitmap > splitHorizontally ( final Bitmap bitmap ) { return splitHorizontally ( bitmap , bitmap . getHeight ( ) / 2 ) ; } | Splits a specific bitmap horizontally at half . |
7,668 | public static Pair < Bitmap , Bitmap > splitHorizontally ( final Bitmap bitmap , final int splitPoint ) { Condition . INSTANCE . ensureNotNull ( bitmap , "The bitmap may not be null" ) ; Condition . INSTANCE . ensureGreater ( splitPoint , 0 , "The split point must be greater than 0" ) ; Condition . INSTANCE . ensureSma... | Splits a specific bitmap horizontally at a specific split point . |
7,669 | public static Pair < Bitmap , Bitmap > splitVertically ( final Bitmap bitmap ) { return splitVertically ( bitmap , bitmap . getWidth ( ) / 2 ) ; } | Splits a specific bitmap vertically at half . |
7,670 | public static Pair < Bitmap , Bitmap > splitVertically ( final Bitmap bitmap , final int splitPoint ) { Condition . INSTANCE . ensureNotNull ( bitmap , "The bitmap may not be null" ) ; Condition . INSTANCE . ensureGreater ( splitPoint , 0 , "The split point must be greater than 0" ) ; Condition . INSTANCE . ensureSmall... | Splits a specific bitmap vertically at a specific split point . |
7,671 | public static Bitmap tile ( final Bitmap bitmap , final int width , final int height ) { Condition . INSTANCE . ensureNotNull ( bitmap , "The bitmap may not be null" ) ; Condition . INSTANCE . ensureAtLeast ( width , 1 , "The width must be at least 1" ) ; Condition . INSTANCE . ensureAtLeast ( height , 1 , "The height ... | Creates and returns a bitmap with a specific width and height by tiling another bitmap . |
7,672 | public static Bitmap tint ( final Bitmap bitmap , final int color ) { Condition . INSTANCE . ensureNotNull ( bitmap , "The bitmap may not be null" ) ; Canvas canvas = new Canvas ( bitmap ) ; Paint paint = new Paint ( ) ; paint . setColor ( color ) ; canvas . drawRect ( new Rect ( 0 , 0 , bitmap . getWidth ( ) , bitmap ... | Creates and returns a bitmap by overlaying it with a specific color . |
7,673 | public static Bitmap drawableToBitmap ( final Drawable drawable ) { Condition . INSTANCE . ensureNotNull ( drawable , "The drawable may not be null" ) ; if ( drawable instanceof BitmapDrawable ) { BitmapDrawable bitmapDrawable = ( BitmapDrawable ) drawable ; if ( bitmapDrawable . getBitmap ( ) != null ) { return bitmap... | Creates and returns a bitmap from a specific drawable . |
7,674 | public static Bitmap colorToBitmap ( final int width , final int height , final int color ) { Condition . INSTANCE . ensureAtLeast ( width , 1 , "The width must be at least 1" ) ; Condition . INSTANCE . ensureAtLeast ( height , 1 , "The height must be at least 1" ) ; Bitmap bitmap = Bitmap . createBitmap ( width , heig... | Creates and returns a bitmap from a specific color . |
7,675 | public static Pair < Integer , Integer > getImageDimensions ( final File file ) throws IOException { Condition . INSTANCE . ensureNotNull ( file , "The file may not be null" ) ; Condition . INSTANCE . ensureFileIsNoDirectory ( file , "The file must exist and must not be a directory" ) ; String path = file . getPath ( )... | Returns the width and height of a specific image file . |
7,676 | public static Pair < Integer , Integer > getImageDimensions ( final Context context , final int resourceId ) throws IOException { Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; BitmapFactory . Options options = new BitmapFactory . Options ( ) ; options . inJustDecodeBounds = true ; B... | Returns the width and height of a specific image resource . |
7,677 | public static Bitmap loadThumbnail ( final File file , final int maxWidth , final int maxHeight ) throws IOException { Pair < Integer , Integer > imageDimensions = getImageDimensions ( file ) ; int sampleSize = getSampleSize ( imageDimensions , maxWidth , maxHeight ) ; BitmapFactory . Options options = new BitmapFactor... | Loads a downsampled thumbnail of a specific image file while maintaining its aspect ratio . |
7,678 | public static void compressToFile ( final Bitmap bitmap , final File file , final CompressFormat format , final int quality ) throws IOException { Condition . INSTANCE . ensureNotNull ( bitmap , "The bitmap may not be null" ) ; Condition . INSTANCE . ensureNotNull ( file , "The file may not be null" ) ; Condition . INS... | Compresses a specific bitmap and stores it within a file . |
7,679 | public static byte [ ] compressToByteArray ( final Bitmap bitmap , final CompressFormat format , final int quality ) throws IOException { Condition . INSTANCE . ensureNotNull ( bitmap , "The bitmap may not be null" ) ; Condition . INSTANCE . ensureNotNull ( format , "The format may not be null" ) ; Condition . INSTANCE... | Compresses a specific bitmap and returns it as a byte array . |
7,680 | public boolean isPlanSane ( Plan plan ) { if ( plan == null ) { logger . warn ( "did not find plan" ) ; return false ; } if ( plan . isDisabled ( ) ) { logger . debug ( "disabled " + plan . getName ( ) ) ; return false ; } if ( plan . getFeedDesc ( ) == null ) { logger . warn ( "feed was null " + plan . getName ( ) ) ;... | Determines if the plan can be run . IE not disabled and not malformed |
7,681 | private OnItemClickListener createItemClickListener ( ) { return new OnItemClickListener ( ) { public void onItemClick ( final AdapterView < ? > parent , final View view , final int position , final long id ) { Pair < Integer , Integer > itemPosition = getItemPosition ( position - getHeaderViewsCount ( ) ) ; int groupI... | Creates and returns a listener which allows to delegate when any item of the grid view has been clicked to the appropriate listeners . |
7,682 | private OnItemLongClickListener createItemLongClickListener ( ) { return new OnItemLongClickListener ( ) { public boolean onItemLongClick ( AdapterView < ? > parent , View view , int position , long id ) { Pair < Integer , Integer > itemPosition = getItemPosition ( position - getHeaderViewsCount ( ) ) ; int groupIndex ... | Creates and returns a listener which allows to delegate when any item of the grid view has been long - clicked to the appropriate listeners . |
7,683 | private int getPackedPosition ( final int position ) { if ( position < getHeaderViewsCount ( ) ) { return position ; } else { Pair < Integer , Integer > pair = getItemPosition ( position - getHeaderViewsCount ( ) ) ; int groupIndex = pair . first ; int childIndex = pair . second ; if ( childIndex == - 1 && groupIndex =... | Returns the packed position of an item which corresponds to a specific position . |
7,684 | private int getPackedGroupPosition ( final int groupIndex ) { int packedPosition = getHeaderViewsCount ( ) ; if ( groupIndex > 0 ) { for ( int i = groupIndex - 1 ; i >= 0 ; i -- ) { packedPosition += getExpandableListAdapter ( ) . getChildrenCount ( i ) + 1 ; } } return packedPosition ; } | Returns the packed position of a group which corresponds to a specific index . |
7,685 | private Pair < Integer , Integer > getItemPosition ( final int packedPosition ) { int currentPosition = packedPosition ; int groupIndex = - 1 ; int childIndex = - 1 ; int numColumns = getNumColumnsCompatible ( ) ; for ( int i = 0 ; i < getExpandableListAdapter ( ) . getGroupCount ( ) ; i ++ ) { if ( currentPosition == ... | Returns a pair which contains the group and child index of the item which corresponds to a specific packed position . |
7,686 | private boolean notifyOnGroupClicked ( final View view , final int groupIndex , final long id ) { return groupClickListener != null && groupClickListener . onGroupClick ( this , view , groupIndex , id ) ; } | Notifies the listener which has been registered to be notified when a group has been clicked about a group being clicked . |
7,687 | private boolean notifyOnChildClicked ( final View view , final int groupIndex , final int childIndex , final long id ) { return childClickListener != null && childClickListener . onChildClick ( this , view , groupIndex , childIndex , id ) ; } | Notifies the listener which has been registered to be notified when a child has been clicked about a child being clicked . |
7,688 | private void notifyOnItemClicked ( final View view , final int position , final long id ) { if ( itemClickListener != null ) { itemClickListener . onItemClick ( this , view , position , id ) ; } } | Notifies the listener which has been registered to be notified when any item has been clicked about an item being clicked . |
7,689 | private boolean notifyOnItemLongClicked ( final View view , final int position , final long id ) { return itemLongClickListener != null && itemLongClickListener . onItemLongClick ( this , view , position , id ) ; } | Notifies the listener which has been registered to be notified when any item has been long - clicked about an item being long - clicked . |
7,690 | public static int getPackedPositionType ( final long packedPosition ) { if ( packedPosition == PACKED_POSITION_VALUE_NULL ) { return PACKED_POSITION_TYPE_NULL ; } return ( packedPosition & PACKED_POSITION_MASK_TYPE ) == PACKED_POSITION_MASK_TYPE ? PACKED_POSITION_TYPE_CHILD : PACKED_POSITION_TYPE_GROUP ; } | Returns the type of the item which corresponds to a specific packed position . |
7,691 | public final void setAdapter ( final ExpandableListAdapter adapter ) { expandedGroups . clear ( ) ; if ( adapter != null ) { this . adapter = new AdapterWrapper ( adapter ) ; super . setAdapter ( this . adapter ) ; } else { this . adapter = null ; super . setAdapter ( null ) ; } } | Sets the adapter that provides data to this view . |
7,692 | public final boolean expandGroup ( final int groupIndex ) { ExpandableListAdapter adapter = getExpandableListAdapter ( ) ; if ( adapter != null && ! isGroupExpanded ( groupIndex ) ) { expandedGroups . add ( groupIndex ) ; notifyDataSetChanged ( ) ; return true ; } return false ; } | Expands the group which corresponds to a specific index . |
7,693 | public final boolean collapseGroup ( final int groupIndex ) { ExpandableListAdapter adapter = getExpandableListAdapter ( ) ; if ( adapter != null && isGroupExpanded ( groupIndex ) ) { expandedGroups . remove ( groupIndex ) ; notifyDataSetChanged ( ) ; return true ; } return false ; } | Collapses the group which corresponds to a specific index . |
7,694 | private void validateString ( Class < ? > clazz ) throws SerializerException { if ( null != clazz && ! clazz . isAssignableFrom ( String . class ) ) { throw new SerializerException ( "String serializer is able to work only with data types assignable from java.lang.String" ) ; } } | Validates that provided class is assignable from java . lang . String |
7,695 | private void validateString ( Type type ) throws SerializerException { if ( null == type || ! String . class . equals ( TypeToken . of ( type ) . getRawType ( ) ) ) { throw new SerializerException ( "String serializer is able to work only with data types assignable from java.lang.String" ) ; } } | Validates that provided type is assignable from java . lang . String |
7,696 | public final void process ( final HttpRequest request , final HttpContext context ) throws HttpException , IOException { AuthState authState = ( AuthState ) context . getAttribute ( HttpClientContext . TARGET_AUTH_STATE ) ; if ( authState . getAuthScheme ( ) == null ) { HttpHost targetHost = ( HttpHost ) context . getA... | Adds provided auth scheme to the client if there are no another provided auth schemes |
7,697 | public final < RQ , RS > Maybe < Response < RS > > executeRequest ( RestCommand < RQ , RS > command ) throws RestEndpointIOException { URI uri = spliceUrl ( command . getUri ( ) ) ; HttpUriRequest rq ; Serializer serializer ; switch ( command . getHttpMethod ( ) ) { case GET : rq = new HttpGet ( uri ) ; break ; case PO... | Executes request command |
7,698 | private Serializer getSupportedSerializer ( Object o ) throws SerializerException { for ( Serializer s : serializers ) { if ( s . canWrite ( o ) ) { return s ; } } throw new SerializerException ( "Unable to find serializer for object with type '" + o . getClass ( ) + "'" ) ; } | Finds supported serializer for this type of object |
7,699 | public final Pair < View , Boolean > inflate ( final ItemType item , final ViewGroup parent , final boolean useCache , final ParamType ... params ) { Condition . INSTANCE . ensureNotNull ( params , "The array may not be null" ) ; Condition . INSTANCE . ensureNotNull ( getAdapter ( ) , "No adapter has been set" , Illega... | Inflates the view which is used to visualize a specific item . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.