idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
138,500
public MethodHandle branch ( MethodHandle test , MethodHandle truePath , MethodHandle falsePath ) { return invoke ( MethodHandles . guardWithTest ( test , truePath , falsePath ) ) ; }
Apply the chain of transforms and bind them to a boolean branch as from java . lang . invoke . MethodHandles . guardWithTest . As with GWT the current endpoint signature must match the given target and fallback signatures .
138,501
public String toJava ( MethodType incoming ) { StringBuilder builder = new StringBuilder ( ) ; boolean second = false ; for ( Transform transform : transforms ) { if ( second ) builder . append ( '\n' ) ; second = true ; builder . append ( transform . toJava ( incoming ) ) ; } return builder . toString ( ) ; }
Produce Java code that would perform equivalent operations to this binder .
138,502
public HttpResponse execute ( ) throws IOException { if ( this . method == HttpMethod . GET ) { String url = this . toString ( ) ; if ( url . length ( ) > this . cutoff ) { if ( log . isLoggable ( Level . FINER ) ) log . finer ( "URL length " + url . length ( ) + " too long, converting GET to POST: " + url ) ; String r...
Replace excessively - long GET requests with a POST .
138,503
private < T > GraphRequest < T > graph ( String object , JavaType type , Param ... params ) { this . checkForBatchExecution ( ) ; GraphRequest < T > req = new GraphRequest < T > ( object , params , this . mapper , this . < T > createMappingChain ( type ) ) ; this . graphRequests . add ( req ) ; return req ; }
The actual implementation of this after we ve converted to proper Jackson JavaType
138,504
private < T > QueryRequest < T > query ( String fql , JavaType type ) { this . checkForBatchExecution ( ) ; if ( this . multiqueryRequest == null ) { this . multiqueryRequest = new MultiqueryRequest ( mapper , this . createUnmappedChain ( ) ) ; this . graphRequests . add ( this . multiqueryRequest ) ; } QueryNodeExtrac...
Implementation now that we have chosen a Jackson JavaType for the return value
138,505
private < T > MapperWrapper < T > createMappingChain ( JavaType type ) { return new MapperWrapper < T > ( type , this . mapper , this . createUnmappedChain ( ) ) ; }
Adds mapping to the basic unmapped chain .
138,506
private ErrorDetectingWrapper createUnmappedChain ( ) { int nextIndex = this . graphRequests . size ( ) ; return new ErrorDetectingWrapper ( new GraphNodeExtractor ( nextIndex , this . mapper , new ErrorDetectingWrapper ( this ) ) ) ; }
Creates the common chain of wrappers that will select out one graph request from the batch and error check it both at the batch level and at the individual request level . Result will be an unmapped JsonNode .
138,507
private Later < JsonNode > getRawBatchResult ( ) { if ( this . rawBatchResult == null ) { this . rawBatchResult = new LaterWrapper < JsonNode , JsonNode > ( this . createFetcher ( ) ) ; this . master . execute ( ) ; } return this . rawBatchResult ; }
Get the batch result firing it off if necessary
138,508
private Later < JsonNode > createFetcher ( ) { final RequestBuilder call = new GraphRequestBuilder ( getGraphEndpoint ( ) , HttpMethod . POST , this . timeout , this . retries ) ; String batchValue = JSONUtils . toJSON ( this . graphRequests , this . mapper ) ; if ( log . isLoggable ( Level . FINEST ) ) log . finest ( ...
Constructs the batch query and executes it possibly asynchronously .
138,509
private void throwPageMigratedException ( String msg , int code , int subcode , String userTitle , String userMsg ) { Matcher matcher = ID_PATTERN . matcher ( msg ) ; long oldId = this . extractNextId ( matcher , msg ) ; long newId = this . extractNextId ( matcher , msg ) ; throw new PageMigratedException ( msg , code ...
Builds the proper exception and throws it .
138,510
private long extractNextId ( Matcher matcher , String msg ) { if ( ! matcher . find ( ) ) throw new IllegalStateException ( "Facebook changed the error msg for page migration to something unfamiliar. The new msg is: " + msg ) ; String idStr = matcher . group ( ) . substring ( "ID " . length ( ) ) ; return Long . parseL...
Gets the next id out of the matcher
138,511
protected void throwCodeAndMessage ( int code , String msg ) { switch ( code ) { case 0 : case 101 : case 102 : case 190 : throw new OAuthException ( msg , "OAuthException" , code , null , null , null ) ; default : throw new ErrorFacebookException ( msg + " (code " + code + ")" , null , code , null , null , null ) ; } ...
Throw the appropriate exception for the given legacy code and message . Always throws never returns .
138,512
protected ListSetItem < T > newItem ( IModel < T > itemModel ) { ListSetItem < T > item = new ListSetItem < T > ( Integer . toString ( counter ++ ) , itemModel ) ; populateItem ( item ) ; return item ; }
Create a new ListSetItem for list item .
138,513
public DateTextField getDateTextField ( ) { DateTextField component = visitChildren ( DateTextField . class , new IVisitor < DateTextField , DateTextField > ( ) { public void component ( DateTextField arg0 , IVisit < DateTextField > arg1 ) { arg1 . stop ( arg0 ) ; } } ) ; if ( component == null ) throw new WicketRuntim...
Gets the DateTextField inside this datepicker wrapper .
138,514
private boolean typesAreCompatible ( Class < ? > [ ] paramTypes , Class < ? > [ ] constructorParamTypes ) { boolean matches = true ; for ( int i = 0 ; i < paramTypes . length ; i ++ ) { Class < ? > paramType = paramTypes [ i ] ; if ( paramType != null ) { Class < ? > inputParamType = translateFromPrimitive ( paramType ...
Checks if a set of types are compatible with the given set of constructor parameter types . If an input type is null then it is considered as a wildcard for matching purposes and always matches .
138,515
public V action ( Callable < V > callable ) throws Exception { Exception re ; RetryState retryState = retryStrategy . getRetryState ( ) ; do { try { return callable . call ( ) ; } catch ( Exception e ) { re = e ; if ( Thread . interrupted ( ) || isInterruptTransitively ( e ) ) { re = new InterruptedException ( e . getM...
Perform the specified action under the defined retry semantics .
138,516
private boolean isInterruptTransitively ( Throwable e ) { do { if ( e instanceof InterruptedException ) { return true ; } e = e . getCause ( ) ; } while ( e != null ) ; return false ; }
Special case during shutdown .
138,517
public Object getSet ( String key , Object value , Integer expiration ) throws Exception { Jedis jedis = null ; try { jedis = this . jedisPool . getResource ( ) ; long begin = System . currentTimeMillis ( ) ; byte [ ] val = jedis . getSet ( SafeEncoder . encode ( key ) , serialize ( value ) ) ; Object result = deserial...
get old value and set new value
138,518
public boolean add ( String key , Object value , Integer expiration ) throws Exception { Jedis jedis = null ; try { jedis = this . jedisPool . getResource ( ) ; long begin = System . currentTimeMillis ( ) ; Long result = jedis . setnx ( SafeEncoder . encode ( key ) , serialize ( value ) ) ; if ( expiration > 0 ) { resu...
add if not exists
138,519
public boolean exists ( String key ) throws Exception { boolean isExist = false ; Jedis jedis = null ; try { jedis = this . jedisPool . getResource ( ) ; isExist = jedis . exists ( SafeEncoder . encode ( key ) ) ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) , e ) ; this . jedisPool . returnBrokenResou...
Test if the specified key exists .
138,520
public boolean delete ( String key ) { Jedis jedis = null ; try { jedis = this . jedisPool . getResource ( ) ; jedis . del ( SafeEncoder . encode ( key ) ) ; logger . info ( "delete key:" + key ) ; return true ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) , e ) ; this . jedisPool . returnBrokenResourc...
Remove the specified keys .
138,521
public boolean flushall ( ) { String result = "" ; Jedis jedis = null ; try { jedis = this . jedisPool . getResource ( ) ; result = jedis . flushAll ( ) ; logger . info ( "redis client name: " + this . getCacheName ( ) + " flushall." ) ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) , e ) ; this . jedis...
Delete all the keys of all the existing databases not just the currently selected one .
138,522
public Object get ( Object obj ) throws ReflectionException { try { if ( isPublic ( readMethod ) ) { return readMethod . invoke ( obj ) ; } else { throw new ReflectionException ( "Cannot get the value of " + this + ", as it is write-only." ) ; } } catch ( Exception e ) { throw new ReflectionException ( "Cannot get the ...
Returns the value of the representation of this property from the specified object .
138,523
public void set ( Object obj , Object value ) throws ReflectionException { try { if ( isPublic ( writeMethod ) ) { writeMethod . invoke ( obj , value ) ; } else { throw new ReflectionException ( "Cannot set the value of " + this + ", as it is read-only." ) ; } } catch ( Exception e ) { throw new ReflectionException ( "...
Sets a new value to the representation of this property on the specified object .
138,524
@ SuppressWarnings ( "unchecked" ) public < C > IConverter < C > getConverter ( final Class < C > type ) { if ( Temporal . class . isAssignableFrom ( type ) ) { return ( IConverter < C > ) converter ; } else { return super . getConverter ( type ) ; } }
Returns the default converter if created without pattern ; otherwise it returns a pattern - specific converter .
138,525
public static boolean isSqlStateDuplicateValueInUniqueIndex ( SQLException se ) { String sqlState = se . getSQLState ( ) ; return sqlState != null && ( sqlState . equals ( "23505" ) || se . getMessage ( ) . contains ( "duplicate value in unique index" ) ) ; }
Determines if the SQL exception a duplicate value in unique index .
138,526
public static boolean isSqlStateConnectionException ( SQLException se ) { String sqlState = se . getSQLState ( ) ; return sqlState != null && sqlState . startsWith ( "08" ) ; }
Determines if the SQL exception is a connection exception
138,527
public static boolean isSqlStateRollbackException ( SQLException se ) { String sqlState = se . getSQLState ( ) ; return sqlState != null && sqlState . startsWith ( "40" ) ; }
Determines if the SQL exception is a rollback exception
138,528
public static Date getPreviousDay ( Date dt ) { if ( dt == null ) { return dt ; } Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( dt ) ; cal . add ( Calendar . DAY_OF_YEAR , - 1 ) ; return cal . getTime ( ) ; }
added by zhuqian 2009 - 03 - 25
138,529
public static synchronized void cancel ( TimerTask task ) { if ( task == null ) { return ; } task . cancel ( ) ; usageCount . decrementAndGet ( ) ; if ( usageCount . get ( ) == 0 ) { timer . cancel ( ) ; timer = null ; } }
Remove the specified eviction task from the timer .
138,530
public void push ( AbstractDrawer drawer , AjaxRequestTarget target , String cssClass ) { ListItem item = new ListItem ( "next" , drawer , this , cssClass ) ; drawers . push ( item ) ; if ( first == null ) { first = item ; addOrReplace ( first ) ; } else { ListItem iter = first ; while ( iter . next != null ) { iter = ...
Push and display a drawer on the page during an AJAX request and inject an optional CSS class onto the drawer s immediate container .
138,531
public void replaceLast ( AbstractDrawer newDrawer , AjaxRequestTarget target ) { if ( ! drawers . isEmpty ( ) ) { ListItem last = drawers . getFirst ( ) ; last . drawer . replaceWith ( newDrawer ) ; last . drawer = newDrawer ; newDrawer . setManager ( this ) ; target . add ( newDrawer ) ; } }
Replaces the topmost open drawer with a new one . If there is no open drawer this method does nothing . This method requires an AJAX request . DrawerManager does not support swapping drawers during page construction .
138,532
public void renderHead ( IHeaderResponse response ) { super . renderHead ( response ) ; response . render ( JavaScriptHeaderItem . forReference ( DRAWER_JAVASCRIPT ) ) ; response . render ( JavaScriptHeaderItem . forReference ( MANAGER_JAVASCRIPT ) ) ; response . render ( CssHeaderItem . forReference ( DRAWER_CSS ) ) ;...
pressing the Back button and landing on a page with open drawers .
138,533
public void setWrappedObject ( Object obj ) { if ( obj == null ) { throw new IllegalArgumentException ( "Cannot warp a 'null' object." ) ; } this . object = obj ; this . bean = Bean . forClass ( obj . getClass ( ) ) ; }
Changes at any time the wrapped object with a new object .
138,534
public Object getIndexedValue ( String propertyName , int index ) { return getIndexedValue ( object , getPropertyOrThrow ( bean , propertyName ) , index , this ) ; }
Returns the value of the specified indexed property from the wrapped object .
138,535
public void setSimpleValue ( String propertyName , Object value ) { setSimpleValue ( object , getPropertyOrThrow ( bean , propertyName ) , value ) ; }
Sets the value of the specified property in the wrapped object .
138,536
public static Class < ? > translateFromPrimitive ( Class < ? > paramType ) { if ( paramType == int . class ) { return Integer . class ; } else if ( paramType == char . class ) { return Character . class ; } else if ( paramType == byte . class ) { return Byte . class ; } else if ( paramType == long . class ) { return Lo...
From a primitive type class tries to return the corresponding wrapper class .
138,537
protected final void onRender ( ) { Iterator < ? extends Component > it = renderIterator ( ) ; while ( it . hasNext ( ) ) { Component child = it . next ( ) ; if ( child == null ) { throw new IllegalStateException ( "The render iterator returned null for a child. Container: " + this . toString ( ) + "; Iterator=" + it ....
Renders all child items in no specified order
138,538
private static int metadata_end_cmp_ ( MetaData x , MetaData y ) { return x . getEnd ( ) . compareTo ( y . getEnd ( ) ) ; }
Comparator in order to sort MetaData based on the end timestamp .
138,539
private static List < Path > file_listing_ ( Path dir ) throws IOException { try ( Stream < Path > files = Files . list ( dir ) ) { return files . collect ( Collectors . toList ( ) ) ; } }
Scan a directory for files . This method reads the entire stream and closes it immediately .
138,540
public TSDataScanDir filterUpgradable ( ) { return new TSDataScanDir ( getDir ( ) , getFiles ( ) . stream ( ) . filter ( MetaData :: isUpgradable ) . collect ( Collectors . toList ( ) ) ) ; }
Filter the list of files to contain only upgradable files .
138,541
protected void init ( ExplodeInfo info , int x , int y , int width , int height ) { _info = info ; _ox = x ; _oy = y ; _owid = width ; _ohei = height ; _info . rvel = ( float ) ( ( 2.0f * Math . PI ) * _info . rvel ) ; _chunkcount = ( _info . xchunk * _info . ychunk ) ; _cxpos = new int [ _chunkcount ] ; _cypos = new i...
Initializes the animation with the attributes of the given explode info object .
138,542
public static MetricValue fromNumberValue ( Number number ) { if ( number == null ) { return EMPTY ; } else if ( number instanceof Float || number instanceof Double ) { return fromDblValue ( number . doubleValue ( ) ) ; } else if ( number instanceof Byte || number instanceof Short || number instanceof Integer || number...
Construct a metric value from a Number implementation .
138,543
public void positionAvoidAnimation ( Animation anim , Rectangle viewBounds ) { Rectangle abounds = new Rectangle ( anim . getBounds ( ) ) ; @ SuppressWarnings ( "unchecked" ) ArrayList < Animation > avoidables = ( ArrayList < Animation > ) _avoidAnims . clone ( ) ; if ( SwingUtil . positionRect ( abounds , viewBounds ,...
Position the specified animation so that it is not overlapping any still - running animations previously passed to this method .
138,544
public void invalidateRegion ( int x , int y , int width , int height ) { if ( isValidSize ( width , height ) ) { addDirtyRegion ( new Rectangle ( x , y , width , height ) ) ; } }
Invalidates the specified region .
138,545
protected final boolean isValidSize ( int width , int height ) { if ( width < 0 || height < 0 ) { log . warning ( "Attempt to add invalid dirty region?!" , "size" , ( width + "x" + height ) , new Exception ( ) ) ; return false ; } else if ( width == 0 || height == 0 ) { return false ; } else { return true ; } }
Used to ensure our dirty regions are not invalid .
138,546
public Rectangle [ ] getDirtyRegions ( ) { List < Rectangle > merged = Lists . newArrayList ( ) ; for ( int ii = _dirty . size ( ) - 1 ; ii >= 0 ; ii -- ) { Rectangle mr = _dirty . remove ( ii ) ; for ( int jj = ii - 1 ; jj >= 0 ; jj -- ) { Rectangle r = _dirty . get ( jj ) ; if ( mr . intersects ( r ) ) { _dirty . rem...
Merges all outstanding dirty regions into a single list of rectangles and returns that to the caller . Internally the list of accumulated dirty regions is cleared out and prepared for the next frame .
138,547
public List < Any2 < Integer , String > > getArguments ( ) { final List < Any2 < Integer , String > > result = new ArrayList < > ( ) ; elements_ . forEach ( elem -> elem . keys ( result :: add ) ) ; return result ; }
Retrieve the variables used to render this string .
138,548
public boolean hasConstraint ( int tileIdx , String constraint ) { return ( _bits == null || _bits [ tileIdx ] . constraints == null ) ? false : ListUtil . contains ( _bits [ tileIdx ] . constraints , constraint ) ; }
Checks whether the tile at the specified index has the given constraint .
138,549
public static TrimmedObjectTileSet trimObjectTileSet ( ObjectTileSet source , OutputStream destImage ) throws IOException { return trimObjectTileSet ( source , destImage , FastImageIO . FILE_SUFFIX ) ; }
Convenience function to trim the tile set to a file using FastImageIO .
138,550
public int renderCompareTo ( AbstractMedia other ) { int result = Ints . compare ( _renderOrder , other . _renderOrder ) ; return ( result != 0 ) ? result : naturalCompareTo ( other ) ; }
Compares this media to the specified media by render order .
138,551
public void queueNotification ( ObserverList . ObserverOp < Object > amop ) { if ( _observers != null ) { if ( _mgr != null ) { _mgr . queueNotification ( _observers , amop ) ; } else { log . warning ( "Have no manager, dropping notification" , "media" , this , "op" , amop ) ; } } }
Queues the supplied notification up to be dispatched to this abstract media s observers .
138,552
protected void addObserver ( Object obs ) { if ( _observers == null ) { _observers = ObserverList . newFastUnsafe ( ) ; } _observers . add ( obs ) ; }
Add the specified observer to this media element .
138,553
private void dispatchEvent ( XoaEvent event ) { LOG . entering ( CLASS_NAME , "dispatchEvent" , event ) ; try { Integer handlerId = event . getHandlerId ( ) ; XoaEventKind eventKind = event . getEvent ( ) ; if ( LOG . isLoggable ( Level . FINEST ) ) { LOG . finest ( "XOA + handlerId + " event: " + eventKind . name ( )...
Dispatch an event to Source Origin
138,554
public void setVariance ( int dx , int dy ) { if ( ( dx < 0 ) || ( dy < 0 ) || ( ( dx == 0 ) && ( dy == 0 ) ) ) { throw new IllegalArgumentException ( "Variance values must be positive, and at least one must be non-zero." ) ; } else { _dx = dx ; _dy = dy ; } }
Set the variance of bobblin in each direction .
138,555
protected boolean updatePositionTo ( Pathable pable , int x , int y ) { if ( ( pable . getX ( ) == x ) && ( pable . getY ( ) == y ) ) { return false ; } else { pable . setLocation ( x , y ) ; return true ; } }
Update the position of the pathable or return false if it s already there .
138,556
public static DisplayMode getDisplayMode ( GraphicsDevice gd , int width , int height , int desiredDepth , int minimumDepth ) { DisplayMode [ ] modes = gd . getDisplayModes ( ) ; final int ddepth = desiredDepth ; Comparator < DisplayMode > mcomp = new Comparator < DisplayMode > ( ) { public int compare ( DisplayMode m1...
Gets a display mode that matches the specified parameters . The screen resolution must match the specified resolution exactly the specified desired depth will be used if it is available and if not the highest depth greater than or equal to the specified minimum depth is used . The highest refresh rate available for the...
138,557
public static CharacterDescriptor getRandomDescriptor ( ComponentRepository crepo , String gender , String [ ] COMP_CLASSES , ColorPository cpos , String [ ] COLOR_CLASSES ) { ArrayList < ComponentClass > classes = Lists . newArrayList ( ) ; for ( String element : COMP_CLASSES ) { String cname = gender + "/" + element ...
Returns a new character descriptor populated with a random set of components .
138,558
public CompletableFuture < NewFile > run ( ) { LOG . log ( Level . FINE , "starting optimized file creation for {0} files" , files . size ( ) ) ; CompletableFuture < NewFile > fileCreation = new CompletableFuture < > ( ) ; final List < TSData > fjpFiles = this . files ; TASK_POOL . execute ( ( ) -> createTmpFile ( file...
Start creating the optimized file . This operation resets the state of the optimizer task so it can be re - used for subsequent invocations .
138,559
private static void createTmpFile ( CompletableFuture < NewFile > fileCreation , Path destDir , List < TSData > files , Compression compression ) { LOG . log ( Level . FINE , "starting temporary file creation..." ) ; try { Collections . sort ( files , Comparator . comparing ( TSData :: getBegin ) ) ; final FileChannel ...
The fork - join task that creates a new file . This function creates a temporary file with the result contents then passes it on to the install thread which will put the final file in place .
138,560
private static void install ( CompletableFuture < NewFile > fileCreation , Path destDir , FileChannel tmpFile , DateTime begin ) { try { try { synchronized ( OUTSTANDING ) { OUTSTANDING . remove ( fileCreation ) ; } if ( fileCreation . isCancelled ( ) ) throw new IOException ( "Installation aborted, due to cancellation...
Installs the newly created file . This function runs on the install thread and essentially performs a copy - operation from the temporary file to the final file .
138,561
private static String prefixForTimestamp ( DateTime timestamp ) { return String . format ( "monsoon-%04d%02d%02d-%02d%02d" , timestamp . getYear ( ) , timestamp . getMonthOfYear ( ) , timestamp . getDayOfMonth ( ) , timestamp . getHourOfDay ( ) , timestamp . getMinuteOfHour ( ) ) ; }
Compute a prefix for a to - be - installed file .
138,562
public ErrorData getErrorData ( ) { return new ErrorData ( ( Throwable ) getRequest ( ) . getAttribute ( "javax.servlet.error.exception" ) , ( ( Integer ) getRequest ( ) . getAttribute ( "javax.servlet.error.status_code" ) ) . intValue ( ) , ( String ) getRequest ( ) . getAttribute ( "javax.servlet.error.request_uri" )...
Provides convenient access to error information .
138,563
public static void storeLogs ( String sourceLogFileName , String destLogFileName ) throws Exception { String tmpdir = System . getProperty ( "java.io.tmpdir" ) ; if ( tmpdir == null || tmpdir == "null" ) { tmpdir = "/tmp" ; } File tmpLogFile = new File ( tmpdir + File . separator + sourceLogFileName ) ; File destFile =...
Stores the specified log for this test
138,564
protected void setSelectedComponent ( int idx ) { int cid = _components . get ( idx ) . intValue ( ) ; _model . setSelectedComponent ( _cclass , cid ) ; }
Sets the selected component in the builder model for the component class associated with this editor to the component at the given index in this editor s list of available components .
138,565
public boolean isFlowActive ( ) { Object val = this . getArgument ( "active" ) ; if ( val instanceof Integer ) { return ( ( Integer ) val ) . intValue ( ) == 1 ; } else { throw new IllegalStateException ( "ChannelEvent does not contain the 'active' argument" ) ; } }
Returns For flow events returns true if flow is active
138,566
static void writeTracker ( JSONWriter writer , Tracker tracker ) throws JSONException { writer . key ( "id" ) ; writer . value ( tracker . getId ( ) ) ; writer . key ( "name" ) ; writer . value ( tracker . getName ( ) ) ; }
Writes a tracker .
138,567
public static void addFull ( JSONWriter writer , String field , Date value ) throws JSONException { final SimpleDateFormat format = RedmineDateUtils . FULL_DATE_FORMAT . get ( ) ; JsonOutput . add ( writer , field , value , format ) ; }
Adds a value to a writer .
138,568
private Optional < Data < Input , Output > > match_ ( Input input ) { return Optional . ofNullable ( recent_ . get ( ) ) . filter ( ( Data < Input , Output > data ) -> equality_ . test ( data . getInput ( ) , input ) ) ; }
Try to match an input against the most recent calculation .
138,569
private Data < Input , Output > derive_ ( Input input ) { Data < Input , Output > result = new Data < > ( input , fn_ . apply ( input ) ) ; recent_ . set ( result ) ; return result ; }
Derive and remember a calculation .
138,570
public Output apply ( Input input ) { if ( input == null ) return fn_ . apply ( input ) ; return match_ ( input ) . orElseGet ( ( ) -> derive_ ( input ) ) . getOutput ( ) ; }
Functional implementation .
138,571
public void setWarning ( float warnPercent , ResultListener < TimerView > warner ) { _warned = false ; _warnPercent = warnPercent ; _warner = warner ; }
Setup a warning to trigger after the timer is warnPercent or more completed . If warner is non - null it will be called at that time .
138,572
public void start ( float startPercent , long duration , ResultListener < TimerView > finisher ) { if ( startPercent < 0.0f || startPercent >= 1.0f ) { throw new IllegalArgumentException ( "Invalid starting percent " + startPercent ) ; } if ( duration < 0 ) { throw new IllegalArgumentException ( "Invalid duration " + d...
Start the timer running from the specified percentage complete to expire at the specified time .
138,573
public void unpause ( ) { if ( _lastUpdate == Long . MIN_VALUE || _start == Long . MIN_VALUE ) { return ; } _processUnpause = true ; _running = true ; }
Unpause the timer .
138,574
public void changeComplete ( float complete ) { _complete = complete ; _renderOffset = _renderComplete - _complete ; _renderOffsetTime = Long . MIN_VALUE ; }
Generate an unexpected change in the timer s completion and set up the necessary details to render interpolation from the old to new states
138,575
protected void invalidate ( ) { _invalidated = true ; _host . repaint ( _bounds . x , _bounds . y , _bounds . width , _bounds . height ) ; }
Invalidates this view s bounds via the host component .
138,576
public void checkFrameParticipation ( ) { boolean participate = _host . isShowing ( ) ; if ( participate && ! _participating ) { _fmgr . registerFrameParticipant ( this ) ; _participating = true ; } else if ( ! participate && _participating ) { _fmgr . removeFrameParticipant ( this ) ; _participating = false ; } }
Check that the frame knows about the timer .
138,577
public static int getTileHash ( int x , int y ) { long seed = ( ( ( x << 2 ) ^ y ) ^ MULTIPLIER ) & MASK ; long hash = ( seed * MULTIPLIER + ADDEND ) & MASK ; return ( int ) ( hash >>> 30 ) ; }
Compute some hash value for randomizing tileset picks based on x and y coordinates .
138,578
public static ObjectSequence < TimeSeriesCollection > fixSequence ( ObjectSequence < TimeSeriesCollection > seq ) { seq = seq . sort ( ) ; if ( ! seq . isDistinct ( ) && ! seq . isEmpty ( ) ) { List < ObjectSequence < TimeSeriesCollection > > toConcat = new ArrayList < > ( ) ; int lastGoodIdx = 0 ; int curIdx = 0 ; whi...
Fix a sequence to contain only distinct sorted elements .
138,579
public static ObjectSequence < TimeSeriesCollection > mergeSequences ( ObjectSequence < TimeSeriesCollection > ... tsSeq ) { if ( tsSeq . length == 0 ) return ObjectSequence . empty ( ) ; if ( tsSeq . length == 1 ) return tsSeq [ 0 ] ; final Queue < ObjectSequence < TimeSeriesCollection > > seq = new PriorityQueue < > ...
Given zero or more sequences that are all sorted and distinct merge them together .
138,580
public void queueResource ( String bundle , String resource , boolean loop ) { try { queueURL ( new URL ( "resource://" + bundle + "/" + resource ) , loop ) ; } catch ( MalformedURLException e ) { log . warning ( "Invalid resource url." , "resource" , resource , e ) ; } }
Adds a resource to the queue of files to play .
138,581
public static boolean isMappedIPv4Address ( Inet6Address ip ) { byte bytes [ ] = ip . getAddress ( ) ; return ( ( bytes [ 0 ] == 0x00 ) && ( bytes [ 1 ] == 0x00 ) && ( bytes [ 2 ] == 0x00 ) && ( bytes [ 3 ] == 0x00 ) && ( bytes [ 4 ] == 0x00 ) && ( bytes [ 5 ] == 0x00 ) && ( bytes [ 6 ] == 0x00 ) && ( bytes [ 7 ] == 0x...
Evaluates whether the argument is an IPv6 mapped address .
138,582
public static Inet4Address getMappedIPv4Address ( Inet6Address ip ) { if ( ! isMappedIPv4Address ( ip ) ) throw new IllegalArgumentException ( String . format ( "Address '%s' is not IPv4-mapped." , toAddrString ( ip ) ) ) ; return getInet4Address ( copyOfRange ( ip . getAddress ( ) , 12 , 16 ) ) ; }
Returns the IPv4 address embedded in an IPv4 mapped address .
138,583
protected void checkIdle ( ) { long now = getTimeStamp ( ) ; switch ( _state ) { case ACTIVE : if ( now >= ( _lastEvent + _toIdleTime ) ) { log . info ( "User idle for " + ( now - _lastEvent ) + "ms." ) ; _state = IDLE ; idledOut ( ) ; } break ; case IDLE : if ( now >= ( _lastEvent + _toIdleTime + _toAbandonTime ) ) { ...
Checks the last user event time and posts a command to idle them out if they ve been inactive for too long or log them out if they ve been idle for too long .
138,584
private void run_implementation_ ( PushProcessor p ) throws Exception { final Map < GroupName , Alert > alerts = registry_ . getCollectionAlerts ( ) ; final TimeSeriesCollection tsdata = registry_ . getCollectionData ( ) ; p . accept ( tsdata , unmodifiableMap ( alerts ) , registry_ . getFailedCollections ( ) ) ; }
Run the implementation of uploading the values and alerts .
138,585
public final void run ( ) { try { registry_ . updateCollection ( ) ; final long t0 = System . nanoTime ( ) ; processors_ . forEach ( p -> { try { run_implementation_ ( p ) ; } catch ( Exception ex ) { logger . log ( Level . SEVERE , p . getClass ( ) . getName ( ) + " failed to run properly, some or all metrics may be m...
Run the collection cycle .
138,586
public void resolveBlock ( SceneBlock block , boolean hipri ) { log . debug ( "Queueing block for resolution" , "block" , block , "hipri" , hipri ) ; if ( hipri ) { _queue . prepend ( block ) ; } else { _queue . append ( block ) ; } }
Queues up a scene block for resolution .
138,587
public static boolean openNotification ( ) throws Exception { boolean success = false ; int apiLevel = Client . getInstance ( ) . mapField ( "android.os.Build$VERSION" , "SDK_INT" ) . getInt ( 0 ) ; if ( apiLevel >= 18 ) { success = Client . getInstance ( ) . map ( Constants . UIAUTOMATOR_UIDEVICE , "openNotification" ...
Open notification shade
138,588
public static boolean click ( int x , int y ) throws Exception { return Client . getInstance ( ) . map ( Constants . UIAUTOMATOR_UIDEVICE , "click" , x , y ) . getBoolean ( 0 ) ; }
Click at x y position
138,589
public void moveAndFadeIn ( Path path , long pathDuration , float fadePortion ) { move ( path ) ; setAlpha ( 0.0f ) ; _fadeInDuration = ( long ) ( pathDuration * fadePortion ) ; }
Puts this sprite on the specified path and fades it in over the specified duration .
138,590
public void moveAndFadeOut ( Path path , long pathDuration , float fadePortion ) { move ( path ) ; setAlpha ( 1.0f ) ; _fadeStamp = 0 ; _pathDuration = pathDuration ; _fadeOutDuration = ( long ) ( pathDuration * fadePortion ) ; _fadeDelay = _pathDuration - _fadeOutDuration ; }
Puts this sprite on the specified path and fades it out over the specified duration .
138,591
public void moveAndFadeInAndOut ( Path path , long pathDuration , float fadePortion ) { move ( path ) ; setAlpha ( 0.0f ) ; _pathDuration = pathDuration ; _fadeInDuration = _fadeOutDuration = ( long ) ( pathDuration * fadePortion ) ; }
Puts this sprite on the specified path fading it in over the specified duration at the beginning and fading it out at the end .
138,592
public void setAlpha ( float alpha ) { if ( alpha < 0.0f ) { alpha = 0.0f ; } else if ( alpha > 1.0f ) { alpha = 1.0f ; } if ( alpha != _alphaComposite . getAlpha ( ) ) { _alphaComposite = AlphaComposite . getInstance ( AlphaComposite . SRC_OVER , alpha ) ; if ( _mgr != null ) { _mgr . getRegionManager ( ) . invalidate...
Sets the alpha value of this sprite .
138,593
public static void register ( PerformanceObserver obs , String name , long delta ) { Map < String , PerformanceAction > actions = _observers . get ( obs ) ; if ( actions == null ) { _observers . put ( obs , actions = Maps . newHashMap ( ) ) ; } actions . put ( name , new PerformanceAction ( obs , name , delta ) ) ; }
Register a new action with an observer the action name and the milliseconds to wait between checkpointing the action s performance .
138,594
public static void unregister ( PerformanceObserver obs , String name ) { Map < String , PerformanceAction > actions = _observers . get ( obs ) ; if ( actions == null ) { log . warning ( "Attempt to unregister by unknown observer " + "[observer=" + obs + ", name=" + name + "]." ) ; return ; } PerformanceAction action =...
Un - register the named action associated with the given observer .
138,595
public static void tick ( PerformanceObserver obs , String name ) { Map < String , PerformanceAction > actions = _observers . get ( obs ) ; if ( actions == null ) { log . warning ( "Attempt to tick by unknown observer " + "[observer=" + obs + ", name=" + name + "]." ) ; return ; } PerformanceAction action = actions . g...
Tick the named action associated with the given observer .
138,596
private URI _getSpecURI ( String spec ) { URI specURI = URI . create ( spec ) ; if ( _scheme . indexOf ( ':' ) == - 1 ) { return specURI ; } String schemeSpecificPart = specURI . getSchemeSpecificPart ( ) ; return URI . create ( schemeSpecificPart ) ; }
the appropriate URI that can be used to retrieve the needed parts .
138,597
protected boolean checkTileIndex ( int tileIndex ) { int tcount = getTileCount ( ) ; if ( tileIndex >= 0 && tileIndex < tcount ) { return true ; } else { log . warning ( "Requested invalid tile [tset=" + this + ", index=" + tileIndex + "]." , new Exception ( ) ) ; return false ; } }
Used to ensure that the specified tile index is valid .
138,598
public TagInfo getTag ( String shortname ) { TagInfo tags [ ] = getTags ( ) ; if ( tags == null || tags . length == 0 ) { return null ; } for ( int i = 0 ; i < tags . length ; i ++ ) { if ( tags [ i ] . getTagName ( ) . equals ( shortname ) ) { return tags [ i ] ; } } return null ; }
Get the TagInfo for a given tag name looking through all the tags in this tag library .
138,599
public TagFileInfo getTagFile ( String shortname ) { TagFileInfo tagFiles [ ] = getTagFiles ( ) ; if ( tagFiles == null || tagFiles . length == 0 ) { return null ; } for ( int i = 0 ; i < tagFiles . length ; i ++ ) { if ( tagFiles [ i ] . getName ( ) . equals ( shortname ) ) { return tagFiles [ i ] ; } } return null ; ...
Get the TagFileInfo for a given tag name looking through all the tag files in this tag library .