idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
7,100
public EChange addListener ( final EventListener aListener ) { ValueEnforcer . notNull ( aListener , "Listener" ) ; if ( ! ( aListener instanceof ServletContextListener ) && ! ( aListener instanceof HttpSessionListener ) && ! ( aListener instanceof ServletRequestListener ) ) { LOGGER . warn ( "Passed mock listener is n...
Add a new listener .
7,101
public static void forEachURLSet ( final Consumer < ? super XMLSitemapURLSet > aConsumer ) { ValueEnforcer . notNull ( aConsumer , "Consumer" ) ; for ( final IXMLSitemapProviderSPI aSPI : s_aProviders ) { final XMLSitemapURLSet aURLSet = aSPI . createURLSet ( ) ; aConsumer . accept ( aURLSet ) ; } }
Create URL sets from every provider and invoke the provided consumer with it .
7,102
public Matrix4f getViewMatrix ( ) { if ( updateViewMatrix ) { rotationMatrixInverse = Matrix4f . createRotation ( rotation ) ; final Matrix4f rotationMatrix = Matrix4f . createRotation ( rotation . invert ( ) ) ; final Matrix4f positionMatrix = Matrix4f . createTranslation ( position . negate ( ) ) ; viewMatrix = rotat...
Returns the view matrix which is the transformation matrix for the position and rotation .
7,103
public static Camera createPerspective ( float fieldOfView , int windowWidth , int windowHeight , float near , float far ) { return new Camera ( Matrix4f . createPerspective ( fieldOfView , ( float ) windowWidth / windowHeight , near , far ) ) ; }
Creates a new camera with a standard perspective projection matrix .
7,104
public static X509Certificate readPemCertificate ( final File file ) throws IOException , CertificateException { final String privateKeyAsString = readPemFileAsBase64 ( file ) ; final byte [ ] decoded = new Base64 ( ) . decode ( privateKeyAsString ) ; return readCertificate ( decoded ) ; }
Read pem certificate .
7,105
protected boolean isLogRequest ( final HttpServletRequest aHttpRequest , final HttpServletResponse aHttpResponse ) { boolean bLog = isGloballyEnabled ( ) && m_aLogger . isInfoEnabled ( ) ; if ( bLog ) { final String sRequestURI = ServletHelper . getRequestRequestURI ( aHttpRequest ) ; for ( final String sExcludedPath :...
Check if this request should be logged or not .
7,106
public CloseableHttpResponse execute ( final HttpUriRequest aRequest ) throws IOException { return execute ( aRequest , ( HttpContext ) null ) ; }
Execute the provided request without any special context . Caller is responsible for consuming the response correctly!
7,107
public CloseableHttpResponse execute ( final HttpUriRequest aRequest , final HttpContext aHttpContext ) throws IOException { checkIfClosed ( ) ; HttpDebugger . beforeRequest ( aRequest , aHttpContext ) ; CloseableHttpResponse ret = null ; Throwable aCaughtException = null ; try { ret = m_aHttpClient . execute ( aReques...
Execute the provided request with an optional special context . Caller is responsible for consuming the response correctly!
7,108
public < T > T execute ( final HttpUriRequest aRequest , final ResponseHandler < T > aResponseHandler ) throws IOException { return execute ( aRequest , ( HttpContext ) null , aResponseHandler ) ; }
Execute the provided request without any special context . The response handler is invoked as a callback . This method automatically cleans up all used resources and as such is preferred over the execute methods returning the CloseableHttpResponse .
7,109
public static EChange setMailQueueSize ( final int nMaxMailQueueLen , final int nMaxMailSendCount ) { ValueEnforcer . isGT0 ( nMaxMailQueueLen , "MaxMailQueueLen" ) ; ValueEnforcer . isGT0 ( nMaxMailSendCount , "MaxMailSendCount" ) ; ValueEnforcer . isTrue ( nMaxMailQueueLen >= nMaxMailSendCount , ( ) -> "MaxMailQueueL...
Set mail queue settings . Changing these settings has no effect on existing mail queues!
7,110
public static EChange setUseSSL ( final boolean bUseSSL ) { return s_aRWLock . writeLocked ( ( ) -> { if ( s_bUseSSL == bUseSSL ) return EChange . UNCHANGED ; s_bUseSSL = bUseSSL ; return EChange . CHANGED ; } ) ; }
Use SSL by default?
7,111
public static EChange setUseSTARTTLS ( final boolean bUseSTARTTLS ) { return s_aRWLock . writeLocked ( ( ) -> { if ( s_bUseSTARTTLS == bUseSTARTTLS ) return EChange . UNCHANGED ; s_bUseSTARTTLS = bUseSTARTTLS ; return EChange . CHANGED ; } ) ; }
Use STARTTLS by default?
7,112
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 transport api: "...
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!
7,113
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 ) ; s_nTim...
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!
7,114
public static void addConnectionListener ( final ConnectionListener aConnectionListener ) { ValueEnforcer . notNull ( aConnectionListener , "ConnectionListener" ) ; s_aRWLock . writeLocked ( ( ) -> s_aConnectionListeners . add ( aConnectionListener ) ) ; }
Add a new mail connection listener .
7,115
public static EChange removeConnectionListener ( final ConnectionListener aConnectionListener ) { if ( aConnectionListener == null ) return EChange . UNCHANGED ; return s_aRWLock . writeLocked ( ( ) -> s_aConnectionListeners . removeObject ( aConnectionListener ) ) ; }
Remove an existing mail connection listener .
7,116
public static void addEmailDataTransportListener ( final IEmailDataTransportListener aEmailDataTransportListener ) { ValueEnforcer . notNull ( aEmailDataTransportListener , "EmailDataTransportListener" ) ; s_aRWLock . writeLocked ( ( ) -> s_aEmailDataTransportListeners . add ( aEmailDataTransportListener ) ) ; }
Add a new mail transport listener .
7,117
public static EChange removeEmailDataTransportListener ( final IEmailDataTransportListener aEmailDataTransportListener ) { if ( aEmailDataTransportListener == null ) return EChange . UNCHANGED ; return s_aRWLock . writeLocked ( ( ) -> s_aEmailDataTransportListeners . removeObject ( aEmailDataTransportListener ) ) ; }
Remove an existing mail transport listener .
7,118
@ 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 .
7,119
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 .
7,120
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 .
7,121
public static String signRequest ( final String yourGooglePrivateKeyString , final String path , final String query ) throws NoSuchAlgorithmException , InvalidKeyException , UnsupportedEncodingException , URISyntaxException { final String resource = path + '?' + query ; final SecretKeySpec sha1Key = new SecretKeySpec (...
Returns the context path with the signature as parameter .
7,122
public static String signRequest ( final URL url , final String yourGooglePrivateKeyString ) throws NoSuchAlgorithmException , InvalidKeyException , UnsupportedEncodingException , URISyntaxException { final String resource = url . getPath ( ) + '?' + url . getQuery ( ) ; final SecretKeySpec sha1Key = new SecretKeySpec ...
Returns the full url as String object with the signature as parameter .
7,123
public static void setResponseHeader ( final String sName , 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 .
7,124
public static void addResponseHeader ( final String sName , 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 .
7,125
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 .
7,126
public void addHeader ( final String sName , final String sValue ) { ValueEnforcer . notNull ( sName , "HeaderName" ) ; final String sNameLower = sName . toLowerCase ( Locale . US ) ; m_aRWLock . writeLocked ( ( ) -> { ICommonsList < String > aHeaderValueList = m_aHeaderNameToValueListMap . get ( sNameLower ) ; if ( aH...
Method to add header values to this instance .
7,127
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 .
7,128
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 .
7,129
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 .
7,130
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 .
7,131
public static ByteBuffer createByteBuffer ( int capacity ) { return ByteBuffer . allocateDirect ( capacity * DataType . BYTE . getByteSize ( ) ) . order ( ByteOrder . nativeOrder ( ) ) ; }
Creates a byte buffer of the desired capacity .
7,132
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 .
7,133
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 .
7,134
public static ISessionWebScope getSessionWebScopeOfSession ( final HttpSession aHttpSession ) { return aHttpSession == null ? null : getSessionWebScopeOfID ( aHttpSession . getId ( ) ) ; }
Get the session web scope of the passed HTTP session .
7,135
public static void destroyAllWebSessions ( ) { for ( final ISessionWebScope aSessionScope : getAllSessionWebScopes ( ) ) { if ( aSessionScope . selfDestruct ( ) . isContinue ( ) ) { ScopeSessionManager . getInstance ( ) . onScopeEnd ( aSessionScope ) ; } } }
Destroy all available web scopes .
7,136
private void writeObject ( final ObjectOutputStream aOS ) throws IOException { if ( m_aDFOS . isInMemory ( ) ) { _ensureCachedContentIsPresent ( ) ; } else { m_aCachedContent = null ; m_aDFOSFile = m_aDFOS . getFile ( ) ; } aOS . defaultWriteObject ( ) ; }
Writes the state of this object during serialization .
7,137
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 .
7,138
@ ReturnsMutableObject ( "Speed" ) @ SuppressFBWarnings ( "EI_EXPOSE_REP" ) 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 .
7,139
public String getStringWithFallback ( 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 .
7,140
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
7,141
void parseCmdLine ( String [ ] args ) { JCommander parser = new JCommander ( this , args ) ; parser . setProgramName ( "GA4GHPicardRunner" ) ; LOG . info ( "Cmd line parsed" ) ; }
Parses cmd line with JCommander
7,142
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 .
7,143
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
7,144
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
7,145
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 .
7,146
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 .
7,147
public static DefaultTreeWithGlobalUniqueID < String , NetworkInterface > createNetworkInterfaceTree ( ) { final DefaultTreeWithGlobalUniqueID < String , NetworkInterface > ret = new DefaultTreeWithGlobalUniqueID < > ( ) ; final ICommonsList < NetworkInterface > aNonRootNIs = new CommonsArrayList < > ( ) ; try { for ( ...
Create a hierarchical tree of the network interfaces .
7,148
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 .
7,149
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 .
7,150
public static void validateHTMLConfiguration ( ) throws IllegalStateException { PhotonCSS . readCSSIncludesForGlobal ( new ClassPathResource ( PhotonCSS . DEFAULT_FILENAME ) ) ; PhotonJS . readJSIncludesForGlobal ( new ClassPathResource ( PhotonJS . DEFAULT_FILENAME ) ) ; }
Check if the referenced JS and CSS files exist
7,151
public FineUploader5Form setElementID ( 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 .
7,152
public static void setAuditor ( final IAuditor aAuditor ) { ValueEnforcer . notNull ( aAuditor , "Auditor" ) ; s_aRWLock . writeLocked ( ( ) -> s_aAuditor = aAuditor ) ; }
Set the global auditor to use .
7,153
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 .
7,154
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 .
7,155
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 .
7,156
public static boolean isJSNode ( final IHCNode aNode ) { final IHCNode aUnwrappedNode = HCHelper . getUnwrappedNode ( aNode ) ; return isDirectJSNode ( aUnwrappedNode ) ; }
Check if the passed node is a JS node after unwrapping .
7,157
public static boolean isJSInlineNode ( final IHCNode aNode ) { final IHCNode aUnwrappedNode = HCHelper . getUnwrappedNode ( aNode ) ; return isDirectJSInlineNode ( aUnwrappedNode ) ; }
Check if the passed node is an inline JS node after unwrapping .
7,158
public static boolean isJSFileNode ( final IHCNode aNode ) { final IHCNode aUnwrappedNode = HCHelper . getUnwrappedNode ( aNode ) ; return isDirectJSFileNode ( aUnwrappedNode ) ; }
Check if the passed node is a file JS node after unwrapping .
7,159
public JSVar param ( 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 .
7,160
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
7,161
public static HCCol perc ( final int nPerc ) { return new HCCol ( ) . setWidth ( ECSSUnit . perc ( nPerc ) ) ; }
Create a new column with a certain percentage .
7,162
public int enrichXml ( final MMOs root ) throws SQLException { int count = 0 ; for ( final MMO mmo : root . getMMO ( ) ) { for ( final Utterance utterance : mmo . getUtterances ( ) . getUtterance ( ) ) { for ( final Phrase phrase : utterance . getPhrases ( ) . getPhrase ( ) ) { System . out . printf ( "Phrase: %s\n" , ...
Tries to look up each Mapping Candidate in the SNOMED CT db to add more data .
7,163
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 .
7,164
public static boolean looksLikeXHTML ( final String sText ) { return StringHelper . hasText ( sText ) && RegExHelper . stringMatchesPattern ( "(?s).*<[a-zA-Z].+" , sText ) ; }
Check whether the passed text looks like it contains XHTML code . This is a heuristic check only and does not perform actual parsing!
7,165
public boolean isValidXHTMLFragment ( 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!
7,166
public IMicroContainer unescapeXHTMLFragment ( final String sXHTML ) { final IMicroDocument aDoc = parseXHTMLFragment ( sXHTML ) ; if ( aDoc != null && aDoc . getDocumentElement ( ) != null ) { final IMicroElement eBody = aDoc . getDocumentElement ( ) . getFirstChildElement ( EHTMLElement . BODY . getElementName ( ) ) ...
Interpret the passed XHTML fragment as HTML and retrieve a result container with all body elements .
7,167
public static LocalDateTime readAsLocalDateTime ( final IMicroElement aElement , final IMicroQName aLDTName , final String aDTName ) { LocalDateTime aLDT = aElement . getAttributeValueWithConversion ( aLDTName , LocalDateTime . class ) ; if ( aLDT == null ) { final ZonedDateTime aDT = aElement . getAttributeValueWithCo...
For migration purposes - read LocalDateTime - if no present fall back to DateTime
7,168
public BootstrapDisplayBuilder display ( final EBootstrapDisplayType eDisplay ) { ValueEnforcer . notNull ( eDisplay , "eDisplay" ) ; m_eDisplay = eDisplay ; return this ; }
Set the display type . Default is block .
7,169
public final HCHead addCSSAt ( final int nIndex , 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 .
7,170
public final HCHead addJS ( 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
7,171
public final HCHead addJSAt ( final int nIndex , 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
7,172
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 .
7,173
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 ) { testResultsDir . mkdirs ( ) ; try { outcomeFile . createNewFile ( ) ; }...
Saves info about the results of running the given test class .
7,174
private boolean initAndReportSuccess ( ) { Config . loadConfig ( ) ; mDependencyAnalyzer = Config . createDepenencyAnalyzer ( ) ; boolean isEnabled = establishIfEnabled ( ) ; if ( ! isEnabled || ! Config . X_INSTRUMENT_CODE_V || isEkstaziSystemClassLoader ( ) ) { return isEnabled ; } Instrumentation instrumentation = E...
Initializes this facade . This method should be invoked only once .
7,175
protected void emitPluginLines ( final MarkdownHCStack aOut , final Line aLines , 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 ) { sIDPlugin = sMe...
interprets a plugin block into the StringBuilder .
7,176
public static Date copy ( final Date d ) { if ( d == null ) { return null ; } else { return new Date ( d . getTime ( ) ) ; } }
Creates a copy on a Date .
7,177
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
7,178
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
7,179
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 .
7,180
public void addFieldInfo ( final String sFieldName , final String sText ) { add ( SingleError . builderInfo ( ) . setErrorFieldName ( sFieldName ) . setErrorText ( sText ) . build ( ) ) ; }
Add a field specific information message .
7,181
public void addFieldWarning ( final String sFieldName , final String sText ) { add ( SingleError . builderWarn ( ) . setErrorFieldName ( sFieldName ) . setErrorText ( sText ) . build ( ) ) ; }
Add a field specific warning message .
7,182
public void addFieldError ( final String sFieldName , final String sText ) { add ( SingleError . builderError ( ) . setErrorFieldName ( sFieldName ) . setErrorText ( sText ) . build ( ) ) ; }
Add a field specific error message .
7,183
public IUserGroup createNewUserGroup ( final String sName , final String sDescription , final Map < String , String > aCustomAttrs ) { final UserGroup aUserGroup = new UserGroup ( sName , sDescription , aCustomAttrs ) ; m_aRWLock . writeLocked ( ( ) -> { internalCreateItem ( aUserGroup ) ; } ) ; AuditHelper . onAuditCr...
Create a new user group .
7,184
public IUserGroup createPredefinedUserGroup ( final String sID , final String sName , final String sDescription , final Map < String , String > aCustomAttrs ) { final UserGroup aUserGroup = new UserGroup ( StubObject . createForCurrentUserAndID ( sID , aCustomAttrs ) , sName , sDescription ) ; m_aRWLock . writeLocked (...
Create a predefined user group .
7,185
public EChange deleteUserGroup ( final String sUserGroupID ) { if ( StringHelper . hasNoText ( sUserGroupID ) ) return EChange . UNCHANGED ; final UserGroup aDeletedUserGroup = getOfID ( sUserGroupID ) ; if ( aDeletedUserGroup == null ) { AuditHelper . onAuditDeleteFailure ( UserGroup . OT , "no-such-usergroup-id" , sU...
Delete the user group with the specified ID
7,186
public EChange undeleteUserGroup ( 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 ( ) . lock ( ) ; try { if ( Bu...
Undelete the user group with the specified ID .
7,187
public EChange renameUserGroup ( final String sUserGroupID , final String sNewName ) { final UserGroup aUserGroup = getOfID ( sUserGroupID ) ; if ( aUserGroup == null ) { AuditHelper . onAuditModifyFailure ( UserGroup . OT , sUserGroupID , "no-such-usergroup-id" , "name" ) ; return EChange . UNCHANGED ; } m_aRWLock . w...
Rename the user group with the specified ID
7,188
public EChange unassignUserFromAllUserGroups ( final String sUserID ) { if ( StringHelper . hasNoText ( sUserID ) ) return EChange . UNCHANGED ; final ICommonsList < IUserGroup > aAffectedUserGroups = new CommonsArrayList < > ( ) ; m_aRWLock . writeLock ( ) . lock ( ) ; try { EChange eChange = EChange . UNCHANGED ; for...
Unassign the passed user ID from all user groups .
7,189
public ICommonsList < IUserGroup > getAllUserGroupsWithAssignedUser ( 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 .
7,190
public ICommonsList < String > getAllUserGroupIDsWithAssignedUser ( final String sUserID ) { if ( StringHelper . hasNoText ( sUserID ) ) return new CommonsArrayList < > ( ) ; return getAllMapped ( aUserGroup -> aUserGroup . containsUserID ( sUserID ) , aUserGroup -> aUserGroup . getID ( ) ) ; }
Get a collection of all user group IDs to which a certain user is assigned to .
7,191
public EChange unassignRoleFromAllUserGroups ( final String sRoleID ) { if ( StringHelper . hasNoText ( sRoleID ) ) return EChange . UNCHANGED ; final ICommonsList < IUserGroup > aAffectedUserGroups = new CommonsArrayList < > ( ) ; m_aRWLock . writeLock ( ) . lock ( ) ; try { EChange eChange = EChange . UNCHANGED ; for...
Unassign the passed role ID from existing user groups .
7,192
public ICommonsList < String > getAllUserGroupIDsWithAssignedRole ( 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 .
7,193
public final void internalSetNodeState ( 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 " + m_eNode...
Change the node state internally . Handle with care!
7,194
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 .
7,195
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
7,196
public static void main ( String [ ] args ) { 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 > 1 ) { mode = args [...
The user has to specify directory that keep coverage and optionally mode that should be used to print non affected classes .
7,197
private static List < String > findNonAffectedClasses ( String workingDirectory ) { Set < String > allClasses = new HashSet < String > ( ) ; Set < String > affectedClasses = new HashSet < String > ( ) ; loadConfig ( workingDirectory ) ; List < String > nonAffectedClasses = findNonAffectedClasses ( Config . ROOT_DIR_V ,...
Returns list of non affected classes as discovered from the given directory with dependencies .
7,198
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 .
7,199
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 .