idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
12,700 | public static Identity createOverlayManagerGroup ( String name ) { return ExtendedIdentifiers . createExtendedIdentifier ( IfmapStrings . ICS_METADATA_NS_URI , IfmapStrings . ICS_METADATA_PREFIX , "overlay-manager-group" , name ) ; } | Create a overlay - manager - group identifier that is an extended identity identifier . |
12,701 | public static List < List < Argument > > sort ( List < Argument > args ) { int i ; int max ; List < List < Argument > > result ; List < RelatedArgument > remaining ; List < RelatedArgument > heads ; result = new ArrayList < List < Argument > > ( ) ; remaining = createRelatedArgs ( args ) ; while ( true ) { max = remaining . size ( ) ; if ( max == 0 ) { return result ; } heads = new ArrayList < RelatedArgument > ( ) ; for ( i = 0 ; i < max ; i ++ ) { addHead ( heads , remaining . get ( i ) ) ; } remaining . clear ( ) ; result . add ( separate ( heads , remaining ) ) ; } } | Returns the sorted list of lists of arguments . |
12,702 | public void setEnvelopeFrom ( String address ) throws AddressException { if ( StringUtils . isEmpty ( address ) ) { this . envelopeFrom = address ; } else { InternetAddress tmp = toInternetAddress ( address , null ) ; this . envelopeFrom = tmp . getAddress ( ) ; } } | set the SMTP Envelope address of the email |
12,703 | public void setFrom ( String address , String personal ) throws AddressException { from = toInternetAddress ( address , personal ) ; } | set the From address of the email |
12,704 | public void setReplyTo ( String address , String personal ) throws AddressException { replyTo = toInternetAddress ( address , personal ) ; } | sets the reply to address |
12,705 | public void addCc ( String address , String personal ) throws AddressException { if ( cc == null ) { cc = new ArrayList < > ( ) ; } cc . add ( toInternetAddress ( address , personal ) ) ; } | adds a CC recipient |
12,706 | public void addBcc ( String address , String personal ) throws AddressException { if ( bcc == null ) { bcc = new ArrayList < > ( ) ; } bcc . add ( toInternetAddress ( address , personal ) ) ; } | adds a BCC recipient |
12,707 | public Proxy setType ( String type ) { if ( this . type . equals ( type ) || ( type == null && this . type . length ( ) <= 0 ) ) { return this ; } return new Proxy ( type , host , port , auth ) ; } | Sets the type of the proxy . |
12,708 | public Proxy setHost ( String host ) { if ( this . host . equals ( host ) || ( host == null && this . host . length ( ) <= 0 ) ) { return this ; } return new Proxy ( type , host , port , auth ) ; } | Sets the host of the proxy . |
12,709 | public Proxy setPort ( int port ) { if ( this . port == port ) { return this ; } return new Proxy ( type , host , port , auth ) ; } | Sets the port number for the proxy . |
12,710 | public Proxy setAuthentication ( Authentication auth ) { if ( eq ( this . auth , auth ) ) { return this ; } return new Proxy ( type , host , port , auth ) ; } | Sets the authentication to use for the proxy connection . |
12,711 | public String get ( String columnCode ) throws UnknownColumnException { for ( DataColumn column : columns ) { if ( columnCode . equals ( column . getCode ( ) ) ) { return content . get ( column ) ; } } throw new UnknownColumnException ( columnCode ) ; } | Returns this row s content for the given column . |
12,712 | public DataRow set ( String columnCode , String value ) throws UnknownColumnException { for ( DataColumn column : columns ) { if ( columnCode . equals ( column . getCode ( ) ) ) { content . put ( column , value ) ; return this ; } } throw new UnknownColumnException ( columnCode ) ; } | Sets this row s content for the given column . |
12,713 | public DataRow setAll ( int offset , String ... values ) throws TooManyColumnsException { if ( offset + values . length > columns . size ( ) ) { throw new TooManyColumnsException ( columns . size ( ) , offset + values . length ) ; } for ( int i = 0 ; i + offset < columns . size ( ) && i < values . length ; i ++ ) { content . put ( columns . get ( i ) , values [ i - offset ] ) ; } return this ; } | Sets multiple columns of this row starting from the given offset . |
12,714 | private void readObject ( ObjectInputStream in ) throws IOException , ClassNotFoundException , NoSuchMethodException { componentType = ClassRef . read ( in ) ; } | Reads this Constructor . |
12,715 | private static CommunicationHandler newHandlerPreference ( String handlerProp , String url , String user , String pass , SSLSocketFactory sslSocketFactory , HostnameVerifier verifier , int initialConnectionTimeout ) throws InitializationException { if ( handlerProp == null ) { throw new NullPointerException ( ) ; } if ( handlerProp . equals ( "java" ) ) { return new JavaCommunicationHandler ( url , user , pass , sslSocketFactory , verifier , initialConnectionTimeout ) ; } else if ( handlerProp . equals ( "apache" ) ) { try { return new ApacheCoreCommunicationHandler ( url , user , pass , sslSocketFactory , verifier , initialConnectionTimeout ) ; } catch ( NoClassDefFoundError e ) { throw new InitializationException ( "Could not initialize ApacheCommunicationHandler" ) ; } } else { throw new InitializationException ( "Invalid " + HANDLER_PROPERTY + " value" ) ; } } | Helper to return the handler which is indicated by handlerProp |
12,716 | public void configureLogging ( final LoggingSettings loggingSettings ) { final Logger root = ( Logger ) LoggerFactory . getLogger ( org . slf4j . Logger . ROOT_LOGGER_NAME ) ; final LoggerContext context = root . getLoggerContext ( ) ; context . reset ( ) ; final LevelChangePropagator propagator = new LevelChangePropagator ( ) ; propagator . setContext ( context ) ; propagator . setResetJUL ( true ) ; root . setLevel ( loggingSettings . getLevel ( ) ) ; for ( final Map . Entry < String , Level > entry : loggingSettings . getLoggers ( ) . entrySet ( ) ) { ( ( Logger ) LoggerFactory . getLogger ( entry . getKey ( ) ) ) . setLevel ( entry . getValue ( ) ) ; } if ( loggingSettings . getLogFile ( ) . isEnabled ( ) ) { root . addAppender ( getFileAppender ( loggingSettings . getLogFile ( ) , context ) ) ; } if ( loggingSettings . getConsole ( ) . isEnabled ( ) ) { root . addAppender ( getConsoleAppender ( loggingSettings . getConsole ( ) , context ) ) ; } } | Configure logging . |
12,717 | public void initialize ( ) { Enumeration enm ; String superclass ; String [ ] packages ; try { m_CacheNames = new HashMap < > ( ) ; m_ListNames = new HashMap < > ( ) ; m_CacheClasses = new HashMap < > ( ) ; m_ListClasses = new HashMap < > ( ) ; enm = m_Packages . propertyNames ( ) ; while ( enm . hasMoreElements ( ) ) { superclass = ( String ) enm . nextElement ( ) ; packages = m_Packages . getProperty ( superclass ) . replaceAll ( " " , "" ) . split ( "," ) ; addHierarchy ( superclass , packages ) ; } } catch ( Exception e ) { getLogger ( ) . log ( Level . SEVERE , "Failed to determine packages/classes:" , e ) ; m_Packages = new Properties ( ) ; } } | loads the props file and interpretes it . |
12,718 | public String [ ] getClassnames ( Class superclass ) { List < String > list ; list = m_ListNames . get ( superclass . getName ( ) ) ; if ( list == null ) return new String [ 0 ] ; else return list . toArray ( new String [ list . size ( ) ] ) ; } | Returns all the classnames that were found for this superclass . |
12,719 | public Class [ ] getClasses ( String superclass ) { List < Class > list ; list = m_ListClasses . get ( superclass ) ; if ( list == null ) return new Class [ 0 ] ; else return list . toArray ( new Class [ list . size ( ) ] ) ; } | Returns all the classes that were found for this superclass . |
12,720 | public String [ ] getSuperclasses ( String cls ) { List < String > result ; result = new ArrayList < > ( ) ; for ( String superclass : m_CacheNames . keySet ( ) ) { if ( m_CacheNames . get ( superclass ) . contains ( cls ) ) result . add ( superclass ) ; } if ( result . size ( ) > 1 ) Collections . sort ( result ) ; return result . toArray ( new String [ result . size ( ) ] ) ; } | Returns the superclasses that the specified classes was listed under . |
12,721 | public String [ ] getSuperclasses ( ) { List < String > result ; result = new ArrayList < > ( m_CacheNames . keySet ( ) ) ; Collections . sort ( result ) ; return result . toArray ( new String [ result . size ( ) ] ) ; } | Returns the all superclasses that define class hierarchies . |
12,722 | public String [ ] getPackages ( String superclass ) { String packages ; packages = m_Packages . getProperty ( superclass ) ; if ( ( packages == null ) || ( packages . length ( ) == 0 ) ) return new String [ 0 ] ; else return packages . split ( "," ) ; } | Returns all the packages that were found for this superclass . |
12,723 | public static synchronized ClassLister getSingleton ( ClassTraversal traversal ) { Class < ? extends ClassTraversal > cls ; cls = ( traversal == null ) ? null : traversal . getClass ( ) ; if ( m_Singleton == null ) m_Singleton = new HashMap < > ( ) ; if ( ! m_Singleton . containsKey ( cls ) ) m_Singleton . put ( cls , new ClassLister ( traversal ) ) ; return m_Singleton . get ( cls ) ; } | Returns the singleton instance of the class lister . |
12,724 | public static Properties load ( String props , Properties defProps ) { Properties result ; InputStream is ; result = new Properties ( defProps ) ; is = null ; try { is = ClassLoader . getSystemResourceAsStream ( props ) ; result . load ( is ) ; } catch ( Exception e ) { result = defProps ; } finally { try { if ( is != null ) is . close ( ) ; } catch ( Exception e ) { } } return result ; } | Loads the properties from the classpath . |
12,725 | public List < Error > lint ( String source , String options ) { if ( source == null ) { throw new NullPointerException ( "Source must not be null." ) ; } Context cx = Context . enter ( ) ; try { Scriptable scope = cx . initStandardObjects ( ) ; evaluateJSHint ( cx , scope ) ; return lint ( cx , scope , source , options ) ; } finally { Context . exit ( ) ; } } | Runs JSHint on given JavaScript source code . |
12,726 | public void addQuotation ( final QuotationAlchemyEntity quotation ) { if ( quotation != null && ! quotations . contains ( quotation ) ) { quotations . add ( quotation ) ; } } | Set extracted quotations for the detected entity . |
12,727 | public final M get ( final int index ) { if ( ( index >= 0 ) && ( index < size ( ) ) ) { return m_jso . get ( index ) ; } return null ; } | Return the primitive found at the specified index . |
12,728 | public final NFastArrayList < M > set ( final int i , final M value ) { m_jso . set ( i , value ) ; return this ; } | Add a value to the List |
12,729 | public Calendar getStart ( ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTimeInMillis ( start ) ; return cal ; } | Returns the start of the interval . This is the whole date that was specified during instantiation even if it s too detailed for the given interval unit . |
12,730 | public Calendar getEnd ( ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTimeInMillis ( end ) ; return cal ; } | Returns the end of the interval . This is the whole date that was specified during instantiation even if it s too detailed for the given interval unit . |
12,731 | public static void main ( final String [ ] args ) { final CroquetWicket < CrmSettings > croquet = configureBuilder ( CrmSettings . class , args ) . build ( ) ; final CrmSettings settings = croquet . getSettings ( ) ; croquet . addGuiceModule ( new CrmModule ( settings ) ) ; croquet . addManagedModule ( EmailModule . class ) ; croquet . run ( ) ; } | The main method of this application . |
12,732 | public String output ( ) { String output = process . output ( ) ; publisher . publish ( new Returned ( command , output ) ) ; return output ; } | Publish and return the output from the underlying process . |
12,733 | private Worker getWorker ( ) throws InterruptedException { while ( ! courtesyMonitor . allowTasksToRun ( ) ) { courtesyMonitor . waitFor ( ) ; } while ( numWorkers > maxWorkers ) { workerQueue . take ( ) ; numWorkers -- ; } return workerQueue . take ( ) ; } | Gets the next worker available to process a task . |
12,734 | public void addParameter ( String parameterName , String parameterExpression ) { if ( parameterName == null || parameterName . trim ( ) . length ( ) == 0 ) return ; if ( parameterExpression == null || parameterExpression . trim ( ) . length ( ) == 0 ) return ; this . parameters . put ( parameterName , parameterExpression ) ; } | Methode d ajout d un Parametre |
12,735 | private boolean isCandidate ( Field field ) { return ! Modifier . isStatic ( field . getModifiers ( ) ) && field . getAnnotation ( Transient . class ) == null ; } | Return true if the field is static or marked as transient |
12,736 | private boolean isCandidate ( PropertyDescriptor property ) { if ( "class" . equals ( property . getName ( ) ) || property . getReadMethod ( ) == null || Modifier . isStatic ( property . getReadMethod ( ) . getModifiers ( ) ) ) { return false ; } Field field = getDeclaredField ( property ) ; if ( field == null && property . getWriteMethod ( ) == null ) { log . debug ( "Property " + property . getName ( ) + " has no setter method or private attribute. Skipping." ) ; return false ; } return property . getReadMethod ( ) . getAnnotation ( Transient . class ) == null && ( field == null || field . getAnnotation ( Transient . class ) == null ) ; } | Return true if the field is private or marked as transient |
12,737 | private void startWorker ( ) { JobServiceFactory serviceFactory = new JobServiceFactory ( ) { private boolean first = true ; public JobService connect ( ) { SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { setStatus ( "Connecting..." ) ; } } ) ; JobService service = first ? MainWindow . this . connect ( ) : reconnect ( ) ; if ( service == null ) { setVisible ( false ) ; throw new RuntimeException ( "Unable to connect" ) ; } SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { setStatus ( "Connected" ) ; } } ) ; first = false ; return service ; } } ; int availableCpus = Runtime . getRuntime ( ) . availableProcessors ( ) ; if ( options . numberOfCpus < 0 ) { options . numberOfCpus = pref . getInt ( "maxCpus" , 0 ) ; } if ( options . numberOfCpus <= 0 || options . numberOfCpus > availableCpus ) { options . numberOfCpus = availableCpus ; } if ( worker != null ) { setStatus ( "Shutting down worker..." ) ; worker . shutdown ( ) ; try { workerThread . join ( ) ; } catch ( InterruptedException e ) { } progressPanel . clear ( ) ; } setStatus ( "Starting worker..." ) ; CourtesyMonitor courtesyMonitor = ( powerMonitor != null ) ? powerMonitor : new UnconditionalCourtesyMonitor ( ) ; ThreadFactory threadFactory = new BackgroundThreadFactory ( ) ; worker = new ThreadServiceWorker ( serviceFactory , threadFactory , getProgressPanel ( ) , courtesyMonitor ) ; worker . setMaxWorkers ( options . numberOfCpus ) ; boolean cacheClassDefinitions = pref . getBoolean ( "cacheClassDefinitions" , true ) ; if ( cacheClassDefinitions ) { setStatus ( "Preparing data source..." ) ; EmbeddedDataSource ds = null ; try { Class . forName ( "org.apache.derby.jdbc.EmbeddedDriver" ) ; ds = new EmbeddedDataSource ( ) ; ds . setConnectionAttributes ( "create=true" ) ; ds . setDatabaseName ( "classes" ) ; worker . setDataSource ( ds ) ; } catch ( ClassNotFoundException e ) { logger . error ( "Could not locate database driver." , e ) ; } catch ( SQLException e ) { logger . error ( "Error occurred while initializing data source." , e ) ; } } onPreferencesChanged ( ) ; workerThread = new Thread ( worker ) ; workerThread . start ( ) ; } | Start the worker thread . |
12,738 | public void setKeyword ( String keyword ) { if ( keyword != null ) { keyword = keyword . trim ( ) ; } this . keyword = keyword ; } | Set the detected keyword text . |
12,739 | private static Class < ? > extractTypeFromParameterizedType ( MethodParameter methodParam , ParameterizedType ptype , Class < ? > source , int typeIndex , int nestingLevel , int currentLevel ) { if ( ! ( ptype . getRawType ( ) instanceof Class ) ) { return null ; } Class rawType = ( Class ) ptype . getRawType ( ) ; Type [ ] paramTypes = ptype . getActualTypeArguments ( ) ; if ( nestingLevel - currentLevel > 0 ) { int nextLevel = currentLevel + 1 ; Integer currentTypeIndex = ( methodParam != null ? methodParam . getTypeIndexForLevel ( nextLevel ) : null ) ; int indexToUse = ( currentTypeIndex != null ? currentTypeIndex : paramTypes . length - 1 ) ; Type paramType = paramTypes [ indexToUse ] ; return extractType ( methodParam , paramType , source , typeIndex , nestingLevel , nextLevel ) ; } if ( source != null && ! source . isAssignableFrom ( rawType ) ) { return null ; } Class fromSuperclassOrInterface = extractTypeFromClass ( methodParam , rawType , source , typeIndex , nestingLevel , currentLevel ) ; if ( fromSuperclassOrInterface != null ) { return fromSuperclassOrInterface ; } if ( paramTypes == null || typeIndex >= paramTypes . length ) { return null ; } Type paramType = paramTypes [ typeIndex ] ; if ( paramType instanceof TypeVariable && methodParam != null && methodParam . typeVariableMap != null ) { Type mappedType = methodParam . typeVariableMap . get ( paramType ) ; if ( mappedType != null ) { paramType = mappedType ; } } if ( paramType instanceof WildcardType ) { WildcardType wildcardType = ( WildcardType ) paramType ; Type [ ] upperBounds = wildcardType . getUpperBounds ( ) ; if ( upperBounds != null && upperBounds . length > 0 && ! Object . class . equals ( upperBounds [ 0 ] ) ) { paramType = upperBounds [ 0 ] ; } else { Type [ ] lowerBounds = wildcardType . getLowerBounds ( ) ; if ( lowerBounds != null && lowerBounds . length > 0 && ! Object . class . equals ( lowerBounds [ 0 ] ) ) { paramType = lowerBounds [ 0 ] ; } } } if ( paramType instanceof ParameterizedType ) { paramType = ( ( ParameterizedType ) paramType ) . getRawType ( ) ; } if ( paramType instanceof GenericArrayType ) { Type compType = ( ( GenericArrayType ) paramType ) . getGenericComponentType ( ) ; if ( compType instanceof Class ) { return Array . newInstance ( ( Class ) compType , 0 ) . getClass ( ) ; } } else if ( paramType instanceof Class ) { return ( Class ) paramType ; } return null ; } | Extract the generic type from the given ParameterizedType object . |
12,740 | public String render ( String templateName , EmailModel emailModel , Map < String , Object > model , Locale locale ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Rendering template [{}] for recipient [{}]" , templateName , emailModel . getTo ( ) ) ; } final IEngineConfiguration engineConfiguration = templateEngineFactory . getTemplateEngine ( ) . getConfiguration ( ) ; final ExpressionContext context = new ExpressionContext ( engineConfiguration , locale ) ; context . setVariable ( ThymeleafEvaluationContext . THYMELEAF_EVALUATION_CONTEXT_CONTEXT_VARIABLE_NAME , new ThymeleafEvaluationContext ( applicationContext , null ) ) ; context . setVariables ( model ) ; context . setVariable ( THYMELEAF_EMAIL_MODEL_NAME , emailModel ) ; return templateEngineFactory . getTemplateEngine ( ) . process ( templateName , context ) ; } | renders a template and returns its output |
12,741 | public String htmlToText ( String html ) { final Source source = new Source ( html ) ; return source . getRenderer ( ) . toString ( ) ; } | Converts HTML to plain text using Jericho HTML parser |
12,742 | public < T > List < T > asList ( ) { String cacheKey = null ; if ( isCacheable ( ) && transaction == null ) { cacheKey = getCacheKey ( ) ; List < Key > keys = getCacheManager ( ) . get ( cacheNamespace , cacheKey ) ; if ( keys != null ) { if ( isKeysOnly ( ) ) { return ( List ) keys ; } else { final Map < Key , T > values = entityManager . get ( keys ) ; return Lists . transform ( keys , new Function < Key , T > ( ) { public T apply ( Key key ) { return values . get ( key ) ; } } ) ; } } } List < T > result = Lists . newArrayList ( ( Iterable < T > ) asIterable ( ) ) ; if ( isCacheable ( ) ) { Collection < Key > keys = isKeysOnly ( ) ? result : Collections2 . transform ( result , new EntityToKeyFunction ( classMetadata . getPersistentClass ( ) ) ) ; populateCache ( cacheKey , Lists . newArrayList ( keys ) ) ; } return result ; } | Execute the provided query and returns the result as a List of java objects |
12,743 | public < T > CursorList < T > asCursorList ( int size ) { CursorList < T > result = CursorList . create ( this , size ) ; return result ; } | Execute the query and return a CursorList |
12,744 | public < T > T asSingleResult ( ) { T javaObject = null ; String cacheKey = getCacheKey ( ) ; if ( isCacheable ( ) && transaction == null ) { Collection < Key > keys = getCacheManager ( ) . get ( cacheNamespace , cacheKey ) ; if ( keys != null && keys . size ( ) > 0 ) { Key key = keys . iterator ( ) . next ( ) ; try { javaObject = ( T ) entityManager . get ( key ) ; } catch ( EntityNotFoundException e ) { throw new InconsistentCacheException ( "Entity Key " + key + " found in the cache but not in the Datastore" ) ; } } } if ( javaObject == null ) { Entity entity = getDatastoreService ( ) . prepare ( query ) . asSingleEntity ( ) ; if ( entity == null ) { throw new org . simpleds . exception . EntityNotFoundException ( "No " + getKind ( ) + " found with " + getFilterPredicates ( ) ) ; } javaObject = ( T ) entityManager . datastoreToJava ( entity ) ; if ( isCacheable ( ) ) { populateCache ( cacheKey , ImmutableList . of ( entity . getKey ( ) ) ) ; } } return javaObject ; } | Execute the query and return a single result |
12,745 | public int count ( ) { Integer result = null ; if ( result == null ) { SimpleQuery q = this . isKeysOnly ( ) ? this : this . clone ( ) . keysOnly ( ) ; result = getDatastoreService ( ) . prepare ( q . getQuery ( ) ) . countEntities ( fetchOptions ) ; } return result ; } | Counts the number of instances returned from this query . This method will only retrieve the matching keys not the entities themselves . |
12,746 | private void addCommonCacheKeyParts ( StringBuilder builder ) { builder . append ( "kind=" ) . append ( getKind ( ) ) ; List < FilterPredicate > predicates = query . getFilterPredicates ( ) ; if ( predicates . size ( ) > 0 ) { builder . append ( ",pred=" ) . append ( predicates ) ; } } | Add cache key parts that are common to query data and query count . |
12,747 | public static JCGLPolygonMode polygonModeFromGL ( final int g ) { switch ( g ) { case GL2GL3 . GL_FILL : return JCGLPolygonMode . POLYGON_FILL ; case GL2GL3 . GL_LINE : return JCGLPolygonMode . POLYGON_LINES ; case GL2GL3 . GL_POINT : return JCGLPolygonMode . POLYGON_POINTS ; default : throw new UnreachableCodeException ( ) ; } } | Convert polygon modes from GL constants . |
12,748 | private MetadataDatabase getDatabase ( String deviceUrl ) throws TheDavidBoxClientException { ResponseCheckDatabase responseCheckDatabase = buildCheckDatabaseOperation ( deviceUrl ) . execute ( ) ; String databasePath = responseCheckDatabase . getDatabasePath ( ) ; MetadataDatabase database = new MetadataDatabase ( deviceUrl , databasePath ) ; return database ; } | Get a possible database from a device url . |
12,749 | private String encodeHttpParameter ( String str ) { String encoded = str . replaceAll ( " " , "%20" ) ; encoded = encoded . replaceAll ( "&" , "%26" ) ; return encoded ; } | It encodes special symbols in their valid representations for http requests . |
12,750 | private StringBuffer buildEncodedParameters ( LinkedHashMap < String , String > params ) { StringBuffer parametersUrlGet = new StringBuffer ( "" ) ; if ( null != params ) { for ( String key : params . keySet ( ) ) { String value = params . get ( key ) ; String encodedParameter = encodeHttpParameter ( value ) ; parametersUrlGet . append ( "&" ) . append ( key ) . append ( "=" ) . append ( encodedParameter ) ; } } return parametersUrlGet ; } | It uses the parameters to build the http arguments with name and value . |
12,751 | public Map < Key , Object > loadRelatedEntities ( String ... propertyName ) { EntityManager entityManager = EntityManagerFactory . getEntityManager ( ) ; Class < J > persistentClass = ( Class < J > ) query . getClassMetadata ( ) . getPersistentClass ( ) ; Set < Key > keys = Sets . newHashSet ( ) ; for ( String p : propertyName ) { keys . addAll ( Collections2 . transform ( data , new EntityToPropertyFunction ( persistentClass , p ) ) ) ; } return entityManager . get ( keys ) ; } | Load the list of related entities . |
12,752 | public CursorList < J > filterNullValues ( ) { for ( Iterator < J > it = data . iterator ( ) ; it . hasNext ( ) ; ) { if ( it . next ( ) == null ) { it . remove ( ) ; } } return this ; } | Remove null values from this collection Be aware that this may result in smaller page size |
12,753 | public Class [ ] getParameterTypes ( ) { Class [ ] a , b , result ; a = base . getParameterTypes ( ) ; b = para . getParameterTypes ( ) ; result = new Class [ a . length - 1 + b . length ] ; System . arraycopy ( a , 0 , result , 0 , idx ) ; System . arraycopy ( b , 0 , result , idx , b . length ) ; System . arraycopy ( a , idx + 1 , result , idx + b . length , a . length - ( idx + 1 ) ) ; return result ; } | Gets the argument count . The parameter function takes away 1 argument from the base function but it adds its own arguments . |
12,754 | public Object invoke ( Object [ ] allVals ) throws InvocationTargetException { Object [ ] vals ; Object tmp ; vals = new Object [ paraParaCount ] ; System . arraycopy ( allVals , idx , vals , 0 , vals . length ) ; tmp = para . invoke ( vals ) ; vals = new Object [ baseParaCount ] ; System . arraycopy ( allVals , 0 , vals , 0 , idx ) ; vals [ idx ] = tmp ; System . arraycopy ( allVals , idx + paraParaCount , vals , idx + 1 , vals . length - ( idx + 1 ) ) ; return base . invoke ( vals ) ; } | Invokes the composed Functions . The computed argument is computed by a call to the parameter Function . |
12,755 | public int run ( final String [ ] args ) throws Exception { String input = args [ 0 ] ; String output = args [ 1 ] ; Configuration conf = super . getConf ( ) ; writeInput ( conf , new Path ( input ) ) ; setupSecondarySort ( conf ) ; Job job = new Job ( conf ) ; job . setJarByClass ( SecondarySort . class ) ; job . setMapperClass ( Map . class ) ; job . setReducerClass ( Reduce . class ) ; job . setMapOutputKeyClass ( Tuple . class ) ; job . setMapOutputValueClass ( Text . class ) ; Path outputPath = new Path ( output ) ; FileInputFormat . setInputPaths ( job , input ) ; FileOutputFormat . setOutputPath ( job , outputPath ) ; if ( job . waitForCompletion ( true ) ) { return 0 ; } return 1 ; } | The MapReduce driver - setup and launch the job . |
12,756 | public static void setupSecondarySort ( Configuration conf ) { ShuffleUtils . configBuilder ( ) . useNewApi ( ) . setPartitionerIndices ( TupleFields . LAST_NAME ) . setSortIndices ( TupleFields . values ( ) ) . setGroupIndices ( TupleFields . LAST_NAME ) . configure ( conf ) ; } | Partition and group on just the last name ; sort on both last and first name . |
12,757 | private JSONObject getTaxonomy ( final JSONArray taxonomies , final int index ) { JSONObject object = new JSONObject ( ) ; try { object = ( JSONObject ) taxonomies . get ( index ) ; } catch ( JSONException e ) { e . printStackTrace ( ) ; } return object ; } | Return a json object from the provided array . Return an empty object if there is any problems fetching the taxonomy data . |
12,758 | public static void activate ( final JCGLInterfaceGL33Type g , final JCGLRenderStateType r ) { NullCheck . notNull ( g , "GL interface" ) ; NullCheck . notNull ( r , "Render state" ) ; configureBlending ( g , r ) ; configureCulling ( g , r ) ; configureColorBufferMasking ( g , r ) ; configureDepth ( g , r ) ; configurePolygonMode ( g , r ) ; configureScissor ( g , r ) ; configureStencil ( g , r ) ; } | Activate the given render state . |
12,759 | public Attribute merge ( List < AgBuffer > copyBuffers , int symbol , Type mergedType ) { Map < Attribute , Merger > mapping ; List < Merger > mergers ; Merger merger ; int i ; int max ; mapping = new HashMap < Attribute , Merger > ( ) ; mergers = new ArrayList < Merger > ( ) ; max = copyBuffers . size ( ) ; for ( i = 0 ; i < max ; i ++ ) { copyBuffers . get ( i ) . createMergers ( mergers , mapping , mergedType ) ; } runMergers ( mergers , mapping ) ; merger = Merger . forSymbol ( mergers , symbol ) ; if ( merger == null ) { throw new IllegalStateException ( ) ; } return merger . dest ; } | Merge all attributes with > ; 0 attributions buffers . Return the merged attribute of the specified symbol . |
12,760 | private int localCompare ( Attribute left , Attribute right , AgBuffer rightSemantics , List < Attribute > nextLefts , List < Attribute > nextRights ) { State leftState ; State rightState ; if ( left . symbol != right . symbol ) { throw new IllegalStateException ( ) ; } leftState = lookup ( left ) ; rightState = rightSemantics . lookup ( right ) ; if ( leftState == null && rightState == null ) { return EQ ; } if ( leftState == null || rightState == null ) { throw new IllegalStateException ( "different number of productions" ) ; } return leftState . compare ( rightState , nextLefts , nextRights ) ; } | Adds only states to left and right that are reached by eq states Never returns ALT . |
12,761 | public Attribute cloneAttributes ( AgBuffer orig , Type type , Attribute seed ) { Map < Attribute , Attribute > map ; Attribute attr ; State newState ; map = new HashMap < Attribute , Attribute > ( ) ; for ( State state : orig . states ) { attr = state . getAttribute ( ) ; map . put ( attr , new Attribute ( attr . symbol , null , type ) ) ; } for ( State state : orig . states ) { newState = state . cloneAttributeTransport ( map ) ; states . add ( newState ) ; } attr = map . get ( seed ) ; if ( attr == null ) { throw new IllegalArgumentException ( ) ; } return attr ; } | Clones this buffer but replaces all transport attributes with new attributes of the specified type . |
12,762 | public void into ( Map < String , String > map ) { for ( String name : properties . stringPropertyNames ( ) ) { map . put ( name , properties . getProperty ( name ) ) ; } } | Copy the loaded properties into a map . |
12,763 | public void into ( Properties properties ) { for ( String name : this . properties . stringPropertyNames ( ) ) { properties . setProperty ( name , this . properties . getProperty ( name ) ) ; } } | Copy the loaded properties into a properties list . |
12,764 | public void free ( IPooledObject < V > borrowedObject , boolean reusable ) { if ( borrowedObject == null ) return ; if ( borrowed . remove ( borrowedObject ) ) { ( ( PoolableObject < V > ) borrowedObject ) . releaseOwner ( ) ; if ( reusable ) available . addFirst ( ( PoolableObject < V > ) borrowedObject ) ; } } | Frees the borrowed object from the internal Pool |
12,765 | public PoolableObject < V > getFree ( ) { if ( ! borrowed . isEmpty ( ) ) { for ( PoolableObject < V > bo : borrowed ) { if ( bo . isCurrentOwner ( ) ) return bo ; } } if ( ! available . isEmpty ( ) ) { PoolableObject < V > obj = available . remove ( ) ; borrowed . add ( obj ) ; return obj ; } return null ; } | Finds an available Poolable Object to borrow |
12,766 | public PoolableObject < V > add ( final PoolableObject < V > entry ) { borrowed . add ( entry ) ; return entry ; } | Adds the Poolable Object to the borrowed list |
12,767 | public final TypeDownloadAgentStatus getDownloadAgentStatus ( ) { TypeDownloadAgentStatus typeStatus = TypeDownloadAgentStatus . UNKNOWN ; TypeDownloadAgentStatus typeStatusFoundByCode = TypeDownloadAgentStatus . findById ( status ) ; if ( null != typeStatusFoundByCode ) { typeStatus = typeStatusFoundByCode ; } return typeStatus ; } | Get the status for the download agent . |
12,768 | public int locate ( Attribute attr ) { List lst ; int i ; int max ; if ( attr . symbol < attrs . size ( ) ) { lst = ( List ) attrs . get ( attr . symbol ) ; max = lst . size ( ) ; for ( i = 0 ; i < max ; i ++ ) { if ( attr == lst . get ( i ) ) { return i ; } } } return - 1 ; } | returns location or - 1 |
12,769 | public void add ( Attribute attr ) { int symbol ; List < Attribute > lst ; if ( locate ( attr ) == - 1 ) { symbol = attr . symbol ; while ( attrs . size ( ) <= symbol ) { attrs . add ( new ArrayList < Attribute > ( ) ) ; } lst = attrs . get ( symbol ) ; lst . add ( attr ) ; } } | adds if new ... |
12,770 | public static Field forName ( Class cl , String name ) { java . lang . reflect . Field result ; try { result = cl . getDeclaredField ( name ) ; } catch ( NoSuchFieldException e ) { return null ; } return create ( result ) ; } | Creates a Field if it the Java Field has valid modifiers . |
12,771 | public Object invoke ( Object [ ] vals ) { try { if ( isStatic ( ) ) { return field . get ( null ) ; } else { return field . get ( vals [ 0 ] ) ; } } catch ( IllegalArgumentException e ) { throw e ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( "can't access field" ) ; } } | Reads this Field . |
12,772 | public static void write ( ObjectOutput out , java . lang . reflect . Field field ) throws IOException { if ( field == null ) { ClassRef . write ( out , null ) ; } else { ClassRef . write ( out , field . getDeclaringClass ( ) ) ; out . writeUTF ( field . getName ( ) ) ; } } | Writes a Java Field . |
12,773 | public static java . lang . reflect . Field read ( ObjectInput in ) throws ClassNotFoundException , NoSuchFieldException , IOException { Class cl ; String name ; cl = ClassRef . read ( in ) ; if ( cl == null ) { return null ; } else { name = in . readUTF ( ) ; return cl . getDeclaredField ( name ) ; } } | Reads a Java Field . |
12,774 | public DataTable createRow ( String ... values ) throws TooManyColumnsException { rows . add ( new DataRow ( columns ) . setAll ( values ) ) ; return this ; } | Creates a new row in the table containing the given values . |
12,775 | public DataRow createRow ( ) { DataRow row = new DataRow ( columns ) ; rows . add ( row ) ; return row ; } | Creates a new empty row in the table . |
12,776 | private void assertAttributeExists ( String attribute ) throws UnknownColumnException { for ( DataColumn column : columns ) { if ( column . getCode ( ) . equals ( attribute ) ) { return ; } } throw new UnknownColumnException ( attribute ) ; } | Asserts that the given attribute exists as a column in this table . |
12,777 | public JsonNode toJson ( ) { ObjectMapper mapper = new ObjectMapper ( ) ; ObjectNode node = mapper . createObjectNode ( ) ; ArrayNode columnsNode = mapper . createArrayNode ( ) ; for ( DataColumn column : columns ) { columnsNode . add ( column . toJson ( ) ) ; } ArrayNode dataNode = mapper . createArrayNode ( ) ; for ( DataRow row : rows ) { dataNode . add ( row . toJson ( ) ) ; } node . put ( "columns" , columnsNode ) ; node . put ( "data" , dataNode ) ; node . put ( "overwrite" , overwritePolicy . toJson ( ) ) ; if ( templateId != null ) { node . put ( "templateId" , templateId ) ; } if ( splitByColumn != null ) { node . put ( "splitByColumn" , splitByColumn ) ; } return node ; } | Returns this table in JSON representation . |
12,778 | public String ctxClassName ( Object object ) { if ( object == null ) return Object . class . getName ( ) ; return object . getClass ( ) . getName ( ) ; } | Methode d obtention du nom de la classe d un Object |
12,779 | public Object invoke ( String methodName , Object ... parameters ) { if ( methodName == null || methodName . trim ( ) . length ( ) == 0 ) return null ; Method method = methods . get ( methodName . trim ( ) ) ; if ( method == null ) return null ; try { Object result = method . invoke ( this , parameters ) ; return result ; } catch ( Exception e ) { return null ; } } | Methode d execution de la methode |
12,780 | public static Icon base64 ( byte [ ] bytes ) { return new Icon ( sanitize ( DatatypeConverter . printBase64Binary ( bytes ) ) , true ) ; } | Create an icon based on a binary representation . |
12,781 | public void update ( char [ ] data , int start , int end ) { int i ; for ( i = start ; i < end ; i ++ ) { if ( data [ i ] == '\n' ) { col = 1 ; line ++ ; } else { col ++ ; } } ofs += ( end - start ) ; } | the indicated range has been passed by the scanner . |
12,782 | private void submitResults ( Object task , Object results ) throws JobExecutionException { synchronized ( monitor ) { this . job . submitTaskResults ( task , results , monitor ) ; } } | Submits results for a task . |
12,783 | private synchronized File getWorkingDirectory ( ) { if ( workingDirectory == null ) { try { workingDirectory = Files . createTempDirectory ( TEMP_DIRECTORY_PREFIX ) . toFile ( ) ; } catch ( IOException e ) { throw new UnexpectedException ( e ) ; } } return workingDirectory ; } | Gets the working directory creating a temporary one if one was not specified during construction . |
12,784 | public F createFilter ( BellaDatiService service , String dataSetId , String attributeCode ) { return createFilter ( new FilterAttribute ( service , dataSetId , attributeCode ) ) ; } | Creates a filter using just an attribute code . Can be used if the code is already known to avoid having to make an extra API call loading report attributes . |
12,785 | public static List < String > childrenText ( Element parentElement , String tagname ) { final Iterable < Element > children = children ( parentElement , tagname ) ; List < String > result = new ArrayList < String > ( ) ; for ( Element element : children ) { result . add ( elementText ( element ) ) ; } return result ; } | Gets all descendant elements of the given parentElement with the given namespace and tagname and returns their text child as a list of String . |
12,786 | public static Node getChild ( Node parent , int type ) { Node n = parent . getFirstChild ( ) ; while ( n != null && type != n . getNodeType ( ) ) { n = n . getNextSibling ( ) ; } if ( n == null ) return null ; return n ; } | Get the first direct child with a given type |
12,787 | protected Document createSingleElementDocument ( String namespaceUri , String namespacePrefix , String name , Cardinality cardinality ) { Document doc = mDocumentBuilder . newDocument ( ) ; String qualifiedName = namespacePrefix + ":" + name ; Element e = doc . createElementNS ( namespaceUri , qualifiedName ) ; e . setAttributeNS ( null , "ifmap-cardinality" , cardinality . toString ( ) ) ; doc . appendChild ( e ) ; return doc ; } | Creates a metadata document with a single element and given namespace information . |
12,788 | public void updateResponse ( ) { setStatus ( httpResp . getStatusLine ( ) . getStatusCode ( ) ) ; setStatusLine ( httpResp . getStatusLine ( ) . toString ( ) ) ; setHeaders ( httpResp . getAllHeaders ( ) ) ; final HttpEntity entity = httpResp . getEntity ( ) ; if ( entity != null ) { try { contentBytes = EntityUtils . toByteArray ( entity ) ; } catch ( IOException e ) { contentBytes = new byte [ 0 ] ; e . printStackTrace ( ) ; } ContentType contentType = ContentType . getOrDefault ( entity ) ; setContentType ( contentType ) ; setContentLength ( entity . getContentLength ( ) ) ; } if ( debug ) System . err . println ( this ) ; } | update Response object from given http response |
12,789 | public static void checkColorRenderableTexture2D ( final JCGLTextureFormat t ) throws JCGLExceptionFormatError { if ( ! isColorRenderable2D ( t ) ) { final String m = String . format ( "Format %s is not color-renderable for 2D textures" , t ) ; assert m != null ; throw new JCGLExceptionFormatError ( m ) ; } } | Check that the texture format is a color - renderable format . |
12,790 | public static void checkDepthRenderableTexture2D ( final JCGLTextureFormat t ) throws JCGLExceptionFormatError { if ( ! isDepthRenderable ( t ) ) { final String m = String . format ( "Format %s is not depth-renderable for 2D textures" , t ) ; assert m != null ; throw new JCGLExceptionFormatError ( m ) ; } } | Check that the texture format is a depth - renderable format . |
12,791 | public static void checkDepthStencilRenderableTexture2D ( final JCGLTextureFormat t ) throws JCGLExceptionFormatError { if ( isDepthRenderable ( t ) && isStencilRenderable ( t ) ) { return ; } final String m = String . format ( "Format %s is not depth+stencil-renderable" , t ) ; assert m != null ; throw new JCGLExceptionFormatError ( m ) ; } | Check that the texture is of a depth + stencil - renderable format . |
12,792 | @ SuppressWarnings ( "unchecked" ) public < T > T features ( Class < T > interfaceClass ) { try { for ( Method method : interfaceClass . getDeclaredMethods ( ) ) { methods . put ( method , findInvocationHandler ( method ) ) ; } return ( T ) Proxy . newProxyInstance ( interfaceClass . getClassLoader ( ) , new Class [ ] { interfaceClass } , this ) ; } catch ( NoSuchMethodException e ) { throw new PicklockException ( "cannot resolve method/property " + e . getMessage ( ) + " on " + getType ( ) ) ; } } | maps the given interface to the wrapped class |
12,793 | public void clean ( ) { for ( int i = 0 ; i < jobProgressStates . size ( ) ; ) { ProgressState state = jobProgressStates . get ( i ) ; if ( state . isCancelled ( ) || state . isComplete ( ) ) { jobProgressStates . remove ( i ) ; } else { i ++ ; } } } | Removes completed and cancelled jobs from the stat list . |
12,794 | public final byte [ ] getClassDigest ( String name ) { byte [ ] digest = digestLookup . get ( name ) ; if ( digest == null ) { try { if ( beginLookup ( pendingDigest , name ) ) { try { digest = service . getClassDigest ( name , jobId ) ; digestLookup . put ( name , digest ) ; } finally { endLookup ( pendingDigest , name ) ; } } else { digest = digestLookup . get ( name ) ; } } catch ( SecurityException e ) { logger . error ( "Could not get class digest" , e ) ; } catch ( RemoteException e ) { logger . error ( "Could not get class digest" , e ) ; } } return digest ; } | Gets the digest associated with a given class . |
12,795 | private synchronized boolean beginLookup ( Map < String , String > pending , String name ) { String canonical = pending . get ( name ) ; if ( canonical != null ) { do { try { canonical . wait ( ) ; } catch ( InterruptedException e ) { } } while ( pending . containsKey ( name ) ) ; } return ( canonical == null ) ; } | Ensures that only one thread is calling the service to obtain the class digest or definition for a particular class name . |
12,796 | private synchronized void endLookup ( Map < String , String > pending , String name ) { String canonical = pending . remove ( name ) ; if ( canonical != null ) { canonical . notifyAll ( ) ; } } | Signals that the current thread is done looking up a class digest or definition . |
12,797 | public static Range range ( char first , Character second ) { if ( second == null ) { return new Range ( first ) ; } else { return new Range ( first , ( ( Character ) second ) . charValue ( ) ) ; } } | second is a Character to detect optional values |
12,798 | static GraphNode getServiceNode ( HttpServletRequest request ) { final IRI serviceUri = new IRI ( getFullRequestUrl ( request ) ) ; final Graph resultGraph = new SimpleGraph ( ) ; return new GraphNode ( serviceUri , resultGraph ) ; } | Returns a GraphNode representing the requested resources in an empty Graph |
12,799 | public T next ( ) { int retryCount = 0 ; do { T next = delegate . next ( ) ; if ( ! alreadyGenerated . contains ( next ) ) { alreadyGenerated . add ( next ) ; return next ; } retryCount ++ ; } while ( retryCount <= numberOfRetries ) ; throw new IllegalStateException ( on ( " " ) . join ( "Exhausted" , numberOfRetries , "retries trying to generate unique value" ) ) ; } | Returns unique < ; T> ; generated by delegate Generator< ; T> ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.