idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
17,300
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
17,301
private IntVar getVMtoLeafNode ( ) { for ( int x = 0 ; x < outs . length ; x ++ ) { if ( outs [ x ] . cardinality ( ) == 0 ) { 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 .
17,302
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 .
17,303
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 { super . put ( iKey , rid . getRecord ( ) ) ; } catch ( ORecordNotFoundException e ) { } } finally { marshalling = false ; } } }
Convert the item with the received key to a record .
17,304
public synchronized ODatabaseComplex < ? > register ( final ODatabaseComplex < ? > db ) { instances . put ( db , Thread . currentThread ( ) ) ; return db ; }
Registers a database .
17,305
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 .
17,306
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 .
17,307
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 .
17,308
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 .
17,309
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
17,310
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 .
17,311
public LobbyStatus createGroupFinderLobby ( int type , String uuid ) { return client . sendRpcAndWait ( SERVICE , "createGroupFinderLobby" , type , uuid ) ; }
Create a group finder lobby . Might be deprecated?
17,312
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
17,313
@ 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 .
17,314
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 .
17,315
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 .
17,316
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 .
17,317
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
17,318
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 .
17,319
public Stream < String > containing ( double lat , double lon ) { return shapes . keySet ( ) . stream ( ) . filter ( name -> shapes . get ( name ) . contains ( lat , lon ) ) ; }
Returns the names of those shapes that contain the given lat lon .
17,320
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 .
17,321
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 .
17,322
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 .
17,323
public OQueryContextNative key ( final Object iKey ) { if ( finalResult != null && finalResult . booleanValue ( ) ) return this ; if ( iKey == null ) 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 .
17,324
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 .
17,325
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 .
17,326
@ 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 .
17,327
@ 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 .
17,328
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 .
17,329
public static < T > Option < T > some ( T t ) { return new Option . Some < T > ( t ) ; }
Gets the some object wrapping the given value .
17,330
public static < T > Option < T > of ( T t ) { return t == null ? Option . < T > none ( ) : some ( t ) ; }
Wraps anything .
17,331
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 .
17,332
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
17,333
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
17,334
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
17,335
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
17,336
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 ; } 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 .
17,337
public LobbyStatus createGroupFinderLobby ( long queueId , String uuid ) { return client . sendRpcAndWait ( SERVICE , "createGroupFinderLobby" , queueId , uuid ) ; }
Create a groupfinder lobby
17,338
boolean flush ( ) { if ( ! dirty ) return true ; acquireExclusiveLock ( ) ; try { final long timer = OProfiler . getInstance ( ) . startChrono ( ) ; 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 .
17,339
void close ( ) { acquireExclusiveLock ( ) ; try { if ( buffer != null ) { if ( dirty ) buffer . force ( ) ; if ( sunClass != null ) { 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 .
17,340
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 .
17,341
public void validate ( ) throws OValidationException { if ( ODatabaseRecordThreadLocal . INSTANCE . isDefined ( ) && ! getDatabase ( ) . isValidationEnabled ( ) ) return ; checkForLoading ( ) ; checkForFields ( ) ; if ( _clazz != null ) { if ( _clazz . isStrictMode ( ) ) { 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 .
17,342
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 .
17,343
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 .
17,344
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 .
17,345
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 ( ) ) underlying . put ( ( ORecordInternal < ? > ) fresh . flatCopy ( ) ) ; else { 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
17,346
public ColumnList addColumn ( byte [ ] family , byte [ ] qualifier , byte [ ] value ) { columns ( ) . add ( new Column ( family , qualifier , - 1 , value ) ) ; return this ; }
Add a standard HBase column
17,347
public ColumnList addCounter ( byte [ ] family , byte [ ] qualifier , long incr ) { counters ( ) . add ( new Counter ( family , qualifier , incr ) ) ; return this ; }
Add an HBase counter column .
17,348
public Future < Map < Long , List < LeagueList > > > getLeagues ( long ... summoners ) { return new ApiFuture < > ( ( ) -> handler . getLeagues ( summoners ) ) ; }
Get a listing of leagues for the specified summoners
17,349
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
17,350
public Future < List < LeagueList > > getLeagues ( String teamId ) { return new ApiFuture < > ( ( ) -> handler . getLeagues ( teamId ) ) ; }
Get a listing of leagues for the specified team
17,351
public Future < Map < String , List < LeagueList > > > getLeagues ( String ... teamIds ) { return new ApiFuture < > ( ( ) -> handler . getLeagues ( teamIds ) ) ; }
Get a listing of leagues for the specified teams
17,352
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
17,353
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
17,354
public Future < MatchDetail > getMatch ( long matchId , boolean includeTimeline ) { return new ApiFuture < > ( ( ) -> handler . getMatch ( matchId , includeTimeline ) ) ; }
Retrieves the specified match .
17,355
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 .
17,356
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
17,357
public Future < List < PlayerStats > > getStatsSummary ( long summoner , Season season ) { return new ApiFuture < > ( ( ) -> handler . getStatsSummary ( summoner , season ) ) ; }
Get player stats for the player
17,358
public Future < Map < String , Summoner > > getSummoners ( String ... names ) { return new ApiFuture < > ( ( ) -> handler . getSummoners ( names ) ) ; }
Get summoner information for the summoners with the specified names
17,359
public Future < Map < Integer , Summoner > > getSummoners ( Integer ... ids ) { return new ApiFuture < > ( ( ) -> handler . getSummoners ( ids ) ) ; }
Get summoner information for the summoners with the specified ids
17,360
public Future < Map < Integer , Set < MasteryPage > > > getMasteryPagesMultipleUsers ( Integer ... ids ) { return new ApiFuture < > ( ( ) -> handler . getMasteryPagesMultipleUsers ( ids ) ) ; }
Retrieve mastery pages for multiple users
17,361
public Future < Map < Integer , String > > getSummonerNames ( Integer ... ids ) { return new ApiFuture < > ( ( ) -> handler . getSummonerNames ( ids ) ) ; }
Retrieve summoner names for the specified ids
17,362
public Future < Map < Integer , Set < RunePage > > > getRunePagesMultipleUsers ( int ... ids ) { return new ApiFuture < > ( ( ) -> handler . getRunePagesMultipleUsers ( ids ) ) ; }
Retrieve runes pages for multiple users
17,363
public Future < Map < Long , List < RankedTeam > > > getTeams ( long ... ids ) { return new ApiFuture < > ( ( ) -> handler . getTeamsBySummoners ( ids ) ) ; }
Retrieve the ranked teams of the specified users
17,364
public Future < Map < String , RankedTeam > > getTeams ( String ... teamIds ) { return new ApiFuture < > ( ( ) -> handler . getTeams ( teamIds ) ) ; }
Retrieve information for the specified ranked teams
17,365
public Future < List < Long > > getSummonerIds ( String ... names ) { return new ApiFuture < > ( ( ) -> handler . getSummonerIds ( names ) ) ; }
Retrieve summoner ids for the specified names
17,366
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
17,367
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
17,368
public ORecordInternal < ? > findRecord ( final ORID rid ) { if ( ! isEnabled ( ) ) return null ; ORecordInternal < ? > record ; underlying . lock ( rid ) ; try { record = underlying . get ( rid ) ; if ( record == null ) { record = secondary . retrieveRecord ( rid ) ; if ( record != null ) 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
17,369
@ 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 .
17,370
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
17,371
public Team invitePlayer ( long summonerId , TeamId teamId ) { return client . sendRpcAndWait ( SERVICE , "invitePlayer" , summonerId , teamId ) ; }
Invite a player to the target team
17,372
public Team kickPlayer ( long summonerId , TeamId teamId ) { return client . sendRpcAndWait ( SERVICE , "kickPlayer" , summonerId , teamId ) ; }
Kick a player from the target team
17,373
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 .
17,374
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 .
17,375
public static boolean isValid ( String sentence ) { 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 .
17,376
private static Properties getEnvironmentFile ( File configFile ) { Properties mergedProperties = new Properties ( ) ; InputStream inputStream ; try { inputStream = new FileInputStream ( configFile ) ; } catch ( FileNotFoundException e ) { 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 .
17,377
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 .
17,378
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
17,379
public String marshal ( Object jaxbObject ) { 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
17,380
static boolean isPghp ( String line ) { if ( line == null ) return false ; else 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 .
17,381
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 .
17,382
private static long getTime ( int year , int month , int day , int hour , int minute , int second , int millisecond ) { Calendar cal = Calendar . getInstance ( Util . TIME_ZONE_UTC ) ; cal . set ( year , month - 1 , day , hour , minute , second ) ; cal . set ( Calendar . MILLISECOND , millisecond ) ; return cal . getTimeInMillis ( ) ; }
Returns the epoch time in ms .
17,383
private String getFolderAndCreateIfMissing ( String inFolder ) { String folder = outputFolder ; if ( inFolder != null ) { folder += "/" + inFolder ; } mkdirs ( folder ) ; return folder ; }
Computes foldername and creates the folders that does not already exist
17,384
public static EventBus get ( ) { if ( EventBus . instance == null ) { EventBus . instance = new EventBus ( ) ; } return EventBus . instance ; }
Get the singleton .
17,385
public ORecordIteratorClusters < REC > last ( ) { currentClusterIdx = clusterIds . length - 1 ; current . clusterPosition = liveUpdated ? database . countClusterElements ( clusterIds [ currentClusterIdx ] ) : lastClusterPosition + 1 ; return this ; }
Move the iterator to the end of the range . If no range was specified move to the last record of the cluster .
17,386
private static OIdentifiable linkToStream ( final StringBuilder buffer , final ORecordSchemaAware < ? > iParentRecord , Object iLinked ) { if ( iLinked == null ) return null ; OIdentifiable resultRid = null ; ORID rid ; final ODatabaseRecord database = ODatabaseRecordThreadLocal . INSTANCE . get ( ) ; if ( iLinked instanceof ORID ) { rid = ( ORID ) iLinked ; if ( rid . isValid ( ) && rid . isNew ( ) ) { final ORecord < ? > record = rid . getRecord ( ) ; if ( database . getTransaction ( ) . isActive ( ) ) { database . save ( ( ORecordInternal < ? > ) record ) ; } else database . save ( ( ORecordInternal < ? > ) record ) ; if ( record != null ) rid = record . getIdentity ( ) ; resultRid = rid ; } } else { if ( iLinked instanceof String ) iLinked = new ORecordId ( ( String ) iLinked ) ; else if ( ! ( iLinked instanceof ORecordInternal < ? > ) ) { final String boundDocumentField = OObjectSerializerHelperManager . getInstance ( ) . getDocumentBoundField ( iLinked . getClass ( ) ) ; if ( boundDocumentField != null ) iLinked = OObjectSerializerHelperManager . getInstance ( ) . getFieldValue ( iLinked , boundDocumentField ) ; } if ( ! ( iLinked instanceof OIdentifiable ) ) throw new IllegalArgumentException ( "Invalid object received. Expected a OIdentifiable but received type=" + iLinked . getClass ( ) . getName ( ) + " and value=" + iLinked ) ; ORecordInternal < ? > iLinkedRecord = ( ( OIdentifiable ) iLinked ) . getRecord ( ) ; rid = iLinkedRecord . getIdentity ( ) ; if ( rid . isNew ( ) || iLinkedRecord . isDirty ( ) ) { if ( iLinkedRecord instanceof ODocument ) { final OClass schemaClass = ( ( ODocument ) iLinkedRecord ) . getSchemaClass ( ) ; database . save ( iLinkedRecord , schemaClass != null ? database . getClusterNameById ( schemaClass . getDefaultClusterId ( ) ) : null ) ; } else database . save ( iLinkedRecord ) ; final ODatabaseComplex < ? > dbOwner = database . getDatabaseOwner ( ) ; dbOwner . registerUserObjectAfterLinkSave ( iLinkedRecord ) ; resultRid = iLinkedRecord ; } if ( iParentRecord != null && database instanceof ODatabaseRecord ) { final ODatabaseRecord db = database ; if ( ! db . isRetainRecords ( ) ) resultRid = iLinkedRecord . getIdentity ( ) ; } } if ( rid . isValid ( ) ) rid . toString ( buffer ) ; return resultRid ; }
Serialize the link .
17,387
public ODocument toStream ( ) { acquireExclusiveLock ( ) ; try { document . setInternalStatus ( ORecordElement . STATUS . UNMARSHALLING ) ; try { final ORecordTrackedSet idxs = new ORecordTrackedSet ( document ) ; for ( final OIndexInternal < ? > i : indexes . values ( ) ) { idxs . add ( i . updateConfiguration ( ) ) ; } document . field ( CONFIG_INDEXES , idxs , OType . EMBEDDEDSET ) ; } finally { document . setInternalStatus ( ORecordElement . STATUS . LOADED ) ; } document . setDirty ( ) ; return document ; } finally { releaseExclusiveLock ( ) ; } }
Binds POJO to ODocument .
17,388
private void releaseCallbacks ( Exception ex ) { synchronized ( callbacks ) { for ( Map . Entry < Integer , InvokeCallback > cb : callbacks . entrySet ( ) ) { cb . getValue ( ) . release ( ex ) ; } } }
Release waiting threads if we fail for some reason
17,389
synchronized void line ( String line , long arrivalTime ) { if ( count . incrementAndGet ( ) % logCountFrequency == 0 ) log . info ( "count=" + count . get ( ) + ",buffer size=" + lines . size ( ) ) ; NmeaMessage nmea ; try { nmea = NmeaUtil . parseNmea ( line ) ; } catch ( NmeaMessageParseException e ) { listener . invalidNmea ( line , arrivalTime , e . getMessage ( ) ) ; return ; } if ( ! nmea . isSingleSentence ( ) ) { Optional < List < NmeaMessage > > messages = nmeaBuffer . add ( nmea ) ; if ( messages . isPresent ( ) ) { Optional < NmeaMessage > joined = AisNmeaBuffer . concatenateMessages ( messages . get ( ) ) ; if ( joined . isPresent ( ) ) { if ( joined . get ( ) . getUnixTimeMillis ( ) != null ) listener . message ( joined . get ( ) . toLine ( ) , joined . get ( ) . getUnixTimeMillis ( ) ) ; else listener . message ( joined . get ( ) . toLine ( ) , arrivalTime ) ; } } return ; } if ( nmea . getUnixTimeMillis ( ) != null ) { listener . message ( line , nmea . getUnixTimeMillis ( ) ) ; return ; } if ( ! matchWithTimestampLine ) { listener . message ( line , arrivalTime ) ; return ; } if ( ! NmeaUtil . isValid ( line ) ) return ; addLine ( line , arrivalTime ) ; log . debug ( "buffer lines=" + lines . size ( ) ) ; Integer earliestTimestampLineIndex = getEarliestTimestampLineIndex ( lines ) ; Set < Integer > removeThese ; if ( earliestTimestampLineIndex != null ) { removeThese = matchWithClosestAisMessageIfBufferLargeEnough ( arrivalTime , earliestTimestampLineIndex ) ; } else removeThese = findExpiredIndexesBeforeIndex ( lastIndex ( ) ) ; TreeSet < Integer > orderedIndexes = Sets . newTreeSet ( removeThese ) ; for ( int index : orderedIndexes . descendingSet ( ) ) { removeLineWithIndex ( index ) ; } }
Handles the arrival of a new NMEA line at the given arrival time .
17,390
private Set < Integer > findExpiredIndexesBeforeIndex ( int index ) { long indexTime = getLineTime ( index ) ; Set < Integer > removeThese = Sets . newHashSet ( ) ; for ( int i = index - 1 ; i >= 0 ; i -- ) { if ( indexTime - getLineTime ( i ) > MAXIMUM_ARRIVAL_TIME_DIFFERENCE_MS ) { listener . timestampNotFound ( getLine ( i ) , getLineTime ( i ) ) ; removeThese . add ( i ) ; } } return removeThese ; }
Returns the list of those indexes that can be removed from the buffer because they have a timestamp more than MAXIMUM_ARRIVAL_TIME_DIFFERENCE_MS from the arrival time of the given index .
17,391
private Set < Integer > matchWithClosestAisMessageIfBufferLargeEnough ( long arrivalTime , Integer earliestTimestampLineIndex ) { String timestampLine = getLine ( earliestTimestampLineIndex ) ; long time = getLineTime ( earliestTimestampLineIndex ) ; log . debug ( "ts=" + timestampLine + ",time=" + time ) ; Set < Integer > removeThese ; if ( arrivalTime - time > MAXIMUM_ARRIVAL_TIME_DIFFERENCE_MS ) { removeThese = matchWithClosestAisMessageAndFindIndexesToRemove ( earliestTimestampLineIndex , timestampLine , time ) ; } else removeThese = findExpiredIndexesBeforeIndex ( earliestTimestampLineIndex ) ; return removeThese ; }
Finds matches and reports them to the listeners if buffer has a sufficent span of time in it . Returns the indexes that should be removed from the buffer .
17,392
private Set < Integer > reportMatchAndFindIndexesToRemove ( Integer earliestTimestampLineIndex , NmeaMessageExactEarthTimestamp timestamp , Integer lowestTimeDiffIndex ) { String msg = getLine ( lowestTimeDiffIndex ) ; log . debug ( "found matching msg=" + msg ) ; listener . message ( msg , timestamp . getTime ( ) ) ; int maxIndex = Math . max ( lowestTimeDiffIndex , earliestTimestampLineIndex ) ; int minIndex = Math . min ( lowestTimeDiffIndex , earliestTimestampLineIndex ) ; return Sets . newHashSet ( minIndex , maxIndex ) ; }
Reports a found match and returns the indexes that can be removed from the buffer .
17,393
public static MimeMessage createMimeMessage ( Session session , String from , String [ ] to , String subject , String content , DataSource [ ] attachments ) { logger . debug ( "Creates a mime message with {} attachments" , ( attachments == null ) ? 0 : attachments . length ) ; try { MimeMessage message = new MimeMessage ( session ) ; if ( from != null ) { message . setSender ( new InternetAddress ( from ) ) ; } if ( subject != null ) { message . setSubject ( subject , "UTF-8" ) ; } if ( to != null ) { for ( String toAdr : to ) { message . addRecipient ( Message . RecipientType . TO , new InternetAddress ( toAdr ) ) ; } } if ( attachments == null || attachments . length == 0 ) { message . setContent ( content , "text/plain; charset=UTF-8" ) ; } else { Multipart multipart = new MimeMultipart ( ) ; message . setContent ( multipart ) ; BodyPart messageBodyPart = new MimeBodyPart ( ) ; messageBodyPart . setContent ( content , "text/plain; charset=UTF-8" ) ; multipart . addBodyPart ( messageBodyPart ) ; if ( attachments != null ) { for ( DataSource attachment : attachments ) { BodyPart attatchmentBodyPart = new MimeBodyPart ( ) ; attatchmentBodyPart . setDataHandler ( new DataHandler ( attachment ) ) ; attatchmentBodyPart . setFileName ( attachment . getName ( ) ) ; multipart . addBodyPart ( attatchmentBodyPart ) ; } } } return message ; } catch ( AddressException e ) { throw new RuntimeException ( e ) ; } catch ( MessagingException e ) { throw new RuntimeException ( e ) ; } }
Creates a mime - message multipart if attachements are supplied otherwise as plain text . Assumes UTF - 8 encoding for both subject and content .
17,394
public static void disableTlsServerCertificateCheck ( Client client ) { if ( ! ( client . getConduit ( ) instanceof HTTPConduit ) ) { log . warn ( "Conduit not of type HTTPConduit (" + client . getConduit ( ) . getClass ( ) . getName ( ) + ") , skip disabling server certification validation." ) ; return ; } log . warn ( "Disables server certification validation for: " + client . getEndpoint ( ) . getEndpointInfo ( ) . getAddress ( ) ) ; HTTPConduit httpConduit = ( HTTPConduit ) client . getConduit ( ) ; TLSClientParameters tlsParams = new TLSClientParameters ( ) ; TrustManager [ ] trustAllCerts = new TrustManager [ ] { new FakeTrustManager ( ) } ; tlsParams . setTrustManagers ( trustAllCerts ) ; tlsParams . setDisableCNCheck ( true ) ; httpConduit . setTlsClientParameters ( tlsParams ) ; }
Disables validation of https server certificates only to be used during development and tests!!!
17,395
public boolean isRuleDefined ( final String iResource ) { for ( ORole r : roles ) if ( r . hasRule ( iResource ) ) return true ; return false ; }
Checks if a rule was defined for the user .
17,396
public Object execute ( final Map < Object , Object > iArgs ) { if ( attribute == null ) throw new OCommandExecutionException ( "Cannot execute the command because it has not yet been parsed" ) ; final OClassImpl sourceClass = ( OClassImpl ) getDatabase ( ) . getMetadata ( ) . getSchema ( ) . getClass ( className ) ; if ( sourceClass == null ) throw new OCommandExecutionException ( "Source class '" + className + "' not found" ) ; final OPropertyImpl prop = ( OPropertyImpl ) sourceClass . getProperty ( fieldName ) ; if ( prop == null ) throw new OCommandExecutionException ( "Property '" + className + "." + fieldName + "' not exists" ) ; prop . setInternalAndSave ( attribute , value ) ; return null ; }
Execute the ALTER PROPERTY .
17,397
public void flush ( ) { lock . writeLock ( ) . lock ( ) ; try { OMMapBufferEntry entry ; for ( Iterator < OMMapBufferEntry > it = bufferPoolLRU . iterator ( ) ; it . hasNext ( ) ; ) { entry = it . next ( ) ; if ( entry . file != null && entry . file . isClosed ( ) ) { if ( removeEntry ( entry ) ) it . remove ( ) ; } } } finally { lock . writeLock ( ) . unlock ( ) ; } }
Flushes away all the buffers of closed files . This frees the memory .
17,398
public void flushFile ( final OFileMMap iFile ) { lock . readLock ( ) . lock ( ) ; try { final List < OMMapBufferEntry > entries = bufferPoolPerFile . get ( iFile ) ; if ( entries != null ) for ( OMMapBufferEntry entry : entries ) entry . flush ( ) ; } finally { lock . readLock ( ) . unlock ( ) ; } }
Flushes all the buffers of the passed file .
17,399
private static int searchEntry ( final List < OMMapBufferEntry > fileEntries , final long iBeginOffset , final int iSize ) { if ( fileEntries == null || fileEntries . size ( ) == 0 ) return - 1 ; int high = fileEntries . size ( ) - 1 ; if ( high < 0 ) return - 1 ; int low = 0 ; int mid = - 1 ; OMMapBufferEntry e ; while ( low <= high ) { mid = ( low + high ) >>> 1 ; e = fileEntries . get ( mid ) ; if ( iBeginOffset >= e . beginOffset && iBeginOffset + iSize <= e . beginOffset + e . size ) { OProfiler . getInstance ( ) . updateCounter ( "OMMapManager.reusedPage" , 1 ) ; e . counter ++ ; return mid ; } if ( low == high ) { if ( iBeginOffset > e . beginOffset ) low ++ ; return ( low + 2 ) * - 1 ; } if ( iBeginOffset >= e . beginOffset ) low = mid + 1 ; else high = mid ; } return mid ; }
Search for a buffer in the ordered list .