idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
7,700 | private static void mkdir ( final File directory , final boolean createParents ) throws IOException { Condition . INSTANCE . ensureNotNull ( directory , "The directory may not be null" ) ; boolean result = createParents ? directory . mkdirs ( ) : directory . mkdir ( ) ; if ( ! result && ! directory . exists ( ) ) { thr... | Creates a specific directory if it does not already exist . |
7,701 | public static void deleteRecursively ( final File file ) throws IOException { Condition . INSTANCE . ensureNotNull ( file , "The file or directory may not be null" ) ; if ( file . isDirectory ( ) ) { for ( File child : file . listFiles ( ) ) { deleteRecursively ( child ) ; } } delete ( file ) ; } | Deletes a specific file or directory . If the file is a directory all contained files and subdirectories are deleted recursively . |
7,702 | public static void createNewFile ( final File file , final boolean overwrite ) throws IOException { Condition . INSTANCE . ensureNotNull ( file , "The file may not be null" ) ; boolean result = file . createNewFile ( ) ; if ( ! result ) { if ( overwrite ) { try { delete ( file ) ; createNewFile ( file , false ) ; } cat... | Creates a new empty file . |
7,703 | public void maybeDoOffset ( ) { long seen = tuplesSeen ; if ( offsetCommitInterval > 0 && seen % offsetCommitInterval == 0 && offsetStorage != null && fp . supportsOffsetManagement ( ) ) { doOffsetInternal ( ) ; } } | To do offset storage we let the topology drain itself out . Then we commit . |
7,704 | private static TypedArray obtainStyledAttributes ( final Context context , final int themeResourceId , final int resourceId ) { Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; Theme theme = context . getTheme ( ) ; int [ ] attrs = new int [ ] { resourceId } ; if ( themeResourceId != -... | Obtains the attribute which corresponds to a specific resource id from a theme . |
7,705 | public static boolean getBoolean ( final Context context , final int themeResourceId , final int resourceId ) { TypedArray typedArray = null ; try { typedArray = obtainStyledAttributes ( context , themeResourceId , resourceId ) ; return typedArray . getBoolean ( 0 , false ) ; } finally { if ( typedArray != null ) { typ... | Obtains the boolean value which corresponds to a specific resource id from a specific theme . |
7,706 | public static boolean getBoolean ( final Context context , final int resourceId , final boolean defaultValue ) { return getBoolean ( context , - 1 , resourceId , defaultValue ) ; } | Obtains the boolean value which corresponds to a specific resource id from a context s theme . |
7,707 | public static int getInt ( final Context context , final int resourceId , final int defaultValue ) { return getInt ( context , - 1 , resourceId , defaultValue ) ; } | Obtains the integer value which corresponds to a specific resource id from a context s theme . |
7,708 | public static float getFloat ( final Context context , final int resourceId , final float defaultValue ) { return getFloat ( context , - 1 , resourceId , defaultValue ) ; } | Obtains the float value which corresponds to a specific resource id from a context s theme . |
7,709 | public static int getResId ( final Context context , final int resourceId , final int defaultValue ) { return getResId ( context , - 1 , resourceId , defaultValue ) ; } | Obtains the resource id which corresponds to a specific resource id from a context s theme . |
7,710 | void setRequest ( HttpUriRequest request ) { requestLock . lock ( ) ; try { if ( this . request != null ) { throw new SparqlException ( "Command is already executing a request." ) ; } this . request = request ; } finally { requestLock . unlock ( ) ; } } | Sets the currently executing request . |
7,711 | private Result execute ( ResultType cmdType ) throws SparqlException { String mimeType = contentType ; if ( mimeType != null && ! ResultFactory . supports ( mimeType , cmdType ) ) { logger . warn ( "Requested MIME content type '{}' does not support expected response type: {}" , mimeType , cmdType ) ; mimeType = null ; ... | Executes the request and parses the response . |
7,712 | private void logRequest ( ResultType cmdType , String mimeType ) { StringBuilder sb = new StringBuilder ( "Executing SPARQL protocol request " ) ; sb . append ( "to endpoint <" ) . append ( ( ( ProtocolDataSource ) getConnection ( ) . getDataSource ( ) ) . getUrl ( ) ) . append ( "> " ) ; if ( mimeType != null ) { sb .... | Log the enpoint URL and request parameters . |
7,713 | public void initialize ( ) { thread = new Thread ( collectorProcessor ) ; thread . start ( ) ; for ( DriverNode dn : this . children ) { dn . initialize ( ) ; } } | initialize driver node and all children of the node |
7,714 | 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 |
7,715 | 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 |
7,716 | public static void setVersion ( JsonNode node , Long version ) { obj ( node ) . put ( ID_VERSION , version ) ; } | Sets the version on a wrapped JsonNode |
7,717 | 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 |
7,718 | 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 . |
7,719 | 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 . |
7,720 | 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 . |
7,721 | 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 . |
7,722 | private OnSeekBarChangeListener createSeekBarListener ( ) { return new OnSeekBarChangeListener ( ) { public void onProgressChanged ( final SeekBar seekBar , final int progress , final boolean fromUser ) { adaptElevation ( progress , parallelLightCheckBox . isChecked ( ) ) ; } public void onStartTrackingTouch ( final Se... | Creates and returns a listener which allows to adjust the elevation when the value of a seek bar has been changed . |
7,723 | 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 . |
7,724 | 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 |
7,725 | 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 |
7,726 | private void obtainInsetForeground ( 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 ) { setInsetDr... | Obtains the drawable which should be shown in the layout s insets from a specific typed array . |
7,727 | 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 . |
7,728 | 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 . |
7,729 | 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 . |
7,730 | 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 . |
7,731 | 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 . |
7,732 | private static Bitmap createEdgeShadow ( final Context context , final int elevation , final Orientation orientation , final boolean parallelLight ) { if ( elevation == 0 ) { return null ; } else { float shadowWidth = getShadowWidth ( context , elevation , orientation , parallelLight ) ; int shadowColor = getShadowColo... | 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 . |
7,733 | private static Bitmap createCornerShadow ( final Context context , final int elevation , final Orientation orientation , final boolean parallelLight ) { if ( elevation == 0 ) { return null ; } else { float horizontalShadowWidth = getHorizontalShadowWidth ( context , elevation , orientation , parallelLight ) ; float ver... | 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 . |
7,734 | private static RectF getCornerBounds ( 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 , size ) ... | Returns the bounds which should be used to draw a shadow which is located at a corner of an elevated view . |
7,735 | private static float getHorizontalShadowWidth ( final Context context , final int elevation , final Orientation orientation , final boolean parallelLight ) { switch ( orientation ) { case TOP_LEFT : case TOP_RIGHT : return getShadowWidth ( context , elevation , Orientation . TOP , parallelLight ) ; case BOTTOM_LEFT : c... | Returns the width of a shadow which is located next to a corner of an elevated view in horizontal direction . |
7,736 | private static float getShadowWidth ( final Context context , final int elevation , final Orientation orientation , final boolean parallelLight ) { float referenceElevationWidth = ( float ) elevation / ( float ) REFERENCE_ELEVATION * REFERENCE_SHADOW_WIDTH ; float shadowWidth ; if ( parallelLight ) { shadowWidth = refe... | Returns the width of a shadow which is located besides an edge of an elevated view . |
7,737 | private static int getHorizontalShadowColor ( final int elevation , 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 getShadowC... | Returns the color of a shadow which is located next to a corner of an elevated view in horizontal direction . |
7,738 | private static int getVerticalShadowColor ( final int elevation , 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 getShadowCo... | Returns the color of a shadow which is located next to a corner of an elevated view in vertical direction . |
7,739 | private static int getShadowColor ( final int elevation , 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 ( elevation , MIN... | Returns the color of a shadow which is located besides an edge of an elevated view . |
7,740 | 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 . |
7,741 | private static Shader createLinearGradient ( final Orientation orientation , final int bitmapWidth , final int bitmapHeight , final float shadowWidth , final int shadowColor ) { RectF bounds = new RectF ( ) ; switch ( orientation ) { case LEFT : bounds . left = bitmapWidth ; bounds . right = bitmapWidth - shadowWidth ;... | Creates and returns a shader which can be used to draw a shadow which located besides an edge of an elevated view . |
7,742 | private static Shader createRadialGradient ( 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 ; case BOTTOM_... | Creates and returns a shader which can be used to draw a shadow which located at a corner of an elevated view . |
7,743 | private static float getCornerAngle ( 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 IllegalArgumentException ... | Returns the angle which should be used to draw a shadow which is located at a corner of an elevated view . |
7,744 | public static Bitmap createElevationShadow ( final Context context , final int elevation , 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... |
7,745 | public static Bitmap createElevationShadow ( final Context context , final int elevation , final Orientation orientation , final boolean parallelLight ) { Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; Condition . INSTANCE . ensureAtLeast ( elevation , 0 , "The elevation must be at l... | 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 . |
7,746 | private void mergeTemplate ( String templateFilename , File folder , String javaFilename , boolean overwrite ) { final File javaFile = new File ( folder , javaFilename ) ; File destinationFolder = javaFile . getParentFile ( ) ; if ( false == destinationFolder . exists ( ) ) { destinationFolder . mkdirs ( ) ; } if ( fal... | Merges a Velocity template for a specified file unless it already exists . |
7,747 | 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 |
7,748 | private int binarySearch ( final List < ItemType > list , final ItemType item , 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 . |
7,749 | public final void setComparator ( 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 >= 0 ; 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 . |
7,750 | 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 . |
7,751 | 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 . |
7,752 | 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 . |
7,753 | 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 . |
7,754 | 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 . |
7,755 | 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 . |
7,756 | 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 . |
7,757 | 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 . |
7,758 | 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 . |
7,759 | 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 . |
7,760 | 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 . |
7,761 | 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 . |
7,762 | 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 . |
7,763 | 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 . |
7,764 | 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 . |
7,765 | 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 . |
7,766 | 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 . |
7,767 | 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 |
7,768 | 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 . |
7,769 | 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 . |
7,770 | 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 . |
7,771 | 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 . |
7,772 | 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 ) ; return lit . getLexical ( ) ; } | Convert from RDF literal to native Java object . |
7,773 | 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 . |
7,774 | 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 ) ; return new TypedLiteralImpl ( value . toString ( ) , Xsd... | Convert from an arbitrary Java object to an RDF typed literal using an XSD datatype if possible . |
7,775 | protected Map < String , RDFNode > readNext ( ) throws SparqlException { try { int eventType = reader . nextTag ( ) ; if ( eventType == END_ELEMENT ) { if ( nameIs ( RESULTS ) ) { cleanup ( ) ; return null ; } else throw new SparqlException ( "Bad element closure with: " + reader . getLocalName ( ) ) ; } testOpen ( eve... | Parse the input stream to look for a result . |
7,776 | 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 ( '0' ) ; sb . append ( s ) ; } | Append the given value to the string builder with leading zeros to result in the given minimum width . |
7,777 | 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 . |
7,778 | 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 . |
7,779 | 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 ; return ms ; } return 0 ; } | Parse the fractional seconds field from the input returning the number of milliseconds and truncating extra places . |
7,780 | private static Integer parseTzOffsetMs ( Input s , boolean strict ) { if ( s . index < s . len ) { char c = s . getChar ( ) ; s . index ++ ; int sign ; if ( c == 'Z' ) { 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 . |
7,781 | 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 . |
7,782 | 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 >= '0' && c <= '9' ) { if ( result >= Integer . MAX_VALUE / 10 ) throw new Arithmet... | Parse an integer from the input reading up to the first non - numeric character . |
7,783 | public static void showAppInfo ( final Context context , 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 ( packageName , "The ... | Starts the settings app in order to show the information about a specific app . |
7,784 | 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 . |
7,785 | 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 . |
7,786 | public List < String > getPlayerNames ( ) { return lastGameState . getPlayers ( ) . stream ( ) . map ( Player :: getUsername ) . collect ( Collectors . toList ( ) ) ; } | Names of all players that played in the game . |
7,787 | 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 . |
7,788 | public com . squareup . okhttp . Call connectCall ( final ProgressResponseBody . ProgressListener progressListener , final ProgressRequestBody . ProgressRequestListener progressRequestListener ) throws ApiException { Object localVarPostBody = null ; String localVarPath = "/notifications/connect" ; List < Pair > localVa... | Build call for connect |
7,789 | 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 . |
7,790 | 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 . |
7,791 | 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 . |
7,792 | 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 . |
7,793 | public PreAuthenticatedGrantedAuthoritiesPortletAuthenticationDetails buildDetails ( PortletRequest context ) { Collection < ? extends GrantedAuthority > userGas = buildGrantedAuthorities ( context ) ; PreAuthenticatedGrantedAuthoritiesPortletAuthenticationDetails result = new PreAuthenticatedGrantedAuthoritiesPortletA... | Builds the authentication details object . |
7,794 | 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 .. |
7,795 | 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 . |
7,796 | public void setFilterChainMap ( Map < RequestMatcher , List < PortletFilter > > filterChainMap ) { filterChains = new ArrayList < PortletSecurityFilterChain > ( filterChainMap . size ( ) ) ; for ( Map . Entry < RequestMatcher , List < PortletFilter > > entry : filterChainMap . entrySet ( ) ) { filterChains . add ( new ... | Sets the mapping of URL patterns to filter chains . |
7,797 | public Map < RequestMatcher , List < PortletFilter > > getFilterChainMap ( ) { LinkedHashMap < RequestMatcher , List < PortletFilter > > map = new LinkedHashMap < RequestMatcher , List < PortletFilter > > ( ) ; for ( PortletSecurityFilterChain chain : filterChains ) { map . put ( ( ( DefaultPortletSecurityFilterChain )... | Returns a copy of the underlying filter chain map . Modifications to the map contents will not affect the PortletFilterChainProxy state . |
7,798 | 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 |
7,799 | 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 . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.