idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
120,300
public void update ( long aRequestCount , long aMaxTime , long aBytesReceived , long aBytesSent , long aProcessingTime , long aErrorCount ) { requestCount . setValueAsLong ( aRequestCount ) ; maxTime . setValueAsLong ( aMaxTime ) ; bytesReceived . setValueAsLong ( aBytesReceived ) ; bytesSent . setValueAsLong ( aBytesS...
Updates stats .
120,301
void reset ( ) { cleanup ( ) ; listeners . clear ( ) ; registry . clear ( ) ; String junittest = System . getProperty ( "JUNITTEST" ) ; if ( junittest != null && junittest . equalsIgnoreCase ( "true" ) ) return ; addListener ( new JMXBridgeListener ( ) ) ; }
Resets the impl for unittests .
120,302
public void cleanup ( ) { ArrayList < ProducerReference > producerReferences = new ArrayList < ProducerReference > ( registry . values ( ) ) ; for ( ProducerReference p : producerReferences ) { try { if ( p . get ( ) != null ) unregisterProducer ( p . get ( ) ) ; } catch ( Exception e ) { LOGGER . warn ( "can't unregis...
This method is primary used for unit tests .
120,303
private static boolean isMBeanRequired ( final ObjectInstance mBean ) { final String domain = mBean . getObjectName ( ) . getDomain ( ) ; final String className = mBean . getClassName ( ) ; return ! domain . startsWith ( "moskito." ) && conf . isMBeanRequired ( domain , className ) ; }
Checks is mbean required to be registered as producer
120,304
public static void buildProducers ( ) { DecoratorRegistryFactory . getDecoratorRegistry ( ) . addDecorator ( MBeanStats . class , new GeneralMBeanDecorator ( ) ) ; for ( MBeanServer server : MBeanServerFactory . findMBeanServer ( null ) ) for ( final ObjectInstance mBean : server . queryMBeans ( null , null ) ) if ( is...
Builds all mbean producer that required by mbean producers configuration .
120,305
public static < T > T createInstance ( T impl , String name , String category , String subsystem , IOnDemandCallHandler handler , IOnDemandStatsFactory < ? extends IStats > statsFactory , boolean attachLoggers , Class < T > interf , Class < ? > ... additionalInterfaces ) { if ( name == null ) name = extractName ( inter...
Creates a new proxied instance for an existing implementation .
120,306
public static < T > T createServiceInstance ( T impl , String category , String subsystem , Class < T > interf , Class < ? > ... additionalInterfaces ) { return createServiceInstance ( impl , null , category , subsystem , interf , additionalInterfaces ) ; }
Shortcut method to create service instance . Creates an instance with service interface name as instance name custom category and subsystem ServiceStatsCallHandler and ServiceStatsFactory .
120,307
private static String extractName ( Class < ? > clazz ) { String name = clazz . getName ( ) ; if ( name == null ) name = "" ; int indexOfDot = name . lastIndexOf ( '.' ) ; return indexOfDot == - 1 ? name : name . substring ( indexOfDot + 1 ) ; }
Internal method which extracts name of the service out of it class . net . java . dev . moskito . core . dynamic . ProxyUtils - > ProxyUtils .
120,308
private Object parseValue ( String value ) { try { return Double . valueOf ( value ) ; } catch ( NumberFormatException ignored ) { } if ( value . equals ( "true" ) || value . equals ( "false" ) ) return Boolean . valueOf ( value ) ; throw new IllegalArgumentException ( "Only number or boolean stats values allowed" ) ; ...
Helper method to parse string representation of value item to number or boolean type
120,309
public void addConsumer ( SnapshotConsumer consumer ) { if ( consumers . contains ( consumer ) ) consumers . remove ( consumer ) ; consumers . add ( consumer ) ; }
Adds a new snapshot consumer .
120,310
static final int guessLengthFromName ( String aName ) { if ( aName . startsWith ( Constants . PREFIX_SNAPSHOT_INTERVAL ) ) return - 1 ; int unitFactor ; int value ; try { value = Integer . parseInt ( aName . substring ( 0 , aName . length ( ) - 1 ) ) ; } catch ( NumberFormatException e ) { throw new UnknownIntervalLeng...
This method parses the given Interval name and returns the length of such an Interval in seconds .
120,311
protected static < T extends GenericMetrics > List < T > getMetricsOfType ( Class < T > type ) { List < T > metricsList = ( List < T > ) registry . get ( type ) ; if ( metricsList == null ) { metricsList = new CopyOnWriteArrayList < > ( ) ; List < T > previous = ( List < T > ) registry . putIfAbsent ( type , metricsLis...
Get all registered metrics of given Class .
120,312
public String getAccumulatorColor ( final String accumulatorName ) { if ( StringUtils . isEmpty ( accumulatorName ) ) throw new IllegalArgumentException ( "accumulatorName is null" ) ; if ( accumulatorsColors == null || accumulatorsColors . length == 0 ) return null ; for ( AccumulatorGraphColor accumulator : accumulat...
Returns accumulator color by given accumulator name .
120,313
public String registerMBean ( Object bean , String name , boolean replace ) throws MalformedObjectNameException , NotCompliantMBeanException , MBeanRegistrationException { synchronized ( mBeanServer ) { ObjectName newBeanName = null ; try { newBeanName = new ObjectName ( name ) ; beansNames . add ( newBeanName ) ; mBea...
Registers MBean in local MBean server .
120,314
public boolean unregisterMBean ( String name ) throws MBeanRegistrationException { synchronized ( mBeanServer ) { ObjectName toRemoveName ; try { toRemoveName = new ObjectName ( name ) ; } catch ( MalformedObjectNameException e ) { return false ; } beansNames . remove ( toRemoveName ) ; try { mBeanServer . unregisterMB...
Unregisters MBean from platform MBean server .
120,315
public void cleanup ( ) { synchronized ( mBeanServer ) { for ( ObjectName beanName : beansNames ) try { mBeanServer . unregisterMBean ( beanName ) ; } catch ( InstanceNotFoundException ignored ) { } catch ( MBeanRegistrationException e ) { log . warn ( "Exception thrown while trying to clean up registered MBeans" , e )...
Unregisters all beans that been registered by this utility object .
120,316
@ Path ( "/{name}" ) public ReplyObject getDashboard ( @ PathParam ( "name" ) String name ) { try { ReplyObject ret = ReplyObject . success ( ) ; DashboardAO dashboard = getDashboardAPI ( ) . getDashboard ( name ) ; ret . addResult ( "dashboard" , dashboard ) ; return ret ; } catch ( APIException e ) { return ReplyObje...
Returns a dashboard by its name .
120,317
private void readThreads ( ) { long [ ] ids = threadMxBean . getAllThreadIds ( ) ; Map < Thread . State , Long > count = new EnumMap < > ( Thread . State . class ) ; for ( int i = 0 ; i < ids . length ; i ++ ) { long id = ids [ i ] ; ThreadInfo info = threadMxBean . getThreadInfo ( id ) ; if ( info != null ) { Thread ....
Reads and updates the thread info .
120,318
private String getDashboardRestApiUrl ( final HttpServletRequest request , final String dashboardName ) { String contextPath = request . getContextPath ( ) ; if ( contextPath == null ) { contextPath = "" ; } if ( ! contextPath . endsWith ( "/" ) ) { contextPath += "/" ; } return contextPath + "moskito-inspect-rest/dash...
Creates Dashboard REST API url for given dashboard . Used at UI .
120,319
private long getDashboardRefreshRate ( final DashboardConfig selectedDashboardConfig ) { if ( selectedDashboardConfig == null ) { return DEFAULT_DASHBOARD_REFRESH_RATE ; } return TimeUnit . SECONDS . toMillis ( selectedDashboardConfig . getRefresh ( ) ) ; }
Returns dashboard refresh rate in ms . Used at UI for refreshing the dashboard .
120,320
private IntervalListener getListener ( String intervalName ) { IntervalListener listener = listeners . get ( intervalName ) ; if ( listener != null ) return listener ; try { Interval interval = IntervalRegistry . getInstance ( ) . getIntervalOnlyIfExisting ( intervalName ) ; listener = new IntervalListener ( ) ; Interv...
Returns interval listener for the specified interval . If there already was a listener it will be returned otherwise a new one will be created . However if there have been no such interval the interval listener will be substituted for a dummy object and no further action will be taken .
120,321
public void removeTieable ( String name ) { T t = tieables . remove ( name ) ; if ( t == null ) return ; detachFromListener ( t ) ; try { yetUntied . remove ( t ) ; } catch ( Exception e ) { } }
Removes previously added tieable by name .
120,322
@ Around ( value = "execution(* *(..)) && (@annotation(method))" ) public Object doProfilingMethod ( ProceedingJoinPoint pjp , Monitor method ) throws Throwable { return doProfiling ( pjp , method . producerId ( ) , method . subsystem ( ) , method . category ( ) ) ; }
Common method profiling entry - point .
120,323
@ Around ( value = "execution(* *.*(..)) && @within(monitor) && !@annotation(net.anotheria.moskito.aop.annotation.DontMonitor)" ) public Object doProfilingClass ( ProceedingJoinPoint pjp , Monitor monitor ) throws Throwable { return doProfiling ( pjp , monitor . producerId ( ) , monitor . subsystem ( ) , monitor . cate...
Common class profiling entry - point .
120,324
public void reset ( ) { tags = new HashMap < > ( ) ; errorOccured = new AtomicBoolean ( false ) ; seenErrors = new HashSet < > ( ) ; tracerFired = false ; }
Resets the current context . Especially useful for unit - testing .
120,325
public void addPlugin ( String name , MoskitoPlugin plugin , PluginConfig config ) { plugins . put ( name , plugin ) ; try { plugin . initialize ( ) ; configs . put ( name , config ) ; } catch ( Exception e ) { log . warn ( "couldn't initialize plugin " + name + " - " + plugin + ", removing" , e ) ; plugins . remove ( ...
Adds a new loaded plugin .
120,326
public void removePlugin ( String name ) { configs . remove ( name ) ; MoskitoPlugin plugin = plugins . remove ( name ) ; if ( plugin == null ) { log . warn ( "Trying to remove not registered plugin " + name ) ; return ; } try { plugin . deInitialize ( ) ; } catch ( Exception e ) { log . warn ( "Couldn't de-initialize ...
Removes a plugin . This call will call deInitialize on the plugin . The plugin is responsible to free all used resources and un - register itself from listening .
120,327
public List < String > getPluginNames ( ) { ArrayList < String > ret = new ArrayList < String > ( plugins . keySet ( ) ) ; return ret ; }
Returns the names of the active plugins .
120,328
public List < MoskitoPlugin > getPlugins ( ) { ArrayList < MoskitoPlugin > ret = new ArrayList < MoskitoPlugin > ( plugins . values ( ) ) ; return ret ; }
Returns all active plugins .
120,329
public TraceStep getLastStep ( ) { TraceStep result = this ; while ( true ) { if ( result . children == null || result . children . size ( ) == 0 ) return result ; result = result . children . get ( result . children . size ( ) - 1 ) ; } }
Returns the last step in this execution .
120,330
public long getNetDuration ( ) { long ret = duration ; for ( TraceStep s : children ) ret -= s . getDuration ( ) ; return ret ; }
Returns the net duration which means total duration minus the duration of all children .
120,331
public void addMemoryUsage ( long memoryUsed ) { totalMemoryUsage . increaseByLong ( memoryUsed ) ; minMemoryUsage . setValueIfLesserThanCurrentAsLong ( memoryUsed ) ; maxMemoryUsage . setValueIfGreaterThanCurrentAsLong ( memoryUsed ) ; }
Adds memory used by script call
120,332
public JSONObject mapColorDataToJSON ( ) { final JSONObject jsonObject = new JSONObject ( ) ; try { jsonObject . put ( "name" , name ) ; jsonObject . put ( "color" , color ) ; } catch ( JSONException e ) { final String message = LogMessageUtil . failMsg ( e ) ; LoggerFactory . getLogger ( AccumulatedSingleGraphAO . cla...
Maps accumulator s color and name to JSON object .
120,333
public boolean isTracingEnabledForProducer ( String producerId ) { if ( ! MoskitoConfigurationHolder . getConfiguration ( ) . getTracingConfig ( ) . isTracingEnabled ( ) ) return false ; Tracer tracer = tracers . get ( producerId ) ; return tracer != null && tracer . isEnabled ( ) ; }
Returns true if tracing is enabled globally and in particular for this producer .
120,334
public static final StatValue createStatValue ( Object aPattern , String aName , Interval [ ] aIntervals ) { return createStatValue ( StatValueTypeUtility . object2type ( aPattern ) , aName , aIntervals ) ; }
This method creates a new StatValue instance . The new object will be from the same type as the given template object .
120,335
public static TypeAwareStatValue createStatValue ( StatValueTypes aType , String aName , Interval [ ] aIntervals ) { IValueHolderFactory valueHolderFactory = StatValueTypeUtility . createValueHolderFactory ( aType ) ; TypeAwareStatValue value = new TypeAwareStatValueImpl ( aName , aType , valueHolderFactory ) ; for ( i...
This method creates a StatValue instance .
120,336
protected void preProcessExecute ( ActionMapping mapping , ActionForm af , HttpServletRequest req , HttpServletResponse res ) throws Exception { }
This method allows you to perform some tasks prior to call to the moskitoExecute .
120,337
private void debug ( final HttpServletRequest request ) { if ( ! logger . isInfoEnabled ( ) ) { logger . warn ( "Logger INTO not enabled!" ) ; return ; } logger . info ( HEADERS ) ; Enumeration headerEnumeration = request . getHeaderNames ( ) ; while ( headerEnumeration . hasMoreElements ( ) ) { String elementName = ( ...
Dump out to sysOut request parameters .
120,338
public static ReplyObject error ( String message ) { ReplyObject ret = new ReplyObject ( ) ; ret . success = false ; ret . message = message ; return ret ; }
Factory method that creates a new erroneous reply object .
120,339
protected void handleStatsResetIfNeeded ( StatusData < NginxMetrics > status ) { StatValue previousHandled = getStatValue ( NginxMetrics . HANDLED ) ; Long currentHandled = Long . class . cast ( status . get ( NginxMetrics . HANDLED ) ) ; if ( previousHandled != null && currentHandled != null && previousHandled . getVa...
Check HANDLED metric and if its value is lower than the stored one - monitored Nginx server was restarted . In this case all DIFFLONG statValues need resetting .
120,340
private void readConfig ( ) { AccumulatorsConfig config = MoskitoConfigurationHolder . getConfiguration ( ) . getAccumulatorsConfig ( ) ; AccumulatorConfig [ ] acs = config . getAccumulators ( ) ; if ( acs != null && acs . length > 0 ) { for ( AccumulatorConfig ac : acs ) { AccumulatorDefinition ad = new AccumulatorDef...
Reads the config and creates configured accumulators . For now this method is only executed on startup .
120,341
public static void addThreshold ( String name , String producerName , String statName , String valueName , String intervalName , ThresholdConditionGuard ... guards ) { ThresholdDefinition definition = new ThresholdDefinition ( ) ; definition . setName ( name ) ; definition . setProducerName ( producerName ) ; definitio...
Creates a new Threshold and adds it to repository .
120,342
private boolean isAuthorized ( HttpServletRequest request ) { if ( Boolean . TRUE . equals ( request . getSession ( true ) . getAttribute ( AuthConstants . AUTH_SESSION_ATTR_NAME ) ) ) return true ; final AuthApi api = APILookupUtility . getAuthApi ( ) ; if ( request . getCookies ( ) != null ) for ( Cookie cookie : req...
Check is current connection user authorized in moskito - inspect . First checks authorization flag in session attributes . Then tries to find valid authorization cookie if flag not found . If cookie was found - sets authorization flag to true .
120,343
public void doFilter ( ServletRequest request , ServletResponse response , FilterChain chain ) throws IOException , ServletException { if ( ! ( request instanceof HttpServletRequest ) ) { chain . doFilter ( request , response ) ; return ; } HttpServletRequest httpServletRequest = ( ( HttpServletRequest ) request ) ; Ht...
Checks user authorization if it enabled in config
120,344
public static final ThreadHistoryEvent created ( long threadId , String threadName ) { return new ThreadHistoryEvent ( threadId , threadName , OPERATION . CREATED ) ; }
Factory method to create new created event .
120,345
public static final ThreadHistoryEvent deleted ( long threadId , String threadName ) { return new ThreadHistoryEvent ( threadId , threadName , OPERATION . DELETED ) ; }
Factory method to create new deleted event .
120,346
private void initializeMe ( ) { Long pattern = Long . valueOf ( 0 ) ; ioExceptions = StatValueFactory . createStatValue ( pattern , "ioexceptions" , getSelectedIntervals ( ) ) ; servletExceptions = StatValueFactory . createStatValue ( pattern , "servletExceptions" , getSelectedIntervals ( ) ) ; runtimeExceptions = Stat...
Initializes this object .
120,347
public static void reconfigureMonitor ( MonitoringPluginConfig config ) { for ( GenericMonitor monitor : MONITORS ) { if ( monitor . config == config ) { monitor . stop ( ) ; monitor . setup ( ) ; } } }
Called when MonitoringPluginConfig source changed at runtime .
120,348
protected String getSelectedDashboard ( HttpServletRequest req ) throws APIException { String dashboardName = req . getParameter ( "dashboard" ) ; if ( dashboardName != null ) return dashboardName ; return getDashboardAPI ( ) . getDefaultDashboardName ( ) ; }
Returns currently selected dashboard .
120,349
private void writeObject ( ObjectOutputStream out ) throws IOException { out . writeObject ( clazz ) ; out . writeInt ( defaultBatchSize ) ; out . writeInt ( queryIndex ) ; out . writeObject ( cursor ) ; out . writeObject ( generators ) ; out . writeInt ( generatorIndex ) ; writeObjects ( out ) ; }
Pumps may be serialized to be processed by asynchronous queues
120,350
public List < String > findAvailableStrings ( String uri ) throws IOException { resourcesNotLoaded . clear ( ) ; String fulluri = path + uri ; List < String > strings = new ArrayList < > ( ) ; Enumeration < URL > resources = getResources ( fulluri ) ; while ( resources . hasMoreElements ( ) ) { URL url = resources . ne...
Reads the contents of the found URLs as a Strings and returns them . Individual URLs that cannot be read are skipped and added to the list of resourcesNotLoaded
120,351
public static int fromFloat ( float fval ) { int fbits = Float . floatToIntBits ( fval ) ; int sign = fbits >>> 16 & 0x8000 ; int val = 0x1000 + fbits & 0x7fffffff ; if ( val >= 0x47800000 ) { if ( ( fbits & 0x7fffffff ) >= 0x47800000 ) { if ( val < 0x7f800000 ) { return sign | 0x7c00 ; } return sign | 0x7c00 | ( fbits...
returns all higher 16 bits as 0 for all results
120,352
public void decode ( DataItemListener dataItemListener ) throws CborException { Objects . requireNonNull ( dataItemListener ) ; DataItem dataItem = decodeNext ( ) ; while ( dataItem != null ) { dataItemListener . onDataItem ( dataItem ) ; dataItem = decodeNext ( ) ; } }
Streaming decoding of an input stream . On each decoded DataItem the callback listener is invoked .
120,353
public DataItem decodeNext ( ) throws CborException { int symbol ; try { symbol = inputStream . read ( ) ; } catch ( IOException ioException ) { throw new CborException ( ioException ) ; } if ( symbol == - 1 ) { return null ; } switch ( MajorType . ofByte ( symbol ) ) { case ARRAY : return arrayDecoder . decode ( symbo...
Decodes exactly one DataItem from the input stream .
120,354
public Fingerprint callback ( FingerprintSecureCallback fingerprintSecureCallback , String KEY_NAME ) { this . fingerprintSecureCallback = fingerprintSecureCallback ; this . cipherHelper = new CipherHelper ( KEY_NAME ) ; return this ; }
Set fingerprint secure callback .
120,355
public Fingerprint fingerprintScanningColor ( int fingerprintScanning ) { this . fingerprintScanning = fingerprintScanning ; this . fingerprintImageView . setBackgroundTintList ( ColorStateList . valueOf ( getContext ( ) . getColor ( fingerprintScanning ) ) ) ; return this ; }
Set the fingerprint icon color in scanning state .
120,356
public Fingerprint fingerprintSuccessColor ( int fingerprintSuccess ) { this . fingerprintSuccess = fingerprintSuccess ; this . fingerprintImageView . setBackgroundTintList ( ColorStateList . valueOf ( getContext ( ) . getColor ( fingerprintSuccess ) ) ) ; return this ; }
Set the fingerprint icon color in success state .
120,357
public Fingerprint fingerprintErrorColor ( int fingerprintError ) { this . fingerprintError = fingerprintError ; this . fingerprintImageView . setBackgroundTintList ( ColorStateList . valueOf ( getContext ( ) . getColor ( fingerprintError ) ) ) ; return this ; }
Set the fingerprint icon color in error state .
120,358
public Fingerprint circleScanningColor ( int circleScanning ) { this . circleScanning = circleScanning ; this . circleView . setBackgroundTintList ( ColorStateList . valueOf ( getContext ( ) . getColor ( circleScanning ) ) ) ; return this ; }
Set the fingerprint circular background color in scanning state .
120,359
public Fingerprint circleSuccessColor ( int circleSuccess ) { this . circleSuccess = circleSuccess ; this . circleView . setBackgroundTintList ( ColorStateList . valueOf ( getContext ( ) . getColor ( circleSuccess ) ) ) ; return this ; }
Set the fingerprint circular background color in success state .
120,360
public Fingerprint circleErrorColor ( int circleError ) { this . circleError = circleError ; this . circleView . setBackgroundTintList ( ColorStateList . valueOf ( getContext ( ) . getColor ( circleError ) ) ) ; return this ; }
Set the fingerprint circular background color in error state .
120,361
public static boolean isAvailable ( Context context ) { FingerprintManager fingerprintManager = ( FingerprintManager ) context . getSystemService ( Context . FINGERPRINT_SERVICE ) ; if ( fingerprintManager != null ) { return ( fingerprintManager . isHardwareDetected ( ) && fingerprintManager . hasEnrolledFingerprints (...
Check if fingerprint authentication is supported by the device and if a fingerprint is enrolled in the device .
120,362
public void authenticate ( ) { if ( fingerprintSecureCallback != null ) { if ( cryptoObject != null ) { throw new RuntimeException ( "If you specify a CryptoObject you have to use FingerprintCallback" ) ; } cryptoObject = cipherHelper . getEncryptionCryptoObject ( ) ; if ( cryptoObject == null ) { fingerprintSecureCall...
start fingerprint scan
120,363
public static boolean isAvailable ( Context context ) { FingerprintManager manager = ( FingerprintManager ) context . getSystemService ( Context . FINGERPRINT_SERVICE ) ; return ( manager != null && manager . isHardwareDetected ( ) && manager . hasEnrolledFingerprints ( ) ) ; }
Check if a fingerprint scanner is available and if at least one finger is enrolled in the phone .
120,364
public FingerprintDialog callback ( FingerprintDialogSecureCallback fingerprintDialogSecureCallback , String KEY_NAME ) { this . fingerprintDialogSecureCallback = fingerprintDialogSecureCallback ; this . fingerprint . callback ( fingerprintSecureCallback , KEY_NAME ) ; return this ; }
Set a callback for secured authentication .
120,365
public FingerprintDialog tryLimit ( int limit , final FailAuthCounterDialogCallback counterCallback ) { this . fingerprint . tryLimit ( limit , new FailAuthCounterCallback ( ) { public void onTryLimitReached ( Fingerprint fingerprint ) { counterCallback . onTryLimitReached ( FingerprintDialog . this ) ; } } ) ; return ...
Set a fail limit . Android blocks automatically when 5 attempts failed .
120,366
public void show ( ) { if ( title == null || message == null ) { throw new RuntimeException ( "Title or message cannot be null." ) ; } dialogView = layoutInflater . inflate ( R . layout . password_dialog , null ) ; ( ( TextView ) dialogView . findViewById ( R . id . password_dialog_title ) ) . setText ( title ) ; ( ( T...
Show the password dialog
120,367
public void register ( boolean hasHistory , boolean usingHash , boolean usingColonForParametersInUrl ) { this . hasHistory = hasHistory ; this . usingHash = usingHash ; this . usingColonForParametersInUrl = usingColonForParametersInUrl ; }
Do NOT cll this method!
120,368
public String toDebugString ( ) { String name = this . getClass ( ) . getName ( ) ; name = name . substring ( name . lastIndexOf ( "." ) + 1 ) ; return "event: " + name + ":" ; }
This is a method used primarily for debugging . It gives a string representation of the event details . This does not override the toString method because the compiler cannot always optimize toString out correctly . Event types should override as desired .
120,369
@ SuppressWarnings ( "unchecked" ) public < S extends AbstractCompositeController < ? , ? , ? > > S getComposite ( String name ) { return ( S ) this . getComposites ( ) . get ( name ) ; }
Returns the composite stored under the composite name .
120,370
public boolean extendsClassOrInterface ( Types types , TypeMirror typeMirror , TypeMirror toImplement ) { String clearedToImplement = this . removeGenericsFromClassName ( toImplement . toString ( ) ) ; Set < TypeMirror > setOfSuperType = this . getFlattenedSupertypeHierarchy ( types , typeMirror ) ; for ( TypeMirror mi...
checks if a class or interface is implemented .
120,371
public void removeHandlers ( ) { Iterator < HandlerRegistration > it = registrations . iterator ( ) ; while ( it . hasNext ( ) ) { HandlerRegistration r = it . next ( ) ; it . remove ( ) ; r . removeHandler ( ) ; } }
Remove all handlers that have been added through this wrapper .
120,372
public < C extends AbstractComponentController < ? , ? , ? > > void storeInCache ( C controller ) { ControllerFactory . get ( ) . storeInCache ( controller ) ; controller . setCached ( true ) ; }
Stores the instance of the controller in the cache so that it can be reused the next time the route is called .
120,373
public < C extends AbstractComponentController < ? , ? , ? > > void removeFromCache ( C controller ) { ControllerFactory . get ( ) . removeFromCache ( controller ) ; controller . setCached ( false ) ; }
Removes a controller from the chache
120,374
public static void logNewUrl ( String newUrl ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "Router: new url ->>" ) . append ( newUrl ) . append ( "<<" ) ; ClientLogger . get ( ) . logSimple ( sb . toString ( ) , 0 ) ; }
Log s the new URL on the browser s console
120,375
private void onFinishLoading ( ) { String hashOnStart = this . plugin . getStartRoute ( isUsingHash ( ) ) ; if ( hashOnStart != null && hashOnStart . trim ( ) . length ( ) > 0 ) { ClientLogger . get ( ) . logDetailed ( "AbstractApplication: handle history (hash at start: >>" + hashOnStart + "<<" , 1 ) ; RouteResult rou...
Once the loader did his job we will continue
120,376
public static void setLocalVar ( ExecutionContext context , String name , Object value ) { LexicalEnvironment localEnv = context . getLexicalEnvironment ( ) ; localEnv . getRecord ( ) . createMutableBinding ( context , name , false ) ; localEnv . getRecord ( ) . setMutableBinding ( context , name , value , false ) ; }
A convenience for module providers . Sets a scoped variable on the provided ExecutionContext .
120,377
public static Object getLocalVar ( ExecutionContext context , String name ) { LexicalEnvironment localEnv = context . getLexicalEnvironment ( ) ; if ( localEnv . getRecord ( ) . hasBinding ( context , name ) ) { return localEnv . getRecord ( ) . getBindingValue ( context , name , false ) ; } return null ; }
A convenience for module providers . Gets a scoped variable from the provided ExecutionContext
120,378
protected String normalizeName ( String originalName ) { if ( originalName == null || originalName . endsWith ( ".js" ) ) { return originalName ; } return originalName + ".js" ; }
Helper method . Since module names should not include the . js extension but the actual modules themselves usually do .
120,379
private BasicBlock buildExitBasicBlock ( Stack < ExceptionRegion > nestedExceptionRegions , BasicBlock firstBB , List < BasicBlock > returnBBs , List < BasicBlock > exceptionBBs , boolean nextIsFallThrough , BasicBlock currBB , BasicBlock entryBB ) { exitBB = createBB ( nestedExceptionRegions ) ; graph . addEdge ( entr...
Create special empty exit BasicBlock that all BasicBlocks will eventually flow into . All Edges to this dummy BasicBlock will get marked with an edge type of EXIT .
120,380
public LocalVariable findVariable ( String name , int depth ) { LocalVariable variable = localVariables . get ( name ) ; if ( variable != null ) { if ( depth != 0 ) { return new LocalVariable ( name , variable . getOffset ( ) , depth ) ; } return variable ; } if ( parent != null ) { return parent . findVariable ( name ...
Tries to find a variable or returns null if it cannot . This will walk all scopes to find a captured variable .
120,381
public Variable acquireLocalVariable ( String name ) { int depth = 0 ; LocalVariable variable = findVariable ( name , depth ) ; if ( variable == null ) { variable = new LocalVariable ( name , localVariablesIndex , 0 ) ; localVariables . put ( name , variable ) ; localVariablesIndex ++ ; } return variable ; }
Return an existing variable or return a new one made in this scope .
120,382
protected File findFile ( List < String > loadPaths , String moduleName ) { String fileName = normalizeName ( moduleName ) ; File file = new File ( moduleName ) ; if ( file . isAbsolute ( ) ) { if ( file . exists ( ) ) { return file ; } } for ( String loadPath : loadPaths ) { file = new File ( loadPath , fileName ) ; i...
Finds the module file based on the known load paths .
120,383
private static void addJumpIfNextNotDestination ( CFG cfg , BasicBlock next , Instruction lastInstr , BasicBlock current ) { Iterator < BasicBlock > outs = cfg . getOutgoingDestinations ( current ) . iterator ( ) ; BasicBlock target = outs . hasNext ( ) ? outs . next ( ) : null ; if ( target != null && ! outs . hasNext...
If there is no jump at add of block and the next block is not destination insert a valid jump
120,384
public List < Variable > getUsedVariables ( ) { ArrayList < Variable > vars = new ArrayList < Variable > ( ) ; for ( Operand o : getOperands ( ) ) { o . addUsedVariables ( vars ) ; } return vars ; }
List of all variables used by this instruction .
120,385
public static Stream < Integer > range ( final int from , final int to , final int step ) { return new Stream < Integer > ( ) { public Iterator < Integer > iterator ( ) { return new ReadOnlyIterator < Integer > ( ) { int value = from ; public boolean hasNext ( ) { return value < to ; } public Integer next ( ) { final i...
Creates a stream that contains a given number of integers starting from a given number .
120,386
public static < T > Optional < T > of ( T value ) { return value == null ? ( Optional < T > ) EMPTY : new Optional < > ( value ) ; }
Returns an optional for a given value
120,387
public T or ( Func0 < T > func1 ) { return value != null ? value : func1 . call ( ) ; }
Returns value of uses a given factory if the value does not exist .
120,388
public < R > Optional < R > map ( Func1 < T , R > func1 ) { return value == null ? Optional . < R > empty ( ) : Optional . of ( func1 . call ( value ) ) ; }
Transforms the value if exists returns empty Optional otherwise .
120,389
public static < K , V > SolidMap < K , V > map ( K key , V value , Object ... pairs ) { if ( pairs . length % 2 != 0 ) throw new IllegalArgumentException ( "SolidMap.map(...) takes even number of arguments" ) ; LinkedHashMap < K , V > m = new LinkedHashMap < > ( ) ; m . put ( key , value ) ; for ( int i = 0 ; i < pairs...
Creates a map using interleaving keys and values .
120,390
public static < T > Stream < T > of ( final T value ) { return new Stream < T > ( ) { public Iterator < T > iterator ( ) { return new ReadOnlyIterator < T > ( ) { boolean has = true ; public boolean hasNext ( ) { return has ; } public T next ( ) { has = false ; return value ; } } ; } } ; }
Returns a stream with just one given element .
120,391
public < R > R collect ( Func1 < Iterable < T > , R > collector ) { return collector . call ( this ) ; }
Converts the current stream into any value with a given method .
120,392
public < R > Stream < R > map ( final Func1 < ? super T , ? extends R > func ) { return new Stream < R > ( ) { public Iterator < R > iterator ( ) { return new ReadOnlyIterator < R > ( ) { Iterator < T > iterator = Stream . this . iterator ( ) ; public boolean hasNext ( ) { return iterator . hasNext ( ) ; } public R nex...
Returns a new stream that contains items that has been returned by a given function for each item in the current stream .
120,393
public Stream < T > merge ( final T value ) { return new Stream < T > ( ) { public Iterator < T > iterator ( ) { return new ReadOnlyIterator < T > ( ) { Iterator < T > iterator = Stream . this . iterator ( ) ; boolean completed ; public boolean hasNext ( ) { return iterator . hasNext ( ) || ! completed ; } public T nex...
Returns a new stream that contains all items of the current stream with addition of a given item .
120,394
public Stream < T > separate ( final T value ) { return filter ( new Func1 < T , Boolean > ( ) { public Boolean call ( T it ) { return ( ( it == null ) ? ( value != null ) : ! it . equals ( value ) ) ; } } ) ; }
Returns a new stream that contains all items of the current stream except of a given item .
120,395
public Stream < T > merge ( final Iterable < ? extends T > with ) { return new Stream < T > ( ) { public Iterator < T > iterator ( ) { return new ReadOnlyIterator < T > ( ) { Iterator < T > iterator = Stream . this . iterator ( ) ; Iterator < ? extends T > withIterator = with . iterator ( ) ; public boolean hasNext ( )...
Adds items from another stream to the end of the current stream .
120,396
public < S , R > Stream < R > zipWith ( final Iterable < ? extends S > with , final Func2 < ? super T , ? super S , ? extends R > func ) { return new Stream < R > ( ) { public Iterator < R > iterator ( ) { return new ReadOnlyIterator < R > ( ) { Iterator < T > iterator = Stream . this . iterator ( ) ; Iterator < ? exte...
Returns a new stream that contains items that has been received by sequentially combining items of the streams into pairs and then applying given function to each pair of items .
120,397
public Stream < T > separate ( Iterable < T > from ) { final ArrayList < T > list = ToArrayList . < T > toArrayList ( ) . call ( from ) ; return filter ( new Func1 < T , Boolean > ( ) { public Boolean call ( T it ) { return ! list . contains ( it ) ; } } ) ; }
Returns a stream that includes only that items of the current stream that do not exist in a given stream .
120,398
public Stream < T > take ( final int count ) { return new Stream < T > ( ) { public Iterator < T > iterator ( ) { return new ReadOnlyIterator < T > ( ) { Iterator < T > iterator = Stream . this . iterator ( ) ; int left = count ; public boolean hasNext ( ) { return left > 0 && iterator . hasNext ( ) ; } public T next (...
Creates a new stream that contains only the first given amount of items of the current stream .
120,399
public Stream < T > skip ( final int count ) { return new Stream < T > ( ) { public Iterator < T > iterator ( ) { Iterator < T > iterator = Stream . this . iterator ( ) ; for ( int skip = count ; skip > 0 && iterator . hasNext ( ) ; skip -- ) iterator . next ( ) ; return iterator ; } } ; }
Creates a new stream that contains elements of the current stream with a given number of them skipped from the beginning .