idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
8,200
void download ( ) { final String path = location . getAbsolutePath ( ) ; logger . info ( "About to download Galaxy from " + downloader . toString ( ) + " to " + path ) ; this . downloader . downloadTo ( location , cache ) ; logger . info ( "Finished downloading Galaxy to " + path ) ; }
Performs the download of Galaxy .
8,201
public final int getRelativeX ( ) { NativeEvent e = getNativeEvent ( ) ; Element target = getTarget ( ) ; return e . getClientX ( ) - target . getAbsoluteLeft ( ) + target . getScrollLeft ( ) + target . getOwnerDocument ( ) . getScrollLeft ( ) ; }
Get relative x position on the page .
8,202
public final int getRelativeY ( ) { NativeEvent e = getNativeEvent ( ) ; Element target = getTarget ( ) ; return e . getClientY ( ) - target . getAbsoluteTop ( ) + target . getScrollTop ( ) + target . getOwnerDocument ( ) . getScrollTop ( ) ; }
Get relative y position on the page .
8,203
public static Function < Object , Collection < ? > > COLLECTION ( final Class < ? extends Collection > collectionType ) { return as ( new CollectionConverterImpl < > ( collectionType , null ) ) ; }
Converts an object to a collection
8,204
public static < T > Function < Object , Collection < T > > COLLECTION ( final Class < ? extends Collection > collectionType , final Class < T > componentType ) { return new CollectionConverterImpl < > ( collectionType , componentType ) ; }
Converts an object to a collection and converts the components as well .
8,205
private void setClassFields ( String name , String superClassName , String [ ] interfaces , int asmAccessMask , File location ) { this . className = translateInternalClassName ( name ) ; this . locationFound = location ; if ( ( superClassName != null ) && ( ! superClassName . equals ( "java/lang/Object" ) ) ) { this . ...
Set the fields in this object .
8,206
private int convertAccessMaskToModifierMask ( int asmAccessMask ) { int modifier = 0 ; if ( ( asmAccessMask & Opcodes . ACC_FINAL ) != 0 ) modifier |= Modifier . FINAL ; if ( ( asmAccessMask & Opcodes . ACC_NATIVE ) != 0 ) modifier |= Modifier . NATIVE ; if ( ( asmAccessMask & Opcodes . ACC_INTERFACE ) != 0 ) modifier ...
Convert an ASM access mask to a reflection Modifier mask .
8,207
public Message call ( ) throws InterruptedException { AbstractExpectation . LOGGER . info ( "Thread blocked waiting for message to pass condition {}." , this . getBlockingCondition ( ) ) ; try { this . latch . await ( ) ; this . manager . unsetExpectation ( this ) ; AbstractExpectation . LOGGER . info ( "Condition pass...
Will start the wait for the condition to become true .
8,208
public final String logOnServer ( LogRecord lr ) { String strongName = getPermutationStrongName ( ) ; logger . error ( lr . getMessage ( ) ) ; return null ; }
Logs a Log Record which has been serialized using GWT RPC on the server .
8,209
public void setSymbolMapsDirectory ( String symbolMapsDir ) { if ( deobfuscator == null ) { deobfuscator = new StackTraceDeobfuscator ( symbolMapsDir ) ; } else { deobfuscator . setSymbolMapsDirectory ( symbolMapsDir ) ; } }
By default this service does not do any deobfuscation . In order to do server side deobfuscation you must copy the symbolMaps files to a directory visible to the server and set the directory using this method .
8,210
public static String [ ] removePathTemplate ( List < MappedEndpoint > mappedEndpoints ) { return mappedEndpoints . stream ( ) . filter ( me -> ! me . type . equals ( MappedEndpoint . Type . STATIC ) ) . map ( me -> { int idx = me . url . indexOf ( "/{" ) ; return idx >= 0 ? me . url . substring ( 0 , idx ) : me . url ;...
best effort to resolve url that may be unique
8,211
private static Double3D normalizeDouble3D ( Double3D vector ) { double invertedlen = 1.0D / Math . sqrt ( vector . x * vector . x + vector . y * vector . y + vector . z * vector . z ) ; if ( ( invertedlen == ( 1.0D / 0.0D ) ) || ( invertedlen == ( - 1.0D / 0.0D ) ) || ( invertedlen == 0.0D ) || ( invertedlen != inverte...
Normalize a Double3D object
8,212
public static int findFreePort ( ) { ServerSocket socket = null ; try { socket = new ServerSocket ( 0 ) ; socket . setReuseAddress ( true ) ; int port = socket . getLocalPort ( ) ; try { socket . close ( ) ; } catch ( IOException e ) { } return port ; } catch ( IOException e ) { } finally { if ( socket != null ) { try ...
Returns a free port number on localhost .
8,213
public static boolean indexClassFile ( final Indexer indexer , final List < File > knownFiles , final File classFile ) { if ( knownFiles . contains ( classFile ) ) { return false ; } knownFiles . add ( classFile ) ; try ( final InputStream in = classFile . toURI ( ) . toURL ( ) . openStream ( ) ) { indexer . index ( in...
Indexes a single file except it was already analyzed .
8,214
public static void indexDir ( final Indexer indexer , final List < File > knownFiles , final File dir ) { final List < File > classes = Utils4J . pathsFiles ( dir . getPath ( ) , Utils4J :: classFile ) ; for ( final File file : classes ) { indexClassFile ( indexer , knownFiles , file ) ; } }
Indexes all classes in a directory or it s sub directories .
8,215
public static boolean indexJar ( final Indexer indexer , final List < File > knownFiles , final File jarFile ) { if ( knownFiles . contains ( jarFile ) ) { return false ; } knownFiles . add ( jarFile ) ; try ( final JarFile jar = new JarFile ( jarFile ) ) { final Enumeration < JarEntry > entries = jar . entries ( ) ; w...
Indexes a single JAR except it was already analyzed .
8,216
public static long totalImageDiff ( BufferedImage img1 , BufferedImage img2 ) { int width = img1 . getWidth ( ) ; int height = img1 . getHeight ( ) ; if ( ( width != img2 . getWidth ( ) ) || ( height != img2 . getHeight ( ) ) ) { throw new IllegalArgumentException ( "Image dimensions do not match" ) ; } long diff = 0 ;...
The total difference between two images calculated as the sum of the difference in RGB values of each pixel the images MUST be the same dimensions .
8,217
public < T > T to ( Class < T > targetType ) { if ( targetType == String . class ) { return ( T ) value ; } try { final String methodName ; final Class type ; if ( targetType . isPrimitive ( ) ) { final String typeName = targetType . getSimpleName ( ) ; methodName = "parse" + typeName . substring ( 0 , 1 ) . toUpperCas...
Converts the underlying string value to a primitive value .
8,218
public static void addNewAgent ( ShanksSimulation sim , ShanksAgent agent ) throws ShanksException { sim . registerShanksAgent ( agent ) ; if ( sim . schedule . getTime ( ) < 0 ) { sim . schedule . scheduleRepeating ( Schedule . EPOCH , 2 , agent , 1 ) ; } else { sim . schedule . scheduleRepeating ( sim . schedule . ge...
Adds an agent to the simulation
8,219
public static void removeAgent ( ShanksSimulation sim , String agentID ) throws ShanksException { sim . logger . info ( "Stoppable not fount. Attempting direct stop..." ) ; sim . unregisterShanksAgent ( agentID ) ; sim . logger . info ( "Agent " + agentID + " stopped." ) ; }
Removes an agent with the given name from the simulation
8,220
public synchronized void clear ( ) { peers . clear ( ) ; for ( Future < ? > timeout : timeouts . values ( ) ) { timeout . cancel ( true ) ; } timeouts . clear ( ) ; }
Clear all known peers
8,221
private void notifyConnected ( Peer peer ) { for ( Listener listener : new HashSet < > ( listeners ) ) { listener . onConnected ( peer ) ; } }
Notifies all registered listeners of the connected peer
8,222
private void notifyActive ( Peer peer ) { for ( Listener listener : new HashSet < > ( listeners ) ) { listener . onActive ( peer ) ; } }
Notifies all registered listeners of the active peer
8,223
private void notifyInactive ( Peer peer ) { for ( Listener listener : new HashSet < > ( listeners ) ) { listener . onInactive ( peer ) ; } }
Notifies all registered listeners of the inactive peer
8,224
private void notifyDisconnected ( Peer peer ) { for ( Listener listener : new HashSet < > ( listeners ) ) { listener . onDisconnected ( peer ) ; } }
Notifies all registered listeners of the disconnected peer
8,225
protected final boolean complies ( final String value , final String constValue , final String separators ) { if ( value == null ) { return false ; } else { final StringTokenizer tok = new StringTokenizer ( value , separators ) ; while ( tok . hasMoreTokens ( ) ) { final String t = tok . nextToken ( ) ; if ( t . equals...
Helper method for subclasses to do the comparation .
8,226
public final SgArgument getLastArgument ( ) { final int size = arguments . size ( ) ; if ( size == 0 ) { return null ; } return arguments . get ( size - 1 ) ; }
Returns the last argument of the list .
8,227
public final void addArgument ( final SgArgument arg ) { if ( arg == null ) { throw new IllegalArgumentException ( "The argument 'arg' cannot be null!" ) ; } if ( arg . getOwner ( ) != this ) { throw new IllegalArgumentException ( "The owner of 'arg' is different from 'this'!" ) ; } if ( ! arguments . contains ( arg ) ...
Adds an argument to the list . Does nothing if the argument is already in the list of arguments . You will never need to use this method in your code! An argument is added automatically to the owning behavior when it s constructed!
8,228
public final void addException ( final SgClass clasz ) { if ( clasz == null ) { throw new IllegalArgumentException ( "The argument 'clasz' cannot be null!" ) ; } if ( ! exceptions . contains ( clasz ) ) { exceptions . add ( clasz ) ; } }
Adds an exception to the list . Does nothing if the class is already in the list of exceptions .
8,229
public boolean run ( ) { ExecutorService executors = Executors . newFixedThreadPool ( producers . size ( ) + consumers . size ( ) ) ; runningProducers . set ( producers . size ( ) ) ; for ( Producer < V > producer : producers ) { producer . setOwner ( this ) ; executors . submit ( new ProducerThread ( producer ) ) ; } ...
Starts execution of the broker .
8,230
public void execute ( final T runnable ) { synchronized ( queue ) { if ( runnable != null && ! disabled ) { queue . addLast ( runnable ) ; queue . notify ( ) ; System . out . println ( "WorkQueue has added runable - WorkQueue size is " + queue . size ( ) ) ; } } }
Add a Runnable object to the pool to be executed once a thread is available
8,231
public static void runAndWait ( final Runnable r ) { try { if ( r != null ) { final Thread thread = new Thread ( r ) ; thread . start ( ) ; thread . join ( ) ; } } catch ( final Exception ex ) { LOG . debug ( "Thread has been interrupted and cannot be joined" , ex ) ; } }
Provides the boilerplate code for running and waiting on a Runnable .
8,232
protected String getNewLockValue ( long timeoutInMillis ) { long time = System . currentTimeMillis ( ) + timeoutInMillis + 1l ; String lockValue = ApplicationContext . NODE_ID + ":" + time ; return lockValue ; }
Return the new value for the lock for given timeout .
8,233
public File locatePom ( final File folder ) { if ( folder != null && folder . exists ( ) && folder . isDirectory ( ) ) { String moduleVersion = folder . getParentFile ( ) . getName ( ) ; File [ ] list = folder . listFiles ( ) ; File [ ] four = new File [ CeylonUtil . NUM_CEYLON_JAVA_DEP_TYPES ] ; for ( File file : list...
Implementing Maven API to locate the project model .
8,234
public T findOneByAttribute ( String attribute , Object value ) { CriteriaBuilder cb = getEntityManager ( ) . getCriteriaBuilder ( ) ; CriteriaQuery < T > query = cb . createQuery ( getEntityClass ( ) ) ; Root < T > from = query . from ( getEntityClass ( ) ) ; query . where ( cb . equal ( from . get ( attribute ) , val...
Finds an entity by a given attribute . Returns null if none was found .
8,235
protected void execute ( EntityManagerCommand command ) { try { getEntityManagerCommandExecutor ( ) . execute ( command ) ; } catch ( javax . persistence . PersistenceException e ) { throw new PersistenceException ( e ) ; } }
Executes the given command using an EntityManagerCommandExecutor .
8,236
public void removeTimeChart ( String chartID ) throws ShanksException { Scenario3DPortrayal scenarioPortrayal = ( Scenario3DPortrayal ) this . getSimulation ( ) . getScenarioPortrayal ( ) ; scenarioPortrayal . removeTimeChart ( chartID ) ; }
Remove a chart to the simulation
8,237
public void addScatterPlot ( String scatterID , String xAxisLabel , String yAxisLabel ) throws ShanksException { Scenario3DPortrayal scenarioPortrayal = ( Scenario3DPortrayal ) this . getSimulation ( ) . getScenarioPortrayal ( ) ; scenarioPortrayal . addScatterPlot ( scatterID , xAxisLabel , yAxisLabel ) ; }
Add a Scatter Plot to the simulation
8,238
public static < T extends Comparable < ? super T > > Integer getSortOrder ( final T first , final T second ) { if ( first == null && second == null ) return null ; if ( first == null && second != null ) return - 1 ; if ( first != null && second == null ) return 1 ; return first . compareTo ( second ) ; }
Provides an easy way to compare two possibly null comparable objects
8,239
public static < T > boolean isEqual ( final T first , final T second ) { if ( first == second ) return true ; if ( first == null && second != null ) return false ; return first . equals ( second ) ; }
Provides an easy way to see if two possibly null objects are equal
8,240
public static String [ ] trimStringArray ( final String [ ] input ) { final ArrayList < String > output = new ArrayList < String > ( ) ; for ( int i = 0 ; i < input . length ; i ++ ) { String s = input [ i ] . trim ( ) ; if ( ! s . equals ( "" ) ) output . add ( s ) ; } return output . toArray ( new String [ 0 ] ) ; }
Trims an array of Strings to remove the whitespace . If the string is empty then its removed from the array .
8,241
public ConcatVector newWeightsVector ( boolean presize ) { ConcatVector vector = new ConcatVector ( featureToIndex . size ( ) ) ; if ( presize ) { for ( ObjectCursor < String > s : sparseFeatureIndex . keys ( ) ) { int size = sparseFeatureIndex . get ( s . value ) . size ( ) ; vector . setDenseComponent ( ensureFeature...
This constructs a fresh vector that is sized correctly to accommodate all the known sparse values for vectors that are possibly sparse .
8,242
public int ensureFeature ( String featureName ) { int feature = featureToIndex . getOrDefault ( featureName , - 1 ) ; if ( feature == - 1 ) { synchronized ( featureToIndex ) { feature = featureToIndex . getOrDefault ( featureName , - 1 ) ; if ( feature == - 1 ) { feature = featureToIndex . size ( ) ; featureToIndex . p...
An optimization this lets clients inform the ConcatVectorNamespace of how many features to expect so that we can avoid resizing ConcatVectors .
8,243
public int ensureSparseFeature ( String featureName , String index ) { ensureFeature ( featureName ) ; ObjectIntMap < String > sparseIndex = sparseFeatureIndex . get ( featureName ) ; IntObjectMap < String > reverseSparseIndex = reverseSparseFeatureIndex . get ( featureName ) ; if ( sparseIndex == null || reverseSparse...
An optimization this lets clients inform the ConcatVectorNamespace of how many sparse feature components to expect again so that we can avoid resizing ConcatVectors .
8,244
public void setDenseFeature ( ConcatVector vector , String featureName , double [ ] value ) { vector . setDenseComponent ( ensureFeature ( featureName ) , value ) ; }
This adds a dense feature to a vector setting the appropriate component of the given vector to the passed in value .
8,245
public void setSparseFeature ( ConcatVector vector , String featureName , String index , double value ) { vector . setSparseComponent ( ensureFeature ( featureName ) , ensureSparseFeature ( featureName , index ) , value ) ; }
This adds a sparse feature to a vector setting the appropriate component of the given vector to the passed in value .
8,246
public void debugVector ( ConcatVector vector , BufferedWriter bw ) throws IOException { List < String > features = new ArrayList < > ( ) ; Map < String , List < Integer > > sortedFeatures = new HashMap < > ( ) ; for ( ObjectCursor < String > key : featureToIndex . keys ( ) ) { features . add ( key . value ) ; int i = ...
This prints out a ConcatVector by mapping to the namespace to make debugging learning algorithms easier .
8,247
private void debugFeatureValue ( String feature , int index , ConcatVector vector , BufferedWriter bw ) throws IOException { bw . write ( "\t" ) ; if ( sparseFeatureIndex . containsKey ( feature ) && sparseFeatureIndex . get ( feature ) . values ( ) . contains ( index ) ) { bw . write ( "SPARSE VALUE \"" ) ; bw . write...
This writes a feature s individual value using the human readable name if possible to a StringBuilder
8,248
public String format ( Object ... array ) { if ( array == null ) { return StringUtils . EMPTY ; } if ( array . length == 1 && array [ 0 ] . getClass ( ) . isArray ( ) ) { return format ( Convert . convert ( array [ 0 ] , Iterable . class ) ) ; } return format ( Arrays . asList ( array ) . iterator ( ) ) ; }
Formats the items in an Array .
8,249
public static String sha1Hash ( File file ) throws IOException { try { DigestInputStream inputStream = new DigestInputStream ( new FileInputStream ( file ) , MessageDigest . getInstance ( "SHA-1" ) ) ; try { byte [ ] buffer = new byte [ 4098 ] ; while ( inputStream . read ( buffer ) != - 1 ) { } return bytesToHex ( inp...
Generate a SHA . 1 Hash for a given file .
8,250
public static void off ( HammerTime hammerTime , EventType eventType , NativeHammmerHandler callback ) { off ( hammerTime , callback , eventType . getText ( ) ) ; }
Unregister hammer event .
8,251
public String getProxyURLString ( HttpServletRequest req ) throws MalformedURLException { String proxyUrlString = proxyURLPrefix ; if ( req . getPathInfo ( ) != null ) if ( req . getPathInfo ( ) . length ( ) > 0 ) proxyUrlString += req . getPathInfo ( ) ; if ( req . getQueryString ( ) != null ) if ( req . getQueryStrin...
Create the url string for the proxy server .
8,252
public HttpRequestBase getHttpRequest ( HttpServletRequest req , String urlString ) { HttpRequestBase httpget = null ; String method = req . getMethod ( ) ; if ( GET . equalsIgnoreCase ( method ) ) httpget = new HttpGet ( urlString ) ; else if ( POST . equalsIgnoreCase ( method ) ) httpget = new HttpPost ( urlString ) ...
Get the correct client type for this request .
8,253
public void addHeaders ( HttpServletRequest reqSource , HttpRequestBase httpTarget ) { Enumeration < ? > headerNames = reqSource . getHeaderNames ( ) ; while ( headerNames . hasMoreElements ( ) ) { String key = headerNames . nextElement ( ) . toString ( ) ; if ( CONTENT_LENGTH . equalsIgnoreCase ( key ) ) continue ; En...
Move the header info to the proxy request .
8,254
public void getDataFromClient ( HttpRequestBase httpget , OutputStream streamOut ) throws ClientProtocolException , IOException { HttpClient httpclient = new DefaultHttpClient ( ) ; HttpResponse response = httpclient . execute ( httpget ) ; HttpEntity entity = response . getEntity ( ) ; if ( entity != null ) { InputStr...
Get the data from the proxy and send it to the client .
8,255
public static void transferURLStream ( InputStream streamIn , OutputStream streamOut ) { try { byte [ ] cbuf = new byte [ 1000 ] ; int iLen = 0 ; while ( ( iLen = streamIn . read ( cbuf , 0 , cbuf . length ) ) > 0 ) { streamOut . write ( cbuf , 0 , iLen ) ; } streamIn . close ( ) ; if ( streamIn != null ) streamIn . cl...
Transfer the data stream from this URL to another stream .
8,256
File findSdkHome ( final String path ) { File dotCeylon = new File ( path ) ; File [ ] homes = null ; if ( ! dotCeylon . exists ( ) ) { return null ; } else { homes = dotCeylon . listFiles ( new FilenameFilter ( ) { public boolean accept ( final File dir , final String name ) { if ( name . startsWith ( "ceylon-1." ) ) ...
Find Ceylon SDK home in a folder in the form of ceylon - 1 . x . x .
8,257
public Class < ? > getType ( String key ) { if ( beanDescriptor . hasReadMethod ( key ) ) { return beanDescriptor . getReadMethod ( key ) . getReturnType ( ) ; } else if ( beanDescriptor . hasWriteMethod ( key ) ) { Class < ? > [ ] paramTypes = beanDescriptor . getWriteMethod ( key ) . getParameterTypes ( ) ; if ( para...
Gets the type of the parameter on the setter method .
8,258
public T get ( X primaryID ) { if ( primaryID == null ) { return null ; } T dbObject = this . mongoTemplate . findById ( primaryID , this . entityClass ) ; return dbObject ; }
Return the object as defined by this primary key .
8,259
public boolean insert ( T entity ) { if ( entity == null ) { return false ; } X primaryID = getPrimaryID ( entity ) ; if ( primaryID != null ) { if ( ! allowEmptyOrZeroID ( ) && AssertUtils . isEmpty ( primaryID ) ) { return false ; } } try { this . mongoTemplate . insert ( entity ) ; } catch ( RuntimeException e ) { r...
Insert the object into the data store .
8,260
public boolean update ( T entity ) { if ( entity == null ) { return false ; } X primaryID = getPrimaryID ( entity ) ; if ( primaryID == null ) { return false ; } if ( ! allowEmptyOrZeroID ( ) && AssertUtils . isEmpty ( primaryID ) ) { return false ; } this . mongoTemplate . save ( entity ) ; return true ; }
Update the entity in the data store .
8,261
public boolean addOrUpdate ( T object ) { if ( object == null ) { return false ; } X primaryID = getPrimaryID ( object ) ; if ( primaryID == null ) { this . mongoTemplate . save ( object ) ; return true ; } if ( ! allowEmptyOrZeroID ( ) && AssertUtils . isEmpty ( primaryID ) ) { return false ; } this . mongoTemplate . ...
Add or update an existing object in the data store .
8,262
public T delete ( X primaryID ) { if ( primaryID == null ) { return null ; } T entity = get ( primaryID ) ; if ( entity == null ) { return null ; } this . mongoTemplate . remove ( entity ) ; return entity ; }
Delete the object against the given primary key .
8,263
public X getPrimaryID ( T entity ) { if ( mappingContext == null || conversionService == null ) { fetchMappingContextAndConversionService ( ) ; } MongoPersistentEntity < ? > persistentEntity = mappingContext . getPersistentEntity ( entity . getClass ( ) ) ; MongoPersistentProperty idProperty = persistentEntity . getIdP...
Extract the value of the primary ID of the entity object
8,264
private synchronized void fetchMappingContextAndConversionService ( ) { if ( mappingContext == null ) { MongoConverter mongoConverter = this . mongoTemplate . getConverter ( ) ; mappingContext = mongoConverter . getMappingContext ( ) ; conversionService = mongoConverter . getConversionService ( ) ; MongoPersistentEntit...
Get the basic services from mongo template
8,265
public void readConfiguration ( File configFile ) throws TracerFactory . Exception , FileNotFoundException { if ( ! configFile . exists ( ) ) throw new FileNotFoundException ( configFile + "doesn't exist." ) ; try ( FileInputStream fileInputStream = new FileInputStream ( configFile ) ) { readConfiguration ( fileInputSt...
Reads the given configuration file validates it against a XML - Schema and creates the tracer pool its mappings and the queue accordingly . This method should normally be invoked once at program start . Multiple calls with the same configuration file leads to instantiations of new tracer objects and mappings which will...
8,266
public AbstractTracer getTracer ( String name ) throws TracerFactory . Exception { this . poolReadLock . lock ( ) ; try { return getTracerByName ( name ) ; } finally { this . poolReadLock . unlock ( ) ; } }
Returns the pooled tracer with the given name .
8,267
public void reset ( ) { this . poolWriteLock . lock ( ) ; try { this . defaultTracer = TracerFactory . NULLTRACER ; this . threadName2Element . clear ( ) ; this . threadNames . clear ( ) ; this . tracerMap . clear ( ) ; this . tracerPool . clear ( ) ; } finally { this . poolWriteLock . unlock ( ) ; } this . queueWriteL...
Clears the pool the mappings and the queue .
8,268
public void openPoolTracer ( ) { this . poolWriteLock . lock ( ) ; try { for ( AbstractTracer tracer : this . tracerPool . values ( ) ) { tracer . open ( ) ; } } finally { this . poolWriteLock . unlock ( ) ; } }
Opens all pooled tracers .
8,269
public void closePoolTracer ( ) { this . poolWriteLock . lock ( ) ; try { for ( AbstractTracer tracer : this . tracerPool . values ( ) ) { tracer . close ( ) ; } } finally { this . poolWriteLock . unlock ( ) ; } }
Closes all pooled tracers .
8,270
public boolean openQueueTracer ( ) { final int TRIALS = 5 ; int tracerCounter = 0 , trialCounter = 0 ; boolean success = false ; do { this . queueWriteLock . lock ( ) ; try { if ( this . queueConfig . enabled ) { for ( QueueTracer < ? > queueTracer : this . queueConfig . blockingTracerDeque ) { if ( ! queueTracer . isO...
Tries to open all enqueued QueueTracer .
8,271
public QueueTracer < ? > getCurrentQueueTracer ( ) { this . queueReadLock . lock ( ) ; try { QueueTracer < ? > tracer ; if ( this . queueConfig . enabled ) { tracer = this . queueConfig . currentTracer . get ( ) ; if ( tracer == null ) { tracer = this . queueConfig . queueNullTracer ; } } else { tracer = this . queueCo...
Returns the QueueTracer for the current thread . If no one was found a QueueNullTracer will be returned .
8,272
void setValue ( String optionValue ) { if ( StringUtils . isNullOrBlank ( optionValue ) && isBoolean ( ) ) { this . value = true ; } else if ( ! StringUtils . isNullOrBlank ( optionValue ) ) { if ( Collection . class . isAssignableFrom ( type ) ) { Class < ? > genericType = field == null ? String . class : ( Class < ? ...
Sets the value of the option .
8,273
public boolean includes ( T value , boolean inclusive ) { if ( inclusive ) { return value . compareTo ( getStart ( ) ) >= 0 && value . compareTo ( getEnd ( ) ) <= 0 ; } else { return value . compareTo ( getStart ( ) ) > 0 && value . compareTo ( getEnd ( ) ) < 0 ; } }
Checks whether the given value is included in this range . If inclusive is set to true checking for 1 in the range of 1 10 will return true .
8,274
public final void process ( final File file ) { if ( file == null ) { throw new IllegalArgumentException ( "Argument 'file' cannot be NULL" ) ; } if ( file . isFile ( ) ) { handler . handleFile ( file ) ; } else { processDir ( file ) ; } }
Processes a file or directory .
8,275
protected final Object getProperty ( final Object obj , final String property ) { if ( ( obj == null ) || ( property == null ) || ( property . trim ( ) . length ( ) == 0 ) ) { return null ; } final String [ ] getterNames = createGetterNames ( property ) ; for ( int i = 0 ; i < getterNames . length ; i ++ ) { final Stri...
Return the value of a property via reflection .
8,276
public static String generateCompilationStacktrace ( final DiagnosticCollector < JavaFileObject > diagnosticCollectors ) { final StringBuilder sb = new StringBuilder ( ) ; for ( final Diagnostic < ? extends JavaFileObject > diagnostic : diagnosticCollectors . getDiagnostics ( ) ) { sb . append ( diagnostic . getMessage...
Generate a compilation stacktrace from the given parameter .
8,277
public static String getClassNameWithExtension ( final String className ) { return new StringBuilder ( ) . append ( className ) . append ( Kind . SOURCE . extension ) . toString ( ) ; }
Gets the class name with java file extension .
8,278
public static String newQualifiedClassName ( final String packageName , final String className ) { if ( StringUtils . isBlank ( packageName ) ) { return className ; } return new StringBuilder ( ) . append ( packageName ) . append ( SeparatorConstants . DOT ) . append ( className ) . toString ( ) ; }
Factory method for create a qualified class name from the given arguments .
8,279
public void waitUntilNoMoreException ( final Runnable runnable , final List < Class < ? extends Exception > > expectedExceptions ) { final List < RuntimeException > actualExceptions = new ArrayList < > ( ) ; int tries = 0 ; while ( tries < maxTries ) { try { runnable . run ( ) ; return ; } catch ( final RuntimeExceptio...
Wait until no more expected exception is thrown or the number of wait cycles has been exceeded .
8,280
public void clear ( ) { this . min = Double . POSITIVE_INFINITY ; this . max = Double . NEGATIVE_INFINITY ; this . sum = 0 ; this . sumOfSq = 0 ; this . count = 0 ; }
Clears the accumulated values .
8,281
public double getPopulationVariance ( ) { if ( getCount ( ) <= 0 ) { return Double . NaN ; } else if ( getCount ( ) == 1 ) { return 0d ; } return Math . abs ( getSumOfSquares ( ) - getAverage ( ) * getSum ( ) ) / getCount ( ) ; }
Gets the population variance .
8,282
public Template getTemplate ( final String parentName , final String name ) throws ResourceNotFoundException { return getTemplate ( this . loader . concat ( parentName , name ) ) ; }
get template by parent template s name and it s relative name .
8,283
public Template getTemplate ( final String name ) throws ResourceNotFoundException { final Template template = this . cachedTemplates . get ( name ) ; if ( template != null ) { return template ; } return createTemplateIfAbsent ( name ) ; }
get template by name .
8,284
public boolean exists ( final String resourceName ) { final Loader myLoader = this . loader ; final String normalizedName = myLoader . normalize ( resourceName ) ; if ( normalizedName == null ) { return false ; } return myLoader . get ( normalizedName ) . exists ( ) ; }
if exists this resource .
8,285
public static Engine create ( final String configPath , final Map < String , Object > parameters ) { return create ( createConfigProps ( configPath ) , parameters ) ; }
Create a Engine with given configPath and extra - parameters .
8,286
public static Engine create ( final Props props , final Map < String , Object > parameters ) { final Petite petite = new Petite ( ) ; petite . config ( props , parameters ) ; petite . initComponents ( ) ; final Engine engine = petite . get ( Engine . class ) ; engine . getLogger ( ) . info ( "Loaded props: {}" , props ...
Create a Engine with given baseProps and extra - parameters .
8,287
@ SuppressWarnings ( "unchecked" ) public static Sequence run ( Query query , QueryableIndex index ) { return findFactory ( query ) . createRunner ( new QueryableIndexSegment ( "" , index ) ) . run ( query , null ) ; }
Executes a Query by identifying the appropriate QueryRunner
8,288
public void executeJob ( ) { AbstractApplicationContext springContext = SpringContext . getContext ( getSpringConfigurationClass ( ) ) ; StreamingCinchJob cinchJob = springContext . getBean ( StreamingCinchJob . class ) ; cinchJob . execute ( this ) ; }
Executes your streaming job from the spring context .
8,289
public < T > ForeachRddFunction < T > foreachRddFunction ( Class < ? extends VoidFunction < T > > springBeanClass ) { return new ForeachRddFunction < > ( voidFunction ( springBeanClass ) ) ; }
Create a new ForeachRddFunction which implements Spark s VoidFunction interface .
8,290
final void renderTo ( final ByteBuffer out ) { final ByteBuffer code = this . code ; out . putShort ( access ) . putShort ( name ) . putShort ( desc ) ; int attributeCount = 0 ; if ( code . length > 0 ) { ++ attributeCount ; } int exceptionCount = exceptions . length ; if ( exceptionCount > 0 ) { ++ attributeCount ; } ...
Puts the bytecode of this method in the given byte vector .
8,291
public static < E > E notNull ( E obj , String msg ) { if ( obj == null ) { throw ( msg == null ) ? new NullPointerException ( ) : new NullPointerException ( msg ) ; } return obj ; }
An assertion method that makes null validation more fluent
8,292
public static Loader csv ( Reader reader , List < String > columns , List < String > dimensions , String timestampDimension ) { return new CSVLoader ( reader , columns , dimensions , timestampDimension ) ; }
CSVLoader implementation of the Loader
8,293
private Item newInteger ( final int value ) { Item result = get ( key . set ( INT , value ) ) ; if ( result == null ) { pool . putByte ( INT ) . putInt ( value ) ; result = new Item ( poolIndex ++ , key ) ; put ( result ) ; } return result ; }
Adds an integer to the constant pool of the class being build . Does nothing if the constant pool already contains a similar item .
8,294
private Item newFloat ( final float value ) { Item result = get ( key . set ( FLOAT , value ) ) ; if ( result == null ) { pool . putByte ( FLOAT ) . putInt ( Float . floatToIntBits ( value ) ) ; result = new Item ( poolIndex ++ , key ) ; put ( result ) ; } return result ; }
Adds a float to the constant pool of the class being build . Does nothing if the constant pool already contains a similar item .
8,295
private Item newLong ( final long value ) { Item result = get ( key . set ( LONG , value ) ) ; if ( result == null ) { pool . putByte ( LONG ) . putLong ( value ) ; result = new Item ( poolIndex , key ) ; put ( result ) ; poolIndex += 2 ; } return result ; }
Adds a long to the constant pool of the class being build . Does nothing if the constant pool already contains a similar item .
8,296
private Item newString ( final String value ) { Item result = get ( key2 . set ( STR , value , null , null ) ) ; if ( result == null ) { pool . putBS ( STR , newUTF8 ( value ) ) ; result = new Item ( poolIndex ++ , key2 ) ; put ( result ) ; } return result ; }
Adds a string to the constant pool of the class being build . Does nothing if the constant pool already contains a similar item .
8,297
private void put122 ( final int b , final int s1 , final int s2 ) { pool . putBS ( b , s1 ) . putShort ( s2 ) ; }
Puts one byte and two shorts into the constant pool .
8,298
public static ByteBuffer readFile ( File inFile ) throws IOException { ByteBuffer mBuf ; try ( FileInputStream fIn = new FileInputStream ( inFile ) ; FileChannel fChan = fIn . getChannel ( ) ) { long fSize = fChan . size ( ) ; mBuf = ByteBuffer . allocate ( ( int ) fSize ) ; fChan . read ( mBuf ) ; mBuf . rewind ( ) ; ...
Helper method to read a file into a ByteBuffer
8,299
public static boolean shouldFilter ( final IVulnerabilityFilter filter , final List < PackageCoordinate > path , final String vid ) { return ( ( VulnerabilityFilterImpl ) filter ) . shouldFilter ( path , vid ) ; }
Kind of filthy this being here . It is in lieu of making a separate utility class for now . It allows us to run the filter without exposing private functionality to the users .