idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
7,100
@ Nonnull public static EChange setConnectionTimeoutMilliSecs ( final long nMilliSecs ) { return s_aRWLock . writeLocked ( ( ) -> { if ( s_nConnectionTimeoutMilliSecs == nMilliSecs ) return EChange . UNCHANGED ; if ( nMilliSecs <= 0 ) LOGGER . warn ( "You are setting an indefinite connection timeout for the mail transp...
Set the connection timeout in milliseconds . Values &le ; 0 are interpreted as indefinite timeout which is not recommended! Changing these settings has no effect on existing mail queues!
132
33
7,101
@ Nonnull public static EChange setTimeoutMilliSecs ( final long nMilliSecs ) { return s_aRWLock . writeLocked ( ( ) -> { if ( s_nTimeoutMilliSecs == nMilliSecs ) return EChange . UNCHANGED ; if ( nMilliSecs <= 0 ) LOGGER . warn ( "You are setting an indefinite socket timeout for the mail transport api: " + nMilliSecs ...
Set the socket timeout in milliseconds . Values &le ; 0 are interpreted as indefinite timeout which is not recommended! Changing these settings has no effect on existing mail queues!
129
33
7,102
public static void addConnectionListener ( @ Nonnull final ConnectionListener aConnectionListener ) { ValueEnforcer . notNull ( aConnectionListener , "ConnectionListener" ) ; s_aRWLock . writeLocked ( ( ) -> s_aConnectionListeners . add ( aConnectionListener ) ) ; }
Add a new mail connection listener .
64
7
7,103
@ Nonnull public static EChange removeConnectionListener ( @ Nullable final ConnectionListener aConnectionListener ) { if ( aConnectionListener == null ) return EChange . UNCHANGED ; return s_aRWLock . writeLocked ( ( ) -> s_aConnectionListeners . removeObject ( aConnectionListener ) ) ; }
Remove an existing mail connection listener .
70
7
7,104
public static void addEmailDataTransportListener ( @ Nonnull final IEmailDataTransportListener aEmailDataTransportListener ) { ValueEnforcer . notNull ( aEmailDataTransportListener , "EmailDataTransportListener" ) ; s_aRWLock . writeLocked ( ( ) -> s_aEmailDataTransportListeners . add ( aEmailDataTransportListener ) ) ...
Add a new mail transport listener .
86
7
7,105
@ Nonnull public static EChange removeEmailDataTransportListener ( @ Nullable final IEmailDataTransportListener aEmailDataTransportListener ) { if ( aEmailDataTransportListener == null ) return EChange . UNCHANGED ; return s_aRWLock . writeLocked ( ( ) -> s_aEmailDataTransportListeners . removeObject ( aEmailDataTransp...
Remove an existing mail transport listener .
89
7
7,106
@ SuppressFBWarnings ( "LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE" ) public static void enableJavaxMailDebugging ( final boolean bDebug ) { java . util . logging . Logger . getLogger ( "com.sun.mail.smtp" ) . setLevel ( bDebug ? Level . FINEST : Level . INFO ) ; java . util . logging . Logger . getLogger ( "com.sun.mail.smt...
Enable or disable javax . mail debugging . By default debugging is disabled .
209
16
7,107
public static void setToDefault ( ) { s_aRWLock . writeLocked ( ( ) -> { s_nMaxMailQueueLen = DEFAULT_MAX_QUEUE_LENGTH ; s_nMaxMailSendCount = DEFAULT_MAX_SEND_COUNT ; s_bUseSSL = DEFAULT_USE_SSL ; s_bUseSTARTTLS = DEFAULT_USE_STARTTLS ; s_nConnectionTimeoutMilliSecs = DEFAULT_CONNECT_TIMEOUT_MILLISECS ; s_nTimeoutMill...
Set all settings to the default . This is helpful for testing .
185
13
7,108
public static byte [ ] convertToKeyByteArray ( String yourGooglePrivateKeyString ) { yourGooglePrivateKeyString = yourGooglePrivateKeyString . replace ( ' ' , ' ' ) ; yourGooglePrivateKeyString = yourGooglePrivateKeyString . replace ( ' ' , ' ' ) ; return Base64 . getDecoder ( ) . decode ( yourGooglePrivateKeyString ) ...
Converts the given private key as String to an base 64 encoded byte array .
81
16
7,109
public static String signRequest ( final String yourGooglePrivateKeyString , final String path , final String query ) throws NoSuchAlgorithmException , InvalidKeyException , UnsupportedEncodingException , URISyntaxException { // Retrieve the proper URL components to sign final String resource = path + ' ' + query ; // ...
Returns the context path with the signature as parameter .
291
10
7,110
public static String signRequest ( final URL url , final String yourGooglePrivateKeyString ) throws NoSuchAlgorithmException , InvalidKeyException , UnsupportedEncodingException , URISyntaxException { // Retrieve the proper URL components to sign final String resource = url . getPath ( ) + ' ' + url . getQuery ( ) ; //...
Returns the full url as String object with the signature as parameter .
342
13
7,111
public static void setResponseHeader ( @ Nonnull @ Nonempty final String sName , @ Nonnull @ Nonempty final String sValue ) { ValueEnforcer . notEmpty ( sName , "Name" ) ; ValueEnforcer . notEmpty ( sValue , "Value" ) ; s_aRWLock . writeLocked ( ( ) -> s_aResponseHeaderMap . setHeader ( sName , sValue ) ) ; }
Sets a response header to the response according to the passed name and value . An existing header entry with the same name is overridden .
92
28
7,112
public static void addResponseHeader ( @ Nonnull @ Nonempty final String sName , @ Nonnull @ Nonempty final String sValue ) { ValueEnforcer . notEmpty ( sName , "Name" ) ; ValueEnforcer . notEmpty ( sValue , "Value" ) ; s_aRWLock . writeLocked ( ( ) -> s_aResponseHeaderMap . addHeader ( sName , sValue ) ) ; }
Adds a response header to the response according to the passed name and value . If an existing header with the same is present the value is added to the list so that the header is emitted more than once .
92
41
7,113
public static < S , T > Map < S , T > merge ( Map < S , T > map , Map < S , T > toMerge ) { Map < S , T > ret = new HashMap < S , T > ( ) ; ret . putAll ( ensure ( map ) ) ; ret . putAll ( ensure ( toMerge ) ) ; return ret ; }
toMerge will overwrite map values .
81
8
7,114
public void addHeader ( @ Nonnull final String sName , @ Nullable final String sValue ) { ValueEnforcer . notNull ( sName , "HeaderName" ) ; final String sNameLower = sName . toLowerCase ( Locale . US ) ; m_aRWLock . writeLocked ( ( ) -> { ICommonsList < String > aHeaderValueList = m_aHeaderNameToValueListMap . get ( s...
Method to add header values to this instance .
176
9
7,115
public static void checkVersion ( GLVersioned required , GLVersioned object ) { if ( ! debug ) { return ; } final GLVersion requiredVersion = required . getGLVersion ( ) ; final GLVersion objectVersion = object . getGLVersion ( ) ; if ( objectVersion . getMajor ( ) > requiredVersion . getMajor ( ) && objectVersion . ge...
Checks if two OpenGL versioned object have compatible version . Throws an exception if that s not the case . A version is determined to be compatible with another is it s lower than the said version . This isn t always true when deprecation is involved but it s an acceptable way of doing this in most implementations .
119
65
7,116
public static int [ ] getPackedPixels ( ByteBuffer imageData , Format format , Rectangle size ) { final int [ ] pixels = new int [ size . getArea ( ) ] ; final int width = size . getWidth ( ) ; final int height = size . getHeight ( ) ; for ( int x = 0 ; x < width ; x ++ ) { for ( int y = 0 ; y < height ; y ++ ) { final...
Converts a byte buffer of image data to a flat integer array integer where each pixel is and integer in the ARGB format . Input data is expected to be 8 bits per component . If the format has no alpha 0xFF is written as the value .
289
52
7,117
public static BufferedImage getImage ( ByteBuffer imageData , Format format , Rectangle size ) { final int width = size . getWidth ( ) ; final int height = size . getHeight ( ) ; final BufferedImage image = new BufferedImage ( width , height , BufferedImage . TYPE_INT_ARGB ) ; final int [ ] pixels = ( ( DataBufferInt )...
Converts a byte buffer of image data to a buffered image in the ARGB format . Input data is expected to be 8 bits per component . If the format has no alpha 0xFF is written as the value .
328
45
7,118
public static Vector4f fromIntRGBA ( int r , int g , int b , int a ) { return new Vector4f ( ( r & 0xff ) / 255f , ( g & 0xff ) / 255f , ( b & 0xff ) / 255f , ( a & 0xff ) / 255f ) ; }
Converts 4 byte color components to a normalized float color .
71
12
7,119
public static ByteBuffer createByteBuffer ( int capacity ) { return ByteBuffer . allocateDirect ( capacity * DataType . BYTE . getByteSize ( ) ) . order ( ByteOrder . nativeOrder ( ) ) ; }
Creates a byte buffer of the desired capacity .
46
10
7,120
protected UnmappedReads < Read > getUnmappedMatesOfMappedReads ( String readsetId ) throws GeneralSecurityException , IOException { LOG . info ( "Collecting unmapped mates of mapped reads for injection" ) ; final Iterable < Read > unmappedReadsIterable = getUnmappedReadsIterator ( readsetId ) ; final UnmappedReads < Re...
Gets unmapped mates so we can inject them besides their mapped pairs .
167
15
7,121
public void set ( Rectangle rectangle ) { set ( rectangle . getX ( ) , rectangle . getY ( ) , rectangle . getWidth ( ) , rectangle . getHeight ( ) ) ; }
Sets the rectangle to be an exact copy of the provided one .
41
14
7,122
@ Nullable public static ISessionWebScope getSessionWebScopeOfSession ( @ Nullable final HttpSession aHttpSession ) { return aHttpSession == null ? null : getSessionWebScopeOfID ( aHttpSession . getId ( ) ) ; }
Get the session web scope of the passed HTTP session .
55
11
7,123
public static void destroyAllWebSessions ( ) { // destroy all session web scopes (make a copy, because we're invalidating // the sessions!) for ( final ISessionWebScope aSessionScope : getAllSessionWebScopes ( ) ) { // Unfortunately we need a special handling here if ( aSessionScope . selfDestruct ( ) . isContinue ( ) ...
Destroy all available web scopes .
112
7
7,124
private void writeObject ( final ObjectOutputStream aOS ) throws IOException { // Read the data if ( m_aDFOS . isInMemory ( ) ) { _ensureCachedContentIsPresent ( ) ; } else { m_aCachedContent = null ; m_aDFOSFile = m_aDFOS . getFile ( ) ; } // write out values aOS . defaultWriteObject ( ) ; }
Writes the state of this object during serialization .
91
11
7,125
@ Nonnegative public long getSize ( ) { if ( m_nSize >= 0 ) return m_nSize ; if ( m_aCachedContent != null ) return m_aCachedContent . length ; if ( m_aDFOS . isInMemory ( ) ) return m_aDFOS . getDataLength ( ) ; return m_aDFOS . getFile ( ) . length ( ) ; }
Returns the size of the file .
90
7
7,126
@ ReturnsMutableObject ( "Speed" ) @ SuppressFBWarnings ( "EI_EXPOSE_REP" ) @ Nullable public byte [ ] directGet ( ) { if ( isInMemory ( ) ) { _ensureCachedContentIsPresent ( ) ; return m_aCachedContent ; } return SimpleFileIO . getAllFileBytes ( m_aDFOS . getFile ( ) ) ; }
Returns the contents of the file as an array of bytes . If the contents of the file were not yet cached in memory they will be loaded from the disk storage and cached .
92
35
7,127
@ Nonnull public String getStringWithFallback ( @ Nonnull final Charset aFallbackCharset ) { final String sCharset = getCharSet ( ) ; final Charset aCharset = CharsetHelper . getCharsetFromNameOrDefault ( sCharset , aFallbackCharset ) ; return getString ( aCharset ) ; }
Get the string with the charset defined in the content type .
86
13
7,128
public void run ( String [ ] args ) { LOG . info ( "Starting GA4GHPicardRunner" ) ; try { parseCmdLine ( args ) ; buildPicardCommand ( ) ; startProcess ( ) ; pumpInputData ( ) ; waitForProcessEnd ( ) ; } catch ( Exception e ) { System . out . println ( e . getMessage ( ) ) ; e . printStackTrace ( ) ; } }
Sets up required streams and pipes and then spawns the Picard tool
92
13
7,129
void parseCmdLine ( String [ ] args ) { JCommander parser = new JCommander ( this , args ) ; parser . setProgramName ( "GA4GHPicardRunner" ) ; LOG . info ( "Cmd line parsed" ) ; }
Parses cmd line with JCommander
55
9
7,130
private void buildPicardCommand ( ) throws IOException , GeneralSecurityException , URISyntaxException { File picardJarPath = new File ( picardPath , "picard.jar" ) ; if ( ! picardJarPath . exists ( ) ) { throw new IOException ( "Picard tool not found at " + picardJarPath . getAbsolutePath ( ) ) ; } command . add ( "ja...
Adds relevant parts to the cmd line for Picard tool finds and extracts INPUT = arguments and processes them by creating appropriate data pumps .
243
26
7,131
private Input processGA4GHInput ( String input ) throws IOException , GeneralSecurityException , URISyntaxException { GA4GHUrl url = new GA4GHUrl ( input ) ; SAMFilePump pump ; if ( usingGrpc ) { factoryGrpc . configure ( url . getRootUrl ( ) , new Settings ( clientSecretsFilename , apiKey , noLocalServer ) ) ; pump = ...
Processes GA4GH based input creates required API connections and data pump
289
14
7,132
private Input processRegularFileInput ( String input ) throws IOException { File inputFile = new File ( input ) ; if ( ! inputFile . exists ( ) ) { throw new IOException ( "Input does not exist: " + input ) ; } if ( pipeFiles ) { SamReader samReader = SamReaderFactory . makeDefault ( ) . open ( inputFile ) ; return new...
Processes regular non GA4GH based file input
121
10
7,133
private void startProcess ( ) throws IOException { LOG . info ( "Building process" ) ; ProcessBuilder processBuilder = new ProcessBuilder ( command ) ; processBuilder . redirectError ( ProcessBuilder . Redirect . INHERIT ) ; processBuilder . redirectOutput ( ProcessBuilder . Redirect . INHERIT ) ; LOG . info ( "Startin...
Starts the Picard tool process based on constructed command .
96
11
7,134
private void pumpInputData ( ) throws IOException { for ( Input input : inputs ) { if ( input . pump == null ) { continue ; } OutputStream os ; if ( input . pipeName . equals ( STDIN_FILE_NAME ) ) { os = process . getOutputStream ( ) ; } else { throw new IOException ( "Only stdin piping is supported so far." ) ; } inpu...
Loops through inputs and for each pumps the data into the proper pipe stream connected to the executing process .
95
21
7,135
@ Nonnull public static DefaultTreeWithGlobalUniqueID < String , NetworkInterface > createNetworkInterfaceTree ( ) { final DefaultTreeWithGlobalUniqueID < String , NetworkInterface > ret = new DefaultTreeWithGlobalUniqueID <> ( ) ; // Build basic level - all IFs without a parent final ICommonsList < NetworkInterface > ...
Create a hierarchical tree of the network interfaces .
416
9
7,136
public static Runner runnerForClass0 ( RunnerBuilder builder , Class < ? > testClass ) throws Throwable { if ( recursiveDepth > 1 || isOnStack ( 0 , CoverageRunner . class . getCanonicalName ( ) ) ) { return builder . runnerForClass ( testClass ) ; } AffectingBuilder affectingBuilder = new AffectingBuilder ( ) ; Runner...
JUnit4 support .
142
5
7,137
private static boolean isOnStack ( int moreThan , String canonicalName ) { StackTraceElement [ ] stackTrace = Thread . currentThread ( ) . getStackTrace ( ) ; int count = 0 ; for ( StackTraceElement element : stackTrace ) { if ( element . getClassName ( ) . startsWith ( canonicalName ) ) { count ++ ; } } return count >...
Checks if the given name is on stack more than the given number of times . This method uses startsWith to check if the given name is on stack so one can pass a package name too .
90
40
7,138
public static void validateHTMLConfiguration ( ) throws IllegalStateException { // This will throw an IllegalStateException for wrong files in html/js.xml // and html/css.xml PhotonCSS . readCSSIncludesForGlobal ( new ClassPathResource ( PhotonCSS . DEFAULT_FILENAME ) ) ; PhotonJS . readJSIncludesForGlobal ( new ClassP...
Check if the referenced JS and CSS files exist
94
9
7,139
@ Nonnull public FineUploader5Form setElementID ( @ Nonnull @ Nonempty final String sElementID ) { ValueEnforcer . notEmpty ( sElementID , "ElementID" ) ; m_sFormElementID = sElementID ; return this ; }
This can be the ID of the &lt ; form&gt ; or a reference to the &lt ; form&gt ; element .
58
28
7,140
public static void setAuditor ( @ Nonnull final IAuditor aAuditor ) { ValueEnforcer . notNull ( aAuditor , "Auditor" ) ; s_aRWLock . writeLocked ( ( ) -> s_aAuditor = aAuditor ) ; }
Set the global auditor to use .
61
7
7,141
private static boolean startsWith ( String str , String ... prefixes ) { for ( String prefix : prefixes ) { if ( str . startsWith ( prefix ) ) return true ; } return false ; }
Checks if the given string starts with any of the given prefixes .
42
15
7,142
private static List < String > extractClassNames ( String jarName ) throws IOException { List < String > classes = new LinkedList < String > ( ) ; ZipInputStream orig = new ZipInputStream ( new FileInputStream ( jarName ) ) ; for ( ZipEntry entry = orig . getNextEntry ( ) ; entry != null ; entry = orig . getNextEntry (...
Extract class names from the given jar . This method is for debugging purpose .
132
16
7,143
public static void main ( String [ ] args ) throws IOException { if ( args . length != 1 ) { System . out . println ( "There should be an argument: path to a jar." ) ; System . exit ( 0 ) ; } String jarInput = args [ 0 ] ; extract ( new File ( jarInput ) , new File ( "/tmp/junit-ekstazi-agent.jar" ) , new String [ ] { ...
Simple test to print all classes in the given jar .
154
11
7,144
public static boolean isJSNode ( @ Nullable final IHCNode aNode ) { final IHCNode aUnwrappedNode = HCHelper . getUnwrappedNode ( aNode ) ; return isDirectJSNode ( aUnwrappedNode ) ; }
Check if the passed node is a JS node after unwrapping .
59
14
7,145
public static boolean isJSInlineNode ( @ Nullable final IHCNode aNode ) { final IHCNode aUnwrappedNode = HCHelper . getUnwrappedNode ( aNode ) ; return isDirectJSInlineNode ( aUnwrappedNode ) ; }
Check if the passed node is an inline JS node after unwrapping .
61
15
7,146
public static boolean isJSFileNode ( @ Nullable final IHCNode aNode ) { final IHCNode aUnwrappedNode = HCHelper . getUnwrappedNode ( aNode ) ; return isDirectJSFileNode ( aUnwrappedNode ) ; }
Check if the passed node is a file JS node after unwrapping .
59
15
7,147
@ Nonnull public JSVar param ( @ Nonnull @ Nonempty final String sName ) { final JSVar aVar = new JSVar ( sName , null ) ; m_aParams . add ( aVar ) ; return aVar ; }
Add the specified variable to the list of parameters for this function signature .
53
14
7,148
@ Nonnull public JSBlock body ( ) { if ( m_aBody == null ) m_aBody = new JSBlock ( ) . newlineAtEnd ( false ) ; return m_aBody ; }
Get the block that makes up body of this function
45
10
7,149
@ Nonnull public static HCCol perc ( @ Nonnegative final int nPerc ) { return new HCCol ( ) . setWidth ( ECSSUnit . perc ( nPerc ) ) ; }
Create a new column with a certain percentage .
46
9
7,150
public int enrichXml ( final MMOs root ) throws SQLException { int count = 0 ; // TODO: take out the print statements for ( final MMO mmo : root . getMMO ( ) ) { for ( final Utterance utterance : mmo . getUtterances ( ) . getUtterance ( ) ) { for ( final Phrase phrase : utterance . getPhrases ( ) . getPhrase ( ) ) { Sy...
Tries to look up each Mapping Candidate in the SNOMED CT db to add more data .
364
21
7,151
public boolean addSnomedId ( final Candidate candidate ) throws SQLException { final SnomedTerm result = findFromCuiAndDesc ( candidate . getCandidateCUI ( ) , candidate . getCandidatePreferred ( ) ) ; if ( result != null ) { candidate . setSnomedId ( result . snomedId ) ; candidate . setTermType ( result . termType ) ...
Tries to find this candidate in the SNOMED CT database and if found adds the SNOMED id and term type to the instance .
161
29
7,152
public static boolean looksLikeXHTML ( @ Nullable final String sText ) { // If the text contains an open angle bracket followed by a character that // we think of it as HTML // (?s) enables the "dotall" mode - see Pattern.DOTALL return StringHelper . hasText ( sText ) && RegExHelper . stringMatchesPattern ( "(?s).*<[a-...
Check whether the passed text looks like it contains XHTML code . This is a heuristic check only and does not perform actual parsing!
99
27
7,153
public boolean isValidXHTMLFragment ( @ Nullable final String sXHTMLFragment ) { return StringHelper . hasNoText ( sXHTMLFragment ) || parseXHTMLFragment ( sXHTMLFragment ) != null ; }
Check if the given fragment is valid XHTML 1 . 1 mark - up . This method tries to parse the XHTML fragment so it is potentially slow!
52
31
7,154
@ Nullable public IMicroContainer unescapeXHTMLFragment ( @ Nullable final String sXHTML ) { // Ensure that the content is surrounded by a single tag final IMicroDocument aDoc = parseXHTMLFragment ( sXHTML ) ; if ( aDoc != null && aDoc . getDocumentElement ( ) != null ) { // Find "body" case insensitive final IMicroEle...
Interpret the passed XHTML fragment as HTML and retrieve a result container with all body elements .
203
19
7,155
@ Nullable @ ContainsSoftMigration public static LocalDateTime readAsLocalDateTime ( @ Nonnull final IMicroElement aElement , @ Nonnull final IMicroQName aLDTName , @ Nonnull final String aDTName ) { LocalDateTime aLDT = aElement . getAttributeValueWithConversion ( aLDTName , LocalDateTime . class ) ; if ( aLDT == null...
For migration purposes - read LocalDateTime - if no present fall back to DateTime
148
17
7,156
@ Nonnull public BootstrapDisplayBuilder display ( @ Nonnull final EBootstrapDisplayType eDisplay ) { ValueEnforcer . notNull ( eDisplay , "eDisplay" ) ; m_eDisplay = eDisplay ; return this ; }
Set the display type . Default is block .
51
9
7,157
@ Nonnull public final HCHead addCSSAt ( @ Nonnegative final int nIndex , @ Nonnull final IHCNode aCSS ) { ValueEnforcer . notNull ( aCSS , "CSS" ) ; if ( ! HCCSSNodeDetector . isCSSNode ( aCSS ) ) throw new IllegalArgumentException ( aCSS + " is not a valid CSS node!" ) ; m_aCSS . add ( nIndex , aCSS ) ; return this ;...
Add a CSS node at the specified index .
102
9
7,158
@ Nonnull public final HCHead addJS ( @ Nonnull final IHCNode aJS ) { ValueEnforcer . notNull ( aJS , "JS" ) ; if ( ! HCJSNodeDetector . isJSNode ( aJS ) ) throw new IllegalArgumentException ( aJS + " is not a valid JS node!" ) ; m_aJS . add ( aJS ) ; return this ; }
Append some JavaScript code
91
5
7,159
@ Nonnull public final HCHead addJSAt ( @ Nonnegative final int nIndex , @ Nonnull final IHCNode aJS ) { ValueEnforcer . notNull ( aJS , "JS" ) ; if ( ! HCJSNodeDetector . isJSNode ( aJS ) ) throw new IllegalArgumentException ( aJS + " is not a valid JS node!" ) ; m_aJS . add ( nIndex , aJS ) ; return this ; }
Append some JavaScript code at the specified index
103
9
7,160
public static Ekstazi inst ( ) { if ( inst != null ) return inst ; synchronized ( Ekstazi . class ) { if ( inst == null ) { inst = new Ekstazi ( ) ; } } return inst ; }
Returns the only instance of this class . This method will construct and initialize the instance if it was not previously constructed .
49
23
7,161
public void endClassCoverage ( String className , boolean isFailOrError ) { File testResultsDir = new File ( Config . ROOT_DIR_V , Names . TEST_RESULTS_DIR_NAME ) ; File outcomeFile = new File ( testResultsDir , className ) ; if ( isFailOrError ) { // TODO: long names. testResultsDir . mkdirs ( ) ; try { outcomeFile . ...
Saves info about the results of running the given test class .
150
13
7,162
private boolean initAndReportSuccess ( ) { // Load configuration. Config . loadConfig ( ) ; // Initialize storer, hashes, and analyzer. mDependencyAnalyzer = Config . createDepenencyAnalyzer ( ) ; // Establish if Tool is enabled. boolean isEnabled = establishIfEnabled ( ) ; // Return if not enabled or code should not b...
Initializes this facade . This method should be invoked only once .
241
13
7,163
protected void emitPluginLines ( final MarkdownHCStack aOut , final Line aLines , @ Nonnull final String sMeta ) { Line aLine = aLines ; String sIDPlugin = sMeta ; String sParams = null ; ICommonsMap < String , String > aParams = null ; final int nIdxOfSpace = sMeta . indexOf ( ' ' ) ; if ( nIdxOfSpace != - 1 ) { sIDPl...
interprets a plugin block into the StringBuilder .
305
11
7,164
public static Date copy ( final Date d ) { if ( d == null ) { return null ; } else { return new Date ( d . getTime ( ) ) ; } }
Creates a copy on a Date .
37
8
7,165
public static < A > List < A > list ( A ... elements ) { final List < A > list = new ArrayList < A > ( elements . length ) ; for ( A element : elements ) { list . add ( element ) ; } return list ; }
Returns an array list of elements
55
6
7,166
public static < A > Set < A > set ( A ... elements ) { final Set < A > set = new HashSet < A > ( elements . length ) ; for ( A element : elements ) { set . add ( element ) ; } return set ; }
Returns a hash set of elements
55
6
7,167
public static < A > A execute ( ExceptionAction < A > action ) { try { return action . doAction ( ) ; } catch ( RuntimeException e ) { throw e ; } catch ( Error e ) { throw e ; } catch ( Throwable e ) { throw new RuntimeException ( e ) ; } }
delegate to your to an ExceptionAction and wraps checked exceptions in RuntimExceptions leaving unchecked exceptions alone .
65
23
7,168
public void addFieldInfo ( @ Nonnull @ Nonempty final String sFieldName , @ Nonnull @ Nonempty final String sText ) { add ( SingleError . builderInfo ( ) . setErrorFieldName ( sFieldName ) . setErrorText ( sText ) . build ( ) ) ; }
Add a field specific information message .
64
7
7,169
public void addFieldWarning ( @ Nonnull @ Nonempty final String sFieldName , @ Nonnull @ Nonempty final String sText ) { add ( SingleError . builderWarn ( ) . setErrorFieldName ( sFieldName ) . setErrorText ( sText ) . build ( ) ) ; }
Add a field specific warning message .
65
7
7,170
public void addFieldError ( @ Nonnull @ Nonempty final String sFieldName , @ Nonnull @ Nonempty final String sText ) { add ( SingleError . builderError ( ) . setErrorFieldName ( sFieldName ) . setErrorText ( sText ) . build ( ) ) ; }
Add a field specific error message .
64
7
7,171
@ Nonnull public IUserGroup createNewUserGroup ( @ Nonnull @ Nonempty final String sName , @ Nullable final String sDescription , @ Nullable final Map < String , String > aCustomAttrs ) { // Create user group final UserGroup aUserGroup = new UserGroup ( sName , sDescription , aCustomAttrs ) ; m_aRWLock . writeLocked ( ...
Create a new user group .
180
6
7,172
@ Nonnull public IUserGroup createPredefinedUserGroup ( @ Nonnull @ Nonempty final String sID , @ Nonnull @ Nonempty final String sName , @ Nullable final String sDescription , @ Nullable final Map < String , String > aCustomAttrs ) { // Create user group final UserGroup aUserGroup = new UserGroup ( StubObject . create...
Create a predefined user group .
215
7
7,173
@ Nonnull public EChange deleteUserGroup ( @ Nullable final String sUserGroupID ) { if ( StringHelper . hasNoText ( sUserGroupID ) ) return EChange . UNCHANGED ; final UserGroup aDeletedUserGroup = getOfID ( sUserGroupID ) ; if ( aDeletedUserGroup == null ) { AuditHelper . onAuditDeleteFailure ( UserGroup . OT , "no-su...
Delete the user group with the specified ID
350
8
7,174
@ Nonnull public EChange undeleteUserGroup ( @ Nullable final String sUserGroupID ) { final UserGroup aUserGroup = getOfID ( sUserGroupID ) ; if ( aUserGroup == null ) { AuditHelper . onAuditUndeleteFailure ( UserGroup . OT , sUserGroupID , "no-such-id" ) ; return EChange . UNCHANGED ; } m_aRWLock . writeLock ( ) . loc...
Undelete the user group with the specified ID .
237
11
7,175
@ Nonnull public EChange renameUserGroup ( @ Nullable final String sUserGroupID , @ Nonnull @ Nonempty final String sNewName ) { // Resolve user group final UserGroup aUserGroup = getOfID ( sUserGroupID ) ; if ( aUserGroup == null ) { AuditHelper . onAuditModifyFailure ( UserGroup . OT , sUserGroupID , "no-such-usergro...
Rename the user group with the specified ID
274
9
7,176
@ Nonnull public EChange unassignUserFromAllUserGroups ( @ Nullable final String sUserID ) { if ( StringHelper . hasNoText ( sUserID ) ) return EChange . UNCHANGED ; final ICommonsList < IUserGroup > aAffectedUserGroups = new CommonsArrayList <> ( ) ; m_aRWLock . writeLock ( ) . lock ( ) ; try { EChange eChange = EChan...
Unassign the passed user ID from all user groups .
496
12
7,177
@ Nonnull @ ReturnsMutableCopy public ICommonsList < IUserGroup > getAllUserGroupsWithAssignedUser ( @ Nullable final String sUserID ) { if ( StringHelper . hasNoText ( sUserID ) ) return new CommonsArrayList <> ( ) ; return getAll ( aUserGroup -> aUserGroup . containsUserID ( sUserID ) ) ; }
Get a collection of all user groups to which a certain user is assigned to .
85
16
7,178
@ Nonnull @ ReturnsMutableCopy public ICommonsList < String > getAllUserGroupIDsWithAssignedUser ( @ Nullable final String sUserID ) { if ( StringHelper . hasNoText ( sUserID ) ) return new CommonsArrayList <> ( ) ; return getAllMapped ( aUserGroup -> aUserGroup . containsUserID ( sUserID ) , aUserGroup -> aUserGroup ....
Get a collection of all user group IDs to which a certain user is assigned to .
98
17
7,179
@ Nonnull public EChange unassignRoleFromAllUserGroups ( @ Nullable final String sRoleID ) { if ( StringHelper . hasNoText ( sRoleID ) ) return EChange . UNCHANGED ; final ICommonsList < IUserGroup > aAffectedUserGroups = new CommonsArrayList <> ( ) ; m_aRWLock . writeLock ( ) . lock ( ) ; try { EChange eChange = EChan...
Unassign the passed role ID from existing user groups .
477
12
7,180
@ Nonnull @ ReturnsMutableCopy public ICommonsList < String > getAllUserGroupIDsWithAssignedRole ( @ Nullable final String sRoleID ) { if ( StringHelper . hasNoText ( sRoleID ) ) return getNone ( ) ; return getAllMapped ( aUserGroup -> aUserGroup . containsRoleID ( sRoleID ) , IUserGroup :: getID ) ; }
Get a collection of all user group IDs to which a certain role is assigned to .
88
17
7,181
public final void internalSetNodeState ( @ Nonnull final EHCNodeState eNodeState ) { if ( DEBUG_NODE_STATE ) { ValueEnforcer . notNull ( eNodeState , "NodeState" ) ; if ( m_eNodeState . isAfter ( eNodeState ) ) HCConsistencyChecker . consistencyError ( "The new node state is invalid. Got " + eNodeState + " but having "...
Change the node state internally . Handle with care!
114
10
7,182
public static boolean check ( Class < ? > clz ) { if ( Config . CACHE_SEEN_CLASSES_V ) { int index = hash ( clz ) ; if ( CACHE [ index ] == clz ) { return true ; } CACHE [ index ] = clz ; } return false ; }
Checks if the given class is in cache . If not puts the class in the cache and returns false ; otherwise it returns true .
71
27
7,183
public Map < String , String > getResults ( ) { final Map < String , String > results = new HashMap < String , String > ( sinks . size ( ) ) ; for ( Map . Entry < String , StringSink > entry : sinks . entrySet ( ) ) { results . put ( entry . getKey ( ) , entry . getValue ( ) . result ( ) ) ; } return Collections . unmo...
Get the results as a Map from names to String data . The names are composed of
95
17
7,184
public static void main ( String [ ] args ) { // Parse arguments. String coverageDirName = null ; if ( args . length == 0 ) { System . out . println ( "Incorrect arguments. Directory with coverage has to be specified." ) ; System . exit ( 1 ) ; } coverageDirName = args [ 0 ] ; String mode = null ; if ( args . length > ...
The user has to specify directory that keep coverage and optionally mode that should be used to print non affected classes .
271
22
7,185
private static List < String > findNonAffectedClasses ( String workingDirectory ) { Set < String > allClasses = new HashSet < String > ( ) ; Set < String > affectedClasses = new HashSet < String > ( ) ; loadConfig ( workingDirectory ) ; // Find non affected classes. List < String > nonAffectedClasses = findNonAffectedC...
Returns list of non affected classes as discovered from the given directory with dependencies .
144
15
7,186
private static void printNonAffectedClasses ( Set < String > allClasses , Set < String > affectedClasses , List < String > nonAffectedClasses , String mode ) { if ( mode != null && mode . equals ( ANT_MODE ) ) { StringBuilder sb = new StringBuilder ( ) ; for ( String className : nonAffectedClasses ) { className = class...
Prints non affected classes in the given mode . If mode is not specified one class is printed per line .
473
22
7,187
private static void includeAffected ( Set < String > allClasses , Set < String > affectedClasses , List < File > sortedFiles ) { Storer storer = Config . createStorer ( ) ; Hasher hasher = Config . createHasher ( ) ; NameBasedCheck classCheck = Config . DEBUG_MODE_V != Config . DebugMode . NONE ? new DebugNameCheck ( s...
Find all non affected classes .
455
6
7,188
@ Nonnull public DataTablesDom addCustom ( @ Nonnull @ Nonempty final String sStr ) { ValueEnforcer . notEmpty ( sStr , "Str" ) ; _internalAdd ( sStr ) ; return this ; }
Add a custom element
50
4
7,189
@ Nonnull public FineUploader5Validation setItemLimit ( @ Nonnegative final int nItemLimit ) { ValueEnforcer . isGE0 ( nItemLimit , "ItemLimit" ) ; m_nValidationItemLimit = nItemLimit ; return this ; }
Maximum number of items that can be potentially uploaded in this session . Will reject all items that are added or retried after this limit is reached .
58
29
7,190
@ Nonnull public FineUploader5Validation setMinSizeLimit ( @ Nonnegative final int nMinSizeLimit ) { ValueEnforcer . isGE0 ( nMinSizeLimit , "MinSizeLimit" ) ; m_nValidationMinSizeLimit = nMinSizeLimit ; return this ; }
The minimum allowable size in bytes for an item .
64
10
7,191
@ Nonnull public FineUploader5Validation setSizeLimit ( @ Nonnegative final int nSizeLimit ) { ValueEnforcer . isGE0 ( nSizeLimit , "SizeLimit" ) ; m_nValidationSizeLimit = nSizeLimit ; return this ; }
The maximum allowable size in bytes for an item .
58
10
7,192
private void sendTextToServer ( ) { statusLabel . setText ( "" ) ; conceptList . clear ( ) ; // don't do anything if we have no text final String text = mainTextArea . getText ( ) ; if ( text . length ( ) < 1 ) { statusLabel . setText ( messages . pleaseEnterTextLabel ( ) ) ; return ; } // disable interaction while we ...
send the text from the mainTextArea to the server and accept an async response
526
16
7,193
@ Override public ParseResult parse ( Source source ) { if ( ! testSrcInfo . equals ( source . getSrcInfo ( ) ) ) { throw new RuntimeException ( "testSrcInfo and source.getSrcInfo were not equal. testSrcInfo = " + testSrcInfo + ", source.getSrcInfo = " + source . getSrcInfo ( ) ) ; } try { BufferedReader reader = sourc...
When called this examines the source to make sure the scrcInfo and data are the expected testSrcInfo and testString . It then produces the testDoc as a result
218
35
7,194
public void registerPasswordHashCreator ( @ Nonnull final IPasswordHashCreator aPasswordHashCreator ) { ValueEnforcer . notNull ( aPasswordHashCreator , "PasswordHashCreator" ) ; final String sAlgorithmName = aPasswordHashCreator . getAlgorithmName ( ) ; if ( StringHelper . hasNoText ( sAlgorithmName ) ) throw new Ille...
Register a new password hash creator . No other password hash creator with the same algorithm name may be registered .
239
21
7,195
@ Nullable public IPasswordHashCreator getPasswordHashCreatorOfAlgorithm ( @ Nullable final String sAlgorithmName ) { return m_aRWLock . readLocked ( ( ) -> m_aPasswordHashCreators . get ( sAlgorithmName ) ) ; }
Get the password hash creator of the specified algorithm name .
62
11
7,196
private List < SemanticError > check ( DataType dataType ) { logger . finer ( "Checking semantic constraints on datatype " + dataType . name ) ; final List < SemanticError > errors = new ArrayList < SemanticError > ( ) ; final Set < String > constructorNames = new HashSet < String > ( ) ; for ( Constructor constructor ...
Checks a data type for duplicate constructor names or constructors having the same name as the data type
288
20
7,197
private List < SemanticError > check ( DataType dataType , Constructor constructor ) { logger . finer ( "Checking semantic constraints on data type " + dataType . name + ", constructor " + constructor . name ) ; final List < SemanticError > errors = new ArrayList < SemanticError > ( ) ; final Set < String > argNames = ...
Check a constructor to make sure it does not duplicate any args and that no arg duplicates any modifiers
168
20
7,198
private List < SemanticError > check ( DataType dataType , Constructor constructor , Arg arg ) { logger . finest ( "Checking semantic constraints on data type " + dataType . name + ", constructor " + constructor . name ) ; final List < SemanticError > errors = new ArrayList < SemanticError > ( ) ; final Set < ArgModifi...
Checkt to make sure an arg doesn t have duplicate modifiers
171
12
7,199
@ SuppressWarnings ( "resource" ) @ Nonnull @ OverrideOnDemand @ WillCloseWhenClosed protected CSVWriter createCSVWriter ( @ Nonnull final OutputStream aOS ) { return new CSVWriter ( new OutputStreamWriter ( aOS , m_aCharset ) ) . setSeparatorChar ( m_cSeparatorChar ) . setQuoteChar ( m_cQuoteChar ) . setEscapeChar ( m...
Create a new CSV writer .
131
6