idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
18,100 | void writeDependencies ( Writer writer , String deco , String ... dependencies ) throws IOException { boolean first = true ; for ( String dependency : dependencies ) { if ( ! first ) { writer . append ( COMMA ) . append ( SPACEOPTIONAL ) ; } writer . append ( deco ) . append ( dependency ) . append ( deco ) ; first = false ; } } | dep1 dep2 or if deco = dep1 dep2 |
18,101 | public void writeCloseFunction ( Writer writer ) throws IOException { writer . append ( TAB ) . append ( CLOSEBRACE ) . append ( CR ) ; } | \ t } |
18,102 | void writeArguments ( Iterator < String > names , Writer writer ) throws IOException { while ( names . hasNext ( ) ) { String name = names . next ( ) ; writer . append ( name ) ; if ( names . hasNext ( ) ) { writer . append ( COMMA ) . append ( SPACEOPTIONAL ) ; } } } | Write argument whit comma if necessary |
18,103 | void writeReturnComment ( TypeMirror returnType , Writer writer ) throws IOException { String type = returnType . toString ( ) ; if ( ! "void" . equals ( type ) ) { writer . append ( TAB2 ) . append ( " * @return " ) . append ( OPENBRACE ) . append ( type ) . append ( CLOSEBRACE ) . append ( CR ) ; } } | write js documentation for return type |
18,104 | void writeArgumentsComment ( Iterator < String > argumentsType , Iterator < String > argumentsName , Writer writer ) throws IOException { while ( argumentsType . hasNext ( ) ) { String type = argumentsType . next ( ) ; String name = argumentsName . next ( ) ; writer . append ( TAB2 ) . append ( " * @param " ) . append ( OPENBRACE ) . append ( type ) . append ( CLOSEBRACE ) . append ( SPACE ) . append ( name ) . append ( CR ) ; } } | write js documentation for arguments |
18,105 | void writeJavadocComment ( String methodComment , Writer writer ) throws IOException { if ( methodComment != null ) { methodComment = methodComment . split ( "@" ) [ 0 ] ; int lastIndexOf = methodComment . lastIndexOf ( "\n" ) ; if ( lastIndexOf >= 0 ) { methodComment = methodComment . substring ( 0 , lastIndexOf ) ; } String comment = methodComment . replaceAll ( "\n" , CR + TAB2 + " *" ) ; writer . append ( TAB2 ) . append ( " *" ) . append ( comment ) . append ( CR ) ; } } | write js documentation from javadoc |
18,106 | void createMethodBody ( String classname , ExecutableElement methodElement , List < String > arguments , Writer writer ) throws IOException { String methodName = getMethodName ( methodElement ) ; boolean ws = isWebsocketDataService ( methodElement ) ; String args = stringJoinAndDecorate ( arguments , COMMA , new NothingDecorator ( ) ) ; String keys = computeKeys ( methodElement , arguments ) ; createReturnOcelotPromiseFactory ( classname , methodName , ws , args , keys , writer ) ; } | Create javascript method body |
18,107 | String computeKeys ( ExecutableElement methodElement , List < String > arguments ) { String keys = stringJoinAndDecorate ( arguments , COMMA , new NothingDecorator ( ) ) ; if ( arguments != null && ! arguments . isEmpty ( ) ) { JsCacheResult jcr = methodElement . getAnnotation ( JsCacheResult . class ) ; if ( ! considerateAllArgs ( jcr ) ) { keys = stringJoinAndDecorate ( Arrays . asList ( jcr . keys ( ) ) , COMMA , new KeyForArgDecorator ( ) ) ; } } return keys ; } | Generate key part for variable part of md5 |
18,108 | void createReturnOcelotPromiseFactory ( String classname , String methodName , boolean ws , String args , String keys , Writer writer ) throws IOException { String md5 = keyMaker . getMd5 ( classname + DOT + methodName ) ; writer . append ( TAB3 ) . append ( "return promiseFactory.create" ) . append ( OPENPARENTHESIS ) . append ( "_ds" ) . append ( COMMA ) . append ( SPACEOPTIONAL ) . append ( QUOTE ) . append ( md5 ) . append ( UNDERSCORE ) . append ( QUOTE ) . append ( " + JSON.stringify([" ) . append ( keys ) . append ( "]).md5()" ) . append ( COMMA ) . append ( SPACEOPTIONAL ) . append ( QUOTE ) . append ( methodName ) . append ( QUOTE ) . append ( COMMA ) . append ( SPACEOPTIONAL ) . append ( "" + ws ) . append ( COMMA ) . append ( SPACEOPTIONAL ) . append ( OPENBRACKET ) . append ( args ) . append ( CLOSEBRACKET ) . append ( CLOSEPARENTHESIS ) . append ( SEMICOLON ) . append ( CR ) ; } | Return body js line that return the OcelotPromise |
18,109 | String stringJoinAndDecorate ( final List < String > list , final String sep , StringDecorator decorator ) { if ( decorator == null ) { decorator = new NothingDecorator ( ) ; } StringBuilder sb = new StringBuilder ( ) ; if ( list != null ) { boolean first = true ; for ( String argument : list ) { if ( ! first ) { sb . append ( sep ) ; } sb . append ( decorator . decorate ( argument ) ) ; first = false ; } } return sb . toString ( ) ; } | Join list and separate by sep each elements is decorate by decorator |
18,110 | public RackResponse call ( RackEnvironment environment ) { RubyHash environmentHash = convertToRubyHash ( environment . entrySet ( ) ) ; RubyArray response = callRackApplication ( environmentHash ) ; return convertToJavaRackResponse ( response ) ; } | Calls the delegate Rack application translating into and back out of the JRuby interpreter . |
18,111 | protected AttributeCertificate getACFromResponse ( VOMSACRequest request , VOMSResponse response ) { byte [ ] acBytes = response . getAC ( ) ; if ( acBytes == null ) return null ; ASN1InputStream asn1InputStream = new ASN1InputStream ( acBytes ) ; AttributeCertificate attributeCertificate = null ; try { attributeCertificate = AttributeCertificate . getInstance ( asn1InputStream . readObject ( ) ) ; asn1InputStream . close ( ) ; return attributeCertificate ; } catch ( Throwable e ) { requestListener . notifyVOMSRequestFailure ( request , null , new VOMSError ( "Error unmarshalling VOMS AC. Cause: " + e . getMessage ( ) , e ) ) ; return null ; } } | Extracts an AC from a VOMS response |
18,112 | protected void handleErrorsInResponse ( VOMSACRequest request , VOMSServerInfo si , VOMSResponse response ) { if ( response . hasErrors ( ) ) requestListener . notifyErrorsInVOMSReponse ( request , si , response . errorMessages ( ) ) ; } | Handles errors included in the VOMS response |
18,113 | protected void handleWarningsInResponse ( VOMSACRequest request , VOMSServerInfo si , VOMSResponse response ) { if ( response . hasWarnings ( ) ) requestListener . notifyWarningsInVOMSResponse ( request , si , response . warningMessages ( ) ) ; } | Handles warnings included in the VOMS response |
18,114 | protected void drawCheckerBoard ( Graphics2D g2d ) { g2d . setColor ( getBackground ( ) ) ; g2d . fillRect ( 0 , 0 , getWidth ( ) , getHeight ( ) ) ; g2d . setColor ( getForeground ( ) ) ; final int checkSize = this . checkerSize ; final int halfCheckSize = checkSize / 2 ; final Stroke checker = this . checkerStroke ; final Stroke backup = g2d . getStroke ( ) ; g2d . setStroke ( checker ) ; final int width = this . getWidth ( ) + checkSize ; final int height = this . getHeight ( ) + checkSize ; for ( int i = halfCheckSize ; i < height ; i += checkSize * 2 ) { g2d . drawLine ( halfCheckSize , i , width , i ) ; g2d . drawLine ( checkSize + halfCheckSize , i + checkSize , width , i + checkSize ) ; } g2d . setStroke ( backup ) ; } | Draws the checkerboard background to the specified graphics context . |
18,115 | @ Produces ( MediaType . APPLICATION_JSON ) @ Consumes ( MediaType . APPLICATION_FORM_URLENCODED ) public String getMessageToClient ( @ FormParam ( Constants . Message . MFC ) String json ) { HttpSession httpSession = getHttpSession ( ) ; setContext ( httpSession ) ; MessageFromClient message = MessageFromClient . createFromJson ( json ) ; MessageToClient mtc = getMessageToClientService ( ) . createMessageToClient ( message , httpSession ) ; return mtc . toJson ( ) ; } | Retrieves representation of an instance of org . ocelotds . GenericResource |
18,116 | @ JsCacheRemove ( cls = OcelotServices . class , methodName = "getLocale" , keys = { } , userScope = true ) public void setLocale ( @ JsonUnmarshaller ( LocaleMarshaller . class ) Locale locale ) { logger . debug ( "Receive setLocale call from client. {}" , locale ) ; ocelotContext . setLocale ( locale ) ; } | define locale for current user |
18,117 | @ JsCacheResult ( year = 1 ) @ JsonMarshaller ( LocaleMarshaller . class ) public Locale getLocale ( ) { logger . debug ( "Receive getLocale call from client." ) ; return ocelotContext . getLocale ( ) ; } | get current user locale |
18,118 | public Collection < String > getOutDatedCache ( Map < String , Long > states ) { return updatedCacheManager . getOutDatedCache ( states ) ; } | GEt outdated cache among list |
18,119 | public Integer subscribe ( @ JsTopicName ( prefix = Constants . Topic . SUBSCRIBERS ) String topic , Session session ) throws IllegalAccessException { return topicManager . registerTopicSession ( topic , session ) ; } | Subscribe to topic |
18,120 | public Integer unsubscribe ( @ JsTopicName ( prefix = Constants . Topic . SUBSCRIBERS ) String topic , Session session ) { return topicManager . unregisterTopicSession ( topic , session ) ; } | Unsubscribe to topic |
18,121 | public JsTopicMessageController getJsTopicMessageController ( String topic ) { logger . debug ( "Looking for messageController for topic '{}'" , topic ) ; JsTopicMessageController messageController = messageControllerCache . loadFromCache ( topic ) ; if ( null == messageController ) { messageController = getJsTopicMessageControllerFromJsTopicControl ( topic ) ; if ( null == messageController ) { messageController = getJsTopicMessageControllerFromJsTopicControls ( topic ) ; if ( null == messageController ) { messageController = new DefaultJsTopicMessageController ( ) ; } } messageControllerCache . saveToCache ( topic , messageController . getClass ( ) ) ; } return messageController ; } | Get jstopic message controller |
18,122 | JsTopicMessageController getJsTopicMessageControllerFromJsTopicControl ( String topic ) { logger . debug ( "Looking for messageController for topic '{}' from JsTopicControl annotation" , topic ) ; Instance < JsTopicMessageController < ? > > select = topicMessageController . select ( new JsTopicCtrlAnnotationLiteral ( topic ) ) ; if ( ! select . isUnsatisfied ( ) ) { logger . debug ( "Found messageController for topic '{}' from JsTopicControl annotation" , topic ) ; return select . get ( ) ; } return null ; } | Get jstopic message controller from JsTopicControl |
18,123 | int sendMessageToTopicForSessions ( Collection < Session > sessions , MessageToClient mtc , Object payload ) { int sended = 0 ; JsTopicMessageController msgControl = messageControllerManager . getJsTopicMessageController ( mtc . getId ( ) ) ; Collection < Session > sessionsClosed = new ArrayList < > ( ) ; for ( Session session : sessions ) { try { sended += checkAndSendMtcToSession ( session , msgControl , mtc , payload ) ; } catch ( SessionException se ) { sessionsClosed . add ( se . getSession ( ) ) ; } } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Send message to '{}' topic {} client(s) : {}" , new Object [ ] { mtc . getId ( ) , sessions . size ( ) - sessionsClosed . size ( ) , mtc } ) ; } topicManager . removeSessionsToTopic ( sessionsClosed ) ; return sended ; } | send message to sessions apply msgControl to topic |
18,124 | int checkAndSendMtcToSession ( Session session , JsTopicMessageController msgControl , MessageToClient mtc , Object payload ) throws SessionException { if ( session != null ) { if ( session . isOpen ( ) ) { try { if ( null != msgControl ) { checkMessageTopic ( userContextFactory . getUserContext ( session . getId ( ) ) , mtc . getId ( ) , payload , msgControl ) ; } mtc . setType ( MessageType . MESSAGE ) ; session . getAsyncRemote ( ) . sendObject ( mtc ) ; return 1 ; } catch ( NotRecipientException ex ) { logger . debug ( "{} is exclude to receive a message in {}" , ex . getMessage ( ) , mtc . getId ( ) ) ; } } else { throw new SessionException ( "CLOSED" , null , session ) ; } } return 0 ; } | Send Message to session check right before |
18,125 | void checkMessageTopic ( UserContext ctx , String topic , Object payload , JsTopicMessageController msgControl ) throws NotRecipientException { if ( null != msgControl ) { msgControl . checkRight ( ctx , topic , payload ) ; } } | Check if message is granted by messageControl |
18,126 | public User getMe ( AccessToken accessToken , String ... attributes ) { return getUserService ( ) . getMe ( accessToken , attributes ) ; } | Retrieves the User holding the given access token . |
18,127 | public AccessToken refreshAccessToken ( AccessToken accessToken , Scope ... scopes ) { return getAuthService ( ) . refreshAccessToken ( accessToken , scopes ) ; } | Provides a new and refreshed access token by getting the refresh token from the given access token . |
18,128 | public User updateUser ( String id , UpdateUser updateUser , AccessToken accessToken ) { return getUserService ( ) . updateUser ( id , updateUser , accessToken ) ; } | update the user of the given id with the values given in the User Object . For more detailed information how to set new field update Fields or to delete Fields please look in the documentation . This method is not compatible with OSIAM 3 . x . |
18,129 | public Group updateGroup ( String id , UpdateGroup updateGroup , AccessToken accessToken ) { return getGroupService ( ) . updateGroup ( id , updateGroup , accessToken ) ; } | update the group of the given id with the values given in the Group Object . For more detailed information how to set new field . Update Fields or to delete Fields please look in the documentation |
18,130 | public Client getClient ( String clientId , AccessToken accessToken ) { return getAuthService ( ) . getClient ( clientId , accessToken ) ; } | Get client by the given client id . |
18,131 | public Client createClient ( Client client , AccessToken accessToken ) { return getAuthService ( ) . createClient ( client , accessToken ) ; } | Create a client . |
18,132 | public Client updateClient ( String clientId , Client client , AccessToken accessToken ) { return getAuthService ( ) . updateClient ( clientId , client , accessToken ) ; } | Get OSIAM OAuth client by the given ID . |
18,133 | public void print ( final PrintStream out , final ICodingAnnotationStudy study ) { if ( study . getRaterCount ( ) > 2 ) throw new IllegalArgumentException ( "Contingency tables are only applicable for two rater studies." ) ; Map < Object , Integer > categories = new LinkedHashMap < Object , Integer > ( ) ; for ( Object cat : study . getCategories ( ) ) categories . put ( cat , categories . size ( ) ) ; int [ ] [ ] frequencies = new int [ study . getCategoryCount ( ) ] [ study . getCategoryCount ( ) ] ; for ( ICodingAnnotationItem item : study . getItems ( ) ) { int cat1 = categories . get ( item . getUnit ( 0 ) . getCategory ( ) ) ; int cat2 = categories . get ( item . getUnit ( 1 ) . getCategory ( ) ) ; frequencies [ cat1 ] [ cat2 ] ++ ; } final String DIVIDER = "\t" ; for ( Object category : categories . keySet ( ) ) out . print ( DIVIDER + category ) ; out . print ( DIVIDER + "Σ") ;
out . println ( ) ; int i = 0 ; int [ ] colSum = new int [ study . getCategoryCount ( ) ] ; for ( Object category1 : categories . keySet ( ) ) { out . print ( category1 ) ; int rowSum = 0 ; for ( int j = 0 ; j < categories . size ( ) ; j ++ ) { out . printf ( DIVIDER + "%3d" , frequencies [ i ] [ j ] ) ; rowSum += frequencies [ i ] [ j ] ; colSum [ j ] += frequencies [ i ] [ j ] ; } out . printf ( DIVIDER + "%3d" , rowSum ) ; out . println ( ) ; i ++ ; } out . print ( "Σ") ;
int rowSum = 0 ; for ( int j = 0 ; j < categories . size ( ) ; j ++ ) { out . printf ( DIVIDER + "%3d" , colSum [ j ] ) ; rowSum += colSum [ j ] ; } out . printf ( DIVIDER + "%3d" , rowSum ) ; out . println ( ) ; } | Print the contingency matrix for the given coding study . |
18,134 | public static void checkSyntax ( String fqan ) { if ( fqan . length ( ) > 255 ) throw new VOMSError ( "fqan.length() > 255" ) ; if ( ! fqanPattern . matcher ( fqan ) . matches ( ) ) throw new VOMSError ( "Syntax error in fqan: " + fqan ) ; } | This methods checks that the string passed as argument complies with the voms FQAN syntax . |
18,135 | public static void checkRole ( String roleName ) { if ( roleName . length ( ) > 255 ) throw new VOMSError ( "roleName.length()>255" ) ; if ( ! rolePattern . matcher ( roleName ) . matches ( ) ) throw new VOMSError ( "Syntax error in role name: " + roleName ) ; } | This methods checks that the string passed as argument complies with the syntax used by voms to identify roles . |
18,136 | public static String getRoleName ( String containerName ) { if ( ! isRole ( containerName ) && ! isQualifiedRole ( containerName ) ) throw new VOMSError ( "No role specified in \"" + containerName + "\" voms syntax." ) ; Matcher m = fqanPattern . matcher ( containerName ) ; if ( m . matches ( ) ) { String roleGroup = m . group ( 4 ) ; return roleGroup . substring ( roleGroup . indexOf ( '=' ) + 1 , roleGroup . length ( ) ) ; } return null ; } | This method extracts the role name information from the FQAN passed as argument . |
18,137 | public static String getGroupName ( String containerName ) { checkSyntax ( containerName ) ; if ( ! isRole ( containerName ) && ! isQualifiedRole ( containerName ) ) return containerName ; Matcher m = fqanPattern . matcher ( containerName ) ; if ( m . matches ( ) ) { String groupName = m . group ( 2 ) ; if ( groupName . endsWith ( "/" ) ) return groupName . substring ( 0 , groupName . length ( ) - 1 ) ; else return groupName ; } return null ; } | This method extracts group name information from the FQAN passed as argument . |
18,138 | public void send ( byte [ ] b , int off , int len ) { handler . send ( b , off , len ) ; } | Wraps sent data from the application side to the network side |
18,139 | protected Artifact createArtifact ( final ArtifactItem item ) throws MojoExecutionException { assert item != null ; if ( item . getVersion ( ) == null ) { fillMissingArtifactVersion ( item ) ; if ( item . getVersion ( ) == null ) { throw new MojoExecutionException ( "Unable to find artifact version of " + item . getGroupId ( ) + ":" + item . getArtifactId ( ) + " in either dependency list or in project's dependency management." ) ; } } VersionRange range ; try { range = VersionRange . createFromVersionSpec ( item . getVersion ( ) ) ; log . trace ( "Using version range: {}" , range ) ; } catch ( InvalidVersionSpecificationException e ) { throw new MojoExecutionException ( "Could not create range for version: " + item . getVersion ( ) , e ) ; } return artifactFactory . createDependencyArtifact ( item . getGroupId ( ) , item . getArtifactId ( ) , range , item . getType ( ) , item . getClassifier ( ) , Artifact . SCOPE_PROVIDED ) ; } | Create a new artifact . If no version is specified it will be retrieved from the dependency list or from the DependencyManagement section of the pom . |
18,140 | private void fillMissingArtifactVersion ( final ArtifactItem item ) { log . trace ( "Attempting to find missing version in {}:{}" , item . getGroupId ( ) , item . getArtifactId ( ) ) ; List list = project . getDependencies ( ) ; for ( int i = 0 ; i < list . size ( ) ; ++ i ) { Dependency dependency = ( Dependency ) list . get ( i ) ; if ( dependency . getGroupId ( ) . equals ( item . getGroupId ( ) ) && dependency . getArtifactId ( ) . equals ( item . getArtifactId ( ) ) && dependency . getType ( ) . equals ( item . getType ( ) ) ) { log . trace ( "Found missing version: {} in dependency list" , dependency . getVersion ( ) ) ; item . setVersion ( dependency . getVersion ( ) ) ; return ; } } list = project . getDependencyManagement ( ) . getDependencies ( ) ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { Dependency dependency = ( Dependency ) list . get ( i ) ; if ( dependency . getGroupId ( ) . equals ( item . getGroupId ( ) ) && dependency . getArtifactId ( ) . equals ( item . getArtifactId ( ) ) && dependency . getType ( ) . equals ( item . getType ( ) ) ) { log . trace ( "Found missing version: {} in dependency management list" , dependency . getVersion ( ) ) ; item . setVersion ( dependency . getVersion ( ) ) ; } } } | Tries to find missing version from dependency list and dependency management . If found the artifact is updated with the correct version . |
18,141 | public void onRecv ( byte [ ] b , int off , int len ) { connection . onRecv ( b , off , len ) ; } | Wraps received data from the network side to the application side |
18,142 | public List < Integer > searchBigBytes ( byte [ ] srcBytes , byte [ ] searchBytes ) { int numOfThreadsOptimized = ( srcBytes . length / analyzeByteArrayUnitSize ) ; if ( numOfThreadsOptimized == 0 ) { numOfThreadsOptimized = 1 ; } return searchBigBytes ( srcBytes , searchBytes , numOfThreadsOptimized ) ; } | Search bytes faster in a concurrent processing . |
18,143 | public String getFromEnvOrSystemProperty ( String propName ) { String val = System . getenv ( propName ) ; if ( val == null ) val = System . getProperty ( propName ) ; return val ; } | Looks for the value of a given property in the environment or in the system properties |
18,144 | public void print ( final PrintStream out , final ICodingAnnotationStudy study ) { Map < Object , Integer > categories = new LinkedHashMap < Object , Integer > ( ) ; for ( Object cat : study . getCategories ( ) ) categories . put ( cat , categories . size ( ) ) ; final String DIVIDER = "\t" ; for ( int i = 0 ; i < study . getItemCount ( ) ; i ++ ) out . print ( DIVIDER + ( i + 1 ) ) ; out . print ( DIVIDER + "Σ") ;
out . println ( ) ; for ( int r = 0 ; r < study . getRaterCount ( ) ; r ++ ) { out . print ( r + 1 ) ; for ( ICodingAnnotationItem item : study . getItems ( ) ) out . print ( DIVIDER + item . getUnit ( r ) . getCategory ( ) ) ; out . println ( ) ; } out . println ( ) ; for ( Object category : study . getCategories ( ) ) { out . print ( category ) ; int catSum = 0 ; for ( ICodingAnnotationItem item : study . getItems ( ) ) { int catCount = 0 ; for ( IAnnotationUnit unit : item . getUnits ( ) ) if ( category . equals ( unit . getCategory ( ) ) ) catCount ++ ; out . print ( DIVIDER + ( catCount > 0 ? catCount : "" ) ) ; catSum += catCount ; } out . println ( DIVIDER + catSum ) ; } } | Print the reliability matrix for the given coding study . |
18,145 | String getPackagePath ( TypeElement te ) { return te . getQualifiedName ( ) . toString ( ) . replaceAll ( "." + te . getSimpleName ( ) , "" ) ; } | Get pachage name of class |
18,146 | String getFilename ( TypeElement te , String fwk ) { return getFilename ( te . getSimpleName ( ) . toString ( ) , fwk ) ; } | Get Js filename from class |
18,147 | void writeCoreInClassesOutput ( ) { String resPath = ProcessorConstants . SEPARATORCHAR + "js" ; fws . copyResourceToClassesOutput ( resPath , "core.ng.min.js" ) ; fws . copyResourceToClassesOutput ( resPath , "core.ng.js" ) ; fws . copyResourceToClassesOutput ( resPath , "core.min.js" ) ; fws . copyResourceToClassesOutput ( resPath , "core.js" ) ; } | Write core in classes directory |
18,148 | protected boolean fileExistsAndIsReadable ( String filename ) { File f = new File ( filename ) ; return f . exists ( ) && f . isFile ( ) && f . canRead ( ) ; } | Convenience method to check if a file exists and is readable |
18,149 | WSController getWSController ( ) { if ( null == controller ) { controller = CDI . current ( ) . select ( WSController . class ) . get ( ) ; } return controller ; } | Fix OpenWebBean issues |
18,150 | public double calculateExpectedAgreement ( ) { Map < Object , int [ ] > annotationsPerCategory = CodingAnnotationStudy . countAnnotationsPerCategory ( study ) ; BigDecimal result = BigDecimal . ZERO ; for ( Object category : study . getCategories ( ) ) { int [ ] annotations = annotationsPerCategory . get ( category ) ; if ( annotations != null ) { BigDecimal prod = BigDecimal . ONE ; for ( int rater = 0 ; rater < study . getRaterCount ( ) ; rater ++ ) prod = prod . multiply ( new BigDecimal ( annotations [ rater ] ) ) ; result = result . add ( prod ) ; } } result = result . divide ( new BigDecimal ( study . getItemCount ( ) ) . pow ( 2 ) , MathContext . DECIMAL128 ) ; return result . doubleValue ( ) ; } | Calculates the expected inter - rater agreement that assumes a different probability distribution for all raters . |
18,151 | public double calculateCategoryAgreement ( final Object category ) { int N = study . getItemCount ( ) ; int n = study . getRaterCount ( ) ; int sum_nij = 0 ; int sum_nij_2 = 0 ; for ( ICodingAnnotationItem item : study . getItems ( ) ) { int nij = 0 ; for ( IAnnotationUnit unit : item . getUnits ( ) ) if ( unit . getCategory ( ) . equals ( category ) ) nij ++ ; sum_nij += nij ; sum_nij_2 += ( nij * nij ) ; } double pj = 1 / ( double ) ( N * n ) * sum_nij ; double Pj = ( sum_nij_2 - N * n * pj ) / ( double ) ( N * n * ( n - 1 ) * pj ) ; double kappaj = ( Pj - pj ) / ( double ) ( 1 - pj ) ; return kappaj ; } | Artstein&Poesio have a different definition! |
18,152 | public IJsonMarshaller getIJsonMarshallerInstance ( Class < ? extends IJsonMarshaller > cls ) throws JsonMarshallerException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Try to get {} by CDI.select Unsatisfied: {}" , cls . getName ( ) , CDI . current ( ) . select ( cls ) . isUnsatisfied ( ) ) ; } if ( CDI . current ( ) . select ( cls ) . isUnsatisfied ( ) ) { throw new JsonMarshallerException ( cls . getName ( ) + " is Unsatisfied" ) ; } return CDI . current ( ) . select ( cls ) . get ( ) ; } | Get Instance of IJsonMarshaller from CDI |
18,153 | public static double getSignificance ( double [ ] sample1 , double [ ] sample2 ) throws IllegalArgumentException , MathException { double alpha = TestUtils . pairedTTest ( sample1 , sample2 ) ; boolean significance = TestUtils . pairedTTest ( sample1 , sample2 , .30 ) ; System . err . println ( "sig: " + significance ) ; return alpha ; } | Uses a paired t - test to test whether the correlation value computed from these datasets is significant . |
18,154 | public static double getSignificance ( double correlation1 , double correlation2 , int n1 , int n2 ) throws MathException { double zv1 = FisherZTransformation . transform ( correlation1 ) ; double zv2 = FisherZTransformation . transform ( correlation2 ) ; double zDifference = ( zv1 - zv2 ) / Math . sqrt ( 2d ) / Math . sqrt ( ( double ) 1 / ( n1 - 3 ) + ( double ) 1 / ( n2 - 3 ) ) ; double p = Erf . erfc ( Math . abs ( zDifference ) ) ; return p ; } | Computes the significance of the difference between two correlations . |
18,155 | private AntBuilder getAnt ( ) { if ( this . ant == null ) { AntBuilder ant = new AntBuilder ( ) ; BuildLogger logger = ( BuildLogger ) ant . getAntProject ( ) . getBuildListeners ( ) . get ( 0 ) ; logger . setEmacsMode ( true ) ; this . ant = ant ; } return this . ant ; } | Lazily initialize the AntBuilder so we can pick up the log impl correctly . |
18,156 | public Method getMethodFromDataService ( final Class dsClass , final MessageFromClient message , List < Object > arguments ) throws NoSuchMethodException { logger . debug ( "Try to find method {} on class {}" , message . getOperation ( ) , dsClass ) ; List < String > parameters = message . getParameters ( ) ; int nbparam = parameters . size ( ) - getNumberOfNullEnderParameter ( parameters ) ; List < Method > candidates = getSortedCandidateMethods ( message . getOperation ( ) , dsClass . getMethods ( ) ) ; if ( ! candidates . isEmpty ( ) ) { while ( nbparam <= parameters . size ( ) ) { for ( Method method : candidates ) { if ( method . getParameterTypes ( ) . length == nbparam ) { logger . debug ( "Process method {}" , method . getName ( ) ) ; try { checkMethod ( method , arguments , parameters , nbparam ) ; logger . debug ( "Method {}.{} with good signature found.", sClass, essage. g etOperation( ) ) ;
return method ; } catch ( JsonMarshallerException | JsonUnmarshallingException | IllegalArgumentException iae ) { logger . debug ( "Method {}.{} not found. Some arguments didn't match. {}.", ew bject[ ] { d sClass, essage. g etOperation( ) , ae. g etMessage( ) } ) ;
} arguments . clear ( ) ; } } nbparam ++ ; } } throw new NoSuchMethodException ( dsClass . getName ( ) + "." + message . getOperation ( ) ) ; } | Get pertinent method and fill the argument list from message arguments |
18,157 | public Method getNonProxiedMethod ( Class cls , String methodName , Class < ? > ... parameterTypes ) throws NoSuchMethodException { return cls . getMethod ( methodName , parameterTypes ) ; } | Get the method on origin class without proxies |
18,158 | int getNumberOfNullEnderParameter ( List < String > parameters ) { int nbnull = 0 ; for ( int i = parameters . size ( ) - 1 ; i >= 0 ; i -- ) { String parameter = parameters . get ( i ) ; if ( parameter . equals ( "null" ) ) { nbnull ++ ; } else { break ; } } return nbnull ; } | Return the number of null parameter at the end of list |
18,159 | void checkMethod ( Method method , List < Object > arguments , List < String > parameters , int nbparam ) throws IllegalArgumentException , JsonUnmarshallingException , JsonMarshallerException { Type [ ] paramTypes = method . getGenericParameterTypes ( ) ; Annotation [ ] [ ] parametersAnnotations = method . getParameterAnnotations ( ) ; int idx = 0 ; for ( Type paramType : paramTypes ) { logger . debug ( "Try to convert argument ({}) {} : {}.", ew bject[ ] { i dx, aramType, arameters. g et( i dx) } ) ;
arguments . add ( argumentConvertor . convertJsonToJava ( parameters . get ( idx ) , paramType , parametersAnnotations [ idx ] ) ) ; idx ++ ; if ( idx > nbparam ) { throw new IllegalArgumentException ( ) ; } } } | Check if for nbparam in parameters the method is correct . If yes store parameters String converted to Java in arguments list |
18,160 | public void setARGB ( int a , int r , int g , int b ) { setValue ( Pixel . argb ( a , r , g , b ) ) ; } | Sets an ARGB value at the position currently referenced by this Pixel . Each channel value is assumed to be 8bit and otherwise truncated . |
18,161 | public void setRGB ( int r , int g , int b ) { setValue ( Pixel . rgb ( r , g , b ) ) ; } | Sets an opaque RGB value at the position currently referenced by this Pixel . Each channel value is assumed to be 8bit and otherwise truncated . |
18,162 | public void setRGB_preserveAlpha ( int r , int g , int b ) { setValue ( ( getValue ( ) & 0xff000000 ) | Pixel . argb ( 0 , r , g , b ) ) ; } | Sets an RGB value at the position currently referenced by this Pixel . The present alpha value will not be altered by this operation . Each channel value is assumed to be 8bit and otherwise truncated . |
18,163 | public static BufferedImage get ( Image img , int imgType ) { Function < Integer , ImageObserver > obs = flags -> { return ( image , infoflags , x , y , width , height ) -> ( infoflags & flags ) != flags ; } ; BufferedImage bimg = new BufferedImage ( img . getWidth ( obs . apply ( ImageObserver . WIDTH ) ) , img . getHeight ( obs . apply ( ImageObserver . HEIGHT ) ) , imgType ) ; Graphics2D gr2D = bimg . createGraphics ( ) ; gr2D . drawImage ( img , 0 , 0 , obs . apply ( ImageObserver . ALLBITS ) ) ; gr2D . dispose ( ) ; return bimg ; } | Creates a new BufferedImage of the specified imgType and same size as the provided image and draws the provided Image onto the new BufferedImage . |
18,164 | public int registerTopicSession ( String topic , Session session ) throws IllegalAccessException { if ( isInconsistenceContext ( topic , session ) ) { return 0 ; } Collection < Session > sessions ; if ( map . containsKey ( topic ) ) { sessions = map . get ( topic ) ; } else { sessions = Collections . synchronizedCollection ( new ArrayList < Session > ( ) ) ; map . put ( topic , sessions ) ; } topicAccessManager . checkAccessTopic ( userContextFactory . getUserContext ( session . getId ( ) ) , topic ) ; logger . debug ( "'{}' subscribe to '{}'" , session . getId ( ) , topic ) ; if ( session . isOpen ( ) ) { sessions . add ( session ) ; } return getNumberSubscribers ( topic ) ; } | Register session for topic |
18,165 | public int unregisterTopicSession ( String topic , Session session ) { if ( isInconsistenceContext ( topic , session ) ) { return 0 ; } logger . debug ( "'{}' unsubscribe to '{}'" , session . getId ( ) , topic ) ; if ( Constants . Topic . ALL . equals ( topic ) ) { for ( Map . Entry < String , Collection < Session > > entry : map . entrySet ( ) ) { Collection < Session > sessions = entry . getValue ( ) ; removeSessionToSessions ( session , sessions ) ; if ( sessions . isEmpty ( ) ) { map . remove ( entry . getKey ( ) ) ; } } } else { Collection < Session > sessions = map . get ( topic ) ; removeSessionToSessions ( session , sessions ) ; if ( sessions == null || sessions . isEmpty ( ) ) { map . remove ( topic ) ; } } return getNumberSubscribers ( topic ) ; } | Unregister session for topic . topic ALL remove session for all topics |
18,166 | int removeSessionToSessions ( Session session , Collection < Session > sessions ) { if ( sessions != null ) { if ( sessions . remove ( session ) ) { return 1 ; } } return 0 ; } | Remove session in sessions |
18,167 | boolean unregisterTopicSessions ( String topic , Collection < Session > sessions ) { boolean unregister = false ; if ( sessions != null && ! sessions . isEmpty ( ) ) { Collection < Session > all = map . get ( topic ) ; if ( all != null ) { unregister = all . removeAll ( sessions ) ; if ( all . isEmpty ( ) ) { map . remove ( topic ) ; } } } return unregister ; } | Unregister sessions for topic |
18,168 | public Collection < String > removeSessionsToTopic ( Collection < Session > sessions ) { if ( sessions != null && ! sessions . isEmpty ( ) ) { Collection < String > topicUpdated = new ArrayList < > ( ) ; for ( String topic : map . keySet ( ) ) { if ( unregisterTopicSessions ( topic , sessions ) ) { topicUpdated . add ( topic ) ; sendSubscriptionEvent ( Constants . Topic . SUBSCRIBERS + Constants . Topic . COLON + topic , getNumberSubscribers ( topic ) ) ; } } return topicUpdated ; } return Collections . EMPTY_LIST ; } | Remove sessions cause they are closed |
18,169 | public Collection < String > removeSessionToTopics ( Session session ) { if ( session != null ) { return removeSessionsToTopic ( Arrays . asList ( session ) ) ; } return Collections . EMPTY_LIST ; } | Remove session cause it s closed by the endpoint |
18,170 | void sendSubscriptionEvent ( String topic , int nb ) { Collection < Session > sessions = getSessionsForTopic ( topic ) ; if ( ! sessions . isEmpty ( ) ) { MessageToClient messageToClient = new MessageToClient ( ) ; messageToClient . setId ( topic ) ; messageToClient . setType ( MessageType . MESSAGE ) ; messageToClient . setResponse ( nb ) ; for ( Session session : sessions ) { if ( session . isOpen ( ) ) { session . getAsyncRemote ( ) . sendObject ( messageToClient ) ; } } } } | Send subscription event to all client |
18,171 | public Collection < Session > getSessionsForTopic ( String topic ) { Collection < Session > result ; if ( map . containsKey ( topic ) ) { return Collections . unmodifiableCollection ( map . get ( topic ) ) ; } else { result = Collections . EMPTY_LIST ; } return result ; } | Get Sessions for topics |
18,172 | public int getNumberSubscribers ( String topic ) { if ( map . containsKey ( topic ) ) { return map . get ( topic ) . size ( ) ; } return 0 ; } | Get Number Sessions for topics |
18,173 | public SSLSocketFactory getSSLSockectFactory ( ) { SSLContext context = null ; try { context = SSLContext . getInstance ( "TLS" ) ; } catch ( NoSuchAlgorithmException e ) { throw new VOMSError ( e . getMessage ( ) , e ) ; } KeyManager [ ] keyManagers = new KeyManager [ ] { credential . getKeyManager ( ) } ; X509TrustManager trustManager = SocketFactoryCreator . getSSLTrustManager ( validator ) ; TrustManager [ ] trustManagers = new TrustManager [ ] { trustManager } ; SecureRandom secureRandom = null ; secureRandom = new SecureRandom ( ) ; try { context . init ( keyManagers , trustManagers , secureRandom ) ; } catch ( KeyManagementException e ) { throw new VOMSError ( e . getMessage ( ) , e ) ; } return context . getSocketFactory ( ) ; } | Get the SSL socket factory . |
18,174 | public static void scaleArray ( final double [ ] array , final double factor ) { for ( int i = 0 ; i < array . length ; i ++ ) { array [ i ] *= factor ; } } | Multiplies elements of array by specified factor |
18,175 | public double calculateObservedDisagreement ( ) { ensureDistanceFunction ( ) ; double result = 0.0 ; double maxDistance = 1.0 ; for ( ICodingAnnotationItem item : study . getItems ( ) ) { Map < Object , Integer > annotationsPerCategory = CodingAnnotationStudy . countTotalAnnotationsPerCategory ( item ) ; for ( Entry < Object , Integer > category1 : annotationsPerCategory . entrySet ( ) ) for ( Entry < Object , Integer > category2 : annotationsPerCategory . entrySet ( ) ) { if ( category1 . getValue ( ) == null ) continue ; if ( category2 . getValue ( ) == null ) continue ; double distance = distanceFunction . measureDistance ( study , category1 . getKey ( ) , category2 . getKey ( ) ) ; result += category1 . getValue ( ) * category2 . getValue ( ) * distance ; if ( distance > maxDistance ) maxDistance = distance ; } } result /= ( double ) ( maxDistance * study . getItemCount ( ) * study . getRaterCount ( ) * ( study . getRaterCount ( ) - 1 ) ) ; return result ; } | Calculates the observed inter - rater agreement for the annotation study that was passed to the class constructor and the currently assigned distance function . |
18,176 | String getJsInstancename ( String classname ) { char chars [ ] = classname . toCharArray ( ) ; chars [ 0 ] = Character . toLowerCase ( chars [ 0 ] ) ; return new String ( chars ) ; } | Compute the name of instance class |
18,177 | String getJsClassname ( TypeElement typeElement ) { DataService dsAnno = typeElement . getAnnotation ( DataService . class ) ; String name = dsAnno . name ( ) ; if ( name . isEmpty ( ) ) { name = typeElement . getSimpleName ( ) . toString ( ) ; } return name ; } | Compute the name of javascript class |
18,178 | void browseAndWriteMethods ( List < ExecutableElement > methodElements , String classname , Writer writer ) throws IOException { Collection < String > methodProceeds = new ArrayList < > ( ) ; boolean first = true ; for ( ExecutableElement methodElement : methodElements ) { if ( isConsiderateMethod ( methodProceeds , methodElement ) ) { if ( ! first ) { writer . append ( COMMA ) . append ( CR ) ; } visitMethodElement ( classname , methodElement , writer ) ; first = false ; } } } | browse valid methods and write equivalent js methods in writer |
18,179 | protected List < ExecutableElement > getOrderedMethods ( TypeElement typeElement , Comparator < ExecutableElement > comparator ) { List < ExecutableElement > methods = ElementFilter . methodsIn ( typeElement . getEnclosedElements ( ) ) ; Collections . sort ( methods , comparator ) ; return methods ; } | Return methods from typeElement ordered by comparator |
18,180 | List < String > getArgumentsType ( ExecutableElement methodElement ) { ExecutableType methodType = ( ExecutableType ) methodElement . asType ( ) ; List < String > res = new ArrayList < > ( ) ; for ( TypeMirror argumentType : methodType . getParameterTypes ( ) ) { res . add ( argumentType . toString ( ) ) ; } return res ; } | Get argument types list from method |
18,181 | List < String > getArguments ( ExecutableElement methodElement ) { List < String > res = new ArrayList < > ( ) ; for ( VariableElement variableElement : methodElement . getParameters ( ) ) { res . add ( variableElement . toString ( ) ) ; } return res ; } | Get argument names list from method |
18,182 | public CodingAnnotationStudy stripCategories ( final Object keepCategory , final Object nullCategory ) { CodingAnnotationStudy result = new CodingAnnotationStudy ( getRaterCount ( ) ) ; for ( ICodingAnnotationItem item : getItems ( ) ) { CodingAnnotationItem newItem = new CodingAnnotationItem ( raters . size ( ) ) ; for ( IAnnotationUnit unit : item . getUnits ( ) ) { Object newCategory ; if ( ! keepCategory . equals ( unit . getCategory ( ) ) ) { newCategory = nullCategory ; } else { newCategory = keepCategory ; } newItem . addUnit ( result . createUnit ( result . items . size ( ) , unit . getRaterIdx ( ) , newCategory ) ) ; } result . items . add ( newItem ) ; } return result ; } | Returns a clone of the current annotation study in which all categories are replaced by the given nullCategory except the categories matching the specified keepCategory . |
18,183 | public double computePhase ( int idx ) { double r = real [ idx ] ; double i = imag [ idx ] ; return atan2 ( r , i ) ; } | Calculates the phase of the pixel at the specified index . The phase is the argument of the complex number i . e . the angle of the complex vector in the complex plane . |
18,184 | private Map findLoaders ( ) { Map loaders = getContainer ( ) . getComponentDescriptorMap ( ProviderLoader . class . getName ( ) ) ; if ( loaders == null ) { throw new Error ( "No provider loaders found" ) ; } Set keys = loaders . keySet ( ) ; Map found = null ; ProviderLoader defaultLoader = null ; for ( Iterator iter = keys . iterator ( ) ; iter . hasNext ( ) ; ) { String key = ( String ) iter . next ( ) ; ProviderLoader loader ; try { loader = ( ProviderLoader ) getContainer ( ) . lookup ( ProviderLoader . class . getName ( ) , key ) ; } catch ( Exception e ) { log . warn ( "Failed to lookup provider loader for key: {}" , key , e ) ; continue ; } if ( loader != null ) { if ( found == null ) { found = new LinkedHashMap ( ) ; } if ( key . equals ( SELECT_DEFAULT ) ) { defaultLoader = loader ; } else { found . put ( key , loader ) ; } } } assert defaultLoader != null ; found . put ( SELECT_DEFAULT , defaultLoader ) ; return found ; } | Find any provider loaders which are available in the container . |
18,185 | public static byte [ ] getBytes ( String text ) { byte [ ] bytes = new byte [ ] { } ; try { bytes = text . getBytes ( "utf-8" ) ; } catch ( UnsupportedEncodingException e ) { } return bytes ; } | Get UTF - 8 without BOM encoded bytes from String |
18,186 | public static byte [ ] loadBytesFromFile ( File file ) { byte [ ] bytes = null ; try { bytes = Files . readAllBytes ( Paths . get ( file . getAbsolutePath ( ) ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return bytes ; } | load from file |
18,187 | public static void saveBytesToFile ( byte [ ] data , File file ) { if ( data == null ) { return ; } FileOutputStream fos = null ; BufferedOutputStream bos = null ; try { fos = new FileOutputStream ( file ) ; bos = new BufferedOutputStream ( fos ) ; bos . write ( data ) ; bos . flush ( ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { if ( bos != null ) { try { bos . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } if ( fos != null ) { try { fos . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } } | save to file |
18,188 | public static BufferedImage loadImage ( String fileName ) { File f = new File ( fileName ) ; if ( f . exists ( ) ) { return loadImage ( f ) ; } throw new ImageLoaderException ( new FileNotFoundException ( fileName ) ) ; } | Tries to load Image from specified filename . |
18,189 | public static BufferedImage loadImage ( File file ) { try { BufferedImage bimg = ImageIO . read ( file ) ; if ( bimg == null ) { throw new ImageLoaderException ( "Could not load Image! ImageIO.read() returned null." ) ; } return bimg ; } catch ( IOException e ) { throw new ImageLoaderException ( e ) ; } } | Tries to load image from specified file . |
18,190 | MessageToClient _createMessageToClient ( MessageFromClient message , T session ) { MessageToClient messageToClient = new MessageToClient ( ) ; messageToClient . setId ( message . getId ( ) ) ; try { Class cls = Class . forName ( message . getDataService ( ) ) ; Object dataService = this . getDataService ( session , cls ) ; logger . debug ( "Process message {}" , message ) ; List < Object > arguments = getArrayList ( ) ; Method method = methodServices . getMethodFromDataService ( cls , message , arguments ) ; injectSession ( method . getParameterTypes ( ) , arguments , session ) ; messageToClient . setResult ( method . invoke ( dataService , arguments . toArray ( ) ) ) ; if ( method . isAnnotationPresent ( JsonMarshaller . class ) ) { messageToClient . setJson ( argumentServices . getJsonResultFromSpecificMarshaller ( method . getAnnotation ( JsonMarshaller . class ) , messageToClient . getResponse ( ) ) ) ; } try { Method nonProxiedMethod = methodServices . getNonProxiedMethod ( cls , method . getName ( ) , method . getParameterTypes ( ) ) ; messageToClient . setDeadline ( cacheManager . processCacheAnnotations ( nonProxiedMethod , message . getParameters ( ) ) ) ; } catch ( NoSuchMethodException ex ) { logger . error ( "Fail to process extra annotations (JsCacheResult, JsCacheRemove) for method : " + method . getName ( ) , ex ) ; } logger . debug ( "Method {} proceed messageToClient : {}." , method . getName ( ) , messageToClient ) ; } catch ( InvocationTargetException ex ) { Throwable cause = ex . getCause ( ) ; if ( ConstraintViolationException . class . isInstance ( cause ) ) { messageToClient . setConstraints ( constraintServices . extractViolations ( ( ConstraintViolationException ) cause ) ) ; } else { messageToClient . setFault ( faultServices . buildFault ( cause ) ) ; } } catch ( Throwable ex ) { messageToClient . setFault ( faultServices . buildFault ( ex ) ) ; } return messageToClient ; } | Create a MessageToClient from MessageFromClient for session Only for available test use case |
18,191 | void injectSession ( Class < ? > [ ] parameterTypes , List < Object > arguments , T session ) { if ( parameterTypes != null ) { int i = 0 ; for ( Class < ? > parameterType : parameterTypes ) { if ( parameterType . isInstance ( session ) ) { arguments . set ( i , session ) ; break ; } i ++ ; } } } | Inject Session or HttpSession if necessary |
18,192 | private void loadCertificateFromFile ( File file ) { certificateFileSanityChecks ( file ) ; try { X509Certificate aaCert = CertificateUtils . loadCertificate ( new FileInputStream ( file ) , Encoding . PEM ) ; String aaCertHash = getOpensslCAHash ( aaCert . getSubjectX500Principal ( ) ) ; localAACertificatesByHash . put ( aaCertHash , aaCert ) ; synchronized ( listenerLock ) { listener . notifyCertificateLoadEvent ( aaCert , file ) ; } } catch ( IOException e ) { String errorMessage = String . format ( "Error parsing VOMS trusted certificate from %s. Reason: %s" , file . getAbsolutePath ( ) , e . getMessage ( ) ) ; throw new VOMSError ( errorMessage , e ) ; } } | Loads a VOMS AA certificate from a given file and stores this certificate in the local map of trusted VOMS AA certificate . |
18,193 | private void certificateFileSanityChecks ( File certFile ) { if ( ! certFile . exists ( ) ) throw new VOMSError ( "Local VOMS trusted certificate does not exist:" + certFile . getAbsolutePath ( ) ) ; if ( ! certFile . canRead ( ) ) throw new VOMSError ( "Local VOMS trusted certificate is not readable:" + certFile . getAbsolutePath ( ) ) ; } | Performs basic sanity checks performed on a file supposed to hold a VOMS AA certificate . |
18,194 | private void directorySanityChecks ( File directory ) { if ( ! directory . exists ( ) ) throw new VOMSError ( "Local trust directory does not exists:" + directory . getAbsolutePath ( ) ) ; if ( ! directory . isDirectory ( ) ) throw new VOMSError ( "Local trust directory is not a directory:" + directory . getAbsolutePath ( ) ) ; if ( ! directory . canRead ( ) ) throw new VOMSError ( "Local trust directory is not readable:" + directory . getAbsolutePath ( ) ) ; if ( ! directory . canExecute ( ) ) throw new VOMSError ( "Local trust directory is not traversable:" + directory . getAbsolutePath ( ) ) ; } | Performs basic sanity checks on a directory that is supposed to contain VOMS AA certificates and LSC files . |
18,195 | private boolean doesItemMatchAppropriateCondition ( Object item ) { Matcher < ? > matcher ; if ( item instanceof View ) { matcher = loaded ( ) ; } else if ( item instanceof Element ) { matcher = displayed ( ) ; } else { matcher = present ( ) ; } return matcher . matches ( item ) ; } | Takes an object and determines a condition for that object that should satisfy the containing view is loaded . Different conditions are made depending on the type of object . |
18,196 | String getClassnameFromProxy ( Object dataservice ) { String ds = dataservice . toString ( ) ; return getClassnameFromProxyname ( ds ) ; } | Return classname from proxy instance |
18,197 | String getClassnameFromProxyname ( String proxyname ) { Pattern pattern = Pattern . compile ( "[@$]" ) ; Matcher matcher = pattern . matcher ( proxyname ) ; matcher . find ( ) ; matcher . start ( ) ; return proxyname . substring ( 0 , matcher . start ( ) ) ; } | Return classname from proxyname |
18,198 | public static X509CertChainValidatorExt buildCertificateValidator ( ) { return buildCertificateValidator ( DefaultVOMSValidator . DEFAULT_TRUST_ANCHORS_DIR , null , null , 0L , DEFAULT_NS_CHECKS , DEFAULT_CRL_CHECKS , DEFAULT_OCSP_CHECKS ) ; } | Builds an Openssl - style certificate validator . |
18,199 | public int getIndexOfMaxValue ( int channel ) { double [ ] values = getData ( ) [ channel ] ; int index = 0 ; double val = values [ index ] ; for ( int i = 1 ; i < numValues ( ) ; i ++ ) { if ( values [ i ] > val ) { index = i ; val = values [ index ] ; } } return index ; } | Returns the index of the maximum value of the specified channel . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.