idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
7,700 | public void addChild ( DriverNode dn ) { collectorProcessor . getChildren ( ) . add ( dn . operator ) ; children . add ( dn ) ; } | Method adds a child data node and binds the collect processor of this node to the operator of the next node | 37 | 21 |
7,701 | public static String getNamespace ( JsonNode node ) { JsonNode nodeNs = obj ( node ) . get ( ID_NAMESPACE ) ; return ( nodeNs != null ) ? nodeNs . asText ( ) : null ; } | Returns the namespace from a wrapped JsonNode | 53 | 9 |
7,702 | public static void setVersion ( JsonNode node , Long version ) { obj ( node ) . put ( ID_VERSION , version ) ; } | Sets the version on a wrapped JsonNode | 30 | 10 |
7,703 | public static Date getTimestamp ( JsonNode node ) { String text = obj ( node ) . get ( ID_TIMESTAMP ) . asText ( ) ; return isNotBlank ( text ) ? from ( instantUtc ( text ) ) . toDate ( ) : null ; } | Returns the timestamp from a wrapped JsonNode | 63 | 9 |
7,704 | public final void update ( final float position ) { if ( reset ) { reset = false ; distance = 0 ; thresholdReachedPosition = - 1 ; dragStartTime = - 1 ; dragStartPosition = position ; reachedThreshold = false ; minDragDistance = 0 ; maxDragDistance = 0 ; } if ( ! reachedThreshold ) { if ( reachedThreshold ( position - ... | Updates the instance by adding a new position . This will cause all properties to be re - calculated depending on the new position . | 203 | 26 |
7,705 | public final void setMaxDragDistance ( final float maxDragDistance ) { if ( maxDragDistance != 0 ) { Condition . INSTANCE . ensureGreater ( maxDragDistance , threshold , "The maximum drag distance must be greater than " + threshold ) ; } this . maxDragDistance = maxDragDistance ; } | Sets the maximum drag distance . | 65 | 7 |
7,706 | public final void setMinDragDistance ( final float minDragDistance ) { if ( minDragDistance != 0 ) { Condition . INSTANCE . ensureSmaller ( minDragDistance , - threshold , "The minimum drag distance must be smaller than " + - threshold ) ; } this . minDragDistance = minDragDistance ; } | Sets the minimum drag distance . | 67 | 7 |
7,707 | public final float getDragSpeed ( ) { if ( hasThresholdBeenReached ( ) ) { long interval = System . currentTimeMillis ( ) - dragStartTime ; return Math . abs ( getDragDistance ( ) ) / ( float ) interval ; } else { return - 1 ; } } | Returns the speed of the drag gesture in pixels per millisecond . | 64 | 13 |
7,708 | private OnSeekBarChangeListener createSeekBarListener ( ) { return new OnSeekBarChangeListener ( ) { @ Override public void onProgressChanged ( final SeekBar seekBar , final int progress , final boolean fromUser ) { adaptElevation ( progress , parallelLightCheckBox . isChecked ( ) ) ; } @ Override public void onStartTr... | Creates and returns a listener which allows to adjust the elevation when the value of a seek bar has been changed . | 112 | 23 |
7,709 | private void adaptElevation ( final int elevation , final boolean parallelLight ) { elevationTextView . setText ( String . format ( getString ( R . string . elevation ) , elevation ) ) ; elevationLeft . setShadowElevation ( elevation ) ; elevationLeft . emulateParallelLight ( parallelLight ) ; elevationTopLeft . setSha... | Adapts the elevation . | 243 | 5 |
7,710 | public Segment getSegment ( SEGMENT_TYPE segmentType ) { if ( segmentType == null ) { return null ; } if ( segmentType == SEGMENT_TYPE . LINEAR ) { return new LinearSegment ( ) ; } else if ( segmentType == SEGMENT_TYPE . SPATIAL ) { return new SpatialSegment ( ) ; } else if ( segmentType == SEGMENT_TYPE . TEMPORAL ) { ... | use getShape method to get object of type shape | 144 | 10 |
7,711 | public String write ( T obj ) throws JsonProcessingException { Date ts = includeTimestamp ? Date . from ( now ( ) ) : null ; MetaWrapper wrapper = new MetaWrapper ( getHighestSourceVersion ( ) , getNamespace ( ) , obj , ts ) ; return mapper . writeValueAsString ( wrapper ) ; } | Serializes the given object to a String | 74 | 8 |
7,712 | private void obtainInsetForeground ( @ NonNull final TypedArray typedArray ) { int color = typedArray . getColor ( R . styleable . ScrimInsetsLayout_insetDrawable , - 1 ) ; if ( color == - 1 ) { Drawable drawable = typedArray . getDrawable ( R . styleable . ScrimInsetsLayout_insetDrawable ) ; if ( drawable != null ) { ... | Obtains the drawable which should be shown in the layout s insets from a specific typed array . | 159 | 21 |
7,713 | public void parse ( final int nYear , final HolidayMap aHolidayMap , final Holidays aConfig ) { for ( final RelativeToEasterSunday aDay : aConfig . getRelativeToEasterSunday ( ) ) { if ( ! isValid ( aDay , nYear ) ) continue ; final ChronoLocalDate aEasterSunday = getEasterSunday ( nYear , aDay . getChronology ( ) ) ; ... | Parses relative to Easter Sunday holidays . | 184 | 9 |
7,714 | protected final void addChrstianHoliday ( final ChronoLocalDate aDate , final String sPropertiesKey , final IHolidayType aHolidayType , final HolidayMap holidays ) { final LocalDate convertedDate = LocalDate . from ( aDate ) ; holidays . add ( convertedDate , new ResourceBundleHoliday ( aHolidayType , sPropertiesKey ) ... | Adds the given day to the list of holidays . | 84 | 10 |
7,715 | public static ChronoLocalDate getEasterSunday ( final int nYear ) { return nYear <= CPDT . LAST_JULIAN_YEAR ? getJulianEasterSunday ( nYear ) : getGregorianEasterSunday ( nYear ) ; } | Returns the easter Sunday for a given year . | 57 | 10 |
7,716 | public static JulianDate getJulianEasterSunday ( final int nYear ) { final int a = nYear % 4 ; final int b = nYear % 7 ; final int c = nYear % 19 ; final int d = ( 19 * c + 15 ) % 30 ; final int e = ( 2 * a + 4 * b - d + 34 ) % 7 ; final int x = d + e + 114 ; final int nMonth = x / 31 ; final int nDay = ( x % 31 ) + 1 ... | Returns the easter Sunday within the julian chronology . | 146 | 13 |
7,717 | public static LocalDate getGregorianEasterSunday ( final int nYear ) { final int a = nYear % 19 ; final int b = nYear / 100 ; final int c = nYear % 100 ; final int d = b / 4 ; final int e = b % 4 ; final int f = ( b + 8 ) / 25 ; final int g = ( b - f + 1 ) / 3 ; final int h = ( 19 * a + b - d - g + 15 ) % 30 ; final in... | Returns the easter Sunday within the gregorian chronology . | 229 | 13 |
7,718 | private static Bitmap createEdgeShadow ( @ NonNull final Context context , final int elevation , @ NonNull final Orientation orientation , final boolean parallelLight ) { if ( elevation == 0 ) { return null ; } else { float shadowWidth = getShadowWidth ( context , elevation , orientation , parallelLight ) ; int shadowC... | Creates and returns a bitmap which can be used to emulate a shadow which is located at a corner of an elevated view on pre - Lollipop devices . | 299 | 32 |
7,719 | private static Bitmap createCornerShadow ( @ NonNull final Context context , final int elevation , @ NonNull final Orientation orientation , final boolean parallelLight ) { if ( elevation == 0 ) { return null ; } else { float horizontalShadowWidth = getHorizontalShadowWidth ( context , elevation , orientation , paralle... | Creates and returns a bitmap which can be used to emulate a shadow which is located besides an edge of an elevated view on pre - Lollipop devices . | 584 | 32 |
7,720 | private static RectF getCornerBounds ( @ NonNull final Orientation orientation , final int size ) { switch ( orientation ) { case TOP_LEFT : return new RectF ( 0 , 0 , 2 * size , 2 * size ) ; case TOP_RIGHT : return new RectF ( - size , 0 , size , 2 * size ) ; case BOTTOM_LEFT : return new RectF ( 0 , - size , 2 * size... | Returns the bounds which should be used to draw a shadow which is located at a corner of an elevated view . | 144 | 22 |
7,721 | private static float getHorizontalShadowWidth ( @ NonNull final Context context , final int elevation , @ NonNull final Orientation orientation , final boolean parallelLight ) { switch ( orientation ) { case TOP_LEFT : case TOP_RIGHT : return getShadowWidth ( context , elevation , Orientation . TOP , parallelLight ) ; ... | Returns the width of a shadow which is located next to a corner of an elevated view in horizontal direction . | 125 | 21 |
7,722 | private static float getShadowWidth ( @ NonNull final Context context , final int elevation , @ NonNull final Orientation orientation , final boolean parallelLight ) { float referenceElevationWidth = ( float ) elevation / ( float ) REFERENCE_ELEVATION * REFERENCE_SHADOW_WIDTH ; float shadowWidth ; if ( parallelLight ) ... | Returns the width of a shadow which is located besides an edge of an elevated view . | 238 | 17 |
7,723 | private static int getHorizontalShadowColor ( final int elevation , @ NonNull final Orientation orientation , final boolean parallelLight ) { switch ( orientation ) { case TOP_LEFT : case TOP_RIGHT : return getShadowColor ( elevation , Orientation . TOP , parallelLight ) ; case BOTTOM_LEFT : case BOTTOM_RIGHT : return ... | Returns the color of a shadow which is located next to a corner of an elevated view in horizontal direction . | 114 | 21 |
7,724 | private static int getVerticalShadowColor ( final int elevation , @ NonNull final Orientation orientation , final boolean parallelLight ) { switch ( orientation ) { case TOP_LEFT : case BOTTOM_LEFT : return getShadowColor ( elevation , Orientation . LEFT , parallelLight ) ; case TOP_RIGHT : case BOTTOM_RIGHT : return g... | Returns the color of a shadow which is located next to a corner of an elevated view in vertical direction . | 113 | 21 |
7,725 | private static int getShadowColor ( final int elevation , @ NonNull final Orientation orientation , final boolean parallelLight ) { int alpha ; if ( parallelLight ) { alpha = getShadowAlpha ( elevation , MIN_BOTTOM_ALPHA , MAX_BOTTOM_ALPHA ) ; } else { switch ( orientation ) { case LEFT : alpha = getShadowAlpha ( eleva... | Returns the color of a shadow which is located besides an edge of an elevated view . | 238 | 17 |
7,726 | private static int getShadowAlpha ( final int elevation , final int minTransparency , final int maxTransparency ) { float ratio = ( float ) elevation / ( float ) MAX_ELEVATION ; int range = maxTransparency - minTransparency ; return Math . round ( minTransparency + ratio * range ) ; } | Returns the alpha value of a shadow by interpolating between a minimum and maximum alpha value depending on a specific elevation . | 68 | 23 |
7,727 | private static Shader createLinearGradient ( @ NonNull final Orientation orientation , final int bitmapWidth , final int bitmapHeight , final float shadowWidth , @ ColorInt final int shadowColor ) { RectF bounds = new RectF ( ) ; switch ( orientation ) { case LEFT : bounds . left = bitmapWidth ; bounds . right = bitmap... | Creates and returns a shader which can be used to draw a shadow which located besides an edge of an elevated view . | 196 | 24 |
7,728 | private static Shader createRadialGradient ( @ NonNull final Orientation orientation , final int bitmapSize , final float radius ) { PointF center = new PointF ( ) ; switch ( orientation ) { case TOP_LEFT : center . x = bitmapSize ; center . y = bitmapSize ; break ; case TOP_RIGHT : center . y = bitmapSize ; break ; ca... | Creates and returns a shader which can be used to draw a shadow which located at a corner of an elevated view . | 170 | 24 |
7,729 | private static float getCornerAngle ( @ NonNull final Orientation orientation ) { switch ( orientation ) { case TOP_LEFT : return QUARTER_ARC_DEGRESS * 2 ; case TOP_RIGHT : return QUARTER_ARC_DEGRESS * 3 ; case BOTTOM_LEFT : return QUARTER_ARC_DEGRESS ; case BOTTOM_RIGHT : return 0 ; default : throw new IllegalArgument... | Returns the angle which should be used to draw a shadow which is located at a corner of an elevated view . | 114 | 22 |
7,730 | public static Bitmap createElevationShadow ( @ NonNull final Context context , final int elevation , @ NonNull final Orientation orientation ) { return createElevationShadow ( context , elevation , orientation , false ) ; } | Creates and returns a bitmap which can be used to emulate a shadow of an elevated view on pre - Lollipop devices . By default a non - parallel illumination of the view is emulated which causes the shadow at its bottom to appear a bit more intense than the shadows to its left and right and a lot more intense than the sh... | 47 | 72 |
7,731 | public static Bitmap createElevationShadow ( @ NonNull final Context context , final int elevation , @ NonNull final Orientation orientation , final boolean parallelLight ) { Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; Condition . INSTANCE . ensureAtLeast ( elevation , 0 , "The el... | Creates and returns a bitmap which can be used to emulate a shadow of an elevated view on pre - Lollipop devices . This method furthermore allows to specify whether parallel illumination of the view should be emulated which causes the shadows at all of its sides to appear identically . | 236 | 56 |
7,732 | private void mergeTemplate ( String templateFilename , File folder , String javaFilename , boolean overwrite ) { final File javaFile = new File ( folder , javaFilename ) ; // create destination folder? File destinationFolder = javaFile . getParentFile ( ) ; if ( false == destinationFolder . exists ( ) ) { destinationFo... | Merges a Velocity template for a specified file unless it already exists . | 264 | 14 |
7,733 | private static void processResource ( String resourceName , AbstractProcessor processor ) { InputStream lastNameStream = NameDbUsa . class . getClassLoader ( ) . getResourceAsStream ( resourceName ) ; BufferedReader lastNameReader = new BufferedReader ( new InputStreamReader ( lastNameStream ) ) ; try { int index = 0 ;... | Processes a given resource using provided closure | 128 | 8 |
7,734 | private int binarySearch ( @ NonNull final List < ItemType > list , @ NonNull final ItemType item , @ NonNull final Comparator < ItemType > comparator ) { int index = Collections . binarySearch ( list , item , comparator ) ; if ( index < 0 ) { index = ~ index ; } return index ; } | Returns the index an item should be added at according to a specific comparator . | 71 | 16 |
7,735 | public final void setComparator ( @ Nullable final Comparator < ItemType > comparator ) { this . comparator = comparator ; if ( comparator != null ) { if ( items . size ( ) > 0 ) { List < ItemType > newItems = new ArrayList <> ( ) ; List < View > views = new ArrayList <> ( ) ; for ( int i = items . size ( ) - 1 ; i >= ... | Sets the comparator which allows to determine the order which should be used to add views to the parent . When setting a comparator which is different from the current one the currently attached views are reordered . | 279 | 42 |
7,736 | public < T > T httpRequest ( HttpMethod method , Class < T > cls , Map < String , Object > params , Object data , String ... segments ) { HttpHeaders requestHeaders = new HttpHeaders ( ) ; requestHeaders . setAccept ( Collections . singletonList ( MediaType . APPLICATION_JSON ) ) ; if ( accessToken != null ) { String a... | Low - level HTTP request method . Synchronous blocks till response or timeout . | 406 | 16 |
7,737 | public ApiResponse apiRequest ( HttpMethod method , Map < String , Object > params , Object data , String ... segments ) { ApiResponse response = null ; try { response = httpRequest ( method , ApiResponse . class , params , data , segments ) ; log . info ( "Client.apiRequest(): Response: " + response ) ; } catch ( Http... | High - level Usergrid API request . | 220 | 8 |
7,738 | public ApiResponse authorizeAppUser ( String email , String password ) { validateNonEmptyParam ( email , "email" ) ; validateNonEmptyParam ( password , "password" ) ; assertValidApplicationId ( ) ; loggedInUser = null ; accessToken = null ; currentOrganization = null ; Map < String , Object > formData = new HashMap < S... | Log the user in and get a valid access token . | 268 | 11 |
7,739 | public ApiResponse changePassword ( String username , String oldPassword , String newPassword ) { Map < String , Object > data = new HashMap < String , Object > ( ) ; data . put ( "newpassword" , newPassword ) ; data . put ( "oldpassword" , oldPassword ) ; return apiRequest ( HttpMethod . POST , null , data , organizat... | Change the password for the currently logged in user . You must supply the old password and the new password . | 96 | 21 |
7,740 | public ApiResponse authorizeAppClient ( String clientId , String clientSecret ) { validateNonEmptyParam ( clientId , "client identifier" ) ; validateNonEmptyParam ( clientSecret , "client secret" ) ; assertValidApplicationId ( ) ; loggedInUser = null ; accessToken = null ; currentOrganization = null ; Map < String , Ob... | Log the app in with it s client id and client secret key . Not recommended for production apps . | 268 | 20 |
7,741 | public ApiResponse createEntity ( Entity entity ) { assertValidApplicationId ( ) ; if ( isEmpty ( entity . getType ( ) ) ) { throw new IllegalArgumentException ( "Missing entity type" ) ; } ApiResponse response = apiRequest ( HttpMethod . POST , null , entity , organizationId , applicationId , entity . getType ( ) ) ; ... | Create a new entity on the server . | 83 | 8 |
7,742 | public ApiResponse createEntity ( Map < String , Object > properties ) { assertValidApplicationId ( ) ; if ( isEmpty ( properties . get ( "type" ) ) ) { throw new IllegalArgumentException ( "Missing entity type" ) ; } ApiResponse response = apiRequest ( HttpMethod . POST , null , properties , organizationId , applicati... | Create a new entity on the server from a set of properties . Properties must include a type property . | 97 | 20 |
7,743 | public Map < String , Group > getGroupsForUser ( String userId ) { ApiResponse response = apiRequest ( HttpMethod . GET , null , null , organizationId , applicationId , "users" , userId , "groups" ) ; Map < String , Group > groupMap = new HashMap < String , Group > ( ) ; if ( response != null ) { List < Group > groups ... | Get the groups for the user . | 128 | 7 |
7,744 | public Query queryActivityFeedForUser ( String userId ) { Query q = queryEntitiesRequest ( HttpMethod . GET , null , null , organizationId , applicationId , "users" , userId , "feed" ) ; return q ; } | Get a user s activity feed . Returned as a query to ease paging . | 53 | 17 |
7,745 | public ApiResponse postUserActivity ( String userId , Activity activity ) { return apiRequest ( HttpMethod . POST , null , activity , organizationId , applicationId , "users" , userId , "activities" ) ; } | Posts an activity to a user . Activity must already be created . | 50 | 13 |
7,746 | public ApiResponse postUserActivity ( String verb , String title , String content , String category , User user , Entity object , String objectType , String objectName , String objectContent ) { Activity activity = Activity . newActivity ( verb , title , content , category , user , object , objectType , objectName , ob... | Creates and posts an activity to a user . | 91 | 10 |
7,747 | public ApiResponse postGroupActivity ( String groupId , Activity activity ) { return apiRequest ( HttpMethod . POST , null , activity , organizationId , applicationId , "groups" , groupId , "activities" ) ; } | Posts an activity to a group . Activity must already be created . | 50 | 13 |
7,748 | public ApiResponse postGroupActivity ( String groupId , String verb , String title , String content , String category , User user , Entity object , String objectType , String objectName , String objectContent ) { Activity activity = Activity . newActivity ( verb , title , content , category , user , object , objectType... | Creates and posts an activity to a group . | 85 | 10 |
7,749 | public Query queryActivity ( ) { Query q = queryEntitiesRequest ( HttpMethod . GET , null , null , organizationId , applicationId , "activities" ) ; return q ; } | Get a group s activity feed . Returned as a query to ease paging . | 41 | 17 |
7,750 | public Query queryEntitiesRequest ( HttpMethod method , Map < String , Object > params , Object data , String ... segments ) { ApiResponse response = apiRequest ( method , params , data , segments ) ; return new EntityQuery ( response , method , params , data , segments ) ; } | Perform a query request and return a query object . The Query object provides a simple way of dealing with result sets that need to be iterated or paged through . | 62 | 34 |
7,751 | public Query queryUsersForGroup ( String groupId ) { Query q = queryEntitiesRequest ( HttpMethod . GET , null , null , organizationId , applicationId , "groups" , groupId , "users" ) ; return q ; } | Queries the users for the specified group . | 52 | 9 |
7,752 | public ApiResponse addUserToGroup ( String userId , String groupId ) { return apiRequest ( HttpMethod . POST , null , null , organizationId , applicationId , "groups" , groupId , "users" , userId ) ; } | Adds a user to the specified groups . | 54 | 8 |
7,753 | public ApiResponse createGroup ( String groupPath , String groupTitle , String groupName ) { Map < String , Object > data = new HashMap < String , Object > ( ) ; data . put ( "type" , "group" ) ; data . put ( "path" , groupPath ) ; if ( groupTitle != null ) { data . put ( "title" , groupTitle ) ; } if ( groupName != nu... | Create a group with a path title and name | 132 | 9 |
7,754 | public ApiResponse connectEntities ( String connectingEntityType , String connectingEntityId , String connectionType , String connectedEntityId ) { return apiRequest ( HttpMethod . POST , null , null , organizationId , applicationId , connectingEntityType , connectingEntityId , connectionType , connectedEntityId ) ; } | Connect two entities together . | 65 | 5 |
7,755 | public ApiResponse disconnectEntities ( String connectingEntityType , String connectingEntityId , String connectionType , String connectedEntityId ) { return apiRequest ( HttpMethod . DELETE , null , null , organizationId , applicationId , connectingEntityType , connectingEntityId , connectionType , connectedEntityId )... | Disconnect two entities . | 67 | 5 |
7,756 | public Query queryEntityConnections ( String connectingEntityType , String connectingEntityId , String connectionType , String ql ) { Map < String , Object > params = new HashMap < String , Object > ( ) ; params . put ( "ql" , ql ) ; Query q = queryEntitiesRequest ( HttpMethod . GET , params , null , organizationId , a... | Query the connected entities . | 97 | 5 |
7,757 | public Query queryEntityConnectionsWithinLocation ( String connectingEntityType , String connectingEntityId , String connectionType , float distance , float lattitude , float longitude , String ql ) { Map < String , Object > params = new HashMap < String , Object > ( ) ; params . put ( "ql" , makeLocationQL ( distance ... | Query the connected entities within distance of a specific point . | 123 | 11 |
7,758 | public static Object toData ( Literal lit ) { if ( lit == null ) throw new IllegalArgumentException ( "Can't convert null literal" ) ; if ( lit instanceof TypedLiteral ) return toData ( ( TypedLiteral ) lit ) ; // Untyped literals are xsd:string // Note this isn't strictly correct; language tags will be lost here. retu... | Convert from RDF literal to native Java object . | 94 | 11 |
7,759 | public static Object toData ( TypedLiteral lit ) { if ( lit == null ) throw new IllegalArgumentException ( "Can't convert null literal" ) ; Conversion < ? > c = uriConversions . get ( lit . getDataType ( ) ) ; if ( c == null ) throw new IllegalArgumentException ( "Don't know how to convert literal of type " + lit . get... | Convert from RDF typed literal to native Java object . | 107 | 12 |
7,760 | public static TypedLiteral toLiteral ( Object value ) { if ( value == null ) throw new IllegalArgumentException ( "Can't convert null value" ) ; Conversion < ? > c = classConversions . get ( value . getClass ( ) ) ; if ( c != null ) return c . literal ( value ) ; // The object has an unrecognized type that doesn't tran... | Convert from an arbitrary Java object to an RDF typed literal using an XSD datatype if possible . | 192 | 23 |
7,761 | protected Map < String , RDFNode > readNext ( ) throws SparqlException { try { // read <result> or </results> int eventType = reader . nextTag ( ) ; // if a closing element, then it should be </results> if ( eventType == END_ELEMENT ) { // already read the final result, so clean up and return nothing if ( nameIs ( RESU... | Parse the input stream to look for a result . | 366 | 11 |
7,762 | private static void append ( StringBuilder sb , int val , int width ) { String s = Integer . toString ( val ) ; for ( int i = s . length ( ) ; i < width ; i ++ ) sb . append ( ' ' ) ; sb . append ( s ) ; } | Append the given value to the string builder with leading zeros to result in the given minimum width . | 64 | 21 |
7,763 | private static long elapsedDays ( int year ) { int y = year - 1 ; return DAYS_IN_YEAR * ( long ) y + div ( y , 400 ) - div ( y , 100 ) + div ( y , 4 ) ; } | Find the number of elapsed days from the epoch to the beginning of the given year . | 53 | 17 |
7,764 | private static int daysInMonth ( int year , int month ) { assert month >= FIRST_MONTH && month <= LAST_MONTH ; int d = DAYS_IN_MONTH [ month - 1 ] ; if ( month == FEBRUARY && isLeapYear ( year ) ) d ++ ; return d ; } | Find the number of days in the given month given the year . | 69 | 13 |
7,765 | private static int parseMillis ( Input s ) { if ( s . index < s . len && s . getChar ( ) == ' ' ) { int startIndex = ++ s . index ; int ms = parseInt ( s ) ; int len = s . index - startIndex ; for ( ; len < 3 ; len ++ ) ms *= 10 ; for ( ; len > 3 ; len -- ) ms /= 10 ; // truncate because it's easier than rounding. retu... | Parse the fractional seconds field from the input returning the number of milliseconds and truncating extra places . | 108 | 21 |
7,766 | private static Integer parseTzOffsetMs ( Input s , boolean strict ) { if ( s . index < s . len ) { char c = s . getChar ( ) ; s . index ++ ; int sign ; if ( c == ' ' ) { return 0 ; } else if ( c == ' ' ) { sign = 1 ; } else if ( c == ' ' ) { sign = - 1 ; } else { throw new DateFormatException ( "unexpected character, e... | Parse the timezone offset from the input returning its millisecond value . | 345 | 15 |
7,767 | private static int parseField ( String field , Input s , Character delim , int minLen , int maxLen , boolean strict ) { int startIndex = s . index ; int result = parseInt ( s ) ; if ( startIndex == s . index ) throw new DateFormatException ( "missing value for field '" + field + "'" , s . str , startIndex ) ; if ( stri... | Parse a field from input validating its delimiter and length if requested . | 285 | 16 |
7,768 | private static int parseInt ( Input s ) { if ( s . index >= s . len ) throw new DateFormatException ( "unexpected end of input" , s . str , s . index ) ; int result = 0 ; while ( s . index < s . len ) { char c = s . getChar ( ) ; if ( c >= ' ' && c <= ' ' ) { if ( result >= Integer . MAX_VALUE / 10 ) throw new Arithmet... | Parse an integer from the input reading up to the first non - numeric character . | 142 | 17 |
7,769 | public static void showAppInfo ( @ NonNull final Context context , @ NonNull final String packageName ) { Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; Condition . INSTANCE . ensureNotNull ( packageName , "The package name may not be null" ) ; Condition . INSTANCE . ensureNotEmpty (... | Starts the settings app in order to show the information about a specific app . | 200 | 16 |
7,770 | public ApiResponse < Void > postPermissionsWithHttpInfo ( String objectType , PostPermissionsData body ) throws ApiException { com . squareup . okhttp . Call call = postPermissionsValidateBeforeCall ( objectType , body , null , null ) ; return apiClient . execute ( call ) ; } | Post permissions for a list of objects . Post permissions from Configuration Server for objects identified by their type and DBIDs . | 68 | 23 |
7,771 | Optional < PlayerKilled > move ( Player player ) { Move move = player . getMoves ( ) . poll ( ) ; if ( move != null ) { Tile from = tiles [ move . getFrom ( ) ] ; boolean armyBigEnough = from . getArmySize ( ) > 1 ; boolean tileAndPlayerMatching = from . isOwnedBy ( player . getPlayerIndex ( ) ) ; boolean oneStepAway =... | Polls move recursively until it finds a valid move . | 260 | 13 |
7,772 | public List < String > getPlayerNames ( ) { return lastGameState . getPlayers ( ) . stream ( ) . map ( Player :: getUsername ) . collect ( Collectors . toList ( ) ) ; } | Names of all players that played in the game . | 46 | 10 |
7,773 | public static Field getField ( Class < ? > clazz , String fieldName ) throws NoSuchFieldException { if ( clazz == Object . class ) { return null ; } try { Field field = clazz . getDeclaredField ( fieldName ) ; return field ; } catch ( NoSuchFieldException e ) { return getField ( clazz . getSuperclass ( ) , fieldName ) ... | Recursively find the field by name up to the top of class hierarchy . | 86 | 16 |
7,774 | public com . squareup . okhttp . Call connectCall ( final ProgressResponseBody . ProgressListener progressListener , final ProgressRequestBody . ProgressRequestListener progressRequestListener ) throws ApiException { Object localVarPostBody = null ; // create path and map variables String localVarPath = "/notifications... | Build call for connect | 474 | 4 |
7,775 | protected void invokeDelegate ( ActionFilter delegate , ActionRequest request , ActionResponse response , FilterChain filterChain ) throws PortletException , IOException { delegate . doFilter ( request , response , filterChain ) ; } | Actually invoke the delegate ActionFilter with the given request and response . | 45 | 13 |
7,776 | protected void invokeDelegate ( EventFilter delegate , EventRequest request , EventResponse response , FilterChain filterChain ) throws PortletException , IOException { delegate . doFilter ( request , response , filterChain ) ; } | Actually invoke the delegate EventFilter with the given request and response . | 45 | 13 |
7,777 | protected void invokeDelegate ( RenderFilter delegate , RenderRequest request , RenderResponse response , FilterChain filterChain ) throws PortletException , IOException { delegate . doFilter ( request , response , filterChain ) ; } | Actually invoke the delegate RenderFilter with the given request and response . | 45 | 13 |
7,778 | protected void invokeDelegate ( ResourceFilter delegate , ResourceRequest request , ResourceResponse response , FilterChain filterChain ) throws PortletException , IOException { delegate . doFilter ( request , response , filterChain ) ; } | Actually invoke the delegate ResourceFilter with the given request and response . | 45 | 13 |
7,779 | public PreAuthenticatedGrantedAuthoritiesPortletAuthenticationDetails buildDetails ( PortletRequest context ) { Collection < ? extends GrantedAuthority > userGas = buildGrantedAuthorities ( context ) ; PreAuthenticatedGrantedAuthoritiesPortletAuthenticationDetails result = new PreAuthenticatedGrantedAuthoritiesPortletA... | Builds the authentication details object . | 76 | 7 |
7,780 | private boolean _runDML ( DataManupulationStatement q , boolean isDDL ) { boolean readOnly = ConnectionManager . instance ( ) . isPoolReadOnly ( getPool ( ) ) ; Transaction txn = Database . getInstance ( ) . getCurrentTransaction ( ) ; if ( ! readOnly ) { q . executeUpdate ( ) ; if ( Database . getJdbcTypeHelper ( getP... | RReturn true if modification was done .. | 159 | 8 |
7,781 | private List < PortletFilter > getFilters ( PortletRequest request ) { for ( PortletSecurityFilterChain chain : filterChains ) { if ( chain . matches ( request ) ) { return chain . getFilters ( ) ; } } return null ; } | Returns the first filter chain matching the supplied URL . | 56 | 10 |
7,782 | @ Deprecated public void setFilterChainMap ( Map < RequestMatcher , List < PortletFilter > > filterChainMap ) { filterChains = new ArrayList < PortletSecurityFilterChain > ( filterChainMap . size ( ) ) ; for ( Map . Entry < RequestMatcher , List < PortletFilter > > entry : filterChainMap . entrySet ( ) ) { filterChains... | Sets the mapping of URL patterns to filter chains . | 113 | 11 |
7,783 | @ Deprecated public Map < RequestMatcher , List < PortletFilter > > getFilterChainMap ( ) { LinkedHashMap < RequestMatcher , List < PortletFilter > > map = new LinkedHashMap < RequestMatcher , List < PortletFilter > > ( ) ; for ( PortletSecurityFilterChain chain : filterChains ) { map . put ( ( ( DefaultPortletSecurity... | Returns a copy of the underlying filter chain map . Modifications to the map contents will not affect the PortletFilterChainProxy state . | 113 | 27 |
7,784 | private void displaySearchLine ( String line , String searchWord ) throws IOException { int start = line . indexOf ( searchWord ) ; connection . write ( line . substring ( 0 , start ) ) ; connection . write ( ANSI . INVERT_BACKGROUND ) ; connection . write ( searchWord ) ; connection . write ( ANSI . RESET ) ; connecti... | highlight the specific word thats found in the search | 104 | 10 |
7,785 | public static PortletApplicationContext getPortletApplicationContext ( PortletContext pc , String attrName ) { Assert . notNull ( pc , "PortletContext must not be null" ) ; Object attr = pc . getAttribute ( attrName ) ; if ( attr == null ) { return null ; } if ( attr instanceof RuntimeException ) { throw ( RuntimeExcep... | Find a custom PortletApplicationContext for this web application . | 190 | 12 |
7,786 | public void setFile ( File file ) throws IOException { if ( ! file . isFile ( ) ) throw new IllegalArgumentException ( file + " must be a file." ) ; else { if ( file . getName ( ) . endsWith ( "gz" ) ) initGzReader ( file ) ; else initReader ( file ) ; } } | Read from a specified file . Also supports gzipped files . | 75 | 13 |
7,787 | public void setFileFromAJar ( String fileName ) { InputStream is = this . getClass ( ) . getResourceAsStream ( fileName ) ; if ( is != null ) { this . fileName = fileName ; reader = new InputStreamReader ( is ) ; } } | Read a file resouce located in a jar | 60 | 10 |
7,788 | private TypeInfo getTypeInfo ( Map < String , TypeInfo > typeMaps , String path , Class < ? > superType ) { TypeInfo typeInfo = typeMaps . get ( path ) ; if ( typeInfo == null ) { typeInfo = new TypeInfo ( superType ) ; typeMaps . put ( path , typeInfo ) ; } return typeInfo ; } | Get the TypeInfo object from specified path or return the new one if it does not exist . | 77 | 19 |
7,789 | protected void successfulAuthentication ( PortletRequest request , PortletResponse response , Authentication authResult ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Authentication success: " + authResult ) ; } SecurityContextHolder . getContext ( ) . setAuthentication ( authResult ) ; // Fire event if ( t... | Puts the Authentication instance returned by the authentication manager into the secure context . | 106 | 15 |
7,790 | public ApiResponse < Templates > deleteTemplatesWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = deleteTemplatesValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < Templates > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; } | Delete Templates . deleteTemplates | 83 | 7 |
7,791 | public ApiResponse < ApiEndpointsSuccess > getApiEndpointsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getApiEndpointsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < ApiEndpointsSuccess > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarR... | Get apiEndpoints . Get api - endpoints | 93 | 10 |
7,792 | public ApiResponse < Templates > getTemplatesWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getTemplatesValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < Templates > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; } | Get Templates . getTemplates | 83 | 7 |
7,793 | public ApiResponse < ApiPostEndpointsSuccess > postApiEndpointsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = postApiEndpointsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < ApiPostEndpointsSuccess > ( ) { } . getType ( ) ; return apiClient . execute ( call ,... | Post apiEndpoints . Post api - endpoints | 95 | 10 |
7,794 | public ApiResponse < Templates > postTemplatesWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = postTemplatesValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < Templates > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; } | Post Templates . postTemplates | 83 | 7 |
7,795 | public ApiResponse < Templates > putTemplatesWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = putTemplatesValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < Templates > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; } | Put Templates . putTemplates | 83 | 7 |
7,796 | public ApiResponse < GetLogout > getLogoutWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getLogoutValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetLogout > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; } | Logout user Logout the user by deleting the session and removing the associated cookie . | 85 | 17 |
7,797 | public ApiResponse < ApiSuccessResponse > initProvisioningWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = initProvisioningValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < ApiSuccessResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarR... | Init Session The GET operation will init user session . | 89 | 10 |
7,798 | public static < T > T dtoFromScratch ( T entity , DTO dtoTemplate ) throws HyalineException { return dtoFromScratch ( entity , dtoTemplate , "Hyaline$Proxy$" + System . currentTimeMillis ( ) ) ; } | It lets you create a new DTO from scratch . This means that any annotation from JAXB Jackson or whatever serialization framework you are using on your entity T will be ignored . The only annotation - based configuration that will be used is the one you are defining in this invocation . | 58 | 57 |
7,799 | public static < T > T dtoFromScratch ( T entity , DTO dtoTemplate , String proxyClassName ) throws HyalineException { try { return createDTO ( entity , dtoTemplate , true , proxyClassName ) ; } catch ( CannotInstantiateProxyException | DTODefinitionException e ) { e . printStackTrace ( ) ; throw new HyalineException ( ... | It lets you create a new DTO from scratch . This means that any annotation for JAXB Jackson or whatever serialization framework you are using on your entity T will be ignored . The only annotation - based configuration that will be used is the one you are defining in this invocation . | 87 | 57 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.