idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
140,700 | protected String moduleNameIdEncodingBeginLayer ( HttpServletRequest request ) { StringBuffer sb = new StringBuffer ( ) ; if ( request . getParameter ( AbstractHttpTransport . SCRIPTS_REQPARAM ) != null ) { // This is a request for a bootstrap layer with non-AMD script modules. // Define the deps variable in global scope in case it's needed by // the script modules. sb . append ( "var " + EXPDEPS_VARNAME + ";" ) ; //$NON-NLS-1$//$NON-NLS-2$ } return sb . toString ( ) ; } | Returns the text to be included at the beginning of the layer if module name id encoding is enabled . | 145 | 20 |
140,701 | protected String getTail ( ) { String tail = "" ; if ( this . offset < this . limit ) { tail = new String ( this . buffer , this . offset , this . limit - this . offset + 1 ) ; } return tail ; } | This method gets the tail of this scanner without changing the state . | 53 | 13 |
140,702 | public String getOriginalString ( ) { if ( this . string != null ) { this . string = new String ( this . buffer , this . initialOffset , getLength ( ) ) ; } return this . string ; } | This method gets the original string to parse . | 46 | 9 |
140,703 | @ Override public boolean applyAction ( Model m ) { Mapping map = m . getMapping ( ) ; return map . isRunning ( vm ) && map . getVMLocation ( vm ) . equals ( src ) && map . addSleepingVM ( vm , dst ) ; } | Apply the action by putting the VM into the sleeping state on its destination node in a given model | 62 | 19 |
140,704 | public StaticRouting . NodesMap nodesMapFromJSON ( Model mo , JSONObject o ) throws JSONConverterException { return new StaticRouting . NodesMap ( requiredNode ( mo , o , "src" ) , requiredNode ( mo , o , "dst" ) ) ; } | Convert a JSON nodes map object into a Java NodesMap object | 64 | 14 |
140,705 | public static ConstraintSplitterMapper newBundle ( ) { ConstraintSplitterMapper mapper = new ConstraintSplitterMapper ( ) ; mapper . register ( new AmongSplitter ( ) ) ; mapper . register ( new BanSplitter ( ) ) ; mapper . register ( new FenceSplitter ( ) ) ; mapper . register ( new GatherSplitter ( ) ) ; mapper . register ( new KilledSplitter ( ) ) ; mapper . register ( new LonelySplitter ( ) ) ; mapper . register ( new OfflineSplitter ( ) ) ; mapper . register ( new OnlineSplitter ( ) ) ; mapper . register ( new OverbookSplitter ( ) ) ; mapper . register ( new PreserveSplitter ( ) ) ; mapper . register ( new QuarantineSplitter ( ) ) ; mapper . register ( new ReadySplitter ( ) ) ; mapper . register ( new RootSplitter ( ) ) ; mapper . register ( new RunningSplitter ( ) ) ; mapper . register ( new SeqSplitter ( ) ) ; mapper . register ( new SleepingSplitter ( ) ) ; mapper . register ( new SplitSplitter ( ) ) ; mapper . register ( new SpreadSplitter ( ) ) ; return mapper ; } | Make a new bridge and register every splitters supported by default . | 281 | 13 |
140,706 | public boolean register ( ConstraintSplitter < ? extends Constraint > ccb ) { return builders . put ( ccb . getKey ( ) , ccb ) == null ; } | Register a splitter . | 40 | 5 |
140,707 | protected void generateDefaultConstructor ( SourceWriter sourceWriter , String simpleName ) { generateSourcePublicConstructorDeclaration ( sourceWriter , simpleName ) ; sourceWriter . println ( "super();" ) ; generateSourceCloseBlock ( sourceWriter ) ; } | Generates the the default constructor . | 53 | 7 |
140,708 | protected final void generateSourcePublicMethodDeclaration ( SourceWriter sourceWriter , JMethod method ) { StringBuilder arguments = new StringBuilder ( ) ; for ( JParameter parameter : method . getParameters ( ) ) { if ( arguments . length ( ) > 0 ) { arguments . append ( ", " ) ; } arguments . append ( parameter . getType ( ) . getQualifiedSourceName ( ) ) ; arguments . append ( " " ) ; arguments . append ( parameter . getName ( ) ) ; } generateSourcePublicMethodDeclaration ( sourceWriter , method . getReturnType ( ) . getQualifiedSourceName ( ) , method . getName ( ) , arguments . toString ( ) , false ) ; } | This method generates the source code for a public method declaration including the opening brace and indentation . | 149 | 19 |
140,709 | protected final void generateSourcePublicMethodDeclaration ( SourceWriter sourceWriter , String returnType , String methodName , String arguments , boolean override ) { if ( override ) { sourceWriter . println ( "@Override" ) ; } sourceWriter . print ( "public " ) ; if ( returnType != null ) { sourceWriter . print ( returnType ) ; sourceWriter . print ( " " ) ; } sourceWriter . print ( methodName ) ; sourceWriter . print ( "(" ) ; sourceWriter . print ( arguments ) ; sourceWriter . println ( ") {" ) ; sourceWriter . indent ( ) ; } | This method generates the source code for a public method or constructor including the opening brace and indentation . | 127 | 20 |
140,710 | protected void notifyInit ( ) { final String sourceMethod = "notifyInit" ; //$NON-NLS-1$ IServiceReference [ ] refs = null ; try { if ( _aggregator != null && _aggregator . getPlatformServices ( ) != null ) { refs = _aggregator . getPlatformServices ( ) . getServiceReferences ( ICacheManagerListener . class . getName ( ) , "(name=" + _aggregator . getName ( ) + ")" ) ; //$NON-NLS-1$ //$NON-NLS-2$ if ( refs != null ) { for ( IServiceReference ref : refs ) { ICacheManagerListener listener = ( ICacheManagerListener ) _aggregator . getPlatformServices ( ) . getService ( ref ) ; if ( listener != null ) { try { listener . initialized ( this ) ; } catch ( Throwable t ) { if ( log . isLoggable ( Level . WARNING ) ) { log . logp ( Level . WARNING , CacheManagerImpl . class . getName ( ) , sourceMethod , t . getMessage ( ) , t ) ; } } finally { _aggregator . getPlatformServices ( ) . ungetService ( ref ) ; } } } } } } catch ( PlatformServicesException e ) { if ( log . isLoggable ( Level . SEVERE ) ) { log . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } } | Notify listeners that the cache manager is initialized . | 329 | 10 |
140,711 | public int getStatus ( ) { int result = status ; if ( status > 0 ) { if ( skip . getAndDecrement ( ) <= 0 ) { if ( count . getAndDecrement ( ) <= 0 ) { result = status = - 1 ; } } else { result = 0 ; } } return result ; } | Returns the error response status that should be returned for the current response . If the value is zero then the normal response should be returned and this method should be called again for the next response . If the value is less than 0 then this error response status object is spent and may be discarded . | 68 | 58 |
140,712 | public static boolean deleteMMapGraph ( String path ) { String directory = ensureDirectory ( path ) ; File f = new File ( directory ) ; boolean ok = true ; if ( f . exists ( ) ) { ok = new File ( directory + "nodes.mmap" ) . delete ( ) ; ok = new File ( directory + "edges.mmap" ) . delete ( ) && ok ; ok = new File ( directory + "treeMap.mmap" ) . delete ( ) && ok ; ok = f . delete ( ) && ok ; } return ok ; } | Delete a graph from the given path . | 123 | 8 |
140,713 | public void mapConstraint ( Class < ? extends Constraint > c , Class < ? extends ChocoConstraint > cc ) { constraints . put ( c , cc ) ; } | Register a mapping between an api - side constraint and its choco implementation . It is expected from the implementation to exhibit a constructor that takes the api - side constraint as argument . | 40 | 35 |
140,714 | public void mapView ( Class < ? extends ModelView > c , Class < ? extends ChocoView > cc ) { views . put ( c , cc ) ; } | Register a mapping between an api - side view and its choco implementation . It is expected from the implementation to exhibit a constructor that takes the api - side constraint as argument . | 35 | 35 |
140,715 | public List < Link > getStaticRoute ( NodesMap nm ) { Map < Link , Boolean > route = routes . get ( nm ) ; if ( route == null ) { return null ; } return new ArrayList <> ( route . keySet ( ) ) ; } | Get the static route between two given nodes . | 57 | 9 |
140,716 | public void setStaticRoute ( NodesMap nm , Map < Link , Boolean > links ) { routes . put ( nm , links ) ; // Only one route between two nodes (replace the old route) } | Manually add a static route between two nodes . | 43 | 10 |
140,717 | private IntVar getMovingVM ( ) { //VMs that are moving for ( int i = move . nextSetBit ( 0 ) ; i >= 0 ; i = move . nextSetBit ( i + 1 ) ) { if ( starts [ i ] != null && ! starts [ i ] . isInstantiated ( ) && oldPos [ i ] != hosts [ i ] . getValue ( ) ) { return starts [ i ] ; } } return null ; } | Get the start moment for a VM that moves | 97 | 9 |
140,718 | private IntVar getEarlyVar ( ) { IntVar earlyVar = null ; for ( int i = stays . nextSetBit ( 0 ) ; i >= 0 ; i = stays . nextSetBit ( i + 1 ) ) { if ( starts [ i ] != null && ! starts [ i ] . isInstantiated ( ) ) { if ( earlyVar == null ) { earlyVar = starts [ i ] ; } else { if ( earlyVar . getLB ( ) > starts [ i ] . getLB ( ) ) { earlyVar = starts [ i ] ; } } } } return earlyVar ; } | Get the earliest un - instantiated start moment | 127 | 9 |
140,719 | private IntVar getVMtoLeafNode ( ) { for ( int x = 0 ; x < outs . length ; x ++ ) { if ( outs [ x ] . cardinality ( ) == 0 ) { //no outgoing VMs, can be launched directly. BitSet in = ins [ x ] ; for ( int i = in . nextSetBit ( 0 ) ; i >= 0 ; i = in . nextSetBit ( i + 1 ) ) { if ( starts [ i ] != null && ! starts [ i ] . isInstantiated ( ) ) { return starts [ i ] ; } } } } return null ; } | Get the start moment for a VM that move to a node where no VM will leave this node . This way we are pretty sure the action can be scheduled at 0 . | 132 | 34 |
140,720 | protected void initBytes ( StringBuilder source ) { if ( this . bytes == null ) { if ( this . string != null ) { String encodingValue = getEncoding ( ) ; try { this . bytes = this . string . getBytes ( encodingValue ) ; } catch ( UnsupportedEncodingException e ) { source . append ( ".encoding" ) ; throw new NlsIllegalArgumentException ( encodingValue , source . toString ( ) , e ) ; } } else if ( this . hex != null ) { this . bytes = parseBytes ( this . hex , "hex" ) ; } else { throw new XmlInvalidException ( new NlsParseException ( XML_TAG , XML_ATTRIBUTE_HEX + "|" + XML_ATTRIBUTE_STRING , source . toString ( ) ) ) ; } } } | This method initializes the internal byte array . | 184 | 9 |
140,721 | private void convertLink2Record ( final Object iKey ) { if ( status == MULTIVALUE_CONTENT_TYPE . ALL_RECORDS ) return ; final Object value ; if ( iKey instanceof ORID ) value = iKey ; else value = super . get ( iKey ) ; if ( value != null && value instanceof ORID ) { final ORID rid = ( ORID ) value ; marshalling = true ; try { try { // OVERWRITE IT super . put ( iKey , rid . getRecord ( ) ) ; } catch ( ORecordNotFoundException e ) { // IGNORE THIS } } finally { marshalling = false ; } } } | Convert the item with the received key to a record . | 146 | 12 |
140,722 | public synchronized ODatabaseComplex < ? > register ( final ODatabaseComplex < ? > db ) { instances . put ( db , Thread . currentThread ( ) ) ; return db ; } | Registers a database . | 40 | 5 |
140,723 | public synchronized void unregister ( final OStorage iStorage ) { for ( ODatabaseComplex < ? > db : new HashSet < ODatabaseComplex < ? > > ( instances . keySet ( ) ) ) { if ( db != null && db . getStorage ( ) == iStorage ) { db . close ( ) ; instances . remove ( db ) ; } } } | Unregisters all the database instances that share the storage received as argument . | 79 | 15 |
140,724 | public synchronized void shutdown ( ) { if ( instances . size ( ) > 0 ) { OLogManager . instance ( ) . debug ( null , "Found %d databases opened during OrientDB shutdown. Assure to always close database instances after usage" , instances . size ( ) ) ; for ( ODatabaseComplex < ? > db : new HashSet < ODatabaseComplex < ? > > ( instances . keySet ( ) ) ) { if ( db != null && ! db . isClosed ( ) ) { db . close ( ) ; } } } } | Closes all open databases . | 118 | 6 |
140,725 | public String digest2String ( final String iInput , final boolean iIncludeAlgorithm ) { final StringBuilder buffer = new StringBuilder ( ) ; if ( iIncludeAlgorithm ) buffer . append ( ALGORITHM_PREFIX ) ; buffer . append ( OSecurityManager . instance ( ) . digest2String ( iInput ) ) ; return buffer . toString ( ) ; } | Hashes the input string . | 84 | 6 |
140,726 | private static Thread [ ] getThreads ( ThreadGroup g ) { int mul = 1 ; do { Thread [ ] arr = new Thread [ g . activeCount ( ) * mul + 1 ] ; if ( g . enumerate ( arr ) < arr . length ) { return arr ; } mul ++ ; } while ( true ) ; } | Returns threads in an array . Some elements may be null . | 70 | 12 |
140,727 | public int getThreadCount ( ThreadGroup group , Status ... s ) { Thread [ ] threads = getThreads ( group ) ; int count = 0 ; for ( Thread t : threads ) { if ( t instanceof MonitoredThread ) { Status status = getStatus ( ( MonitoredThread ) t ) ; if ( status != null ) { for ( Status x : s ) { if ( x == status ) { count ++ ; } } } } } return count ; } | Return the count of threads that are in any of the statuses | 98 | 13 |
140,728 | public final Object assemble ( Serializable cached , Object owner ) throws HibernateException { if ( cached != null ) { log . trace ( "assemble " + cached + " (" + cached . getClass ( ) + "), owner is " + owner ) ; } return cached ; } | Returns the cached value . | 61 | 5 |
140,729 | public LobbyStatus createGroupFinderLobby ( int type , String uuid ) { return client . sendRpcAndWait ( SERVICE , "createGroupFinderLobby" , type , uuid ) ; } | Create a group finder lobby . Might be deprecated? | 45 | 11 |
140,730 | public Object call ( String uuid , GameMode mode , String procCall , JsonObject object ) { return client . sendRpcAndWait ( SERVICE , "call" , uuid , mode . name ( ) , procCall , object . toString ( ) ) ; } | Call a group finder action | 58 | 6 |
140,731 | @ SuppressWarnings ( "unchecked" ) public List < T > run ( final Object ... iArgs ) { final ODatabaseRecord database = ODatabaseRecordThreadLocal . INSTANCE . get ( ) ; if ( database == null ) throw new OQueryParsingException ( "No database configured" ) ; setParameters ( iArgs ) ; return ( List < T > ) database . getStorage ( ) . command ( this ) ; } | Delegates to the OQueryExecutor the query execution . | 94 | 12 |
140,732 | public AddressbookQuery limitNumberOfResults ( int limit ) { if ( limit > 0 ) { addLimit ( WebDavSearch . NRESULTS , limit ) ; } else { removeLimit ( WebDavSearch . NRESULTS ) ; } return this ; } | Limit the number of results in the response if supported by the server . A negative value will remove the limit . | 54 | 22 |
140,733 | public void close ( ) { for ( Entry < String , OResourcePool < String , DB > > pool : pools . entrySet ( ) ) { for ( DB db : pool . getValue ( ) . getResources ( ) ) { pool . getValue ( ) . close ( ) ; try { OLogManager . instance ( ) . debug ( this , "Closing pooled database '%s'..." , db . getName ( ) ) ; ( ( ODatabasePooled ) db ) . forceClose ( ) ; OLogManager . instance ( ) . debug ( this , "OK" , db . getName ( ) ) ; } catch ( Exception e ) { OLogManager . instance ( ) . debug ( this , "Error: %d" , e . toString ( ) ) ; } } } } | Closes all the databases . | 170 | 6 |
140,734 | public static boolean isMultiValue ( final Class < ? > iType ) { return ( iType . isArray ( ) || Collection . class . isAssignableFrom ( iType ) || Map . class . isAssignableFrom ( iType ) ) ; } | Checks if a class is a multi - value type . | 56 | 12 |
140,735 | public static int getSize ( final Object iObject ) { if ( iObject == null ) return 0 ; if ( ! isMultiValue ( iObject ) ) return 0 ; if ( iObject instanceof Collection < ? > ) return ( ( Collection < Object > ) iObject ) . size ( ) ; if ( iObject instanceof Map < ? , ? > ) return ( ( Map < ? , Object > ) iObject ) . size ( ) ; if ( iObject . getClass ( ) . isArray ( ) ) return Array . getLength ( iObject ) ; return 0 ; } | Returns the size of the multi - value object | 123 | 9 |
140,736 | public static boolean pauseCurrentThread ( long iTime ) { try { if ( iTime <= 0 ) iTime = Long . MAX_VALUE ; Thread . sleep ( iTime ) ; return true ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; return false ; } } | Pauses current thread until iTime timeout or a wake up by another thread . | 66 | 16 |
140,737 | public Stream < String > containing ( double lat , double lon ) { return shapes . keySet ( ) . stream ( ) // select if contains lat lon . filter ( name -> shapes . get ( name ) . contains ( lat , lon ) ) ; } | Returns the names of those shapes that contain the given lat lon . | 55 | 14 |
140,738 | public OQuery < T > setFetchPlan ( final String fetchPlan ) { OFetchHelper . checkFetchPlanValid ( fetchPlan ) ; if ( fetchPlan != null && fetchPlan . length ( ) == 0 ) this . fetchPlan = null ; else this . fetchPlan = fetchPlan ; return this ; } | Sets the fetch plan to use . | 67 | 8 |
140,739 | public static ITargetIdentifier field ( final String fieldName ) { return new ITargetIdentifier ( ) { public IDependencyInjector of ( final Object target ) { return new FieldInjector ( target , fieldName ) ; } } ; } | Returns a target identifier that uses an injector that injects directly to a member field regardless of the field s visibility . | 54 | 24 |
140,740 | public static ITargetInjector with ( final IInjectionStrategy strategy ) { return new ITargetInjector ( ) { public void bean ( Object target ) { strategy . inject ( target ) ; } } ; } | Returns an injector implementation which delegates actual injection to the given strategy when provided with a target to inject . | 47 | 21 |
140,741 | public OQueryContextNative key ( final Object iKey ) { if ( finalResult != null && finalResult . booleanValue ( ) ) return this ; if ( iKey == null ) // ERROR: BREAK CHAIN return error ( ) ; if ( currentValue != null && currentValue instanceof Map ) currentValue = ( ( Map < Object , Object > ) currentValue ) . get ( iKey ) ; return this ; } | Sets as current value the map s value by key . | 89 | 12 |
140,742 | public synchronized RESPONSE_TYPE getValue ( final RESOURCE_TYPE iResource , final long iTimeout ) { if ( OLogManager . instance ( ) . isDebugEnabled ( ) ) OLogManager . instance ( ) . debug ( this , "Thread [" + Thread . currentThread ( ) . getId ( ) + "] is waiting for the resource " + iResource + ( iTimeout <= 0 ? " forever" : " until " + iTimeout + "ms" ) ) ; synchronized ( iResource ) { try { iResource . wait ( iTimeout ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; throw new OLockException ( "Thread interrupted while waiting for resource '" + iResource + "'" ) ; } } Object [ ] value = queue . remove ( iResource ) ; return ( RESPONSE_TYPE ) ( value != null ? value [ 1 ] : null ) ; } | Wait until the requested resource is unlocked . Put the current thread in sleep until timeout or is waked up by an unlock . | 204 | 25 |
140,743 | public synchronized void setClassHandler ( final OEntityManagerClassHandler iClassHandler ) { for ( Entry < String , Class < ? > > entry : classHandler . getClassesEntrySet ( ) ) { iClassHandler . registerEntityClass ( entry . getValue ( ) ) ; } this . classHandler = iClassHandler ; } | Sets the received handler as default and merges the classes all together . | 70 | 15 |
140,744 | @ GET @ Path ( "create" ) public Response createFromRedirect ( ) { KeycloakPrincipal principal = ( KeycloakPrincipal ) sessionContext . getCallerPrincipal ( ) ; RefreshableKeycloakSecurityContext kcSecurityContext = ( RefreshableKeycloakSecurityContext ) principal . getKeycloakSecurityContext ( ) ; String refreshToken = kcSecurityContext . getRefreshToken ( ) ; Token token = create ( refreshToken ) ; try { String redirectTo = System . getProperty ( "secretstore.redirectTo" ) ; if ( null == redirectTo || redirectTo . isEmpty ( ) ) { return Response . ok ( "Redirect URL was not specified but token was created." ) . build ( ) ; } URI location ; if ( redirectTo . toLowerCase ( ) . startsWith ( "http" ) ) { location = new URI ( redirectTo ) ; } else { URI uri = uriInfo . getAbsolutePath ( ) ; String newPath = redirectTo . replace ( "{tokenId}" , token . getId ( ) . toString ( ) ) ; location = new URI ( uri . getScheme ( ) , uri . getUserInfo ( ) , uri . getHost ( ) , uri . getPort ( ) , newPath , uri . getQuery ( ) , uri . getFragment ( ) ) ; } return Response . seeOther ( location ) . build ( ) ; } catch ( URISyntaxException e ) { e . printStackTrace ( ) ; return Response . ok ( "Could not redirect back to the original URL, but token was created." ) . build ( ) ; } } | This endpoint is called when Keycloak redirects the logged in user to our application . | 360 | 18 |
140,745 | @ POST @ Path ( "create" ) @ Consumes ( MediaType . APPLICATION_FORM_URLENCODED ) public Response createFromBasicAuth ( ) throws Exception { return doCreateFromBasicAuth ( null ) ; } | This endpoint is called when a client makes a REST call with basic auth as APPLICATION_FORM_URLENCODED without parameters . | 48 | 27 |
140,746 | public OStorageConfiguration load ( ) throws OSerializationException { final byte [ ] record = storage . readRecord ( CONFIG_RID , null , false , null ) . buffer ; if ( record == null ) throw new OStorageException ( "Cannot load database's configuration. The database seems to be corrupted." ) ; fromStream ( record ) ; return this ; } | This method load the record information by the internal cluster segment . It s for compatibility with older database than 0 . 9 . 25 . | 77 | 26 |
140,747 | public static < T > Option < T > some ( T t ) { return new Option . Some < T > ( t ) ; } | Gets the some object wrapping the given value . | 28 | 10 |
140,748 | public static < T > Option < T > of ( T t ) { return t == null ? Option . < T > none ( ) : some ( t ) ; } | Wraps anything . | 35 | 4 |
140,749 | public PropertyRequest addProperty ( ElementDescriptor < ? > property ) { if ( mProp == null ) { mProp = new HashMap < ElementDescriptor < ? > , Object > ( 16 ) ; } mProp . put ( property , null ) ; return this ; } | Add another property to the list of requested properties . | 60 | 10 |
140,750 | public void setOption ( Option option ) { switch ( option ) { case ARRAY_ORDER_SIGNIFICANT : arrayComparator = new DefaultArrayNodeComparator ( ) ; break ; case ARRAY_ORDER_INSIGNIFICANT : arrayComparator = new SetArrayNodeComparator ( ) ; break ; case RETURN_PARENT_DIFFS : returnParentDiffs = true ; break ; case RETURN_LEAVES_ONLY : returnParentDiffs = false ; break ; } } | Sets an option | 109 | 4 |
140,751 | public List < JsonDelta > computeDiff ( String node1 , String node2 ) throws IOException { ObjectMapper mapper = new ObjectMapper ( ) ; return computeDiff ( mapper . readTree ( node1 ) , mapper . readTree ( node2 ) ) ; } | Computes the difference of two JSON strings and returns the differences | 61 | 12 |
140,752 | public List < JsonDelta > computeDiff ( JsonNode node1 , JsonNode node2 ) { List < JsonDelta > list = new ArrayList <> ( ) ; computeDiff ( list , new ArrayList < String > ( ) , node1 , node2 ) ; return list ; } | Computes the difference of two JSON nodes and returns the differences | 64 | 12 |
140,753 | public boolean computeDiff ( List < JsonDelta > delta , List < String > context , JsonNode node1 , JsonNode node2 ) { boolean ret = false ; if ( context . size ( ) == 0 || filter . includeField ( context ) ) { JsonComparator cmp = getComparator ( context , node1 , node2 ) ; if ( cmp != null ) { ret = cmp . compare ( delta , context , node1 , node2 ) ; } else { delta . add ( new JsonDelta ( toString ( context ) , node1 , node2 ) ) ; ret = true ; } } return ret ; } | Returns true if there is a difference | 138 | 7 |
140,754 | public JsonComparator getComparator ( List < String > context , JsonNode node1 , JsonNode node2 ) { if ( node1 == null ) { if ( node2 == null ) { return NODIFF_CMP ; } else { return null ; } } else if ( node2 == null ) { return null ; } else { if ( node1 instanceof NullNode ) { if ( node2 instanceof NullNode ) { return NODIFF_CMP ; } else { return null ; } } else if ( node2 instanceof NullNode ) { return null ; } // Nodes are not null, and they are not null node if ( node1 . isContainerNode ( ) && node2 . isContainerNode ( ) ) { if ( node1 instanceof ObjectNode ) { return objectComparator ; } else if ( node1 instanceof ArrayNode ) { return arrayComparator ; } } else if ( node1 . isValueNode ( ) && node2 . isValueNode ( ) ) { return valueComparator ; } } return null ; } | Returns the comparator for the give field and nodes . This method can be overriden to customize comparison logic . | 227 | 23 |
140,755 | public LobbyStatus createGroupFinderLobby ( long queueId , String uuid ) { return client . sendRpcAndWait ( SERVICE , "createGroupFinderLobby" , queueId , uuid ) ; } | Create a groupfinder lobby | 47 | 5 |
140,756 | boolean flush ( ) { if ( ! dirty ) return true ; acquireExclusiveLock ( ) ; try { final long timer = OProfiler . getInstance ( ) . startChrono ( ) ; // FORCE THE WRITE OF THE BUFFER for ( int i = 0 ; i < FORCE_RETRY ; ++ i ) { try { buffer . force ( ) ; dirty = false ; break ; } catch ( Exception e ) { OLogManager . instance ( ) . debug ( this , "Cannot write memory buffer to disk. Retrying (" + ( i + 1 ) + "/" + FORCE_RETRY + ")..." ) ; OMemoryWatchDog . freeMemory ( FORCE_DELAY ) ; } } if ( dirty ) OLogManager . instance ( ) . debug ( this , "Cannot commit memory buffer to disk after %d retries" , FORCE_RETRY ) ; else OProfiler . getInstance ( ) . updateCounter ( "system.file.mmap.pagesCommitted" , 1 ) ; OProfiler . getInstance ( ) . stopChrono ( "system.file.mmap.commitPages" , timer ) ; return ! dirty ; } finally { releaseExclusiveLock ( ) ; } } | Flushes the memory mapped buffer to disk only if it s dirty . | 267 | 14 |
140,757 | void close ( ) { acquireExclusiveLock ( ) ; try { if ( buffer != null ) { if ( dirty ) buffer . force ( ) ; if ( sunClass != null ) { // USE SUN JVM SPECIAL METHOD TO FREE RESOURCES try { final Method m = sunClass . getMethod ( "cleaner" ) ; final Object cleaner = m . invoke ( buffer ) ; cleaner . getClass ( ) . getMethod ( "clean" ) . invoke ( cleaner ) ; } catch ( Exception e ) { OLogManager . instance ( ) . error ( this , "Error on calling Sun's MMap buffer clean" , e ) ; } } buffer = null ; } counter = 0 ; file = null ; } finally { releaseExclusiveLock ( ) ; } } | Force closing of file if it s opened yet . | 163 | 10 |
140,758 | private Set < Comparable > prepareKeys ( OIndex < ? > index , Object keys ) { final Class < ? > targetType = index . getKeyTypes ( ) [ 0 ] . getDefaultJavaType ( ) ; return convertResult ( keys , targetType ) ; } | Make type conversion of keys for specific index . | 57 | 9 |
140,759 | public void validate ( ) throws OValidationException { if ( ODatabaseRecordThreadLocal . INSTANCE . isDefined ( ) && ! getDatabase ( ) . isValidationEnabled ( ) ) return ; checkForLoading ( ) ; checkForFields ( ) ; if ( _clazz != null ) { if ( _clazz . isStrictMode ( ) ) { // CHECK IF ALL FIELDS ARE DEFINED for ( String f : fieldNames ( ) ) { if ( _clazz . getProperty ( f ) == null ) throw new OValidationException ( "Found additional field '" + f + "'. It cannot be added because the schema class '" + _clazz . getName ( ) + "' is defined as STRICT" ) ; } } for ( OProperty p : _clazz . properties ( ) ) { validateField ( this , p ) ; } } } | Validates the record following the declared constraints defined in schema such as mandatory notNull min max regexp etc . If the schema is not defined for the current class or there are not constraints then the validation is ignored . | 191 | 43 |
140,760 | public < T > void set ( ElementDescriptor < T > property , T value ) { if ( mSet == null ) { mSet = new HashMap < ElementDescriptor < ? > , Object > ( 16 ) ; } mSet . put ( property , value ) ; if ( mRemove != null ) { mRemove . remove ( property ) ; } } | Add a new property with a specific value to the resource . | 78 | 12 |
140,761 | public < T > void remove ( ElementDescriptor < T > property ) { if ( mRemove == null ) { mRemove = new HashMap < ElementDescriptor < ? > , Object > ( 16 ) ; } mRemove . put ( property , null ) ; if ( mSet != null ) { mSet . remove ( property ) ; } } | Remove a property from the resource . | 75 | 7 |
140,762 | public < T > void clear ( ElementDescriptor < T > property ) { if ( mRemove != null ) { mRemove . remove ( property ) ; } if ( mSet != null ) { mSet . remove ( property ) ; } } | Clear the modification of given property i . e . neither change nor remove the property . | 52 | 17 |
140,763 | public void updateRecord ( final ORecordInternal < ? > fresh ) { if ( ! isEnabled ( ) || fresh == null || fresh . isDirty ( ) || fresh . getIdentity ( ) . isNew ( ) || ! fresh . getIdentity ( ) . isValid ( ) || fresh . getIdentity ( ) . getClusterId ( ) == excludedCluster ) return ; if ( fresh . isPinned ( ) == null || fresh . isPinned ( ) ) { underlying . lock ( fresh . getIdentity ( ) ) ; try { final ORecordInternal < ? > current = underlying . get ( fresh . getIdentity ( ) ) ; if ( current != null && current . getVersion ( ) >= fresh . getVersion ( ) ) return ; if ( ODatabaseRecordThreadLocal . INSTANCE . isDefined ( ) && ! ODatabaseRecordThreadLocal . INSTANCE . get ( ) . isClosed ( ) ) // CACHE A COPY underlying . put ( ( ORecordInternal < ? > ) fresh . flatCopy ( ) ) ; else { // CACHE THE DETACHED RECORD fresh . detach ( ) ; underlying . put ( fresh ) ; } } finally { underlying . unlock ( fresh . getIdentity ( ) ) ; } } else underlying . remove ( fresh . getIdentity ( ) ) ; } | Push record to cache . Identifier of record used as access key | 288 | 13 |
140,764 | public ColumnList addColumn ( byte [ ] family , byte [ ] qualifier , byte [ ] value ) { columns ( ) . add ( new Column ( family , qualifier , - 1 , value ) ) ; return this ; } | Add a standard HBase column | 46 | 6 |
140,765 | public ColumnList addCounter ( byte [ ] family , byte [ ] qualifier , long incr ) { counters ( ) . add ( new Counter ( family , qualifier , incr ) ) ; return this ; } | Add an HBase counter column . | 43 | 7 |
140,766 | public Future < Map < Long , List < LeagueList > > > getLeagues ( long ... summoners ) { return new ApiFuture <> ( ( ) -> handler . getLeagues ( summoners ) ) ; } | Get a listing of leagues for the specified summoners | 47 | 10 |
140,767 | public Future < Map < Long , List < LeagueItem > > > getLeagueEntries ( long ... summoners ) { return new ApiFuture <> ( ( ) -> handler . getLeagueEntries ( summoners ) ) ; } | Get a listing of all league entries in the summoners leagues | 49 | 12 |
140,768 | public Future < List < LeagueList > > getLeagues ( String teamId ) { return new ApiFuture <> ( ( ) -> handler . getLeagues ( teamId ) ) ; } | Get a listing of leagues for the specified team | 41 | 9 |
140,769 | public Future < Map < String , List < LeagueList > > > getLeagues ( String ... teamIds ) { return new ApiFuture <> ( ( ) -> handler . getLeagues ( teamIds ) ) ; } | Get a listing of leagues for the specified teams | 49 | 9 |
140,770 | public Future < List < LeagueItem > > getLeagueEntries ( String teamId ) { return new ApiFuture <> ( ( ) -> handler . getLeagueEntries ( teamId ) ) ; } | Get a listing of all league entries in the team s leagues | 43 | 12 |
140,771 | public Future < Map < String , List < LeagueItem > > > getLeagueEntries ( String ... teamIds ) { return new ApiFuture <> ( ( ) -> handler . getLeagueEntries ( teamIds ) ) ; } | Get a listing of all league entries in the teams leagues | 51 | 11 |
140,772 | public Future < MatchDetail > getMatch ( long matchId , boolean includeTimeline ) { return new ApiFuture <> ( ( ) -> handler . getMatch ( matchId , includeTimeline ) ) ; } | Retrieves the specified match . | 46 | 7 |
140,773 | public Future < List < MatchSummary > > getMatchHistory ( long playerId , String [ ] championIds , QueueType ... queueTypes ) { return new ApiFuture <> ( ( ) -> handler . getMatchHistory ( playerId , championIds , queueTypes ) ) ; } | Retrieve a player s match history filtering out all games not in the specified queues . | 62 | 17 |
140,774 | public Future < RankedStats > getRankedStats ( long summoner , Season season ) { return new ApiFuture <> ( ( ) -> handler . getRankedStats ( summoner , season ) ) ; } | Get ranked stats for a player in a specific season | 43 | 10 |
140,775 | public Future < List < PlayerStats > > getStatsSummary ( long summoner , Season season ) { return new ApiFuture <> ( ( ) -> handler . getStatsSummary ( summoner , season ) ) ; } | Get player stats for the player | 46 | 6 |
140,776 | public Future < Map < String , Summoner > > getSummoners ( String ... names ) { return new ApiFuture <> ( ( ) -> handler . getSummoners ( names ) ) ; } | Get summoner information for the summoners with the specified names | 43 | 12 |
140,777 | public Future < Map < Integer , Summoner > > getSummoners ( Integer ... ids ) { return new ApiFuture <> ( ( ) -> handler . getSummoners ( ids ) ) ; } | Get summoner information for the summoners with the specified ids | 45 | 13 |
140,778 | public Future < Map < Integer , Set < MasteryPage > > > getMasteryPagesMultipleUsers ( Integer ... ids ) { return new ApiFuture <> ( ( ) -> handler . getMasteryPagesMultipleUsers ( ids ) ) ; } | Retrieve mastery pages for multiple users | 53 | 7 |
140,779 | public Future < Map < Integer , String > > getSummonerNames ( Integer ... ids ) { return new ApiFuture <> ( ( ) -> handler . getSummonerNames ( ids ) ) ; } | Retrieve summoner names for the specified ids | 47 | 10 |
140,780 | public Future < Map < Integer , Set < RunePage > > > getRunePagesMultipleUsers ( int ... ids ) { return new ApiFuture <> ( ( ) -> handler . getRunePagesMultipleUsers ( ids ) ) ; } | Retrieve runes pages for multiple users | 53 | 7 |
140,781 | public Future < Map < Long , List < RankedTeam > > > getTeams ( long ... ids ) { return new ApiFuture <> ( ( ) -> handler . getTeamsBySummoners ( ids ) ) ; } | Retrieve the ranked teams of the specified users | 51 | 9 |
140,782 | public Future < Map < String , RankedTeam > > getTeams ( String ... teamIds ) { return new ApiFuture <> ( ( ) -> handler . getTeams ( teamIds ) ) ; } | Retrieve information for the specified ranked teams | 46 | 8 |
140,783 | public Future < List < Long > > getSummonerIds ( String ... names ) { return new ApiFuture <> ( ( ) -> handler . getSummonerIds ( names ) ) ; } | Retrieve summoner ids for the specified names | 45 | 10 |
140,784 | public static ThrottledApiHandler developmentDefault ( Shard shard , String token ) { return new ThrottledApiHandler ( shard , token , new Limit ( 10 , 10 , TimeUnit . SECONDS ) , new Limit ( 500 , 10 , TimeUnit . MINUTES ) ) ; } | Returns a throttled api handler with the current development request limits which is 10 requests per 10 seconds and 500 requests per 10 minutes | 65 | 25 |
140,785 | public void updateRecord ( final ORecordInternal < ? > record ) { if ( isEnabled ( ) && record . getIdentity ( ) . getClusterId ( ) != excludedCluster && record . getIdentity ( ) . isValid ( ) ) { underlying . lock ( record . getIdentity ( ) ) ; try { if ( underlying . get ( record . getIdentity ( ) ) != record ) underlying . put ( record ) ; } finally { underlying . unlock ( record . getIdentity ( ) ) ; } } secondary . updateRecord ( record ) ; } | Pushes record to cache . Identifier of record used as access key | 121 | 14 |
140,786 | public ORecordInternal < ? > findRecord ( final ORID rid ) { if ( ! isEnabled ( ) ) // DELEGATE TO THE 2nd LEVEL CACHE return null ; // secondary.retrieveRecord(rid); ORecordInternal < ? > record ; underlying . lock ( rid ) ; try { record = underlying . get ( rid ) ; if ( record == null ) { // DELEGATE TO THE 2nd LEVEL CACHE record = secondary . retrieveRecord ( rid ) ; if ( record != null ) // STORE IT LOCALLY underlying . put ( record ) ; } } finally { underlying . unlock ( rid ) ; } OProfiler . getInstance ( ) . updateCounter ( record != null ? CACHE_HIT : CACHE_MISS , 1L ) ; return record ; } | Looks up for record in cache by it s identifier . Optionally look up in secondary cache and update primary with found record | 175 | 24 |
140,787 | @ SuppressWarnings ( "rawtypes" ) public Object execute ( final Map < Object , Object > iArgs ) { if ( indexName == null ) throw new OCommandExecutionException ( "Cannot execute the command because it has not been parsed yet" ) ; final ODatabaseRecord database = getDatabase ( ) ; final OIndex < ? > idx ; if ( fields == null || fields . length == 0 ) { if ( keyTypes != null ) idx = database . getMetadata ( ) . getIndexManager ( ) . createIndex ( indexName , indexType . toString ( ) , new OSimpleKeyIndexDefinition ( keyTypes ) , null , null ) ; else if ( serializerKeyId != 0 ) { idx = database . getMetadata ( ) . getIndexManager ( ) . createIndex ( indexName , indexType . toString ( ) , new ORuntimeKeyIndexDefinition ( serializerKeyId ) , null , null ) ; } else idx = database . getMetadata ( ) . getIndexManager ( ) . createIndex ( indexName , indexType . toString ( ) , null , null , null ) ; } else { if ( keyTypes == null || keyTypes . length == 0 ) { idx = oClass . createIndex ( indexName , indexType , fields ) ; } else { final OIndexDefinition idxDef = OIndexDefinitionFactory . createIndexDefinition ( oClass , Arrays . asList ( fields ) , Arrays . asList ( keyTypes ) ) ; idx = database . getMetadata ( ) . getIndexManager ( ) . createIndex ( indexName , indexType . name ( ) , idxDef , oClass . getPolymorphicClusterIds ( ) , null ) ; } } if ( idx != null ) return idx . getSize ( ) ; return null ; } | Execute the CREATE INDEX . | 399 | 8 |
140,788 | public Team createTeam ( String name , String tag ) { return client . sendRpcAndWait ( SERVICE , "createTeam" , name , tag ) ; } | Create a new ranked team with the specified name and tag | 34 | 11 |
140,789 | public Team invitePlayer ( long summonerId , TeamId teamId ) { return client . sendRpcAndWait ( SERVICE , "invitePlayer" , summonerId , teamId ) ; } | Invite a player to the target team | 42 | 8 |
140,790 | public Team kickPlayer ( long summonerId , TeamId teamId ) { return client . sendRpcAndWait ( SERVICE , "kickPlayer" , summonerId , teamId ) ; } | Kick a player from the target team | 41 | 7 |
140,791 | static AnalysisResult analyse ( Class < ? > klass , Constructor < ? > constructor ) throws IOException { Class < ? > [ ] parameterTypes = constructor . getParameterTypes ( ) ; InputStream in = klass . getResourceAsStream ( "/" + klass . getName ( ) . replace ( ' ' , ' ' ) + ".class" ) ; if ( in == null ) { throw new IllegalArgumentException ( format ( "can not find bytecode for %s" , klass ) ) ; } return analyse ( in , klass . getName ( ) . replace ( ' ' , ' ' ) , klass . getSuperclass ( ) . getName ( ) . replace ( ' ' , ' ' ) , parameterTypes ) ; } | Produces an assignment or field names to values or fails . | 160 | 12 |
140,792 | @ Override public String marshal ( ZonedDateTime zonedDateTime ) { if ( null == zonedDateTime ) { return null ; } return zonedDateTime . withZoneSameInstant ( ZoneOffset . UTC ) . format ( formatter ) ; } | When marshalling the provided zonedDateTime is normalized to UTC so that the output is consistent between dates and time zones . | 56 | 25 |
140,793 | public static boolean isValid ( String sentence ) { // Compare the characters after the asterisk to the calculation try { return sentence . substring ( sentence . lastIndexOf ( "*" ) + 1 ) . equalsIgnoreCase ( getChecksum ( sentence ) ) ; } catch ( AisParseException e ) { return false ; } } | Returns true if and only if the sentence s checksum matches the calculated checksum . | 73 | 17 |
140,794 | private static Properties getEnvironmentFile ( File configFile ) { Properties mergedProperties = new Properties ( ) ; InputStream inputStream ; try { inputStream = new FileInputStream ( configFile ) ; } catch ( FileNotFoundException e ) { // File does not exist. That's all right. return mergedProperties ; } try { mergedProperties . load ( inputStream ) ; inputStream . close ( ) ; return mergedProperties ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } | Leser properties fra classpath og vil overlaste i reverse order slik at classpath reverse order styrer hvilke props som gjelder . | 110 | 32 |
140,795 | private static OIndexSearchResult createIndexedProperty ( final OSQLFilterCondition iCondition , final Object iItem ) { if ( iItem == null || ! ( iItem instanceof OSQLFilterItemField ) ) return null ; if ( iCondition . getLeft ( ) instanceof OSQLFilterItemField && iCondition . getRight ( ) instanceof OSQLFilterItemField ) return null ; final OSQLFilterItemField item = ( OSQLFilterItemField ) iItem ; if ( item . hasChainOperators ( ) && ! item . isFieldChain ( ) ) return null ; final Object origValue = iCondition . getLeft ( ) == iItem ? iCondition . getRight ( ) : iCondition . getLeft ( ) ; if ( iCondition . getOperator ( ) instanceof OQueryOperatorBetween || iCondition . getOperator ( ) instanceof OQueryOperatorIn ) { return new OIndexSearchResult ( iCondition . getOperator ( ) , item . getFieldChain ( ) , origValue ) ; } final Object value = OSQLHelper . getValue ( origValue ) ; if ( value == null ) return null ; return new OIndexSearchResult ( iCondition . getOperator ( ) , item . getFieldChain ( ) , value ) ; } | Add SQL filter field to the search candidate list . | 272 | 10 |
140,796 | void addResult ( String valueData , String detailData ) { if ( value ) { if ( valueData == null ) throw new IllegalArgumentException ( CLASS + ": valueData may not be null" ) ; values . add ( valueData ) ; if ( detail ) { if ( detailData == null ) throw new IllegalArgumentException ( CLASS + ": detailData may not be null" ) ; details . add ( detailData ) ; } } counter ++ ; } | Store the data for a match found | 99 | 7 |
140,797 | public String marshal ( Object jaxbObject ) { // Precondition, check that the jaxbContext is set! if ( jaxbContext == null ) { logger . error ( "Trying to marshal with a null jaxbContext, returns null. Check your configuration, e.g. jaxb-transformers!" ) ; return null ; } try { StringWriter writer = new StringWriter ( ) ; Marshaller marshaller = jaxbContext . createMarshaller ( ) ; if ( marshallProps != null ) { for ( Entry < String , Object > entry : marshallProps . entrySet ( ) ) { marshaller . setProperty ( entry . getKey ( ) , entry . getValue ( ) ) ; } } marshaller . marshal ( jaxbObject , writer ) ; String xml = writer . toString ( ) ; if ( logger . isDebugEnabled ( ) ) logger . debug ( "marshalled jaxb object of type {}, returns xml: {}" , jaxbObject . getClass ( ) . getSimpleName ( ) , xml ) ; return xml ; } catch ( JAXBException e ) { throw new RuntimeException ( e ) ; } } | Marshal a JAXB object to a XML - string | 262 | 12 |
140,798 | @ VisibleForTesting static boolean isPghp ( String line ) { if ( line == null ) return false ; else // return Pattern.matches("^(\\\\.*\\\\)?\\$PGHP.*$", line); return pghpPattern . matcher ( line ) . matches ( ) ; } | Returns true if and only if the given NMEA line is a PGHP line . Remember that the line can start with a tag block . | 65 | 29 |
140,799 | public static boolean isExactEarthTimestamp ( String line ) { try { new NmeaMessageExactEarthTimestamp ( line ) ; return true ; } catch ( AisParseException e ) { return false ; } catch ( NmeaMessageParseException e ) { return false ; } } | Returns true if the given line is a custom ExactEarth timestamp . | 65 | 14 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.