idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
36,500 | public String differenceBetweenAnd ( String first , String second ) { Formatter whitespaceFormatter = new Formatter ( ) { @ Override public String format ( String value ) { return ensureWhitespaceVisible ( value ) ; } } ; return getDifferencesHtml ( first , second , whitespaceFormatter ) ; } | Determines difference between two strings . | 69 | 8 |
36,501 | public String differenceBetweenExplicitWhitespaceAnd ( String first , String second ) { Formatter whitespaceFormatter = new Formatter ( ) { @ Override public String format ( String value ) { return explicitWhitespace ( value ) ; } } ; return getDifferencesHtml ( first , second , whitespaceFormatter ) ; } | Determines difference between two strings visualizing various forms of whitespace . | 72 | 15 |
36,502 | public String differenceBetweenIgnoreWhitespaceAnd ( String first , String second ) { String cleanFirst = allWhitespaceToSingleSpace ( first ) ; String cleanSecond = allWhitespaceToSingleSpace ( second ) ; String cleanDiff = differenceBetweenAnd ( cleanFirst , cleanSecond ) ; if ( cleanDiff != null ) { if ( ( "<div>" +... | Determines difference between two strings ignoring whitespace changes . | 139 | 12 |
36,503 | protected static void registerNs ( String prefix , String url ) { Environment . getInstance ( ) . registerNamespace ( prefix , url ) ; } | Registers a namespace in the environment so the prefix can be used in XPath expressions . | 30 | 18 |
36,504 | protected Response callServiceImpl ( String urlSymbolKey , String soapAction ) { String url = getSymbol ( urlSymbolKey ) . toString ( ) ; Response response = getEnvironment ( ) . createInstance ( getResponseClass ( ) ) ; callSoapService ( url , getTemplateName ( ) , soapAction , response ) ; return response ; } | Creates response calls service using configured template and current row s values and calls SOAP service . | 76 | 19 |
36,505 | protected XmlHttpResponse callCheckServiceImpl ( String urlSymbolKey , String soapAction ) { String url = getSymbol ( urlSymbolKey ) . toString ( ) ; XmlHttpResponse response = getEnvironment ( ) . createInstance ( getCheckResponseClass ( ) ) ; callSoapService ( url , getCheckTemplateName ( ) , soapAction , response ) ... | Creates check response calls service using configured check template and current row s values and calls SOAP service . | 85 | 21 |
36,506 | protected void callSoapService ( String url , String templateName , String soapAction , XmlHttpResponse response ) { Map < String , Object > headers = soapAction != null ? Collections . singletonMap ( "SOAPAction" , ( Object ) soapAction ) : null ; getEnvironment ( ) . callService ( url , templateName , getCurrentRowVa... | Calls SOAP service using template and current row s values . | 85 | 13 |
36,507 | public String getUrl ( String htmlLink ) { String result = htmlLink ; if ( htmlLink != null ) { Matcher linkMatcher = LINKPATTERN . matcher ( htmlLink ) ; Matcher imgMatcher = IMAGEPATTERN . matcher ( htmlLink ) ; if ( linkMatcher . matches ( ) ) { String href = linkMatcher . group ( 2 ) ; href = StringEscapeUtils . un... | Gets a URL from a wiki page value . | 162 | 10 |
36,508 | public static String getXPathForRowByValueInOtherColumn ( String selectIndex , String value ) { return String . format ( "/tr[td[%1$s]/descendant-or-self::text()[normalized(.)='%2$s']]" , selectIndex , value ) ; } | Creates an XPath expression - segment that will find a row selecting the row based on the text in a specific column . | 68 | 25 |
36,509 | public static String getXPathForColumnIndex ( String columnName ) { // determine how many columns are before the column with the requested name // the column with the requested name will have an index of the value +1 (since XPath indexes are 1 based) String headerXPath = getXPathForHeaderCellWithText ( columnName ) ; r... | Creates an XPath expression that will determine for a row which index to use to select the cell in the column with the supplied header text value . | 113 | 30 |
36,510 | public static String getXPathForHeaderRowByHeaders ( String columnName , String ... extraColumnNames ) { String allHeadersPresent ; if ( extraColumnNames != null && extraColumnNames . length > 0 ) { int extraCount = extraColumnNames . length ; String [ ] columnNames = new String [ extraCount + 1 ] ; columnNames [ 0 ] =... | Creates an XPath expression that will find a header row selecting the row based on the header texts present . | 185 | 22 |
36,511 | private < T > T doWithLock ( LockCallback < T > callback ) throws JobPersistenceException { return doWithLock ( callback , null ) ; } | Perform Redis operations while possessing lock | 33 | 8 |
36,512 | private < T > T doWithLock ( LockCallback < T > callback , String errorMessage ) throws JobPersistenceException { JedisCommands jedis = null ; try { jedis = getResource ( ) ; try { storage . waitForLock ( jedis ) ; return callback . doWithLock ( jedis ) ; } catch ( ObjectAlreadyExistsException e ) { throw e ; } catch (... | Perform a redis operation while lock is acquired | 196 | 10 |
36,513 | public boolean lock ( T jedis ) { UUID lockId = UUID . randomUUID ( ) ; final String setResponse = jedis . set ( redisSchema . lockKey ( ) , lockId . toString ( ) , "NX" , "PX" , lockTimeout ) ; boolean lockAcquired = ! isNullOrEmpty ( setResponse ) && setResponse . equals ( "OK" ) ; if ( lockAcquired ) { // save the r... | Attempt to acquire a lock | 130 | 5 |
36,514 | public void waitForLock ( T jedis ) { while ( ! lock ( jedis ) ) { try { logger . debug ( "Waiting for Redis lock." ) ; Thread . sleep ( randomInt ( 75 , 125 ) ) ; } catch ( InterruptedException e ) { logger . error ( "Interrupted while waiting for lock." , e ) ; } } } | Attempt to acquire lock . If lock cannot be acquired wait until lock is successfully acquired . | 80 | 17 |
36,515 | public boolean unlock ( T jedis ) { final String currentLock = jedis . get ( redisSchema . lockKey ( ) ) ; if ( ! isNullOrEmpty ( currentLock ) && UUID . fromString ( currentLock ) . equals ( lockValue ) ) { // This is our lock. We can remove it. jedis . del ( redisSchema . lockKey ( ) ) ; return true ; } return false ... | Attempt to remove lock | 97 | 4 |
36,516 | public JobDetail retrieveJob ( JobKey jobKey , T jedis ) throws JobPersistenceException , ClassNotFoundException { final String jobHashKey = redisSchema . jobHashKey ( jobKey ) ; final String jobDataMapHashKey = redisSchema . jobDataMapHashKey ( jobKey ) ; final Map < String , String > jobDetailMap = jedis . hgetAll ( ... | Retrieve a job from redis | 252 | 7 |
36,517 | public OperableTrigger retrieveTrigger ( TriggerKey triggerKey , T jedis ) throws JobPersistenceException { final String triggerHashKey = redisSchema . triggerHashKey ( triggerKey ) ; Map < String , String > triggerMap = jedis . hgetAll ( triggerHashKey ) ; if ( triggerMap == null || triggerMap . isEmpty ( ) ) { logger... | Retrieve a trigger from Redis | 363 | 7 |
36,518 | public List < OperableTrigger > getTriggersForJob ( JobKey jobKey , T jedis ) throws JobPersistenceException { final String jobTriggerSetKey = redisSchema . jobTriggersSetKey ( jobKey ) ; final Set < String > triggerHashKeys = jedis . smembers ( jobTriggerSetKey ) ; List < OperableTrigger > triggers = new ArrayList <> ... | Retrieve triggers associated with the given job | 135 | 8 |
36,519 | public boolean setTriggerState ( final RedisTriggerState state , final double score , final String triggerHashKey , T jedis ) throws JobPersistenceException { boolean success = false ; if ( state != null ) { unsetTriggerState ( triggerHashKey , jedis ) ; success = jedis . zadd ( redisSchema . triggerStateKey ( state ) ... | Set a trigger state by adding the trigger to the relevant sorted set using its next fire time as the score . | 95 | 22 |
36,520 | public boolean checkExists ( JobKey jobKey , T jedis ) { return jedis . exists ( redisSchema . jobHashKey ( jobKey ) ) ; } | Check if the job identified by the given key exists in storage | 39 | 12 |
36,521 | public boolean checkExists ( TriggerKey triggerKey , T jedis ) { return jedis . exists ( redisSchema . triggerHashKey ( triggerKey ) ) ; } | Check if the trigger identified by the given key exists | 39 | 10 |
36,522 | public Calendar retrieveCalendar ( String name , T jedis ) throws JobPersistenceException { final String calendarHashKey = redisSchema . calendarHashKey ( name ) ; Calendar calendar ; try { final Map < String , String > calendarMap = jedis . hgetAll ( calendarHashKey ) ; if ( calendarMap == null || calendarMap . isEmpt... | Retrieve a calendar | 231 | 4 |
36,523 | public void pauseJob ( JobKey jobKey , T jedis ) throws JobPersistenceException { for ( OperableTrigger trigger : getTriggersForJob ( jobKey , jedis ) ) { pauseTrigger ( trigger . getKey ( ) , jedis ) ; } } | Pause a job by pausing all of its triggers | 61 | 10 |
36,524 | public Set < String > getPausedTriggerGroups ( T jedis ) { final Set < String > triggerGroupSetKeys = jedis . smembers ( redisSchema . pausedTriggerGroupsSet ( ) ) ; Set < String > names = new HashSet <> ( triggerGroupSetKeys . size ( ) ) ; for ( String triggerGroupSetKey : triggerGroupSetKeys ) { names . add ( redisSc... | Retrieve all currently paused trigger groups | 110 | 7 |
36,525 | protected boolean isActiveInstance ( String instanceId , T jedis ) { boolean isActive = ( System . currentTimeMillis ( ) - getLastInstanceActiveTime ( instanceId , jedis ) < clusterCheckInterval ) ; if ( ! isActive ) { removeLastInstanceActiveTime ( instanceId , jedis ) ; } return isActive ; } | Determine if the instance with the given id has been active in the last 4 minutes | 77 | 18 |
36,526 | protected void releaseOrphanedTriggers ( RedisTriggerState currentState , RedisTriggerState newState , T jedis ) throws JobPersistenceException { for ( Tuple triggerTuple : jedis . zrangeWithScores ( redisSchema . triggerStateKey ( currentState ) , 0 , - 1 ) ) { final String lockId = jedis . get ( redisSchema . trigger... | Release triggers from the given current state to the new state if its locking scheduler has not registered as alive in the last 10 minutes | 228 | 26 |
36,527 | protected void releaseTriggersCron ( T jedis ) throws JobPersistenceException { // has it been more than 10 minutes since we last released orphaned triggers // or is this the first check upon initialization if ( isTriggerLockTimeoutExceeded ( jedis ) || ! isActiveInstance ( schedulerInstanceId , jedis ) ) { releaseOrph... | Release triggers currently held by schedulers which have ceased to function | 194 | 13 |
36,528 | protected void settLastTriggerReleaseTime ( long time , T jedis ) { jedis . set ( redisSchema . lastTriggerReleaseTime ( ) , Long . toString ( time ) ) ; } | Set the last time at which orphaned triggers were released | 45 | 11 |
36,529 | protected void setLastInstanceActiveTime ( String instanceId , long time , T jedis ) { jedis . hset ( redisSchema . lastInstanceActiveTime ( ) , instanceId , Long . toString ( time ) ) ; } | Set the last time at which this instance was active | 53 | 10 |
36,530 | protected void removeLastInstanceActiveTime ( String instanceId , T jedis ) { jedis . hdel ( redisSchema . lastInstanceActiveTime ( ) , instanceId ) ; } | Remove the given instance from the hash | 42 | 7 |
36,531 | protected boolean isBlockedJob ( String jobHashKey , T jedis ) { JobKey jobKey = redisSchema . jobKey ( jobHashKey ) ; return jedis . sismember ( redisSchema . blockedJobsSet ( ) , jobHashKey ) && isActiveInstance ( jedis . get ( redisSchema . jobBlockedKey ( jobKey ) ) , jedis ) ; } | Determine if the given job is blocked by an active instance | 93 | 13 |
36,532 | protected boolean lockTrigger ( TriggerKey triggerKey , T jedis ) { return jedis . set ( redisSchema . triggerLockKey ( triggerKey ) , schedulerInstanceId , "NX" , "PX" , TRIGGER_LOCK_TIMEOUT ) . equals ( "OK" ) ; } | Lock the trigger with the given key to the current jobstore instance | 69 | 13 |
36,533 | protected List < String > split ( final String string ) { if ( null != prefix ) { //remove prefix before split return Arrays . asList ( string . substring ( prefix . length ( ) ) . split ( delimiter ) ) ; } else { return Arrays . asList ( string . split ( delimiter ) ) ; } } | Split a string on the configured delimiter | 71 | 8 |
36,534 | @ Override public void storeTrigger ( OperableTrigger trigger , boolean replaceExisting , JedisCluster jedis ) throws JobPersistenceException { final String triggerHashKey = redisSchema . triggerHashKey ( trigger . getKey ( ) ) ; final String triggerGroupSetKey = redisSchema . triggerGroupSetKey ( trigger . getKey ( ) ... | Store a trigger in redis | 836 | 6 |
36,535 | @ Override public boolean removeJob ( JobKey jobKey , Jedis jedis ) throws JobPersistenceException { final String jobHashKey = redisSchema . jobHashKey ( jobKey ) ; final String jobBlockedKey = redisSchema . jobBlockedKey ( jobKey ) ; final String jobDataMapHashKey = redisSchema . jobDataMapHashKey ( jobKey ) ; final S... | Remove the given job from Redis | 646 | 7 |
36,536 | @ Override @ SuppressWarnings ( "unchecked" ) public void storeJob ( JobDetail jobDetail , boolean replaceExisting , Jedis jedis ) throws ObjectAlreadyExistsException { final String jobHashKey = redisSchema . jobHashKey ( jobDetail . getKey ( ) ) ; final String jobDataMapHashKey = redisSchema . jobDataMapHashKey ( jobD... | Store a job in Redis | 345 | 6 |
36,537 | @ SuppressWarnings ( "resource" ) protected DatabaseConnection makeConnection ( Logger logger ) throws SQLException { Properties properties = new Properties ( ) ; if ( username != null ) { properties . setProperty ( "user" , username ) ; } if ( password != null ) { properties . setProperty ( "password" , password ) ; }... | Make a connection to the database . | 168 | 7 |
36,538 | public void initialize ( ) throws SQLException { if ( ! Boolean . parseBoolean ( System . getProperty ( AUTO_CREATE_TABLES ) ) ) { return ; } if ( configuredDaos == null ) { throw new SQLException ( "configuredDaos was not set in " + getClass ( ) . getSimpleName ( ) ) ; } // find all of the daos and create the tables f... | If you are using the Spring type wiring this should be called after all of the set methods . | 283 | 19 |
36,539 | private Number getIdColumnData ( ResultSet resultSet , ResultSetMetaData metaData , int columnIndex ) throws SQLException { int typeVal = metaData . getColumnType ( columnIndex ) ; switch ( typeVal ) { case Types . BIGINT : case Types . DECIMAL : case Types . NUMERIC : return ( Number ) resultSet . getLong ( columnInde... | Return the id associated with the column . | 190 | 8 |
36,540 | public static int getTypeValForSqlType ( SqlType sqlType ) throws SQLException { int [ ] typeVals = typeToValMap . get ( sqlType ) ; if ( typeVals == null ) { throw new SQLException ( "SqlType is unknown to type val mapping: " + sqlType ) ; } if ( typeVals . length == 0 ) { throw new SQLException ( "SqlType does not ha... | Returns the primary type value associated with the SqlType argument . | 126 | 13 |
36,541 | public static SqlType getSqlTypeForTypeVal ( int typeVal ) { // iterate through to save on the extra HashMap since only for errors for ( Map . Entry < SqlType , int [ ] > entry : typeToValMap . entrySet ( ) ) { for ( int val : entry . getValue ( ) ) { if ( val == typeVal ) { return entry . getKey ( ) ; } } } return Sql... | Returns the SqlType value associated with the typeVal argument . Can be slow - er . | 101 | 19 |
36,542 | public static boolean isColorValue ( @ Nullable final String sValue ) { final String sRealValue = StringHelper . trim ( sValue ) ; if ( StringHelper . hasNoText ( sRealValue ) ) return false ; return isRGBColorValue ( sRealValue ) || isRGBAColorValue ( sRealValue ) || isHSLColorValue ( sRealValue ) || isHSLAColorValue ... | Check if the passed string is any color value . | 166 | 10 |
36,543 | @ Nonnull @ Nonempty public static String getRGBColorValue ( final int nRed , final int nGreen , final int nBlue ) { return new StringBuilder ( 16 ) . append ( CCSSValue . PREFIX_RGB_OPEN ) . append ( getRGBValue ( nRed ) ) . append ( ' ' ) . append ( getRGBValue ( nGreen ) ) . append ( ' ' ) . append ( getRGBValue ( n... | Get the passed values as CSS RGB color value | 120 | 9 |
36,544 | @ Nonnull @ Nonempty public static String getRGBAColorValue ( final int nRed , final int nGreen , final int nBlue , final float fOpacity ) { return new StringBuilder ( 24 ) . append ( CCSSValue . PREFIX_RGBA_OPEN ) . append ( getRGBValue ( nRed ) ) . append ( ' ' ) . append ( getRGBValue ( nGreen ) ) . append ( ' ' ) .... | Get the passed values as CSS RGBA color value | 148 | 10 |
36,545 | public void adjustBeginLineColumn ( final int nNewLine , final int newCol ) { int start = m_nTokenBegin ; int newLine = nNewLine ; int len ; if ( m_nBufpos >= m_nTokenBegin ) { len = m_nBufpos - m_nTokenBegin + m_nInBuf + 1 ; } else { len = m_nBufsize - m_nTokenBegin + m_nBufpos + 1 + m_nInBuf ; } int nIdx = 0 ; int j ... | Method to adjust line and column numbers for the start of a token . | 433 | 14 |
36,546 | @ Nonnull public static String unescapeURL ( @ Nonnull final String sEscapedURL ) { int nIndex = sEscapedURL . indexOf ( URL_ESCAPE_CHAR ) ; if ( nIndex < 0 ) { // No escape sequence found return sEscapedURL ; } final StringBuilder aSB = new StringBuilder ( sEscapedURL . length ( ) ) ; int nPrevIndex = 0 ; do { // Appe... | Unescape all escaped characters in a CSS URL . All characters masked with a \\ character replaced . | 235 | 20 |
36,547 | @ Nonnull public CSSSimpleValueWithUnit setValue ( @ Nonnull final BigDecimal aValue ) { m_aValue = ValueEnforcer . notNull ( aValue , "Value" ) ; return this ; } | Set the numerical value . | 47 | 5 |
36,548 | @ Nonnull public CSSSimpleValueWithUnit setUnit ( @ Nonnull final ECSSUnit eUnit ) { m_eUnit = ValueEnforcer . notNull ( eUnit , "Unit" ) ; return this ; } | Set the unit type . | 47 | 5 |
36,549 | @ Nonnull @ CheckReturnValue public CSSSimpleValueWithUnit add ( @ Nonnull final BigDecimal aDelta ) { return new CSSSimpleValueWithUnit ( m_aValue . add ( aDelta ) , m_eUnit ) ; } | Get a new object with the same unit but an added value . | 52 | 13 |
36,550 | @ Nonnull @ CheckReturnValue public CSSSimpleValueWithUnit substract ( @ Nonnull final BigDecimal aDelta ) { return new CSSSimpleValueWithUnit ( m_aValue . subtract ( aDelta ) , m_eUnit ) ; } | Get a new object with the same unit but a subtracted value . | 53 | 14 |
36,551 | @ Nonnull @ CheckReturnValue public CSSSimpleValueWithUnit multiply ( @ Nonnull final BigDecimal aValue ) { return new CSSSimpleValueWithUnit ( m_aValue . multiply ( aValue ) , m_eUnit ) ; } | Get a new object with the same unit but a multiplied value . | 52 | 13 |
36,552 | @ Nonnull @ CheckReturnValue public CSSSimpleValueWithUnit divide ( @ Nonnull final BigDecimal aDivisor , @ Nonnegative final int nScale , @ Nonnull final RoundingMode eRoundingMode ) { return new CSSSimpleValueWithUnit ( m_aValue . divide ( aDivisor , nScale , eRoundingMode ) , m_eUnit ) ; } | Get a new object with the same unit but an divided value . | 84 | 13 |
36,553 | @ Nullable public static String [ ] getRectValues ( @ Nullable final String sCSSValue ) { String [ ] ret = null ; final String sRealValue = StringHelper . trim ( sCSSValue ) ; if ( StringHelper . hasText ( sRealValue ) ) { ret = RegExHelper . getAllMatchingGroupValues ( PATTERN_CURRENT_SYNTAX , sRealValue ) ; if ( ret ... | Get all the values from within a CSS rectangle definition . | 127 | 11 |
36,554 | @ Nonnull public EChange removeRules ( @ Nonnull final Predicate < ? super ICSSTopLevelRule > aFilter ) { return EChange . valueOf ( m_aRules . removeIf ( aFilter ) ) ; } | Remove all rules matching the passed predicate . | 50 | 8 |
36,555 | @ Nullable public CSSStyleRule getStyleRuleAtIndex ( @ Nonnegative final int nIndex ) { return m_aRules . getAtIndexMapped ( r -> r instanceof CSSStyleRule , nIndex , r -> ( CSSStyleRule ) r ) ; } | Get the style rule at the specified index . | 57 | 9 |
36,556 | @ Nullable public CSSUnknownRule getUnknownRuleAtIndex ( @ Nonnegative final int nIndex ) { return m_aRules . getAtIndexMapped ( r -> r instanceof CSSUnknownRule , nIndex , r -> ( CSSUnknownRule ) r ) ; } | Get the unknown rule at the specified index . | 57 | 9 |
36,557 | @ Nonnull public CSSMediaQuery addMediaExpression ( @ Nonnull final CSSMediaExpression aMediaExpression ) { ValueEnforcer . notNull ( aMediaExpression , "MediaExpression" ) ; m_aMediaExpressions . add ( aMediaExpression ) ; return this ; } | Append a media expression to the list . | 64 | 9 |
36,558 | @ Nonnull public CSSMediaQuery addMediaExpression ( @ Nonnegative final int nIndex , @ Nonnull final CSSMediaExpression aMediaExpression ) { ValueEnforcer . isGE0 ( nIndex , "Index" ) ; ValueEnforcer . notNull ( aMediaExpression , "MediaExpression" ) ; if ( nIndex >= getMediaExpressionCount ( ) ) m_aMediaExpressions . ... | Add a media expression to the list at the specified index . | 120 | 12 |
36,559 | public static void setDefaultInterpretErrorHandler ( @ Nonnull final ICSSInterpretErrorHandler aDefaultErrorHandler ) { ValueEnforcer . notNull ( aDefaultErrorHandler , "DefaultErrorHandler" ) ; s_aRWLock . writeLocked ( ( ) -> s_aDefaultInterpretErrorHandler = aDefaultErrorHandler ) ; } | Set the default interpret error handler to handle interpretation errors in successfully parsed CSS . | 74 | 15 |
36,560 | public static boolean isValidCSS ( @ Nonnull final File aFile , @ Nonnull final Charset aCharset , @ Nonnull final ECSSVersion eVersion ) { return isValidCSS ( new FileSystemResource ( aFile ) , aCharset , eVersion ) ; } | Check if the passed CSS file can be parsed without error | 62 | 11 |
36,561 | public static boolean isURLValue ( @ Nullable final String sValue ) { final String sRealValue = StringHelper . trim ( sValue ) ; if ( StringHelper . hasNoText ( sRealValue ) ) return false ; if ( sRealValue . equals ( CCSSValue . NONE ) ) return true ; // 5 = "url(".length () + ")".length return sRealValue . length ( )... | Check if the passed CSS value is an URL value . This is either a URL starting with url ( or it is the string none . | 133 | 27 |
36,562 | @ Nullable public static String getURLValue ( @ Nullable final String sValue ) { if ( isURLValue ( sValue ) ) { return CSSParseHelper . trimUrl ( sValue ) ; } return null ; } | Extract the real URL contained in a CSS URL value . | 48 | 12 |
36,563 | public static boolean isCSSURLRequiringQuotes ( @ Nonnull final String sURL ) { ValueEnforcer . notNull ( sURL , "URL" ) ; for ( final char c : sURL . toCharArray ( ) ) if ( ! isValidCSSURLChar ( c ) ) return true ; return false ; } | Check if any character inside the passed URL needs escaping . | 68 | 11 |
36,564 | @ Nonnull @ Nonempty public static String getEscapedCSSURL ( @ Nonnull final String sURL , final char cQuoteChar ) { ValueEnforcer . notNull ( sURL , "URL" ) ; if ( sURL . indexOf ( cQuoteChar ) < 0 && sURL . indexOf ( CSSParseHelper . URL_ESCAPE_CHAR ) < 0 ) { // Found nothing to quote return sURL ; } final StringBuil... | Internal method to escape a CSS URL . Because this method is only called for quoted URLs only the quote character itself needs to be quoted . | 200 | 27 |
36,565 | @ Nonnull public CSSMediaRule addMediaQuery ( @ Nonnull @ Nonempty final CSSMediaQuery aMediaQuery ) { ValueEnforcer . notNull ( aMediaQuery , "MediaQuery" ) ; m_aMediaQueries . add ( aMediaQuery ) ; return this ; } | Add a new media query . | 61 | 6 |
36,566 | @ Nonnull public CSSMediaRule addMediaQuery ( @ Nonnegative final int nIndex , @ Nonnull @ Nonempty final CSSMediaQuery aMediaQuery ) { ValueEnforcer . isGE0 ( nIndex , "Index" ) ; ValueEnforcer . notNull ( aMediaQuery , "MediaQuery" ) ; if ( nIndex >= getMediaQueryCount ( ) ) m_aMediaQueries . add ( aMediaQuery ) ; el... | Add a media query at the specified index . | 115 | 9 |
36,567 | public static boolean isValidCSS ( @ Nonnull final IReadableResource aRes , @ Nonnull final Charset aFallbackCharset , @ Nonnull final ECSSVersion eVersion ) { ValueEnforcer . notNull ( aRes , "Resource" ) ; ValueEnforcer . notNull ( aFallbackCharset , "FallbackCharset" ) ; ValueEnforcer . notNull ( eVersion , "Version... | Check if the passed CSS resource can be parsed without error | 158 | 11 |
36,568 | @ Nonnull public CSSRect setTop ( @ Nonnull @ Nonempty final String sTop ) { ValueEnforcer . notEmpty ( sTop , "Top" ) ; m_sTop = sTop ; return this ; } | Set the top coordinate . | 48 | 5 |
36,569 | @ Nonnull public CSSRect setRight ( @ Nonnull @ Nonempty final String sRight ) { ValueEnforcer . notEmpty ( sRight , "Right" ) ; m_sRight = sRight ; return this ; } | Set the right coordinate . | 48 | 5 |
36,570 | @ Nonnull public CSSRect setBottom ( @ Nonnull @ Nonempty final String sBottom ) { ValueEnforcer . notEmpty ( sBottom , "Bottom" ) ; m_sBottom = sBottom ; return this ; } | Set the bottom coordinate . | 48 | 5 |
36,571 | @ Nonnull public CSSRect setLeft ( @ Nonnull @ Nonempty final String sLeft ) { ValueEnforcer . notEmpty ( sLeft , "Left" ) ; m_sLeft = sLeft ; return this ; } | Set the left coordinate . | 48 | 5 |
36,572 | @ Nonnull public CSSMediaList addMedium ( @ Nonnull final ECSSMedium eMedium ) { ValueEnforcer . notNull ( eMedium , "Medium" ) ; m_aMedia . add ( eMedium ) ; return this ; } | Add a new medium to the list | 51 | 7 |
36,573 | @ Nonnull public String getCSSAsString ( @ Nonnull final CascadingStyleSheet aCSS ) { final NonBlockingStringWriter aSW = new NonBlockingStringWriter ( ) ; try { writeCSS ( aCSS , aSW ) ; } catch ( final IOException ex ) { // Should never occur since NonBlockingStringWriter does not throw such an // exception throw new... | Create the CSS without a specific charset . | 107 | 9 |
36,574 | @ Nonnull public CSSExpressionMemberTermURI setURI ( @ Nonnull final CSSURI aURI ) { m_aURI = ValueEnforcer . notNull ( aURI , "URI" ) ; return this ; } | Set a new URI | 47 | 4 |
36,575 | public static boolean canWrapInMediaQuery ( @ Nullable final CascadingStyleSheet aCSS , final boolean bAllowNestedMediaQueries ) { if ( aCSS == null ) return false ; if ( bAllowNestedMediaQueries ) return true ; // Nested media queries are not allowed, therefore wrapping can only take // place if no other media queries... | Check if the passed CSS can be wrapped in an external media rule . | 92 | 14 |
36,576 | @ Nonnull public static String getMinifiedCSSFilename ( @ Nonnull final String sCSSFilename ) { if ( ! isCSSFilename ( sCSSFilename ) ) throw new IllegalArgumentException ( "Passed file name '" + sCSSFilename + "' is not a CSS file name!" ) ; if ( isMinifiedCSSFilename ( sCSSFilename ) ) return sCSSFilename ; return St... | Get the minified CSS filename from the passed filename . If the passed filename is already minified it is returned as is . | 118 | 25 |
36,577 | @ Nonnull public CSSReaderSettings setCSSVersion ( @ Nonnull final ECSSVersion eCSSVersion ) { ValueEnforcer . notNull ( eCSSVersion , "CSSVersion" ) ; m_eCSSVersion = eCSSVersion ; return this ; } | Set the CSS version to be read . | 54 | 8 |
36,578 | @ Nonnull public CSSReaderSettings setTabSize ( @ Nonnegative final int nTabSize ) { ValueEnforcer . isGT0 ( nTabSize , "TabSize" ) ; m_nTabSize = nTabSize ; return this ; } | Set the tab size to be used to determine the source location . | 53 | 13 |
36,579 | @ Nonnull public CSSImportRule addMediaQuery ( @ Nonnull final CSSMediaQuery aMediaQuery ) { ValueEnforcer . notNull ( aMediaQuery , "MediaQuery" ) ; m_aMediaQueries . add ( aMediaQuery ) ; return this ; } | Add a media query at the end of the list . | 58 | 11 |
36,580 | @ Nonnull public CSSImportRule setLocation ( @ Nonnull final CSSURI aLocation ) { ValueEnforcer . notNull ( aLocation , "Location" ) ; m_aLocation = aLocation ; return this ; } | Set the URI of the file to be imported . | 47 | 10 |
36,581 | public static boolean isNumberValue ( @ Nullable final String sCSSValue ) { final String sRealValue = StringHelper . trim ( sCSSValue ) ; return StringHelper . hasText ( sRealValue ) && StringParser . isDouble ( sRealValue ) ; } | Check if the passed value is a pure numeric value without a unit . | 57 | 14 |
36,582 | public void jjtAddChild ( final Node aNode , final int nIndex ) { if ( m_aChildren == null ) m_aChildren = new CSSNode [ nIndex + 1 ] ; else if ( nIndex >= m_aChildren . length ) { // Does not really occur here final CSSNode [ ] aTmpArray = new CSSNode [ nIndex + 1 ] ; System . arraycopy ( m_aChildren , 0 , aTmpArray ,... | Called from the highest index to the lowest index! | 138 | 11 |
36,583 | @ Nonnull public CSSExpression addTermSimple ( @ Nonnull @ Nonempty final String sValue ) { return addMember ( new CSSExpressionMemberTermSimple ( sValue ) ) ; } | Shortcut method to add a simple text value . | 41 | 10 |
36,584 | @ Nonnull public CSSExpression addString ( @ Nonnegative final int nIndex , @ Nonnull final String sValue ) { return addTermSimple ( nIndex , getQuotedStringValue ( sValue ) ) ; } | Shortcut method to add a string value that is automatically quoted inside | 47 | 13 |
36,585 | @ Nonnull public CSSExpression addURI ( @ Nonnull @ Nonempty final String sURI ) { return addMember ( new CSSExpressionMemberTermURI ( sURI ) ) ; } | Shortcut method to add a URI value | 40 | 8 |
36,586 | @ Nonnull public static CSSExpression createSimple ( @ Nonnull @ Nonempty final String sValue ) { return new CSSExpression ( ) . addTermSimple ( sValue ) ; } | Create a CSS expression only containing a text value | 40 | 9 |
36,587 | @ Nonnull public static CSSExpression createString ( @ Nonnull @ Nonempty final String sValue ) { return new CSSExpression ( ) . addString ( sValue ) ; } | Create a CSS expression only containing a string | 39 | 8 |
36,588 | @ Nonnull public static CSSExpression createURI ( @ Nonnull @ Nonempty final String sURI ) { return new CSSExpression ( ) . addURI ( sURI ) ; } | Create a CSS expression only containing a URI | 39 | 8 |
36,589 | @ Nonnull public static Charset getCharsetFromMimeTypeOrDefault ( @ Nullable final IMimeType aMimeType ) { final Charset ret = MimeTypeHelper . getCharsetFromMimeType ( aMimeType ) ; return ret != null ? ret : CSSDataURLHelper . DEFAULT_CHARSET ; } | Determine the charset from the passed MIME type . If no charset was found return the default charset . | 78 | 25 |
36,590 | public void writeContentBytes ( @ Nonnull @ WillNotClose final OutputStream aOS ) throws IOException { aOS . write ( m_aContent , 0 , m_aContent . length ) ; } | Write all the binary content to the passed output stream . No Base64 encoding is performed in this method . | 44 | 21 |
36,591 | @ Nonnull public String getContentAsString ( @ Nonnull final Charset aCharset ) { if ( m_aCharset . equals ( aCharset ) ) { // Potentially return cached version return getContentAsString ( ) ; } return new String ( m_aContent , aCharset ) ; } | Get the data content of this Data URL as String in the specified charset . No Base64 encoding is performed in this method . | 72 | 26 |
36,592 | public DelimiterWriterFactory addColumnTitles ( final Collection < String > columnTitles ) { if ( columnTitles != null ) { for ( final String columnTitle : columnTitles ) { addColumnTitle ( columnTitle ) ; } } return this ; } | Convenience method to add a series of cols in one go . | 56 | 15 |
36,593 | public static int getDelimiterOffset ( final String line , final int start , final char delimiter ) { int idx = line . indexOf ( delimiter , start ) ; if ( idx >= 0 ) { idx -= start - 1 ; } return idx ; } | reads from the specified point in the line and returns how many chars to the specified delimiter | 59 | 18 |
36,594 | public static String lTrim ( final String value ) { if ( value == null ) { return null ; } String trimmed = value ; int offset = 0 ; final int maxLength = value . length ( ) ; while ( offset < maxLength && ( value . charAt ( offset ) == ' ' || value . charAt ( offset ) == ' ' ) ) { offset ++ ; } if ( offset > 0 ) { tri... | Removes empty space from the beginning of a string | 102 | 10 |
36,595 | public static String rTrim ( final String value ) { if ( value == null ) { return null ; } String trimmed = value ; int offset = value . length ( ) - 1 ; while ( offset > - 1 && ( value . charAt ( offset ) == ' ' || value . charAt ( offset ) == ' ' ) ) { offset -- ; } if ( offset < value . length ( ) - 1 ) { trimmed = ... | Removes empty space from the end of a string | 107 | 10 |
36,596 | public static MetaData getPZMetaDataFromFile ( final String line , final char delimiter , final char qualifier , final Parser p , final boolean addSuffixToDuplicateColumnNames ) { final List < ColumnMetaData > results = new ArrayList <> ( ) ; final Set < String > dupCheck = new HashSet <> ( ) ; final List < String > li... | Returns a list of ColumnMetaData objects . This is for use with delimited files . The first line of the file which contains data will be used as the column names | 291 | 34 |
36,597 | public static boolean isMultiLine ( final char [ ] chrArry , final char delimiter , final char qualifier ) { // check if the last char is the qualifier, if so then this a good // chance it is not multiline if ( chrArry [ chrArry . length - 1 ] != qualifier ) { // could be a potential line break boolean qualiFound = fal... | Determines if the given line is the first part of a multiline record . It does this by verifying that the qualifer on the last element is not closed | 826 | 34 |
36,598 | public static String stripNonLongChars ( final String value ) { final StringBuilder newString = new StringBuilder ( ) ; for ( int i = 0 ; i < value . length ( ) ; i ++ ) { final char c = value . charAt ( i ) ; if ( c == ' ' ) { // stop if we hit a decimal point break ; } else if ( c >= ' ' && c <= ' ' || c == ' ' ) { n... | Removes chars from the String that could not be parsed into a Long value | 185 | 15 |
36,599 | public static boolean isListElementsEmpty ( final List < String > l ) { for ( final String s : l ) { if ( s != null && s . trim ( ) . length ( ) > 0 ) { return false ; } } return true ; } | Checks a list of < ; String> ; elements to see if every element in the list is empty . | 54 | 24 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.