idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
120,400 | public Stream < T > sort ( final Comparator < T > comparator ) { return new Stream < T > ( ) { public Iterator < T > iterator ( ) { final ArrayList < T > array = ToArrayList . < T > toArrayList ( ) . call ( Stream . this ) ; Collections . sort ( array , comparator ) ; return array . iterator ( ) ; } } ; } | Returns a new stream that contains all items of the current stream in sorted order . The operator creates a list of all items internally . |
120,401 | public Stream < T > reverse ( ) { return new Stream < T > ( ) { public Iterator < T > iterator ( ) { final ArrayList < T > array = ToArrayList . < T > toArrayList ( ) . call ( Stream . this ) ; Collections . reverse ( array ) ; return array . iterator ( ) ; } } ; } | Returns a new stream that contains all items of the current stream in reverse order . The operator creates a list of all items internally . |
120,402 | public < R > Stream < R > cast ( final Class < R > c ) { return map ( new Func1 < T , R > ( ) { public R call ( T obj ) { return c . cast ( obj ) ; } } ) ; } | Returns a stream that contains all values of the original stream that has been casted to a given class type . |
120,403 | public boolean every ( Func1 < ? super T , Boolean > predicate ) { for ( T item : this ) { if ( ! predicate . call ( item ) ) return false ; } return true ; } | Returns true if all of stream items satisfy a given condition . |
120,404 | public Stream < T > onNext ( final Action1 < ? super T > action ) { return new Stream < T > ( ) { public Iterator < T > iterator ( ) { return new ReadOnlyIterator < T > ( ) { Iterator < T > iterator = Stream . this . iterator ( ) ; public boolean hasNext ( ) { return iterator . hasNext ( ) ; } public T next ( ) { final... | Executes an action for each item in the stream . |
120,405 | public static void i ( String msg , Throwable thr ) { if ( DEBUG ) Log . i ( TAG , buildMessage ( msg ) , thr ) ; } | Send a INFO log message and log the exception . |
120,406 | public static String getDataColumn ( Context context , Uri uri , String selection , String [ ] selectionArgs ) { Cursor cursor = null ; final String column = "_data" ; final String [ ] projection = { column } ; try { cursor = context . getContentResolver ( ) . query ( uri , projection , selection , selectionArgs , null... | Get the value of the data column for this Uri . This is useful for MediaStore Uris and other file - based ContentProviders . |
120,407 | protected EventType decodeEvent ( EventType nextEventType ) throws EXIException , IOException { endElementPrefix = null ; switch ( nextEventType ) { case START_DOCUMENT : decoder . decodeStartDocument ( ) ; break ; case END_DOCUMENT : decoder . decodeEndDocument ( ) ; break ; case ATTRIBUTE_XSI_NIL : attributes . add (... | without further attribute handling |
120,408 | public static boolean beginOrJoinTransaction ( ) { boolean newTransaction = false ; try { newTransaction = userTransaction . getStatus ( ) == Status . STATUS_NO_TRANSACTION ; if ( newTransaction ) { userTransaction . begin ( ) ; } } catch ( Exception e ) { throw new RuntimeException ( "Unable to start transaction." , e... | Start or join a transaction . |
120,409 | public static void commit ( ) { try { if ( ! isDone ( ) ) { userTransaction . commit ( ) ; } else { LOGGER . warn ( "commit() called with no current transaction." ) ; } } catch ( Exception e ) { throw new RuntimeException ( "Transaction commit failed." , e ) ; } } | Commit the current transaction . |
120,410 | public static void rollback ( ) { try { if ( userTransaction . getStatus ( ) != Status . STATUS_NO_TRANSACTION ) { userTransaction . rollback ( ) ; } else { LOGGER . warn ( "Request to rollback transaction when none was in started." ) ; } } catch ( Exception e ) { LOGGER . warn ( "Transaction rollback failed." , e ) ; ... | Rollback the current transaction . |
120,411 | public static Transaction suspend ( ) { try { Transaction suspend = transactionManager . suspend ( ) ; return suspend ; } catch ( SystemException e ) { throw new RuntimeException ( "Unable to suspend current transaction" , e ) ; } } | Suspend the current transaction and return it to the caller . |
120,412 | public static void resume ( Transaction transaction ) { try { transactionManager . resume ( transaction ) ; } catch ( Exception e ) { throw new RuntimeException ( "Unable to resume transaction" , e ) ; } } | Resume the specified transaction . If the transaction was never suspended or was already committed or rolled back a RuntimeException will be thrown wrapping the JTA originated exception . |
120,413 | public final T execute ( ) { boolean txOwner = ! TransactionElf . hasTransactionManager ( ) || TransactionElf . beginOrJoinTransaction ( ) ; Connection connection = null ; try { connection = ConnectionProxy . wrapConnection ( dataSource . getConnection ( ) ) ; if ( txOwner ) { connection . setAutoCommit ( false ) ; } r... | Execute the closure . |
120,414 | private static PreparedStatement createStatementForUpdate ( final Connection connection , final Introspected introspected , final FieldColumnInfo [ ] fieldColumnInfos , final Set < String > excludedColumns ) throws SQLException { final String sql = createSqlForUpdate ( introspected , fieldColumnInfos , excludedColumns ... | To exclude columns situative . Does not cache the statement . |
120,415 | private static < T > void setParamsExecute ( final T target , final Introspected introspected , final FieldColumnInfo [ ] fcInfos , final PreparedStatement stmt , final boolean checkExistingId , final Set < String > excludedColumns ) throws SQLException { final int [ ] parameterTypes = getParameterTypes ( stmt ) ; int ... | You should close stmt by yourself |
120,416 | private static < T > int setStatementParameters ( final T item , final Introspected introspected , final FieldColumnInfo [ ] fcInfos , final PreparedStatement stmt , final int [ ] parameterTypes , final Set < String > excludedColumns ) throws SQLException { int parameterIndex = 1 ; for ( final FieldColumnInfo fcInfo : ... | Small helper to set statement parameters from given object |
120,417 | private static < T > void fillGeneratedId ( final T target , final Introspected introspected , final PreparedStatement stmt , final boolean checkExistingId ) throws SQLException { if ( ! introspected . hasGeneratedId ( ) ) { return ; } final FieldColumnInfo fcInfo = introspected . getGeneratedIdFcInfo ( ) ; if ( checkE... | Sets auto - generated ID if not set yet |
120,418 | void set ( Object target , FieldColumnInfo fcInfo , Object value ) { if ( fcInfo == null ) { throw new RuntimeException ( "FieldColumnInfo must not be null. Type is " + target . getClass ( ) . getCanonicalName ( ) ) ; } try { final Class < ? > fieldType = fcInfo . fieldType ; Class < ? > columnType = value . getClass (... | Set a field value of the specified target object . |
120,419 | public boolean isInsertableColumn ( final String columnName ) { final FieldColumnInfo [ ] fcInfos = getInsertableFcInfos ( ) ; for ( int i = 0 ; i < fcInfos . length ; i ++ ) { if ( fcInfos [ i ] . getCaseSensitiveColumnName ( ) . equals ( columnName ) ) { return true ; } } return false ; } | Is this specified column insertable? |
120,420 | public boolean isUpdatableColumn ( final String columnName ) { final FieldColumnInfo [ ] fcInfos = getUpdatableFcInfos ( ) ; for ( int i = 0 ; i < fcInfos . length ; i ++ ) { if ( fcInfos [ i ] . getCaseSensitiveColumnName ( ) . equals ( columnName ) ) { return true ; } } return false ; } | Is this specified column updatable? |
120,421 | public static < T > void insertListBatched ( Connection connection , Iterable < T > iterable ) throws SQLException { OrmWriter . insertListBatched ( connection , iterable ) ; } | Insert a collection of objects using JDBC batching . |
120,422 | public static < T > T insertObject ( Connection connection , T target ) throws SQLException { return OrmWriter . insertObject ( connection , target ) ; } | Insert an annotated object into the database . |
120,423 | public static String getColumnFromProperty ( Class < ? > clazz , String propertyName ) { return Introspector . getIntrospected ( clazz ) . getColumnNameForProperty ( propertyName ) ; } | Gets the column name defined for the given property for the given type . |
120,424 | public static < T > String getColumnsCsv ( Class < T > clazz , String ... tablePrefix ) { return OrmReader . getColumnsCsv ( clazz , tablePrefix ) ; } | Get a comma separated values list of column names for the given class suitable for inclusion into a SQL SELECT statement . |
120,425 | public static < T > T refresh ( Connection connection , T target ) throws SQLException { return OrmReader . refresh ( connection , target ) ; } | To refresh all fields in case they have changed in database . |
120,426 | protected static boolean isIgnoredColumn ( final Set < String > ignoredColumns , final String columnName ) { return ignoredColumns . stream ( ) . anyMatch ( s -> s . equalsIgnoreCase ( columnName ) ) ; } | Case insensitive comparison . |
120,427 | public static void deinitialize ( ) { SqlClosure . setDefaultDataSource ( null ) ; TransactionElf . setUserTransaction ( null ) ; TransactionElf . setTransactionManager ( null ) ; } | You can reset SansOrm to a fresh state if desired . E . g . if you want to call another initializeXXX method . |
120,428 | public static < T > T getObjectById ( Class < T > type , Object ... ids ) { return SqlClosure . sqlExecute ( c -> OrmElf . objectById ( c , type , ids ) ) ; } | Gets an object by ID from the database . |
120,429 | public static < T > T objectFromClause ( Class < T > type , String clause , Object ... args ) { return SqlClosure . sqlExecute ( c -> OrmElf . objectFromClause ( c , type , clause , args ) ) ; } | Gets an object using a from clause . |
120,430 | public static < T > T insertObject ( T object ) { return SqlClosure . sqlExecute ( c -> OrmElf . insertObject ( c , object ) ) ; } | Inserts the given object into the database . |
120,431 | public static < T > T updateObject ( T object ) { return SqlClosure . sqlExecute ( c -> OrmElf . updateObject ( c , object ) ) ; } | Updates the given object in the database . |
120,432 | public static < T > int deleteObject ( T object ) { return SqlClosure . sqlExecute ( c -> OrmElf . deleteObject ( c , object ) ) ; } | Delete the given object in the database . |
120,433 | public static < T > int deleteObjectById ( Class < T > clazz , Object ... args ) { return SqlClosure . sqlExecute ( c -> OrmElf . deleteObjectById ( c , clazz , args ) ) ; } | Delete an object from the database by ID . |
120,434 | public static < T > List < T > listFromClause ( Class < T > clazz , String clause , Object ... args ) { return SqlClosure . sqlExecute ( c -> OrmElf . listFromClause ( c , clazz , clause , args ) ) ; } | Gets a list of objects from the database . |
120,435 | public static < T > int countObjectsFromClause ( Class < T > clazz , String clause , Object ... args ) { return SqlClosure . sqlExecute ( c -> OrmElf . countObjectsFromClause ( c , clazz , clause , args ) ) ; } | Counts the number of rows for the given query . |
120,436 | public static int executeUpdate ( final String sql , final Object ... args ) { return SqlClosure . sqlExecute ( c -> executeUpdate ( c , sql , args ) ) ; } | Executes an update or insert statement . |
120,437 | public static String getInClausePlaceholdersForCount ( final int placeholderCount ) { if ( placeholderCount < 0 ) { throw new IllegalArgumentException ( "Placeholder count must be greater than or equal to zero" ) ; } if ( placeholderCount == 0 ) { return " ('s0me n0n-ex1st4nt v4luu') " ; } final StringBuilder sb = new ... | Get a SQL IN clause for the number of items . |
120,438 | public static ResultSet executeQuery ( Connection connection , String sql , Object ... args ) throws SQLException { return OrmReader . statementToResultSet ( connection . prepareStatement ( sql ) , args ) ; } | Execute the specified SQL as a PreparedStatement with the specified arguments . |
120,439 | public static String compile ( File lessFile , boolean compress ) throws IOException { String lessData = new String ( Files . readAllBytes ( lessFile . toPath ( ) ) , StandardCharsets . UTF_8 ) ; return Less . compile ( lessFile . toURI ( ) . toURL ( ) , lessData , compress , new ReaderFactory ( ) ) ; } | Compile the less data from a file . |
120,440 | void addPosition ( String filename , int line , int column ) { LessFilePosition pos = new LessFilePosition ( filename , line , column ) ; if ( ! positions . contains ( pos ) ) { this . positions . add ( pos ) ; } } | Add a position to the less file stacktrace |
120,441 | public String replace ( String input , String replacement ) throws ParameterOutOfBoundsException { replacement = REPLACEMENT_BACKSLASH . matcher ( replacement ) . replaceAll ( REPLACEMENT_BACKSLASH_FOR_JAVA ) ; replacement = REPLACEMENT_DOLLAR_AMPERSAND . matcher ( replacement ) . replaceAll ( REPLACEMENT_DOLLAR_AMPERS... | Replace the matches in the input with the replacement . |
120,442 | void appendSubRules ( String [ ] parentSelector , CssFormatter formatter ) { try { if ( important ) { formatter . incImportant ( ) ; } for ( MixinMatch match : getRules ( formatter ) ) { Rule rule = match . getRule ( ) ; formatter . addMixin ( rule , match . getMixinParameters ( ) , rule . getVariables ( ) ) ; rule . a... | Append the rules of the mixins to the formatter . |
120,443 | private List < MixinMatch > getRules ( CssFormatter formatter ) throws LessException { if ( mixinRules != null && stackID == formatter . stackID ( ) ) { return mixinRules ; } List < Rule > rules = formatter . getMixin ( name ) ; if ( rules == null ) { rules = mixins . get ( name ) ; } if ( rules == null ) { int idx = n... | Get the rules of the mixin |
120,444 | private void bubbling ( String [ ] mediaSelector , String [ ] blockSelector , CssFormatter formatter ) { if ( properties . size ( ) > 0 ) { String media = mediaSelector [ 0 ] ; if ( media . startsWith ( "@media" ) || media . startsWith ( "@supports" ) || media . startsWith ( "@document" ) ) { int size0 = formatter . ge... | Nested Directives are bubbling . |
120,445 | void appendMixinsTo ( String [ ] parentSelector , CssFormatter formatter ) { for ( Formattable prop : properties ) { switch ( prop . getType ( ) ) { case MIXIN : ( ( Mixin ) prop ) . appendSubRules ( parentSelector , formatter ) ; break ; case CSS_AT_RULE : case COMMENT : prop . appendTo ( formatter ) ; break ; } } } | Append the mixins of this rule to current output . |
120,446 | void appendPropertiesTo ( CssFormatter formatter ) { if ( properties . isEmpty ( ) ) { return ; } formatter . addVariables ( variables ) ; for ( Formattable prop : properties ) { switch ( prop . getType ( ) ) { case Formattable . RULE : Rule rule = ( Rule ) prop ; if ( rule . isValidCSS ( formatter ) && rule . isInline... | Append the properties of the rule . |
120,447 | List < Rule > getMixin ( String name ) { ArrayList < Rule > rules = null ; for ( Rule rule : subrules ) { for ( String sel : rule . selectors ) { if ( name . equals ( sel ) ) { if ( rules == null ) { rules = new ArrayList < > ( ) ; } rules . add ( rule ) ; break ; } } } return rules ; } | Get a nested mixin of this rule . |
120,448 | MixinMatch match ( CssFormatter formatter , List < Expression > paramValues , boolean isDefault ) { if ( guard == null && formatter . containsRule ( this ) ) { return null ; } Map < String , Expression > mixinParameters = getMixinParams ( formatter , paramValues ) ; if ( mixinParameters == NO_MATCH ) { return null ; } ... | If this mixin match the calling parameters . |
120,449 | boolean isInlineRule ( CssFormatter formatter ) { if ( selectors . length == 1 && selectors [ 0 ] . equals ( "&" ) ) { return hasOnlyInlineProperties ( formatter ) ; } return false ; } | If there is only a special selector & and also all subrules have only this special selector . |
120,450 | boolean hasOnlyInlineProperties ( CssFormatter formatter ) { for ( Formattable prop : properties ) { if ( prop instanceof Mixin ) { return false ; } } for ( Rule rule : subrules ) { if ( rule . isValidCSS ( formatter ) && rule . isInlineRule ( formatter ) ) { return false ; } } return true ; } | If there are only properties that should be inlined . |
120,451 | public static ValueExpression eval ( CssFormatter formatter , Expression expr ) { expr = expr . unpack ( formatter ) ; if ( expr . getClass ( ) == ValueExpression . class ) { return ( ValueExpression ) expr ; } ValueExpression valueEx = new ValueExpression ( expr , expr . stringValue ( formatter ) ) ; valueEx . type = ... | Create a value expression as parameter for a mixin which not change it value in a different context . |
120,452 | Expression getValue ( CssFormatter formatter ) { String name = toString ( ) ; Expression value = formatter . getVariable ( name ) ; if ( value != null ) { return value ; } if ( name . startsWith ( "@@" ) ) { name = name . substring ( 1 ) ; value = formatter . getVariable ( name ) ; if ( value != null ) { formatter . se... | Get the referencing expression |
120,453 | private static void putConvertion ( HashMap < String , Double > group , String unit , double factor ) { UNIT_CONVERSIONS . put ( unit , group ) ; group . put ( unit , factor ) ; } | Helper for creating static unit conversions . |
120,454 | private int maxOperadType ( CssFormatter formatter ) { int dataType = operands . get ( 0 ) . getDataType ( formatter ) ; for ( int i = 1 ; i < operands . size ( ) ; i ++ ) { dataType = Math . max ( dataType , operands . get ( i ) . getDataType ( formatter ) ) ; } return dataType ; } | Get the highest data type of different operands |
120,455 | static double unitFactor ( String leftUnit , String rightUnit , boolean fail ) { if ( leftUnit . length ( ) == 0 || rightUnit . length ( ) == 0 || leftUnit . equals ( rightUnit ) ) { return 1 ; } HashMap < String , Double > leftGroup = UNIT_CONVERSIONS . get ( leftUnit ) ; if ( leftGroup != null ) { HashMap < String , ... | Calculate the factor between 2 units . |
120,456 | private double doubleValue ( double left , double right ) { switch ( operator ) { case '+' : return left + right ; case '-' : return left - right ; case '*' : return left * right ; case '/' : return left / right ; default : throw createException ( "Not supported Oprator '" + operator + "' for Expression '" + toString (... | Calculate the number value of two operands if possible . |
120,457 | private double doubleValueLeftColor ( double color , double right ) { return rgba ( doubleValue ( red ( color ) , right ) , doubleValue ( green ( color ) , right ) , doubleValue ( blue ( color ) , right ) , 1 ) ; } | Calculate a color on left with a number on the right side . The calculation occur for every color channel . |
120,458 | private double doubleValueRightColor ( double left , double color ) { return rgba ( doubleValue ( left , red ( color ) ) , doubleValue ( left , green ( color ) ) , doubleValue ( left , blue ( color ) ) , 1 ) ; } | Calculate a number on left with a color on the right side . The calculation occur for every color channel . |
120,459 | private double doubleValue2Colors ( double left , double right ) { return rgba ( doubleValue ( red ( left ) , red ( right ) ) , doubleValue ( green ( left ) , green ( right ) ) , doubleValue ( blue ( left ) , blue ( right ) ) , 1 ) ; } | Calculate two colors . The calculation occur for every color channel . |
120,460 | private String normlizeQuotes ( String str ) { if ( str . length ( ) > 1 && str . charAt ( 0 ) == '\'' && str . charAt ( str . length ( ) - 1 ) == '\'' ) { return '\"' + str . substring ( 1 , str . length ( ) - 1 ) + '\"' ; } return str ; } | Convert single quotes to double quotes . |
120,461 | private ArrayList < Unit > unit ( CssFormatter formatter , ArrayList < Unit > list ) { for ( int i = 0 ; i < operands . size ( ) ; i ++ ) { Expression exp = operands . get ( i ) ; if ( exp . getClass ( ) == Operation . class ) { Operation op = ( Operation ) exp ; switch ( op . operator ) { case '*' : case '/' : list = ... | Calculate the unit if there are different units . It use the numerator and denominator count . |
120,462 | void add ( K key , V value ) { List < V > rules = map . get ( key ) ; if ( rules == null ) { rules = new ArrayList < > ( ) ; map . put ( key , rules ) ; } rules . add ( value ) ; } | Add a value to this map . If the map previously contained a mapping for the key then there are two values now . |
120,463 | List < V > get ( K key ) { List < V > result = map . get ( key ) ; if ( parent != null ) { List < V > resultParent = parent . get ( key ) ; if ( result == null ) { return resultParent ; } else if ( resultParent == null ) { return result ; } else { for ( V value : resultParent ) { if ( ! result . contains ( value ) ) { ... | Get all values for the given key . If no key exists then null is return . |
120,464 | void addAll ( HashMultimap < K , V > m ) { if ( m == this ) { return ; } for ( Entry < K , List < V > > entry : m . map . entrySet ( ) ) { K key = entry . getKey ( ) ; List < V > rules = map . get ( key ) ; if ( rules == null ) { rules = new ArrayList < > ( ) ; map . put ( key , rules ) ; } for ( V value : entry . getV... | Add all values of the mappings from the specified map to this map . |
120,465 | private int parseRewriteUrl ( ) { String rewrite = options . get ( Less . REWRITE_URLS ) ; if ( rewrite != null ) { switch ( rewrite . toLowerCase ( ) ) { case "off" : return 0 ; case "local" : return 1 ; case "all" : return 2 ; } } return 0 ; } | Parse the parameter rewrite URL |
120,466 | void addOutput ( ) { if ( output != null ) { outputs . addLast ( output ) ; } output = state . pool . get ( ) ; } | Add a new output buffer to the formatter . |
120,467 | void freeOutput ( ) { state . pool . free ( output ) ; output = outputs . size ( ) > 0 ? outputs . removeLast ( ) : null ; } | Release an output and delete it . |
120,468 | String releaseOutput ( ) { if ( output == null ) { return "" ; } String str = output . toString ( ) ; freeOutput ( ) ; return str ; } | Release an output buffer return the content and restore the previous output . |
120,469 | Expression getVariable ( String name ) { for ( int i = state . stackIdx - 1 ; i >= 0 ; i -- ) { Expression variable = state . stack . get ( i ) . getVariable ( name ) ; if ( variable != null ) { return variable ; } } if ( name . equals ( "@arguments" ) ) { for ( int i = state . stackIdx - 1 ; i >= 0 ; i -- ) { Scope sc... | Get a variable expression from the current stack |
120,470 | void addMixin ( Rule mixin , Map < String , Expression > parameters , Map < String , Expression > variables ) { int idx = state . stackIdx ++ ; Scope scope ; if ( state . stack . size ( ) <= idx ) { scope = new Scope ( ) ; state . stack . add ( scope ) ; } else { scope = state . stack . get ( idx ) ; scope . returns . ... | Add the scope of a mixin to the stack . |
120,471 | void removeMixin ( ) { int idx = state . stackIdx - 1 ; Scope current = state . stack . get ( idx ) ; if ( idx > 0 ) { Scope previous = state . stack . get ( idx - 1 ) ; Map < String , Expression > currentReturn = previous . returns ; Map < String , Expression > vars = current . variables ; if ( vars != null ) { for ( ... | Remove the scope of a mixin . |
120,472 | void addGuardParameters ( Map < String , Expression > parameters , boolean isDefault ) { isGuard = true ; wasDefaultFunction = false ; guardDefault = isDefault ; if ( parameters != null ) { addMixin ( null , parameters , null ) ; } } | Add the parameters of a guard |
120,473 | void removeGuardParameters ( Map < String , Expression > parameters ) { if ( parameters != null ) { removeMixin ( ) ; } isGuard = false ; } | remove the parameters of a guard |
120,474 | boolean containsRule ( Rule rule ) { for ( int i = state . stackIdx - 1 ; i >= 0 ; i -- ) { if ( rule == state . stack . get ( i ) . mixin ) { return true ; } } return false ; } | A mixin inline never it self . |
120,475 | List < Rule > getMixin ( String name ) { for ( int i = state . stackIdx - 1 ; i >= 0 ; i -- ) { Rule mixin = state . stack . get ( i ) . mixin ; if ( mixin != null ) { List < Rule > rules = mixin . getMixin ( name ) ; if ( rules != null ) { for ( int r = 0 ; r < rules . size ( ) ; r ++ ) { if ( ! containsRule ( rules .... | Get a nested mixin of a parent rule . |
120,476 | StringBuilder getOutput ( ) { if ( output == null ) { CssFormatter block = copy ( null ) ; state . results . add ( new CssPlainOutput ( block . output ) ) ; output = block . output ; } return output ; } | Get the current output of the formatter . |
120,477 | CssFormatter append ( String str ) { if ( inlineMode ) { str = UrlUtils . removeQuote ( str ) ; } output . append ( str ) ; return this ; } | Append a string to the output . In inline mode quotes are removed . |
120,478 | void appendHex ( int value , int digits ) { if ( digits > 1 ) { appendHex ( value >>> 4 , digits - 1 ) ; } output . append ( DIGITS [ value & 0xF ] ) ; } | Append an hex value to the output . |
120,479 | CssFormatter append ( double value ) { if ( value == ( int ) value ) { output . append ( Integer . toString ( ( int ) value ) ) ; } else { output . append ( decFormat . format ( value ) ) ; } return this ; } | Append a decimal number to the output . |
120,480 | CssFormatter startBlock ( String [ ] selectors ) { final List < CssOutput > results = state . results ; if ( blockDeep == 0 ) { output = null ; CssOutput nextOutput = null ; if ( results . size ( ) > 0 && ! "@font-face" . equals ( selectors [ 0 ] ) ) { CssOutput cssOutput = results . get ( results . size ( ) - 1 ) ; if... | Start a new block with a list of selectors . |
120,481 | void startBlockImpl ( String [ ] selectors ) { for ( int i = 0 ; i < selectors . length ; i ++ ) { if ( i > 0 ) { output . append ( ',' ) ; newline ( ) ; } insets ( ) ; append ( selectors [ i ] ) ; } space ( ) ; output . append ( '{' ) ; newline ( ) ; incInsets ( ) ; } | Output a new block and increment the insets . |
120,482 | CssFormatter endBlock ( ) { blockDeep -- ; if ( blockDeep == 0 ) { state . pool . free ( insets ) ; insets = null ; inlineMode = false ; } else { if ( blockDeep == 1 && currentOutput . getClass ( ) == CssMediaOutput . class ) { state . pool . free ( insets ) ; insets = null ; inlineMode = false ; } else { endBlockImpl ... | Terminate a CSS block . |
120,483 | CssFormatter comment ( String msg ) { getOutput ( ) . append ( insets ) . append ( msg ) . append ( '\n' ) ; return this ; } | Write a comment . The compress formatter do nothing . |
120,484 | char read ( ) { try { if ( cachePos < cache . length ( ) ) { return incLineColumn ( cache . charAt ( cachePos ++ ) ) ; } int ch = readCharBlockMarker ( ) ; if ( ch == - 1 ) { throw createException ( "Unexpected end of Less data" ) ; } return incLineColumn ( ch ) ; } catch ( IOException ex ) { throw new LessException ( ... | Read a single character from reader or from back buffer |
120,485 | void skipLine ( ) { int ch ; do { try { ch = reader . read ( ) ; } catch ( IOException ex ) { throw new LessException ( ex ) ; } incLineColumn ( ch ) ; } while ( ch != '\n' && ch != - 1 ) ; } | Skip all data until a newline occur or an EOF |
120,486 | static HSL toHSL ( double color ) { long argb = Double . doubleToRawLongBits ( color ) ; double a = alpha ( color ) ; double r = clamp ( ( ( argb >> 32 ) & 0xFFFF ) / ( double ) 0xFF00 ) ; double g = clamp ( ( ( argb >> 16 ) & 0xFFFF ) / ( double ) 0xFF00 ) ; double b = clamp ( ( ( argb >> 0 ) & 0xFFFF ) / ( double ) 0... | Create a HSL color . |
120,487 | static double rgba ( double r , double g , double b , double a ) { return Double . longBitsToDouble ( Math . round ( a * 0xFFFF ) << 48 | ( colorLargeDigit ( r ) << 32 ) | ( colorLargeDigit ( g ) << 16 ) | colorLargeDigit ( b ) ) ; } | Create a color from rgba values |
120,488 | static double rgb ( int r , int g , int b ) { return Double . longBitsToDouble ( Expression . ALPHA_1 | ( colorLargeDigit ( r ) << 32 ) | ( colorLargeDigit ( g ) << 16 ) | colorLargeDigit ( b ) ) ; } | Create an color value . |
120,489 | static int argb ( double color ) { long value = Double . doubleToRawLongBits ( color ) ; int result = colorDigit ( ( ( value >>> 48 ) ) / 256.0 ) << 24 ; result |= colorDigit ( ( ( value >> 32 ) & 0xFFFF ) / 256.0 ) << 16 ; result |= colorDigit ( ( ( value >> 16 ) & 0xFFFF ) / 256.0 ) << 8 ; result |= colorDigit ( ( ( ... | Convert an color value as long into integer color value |
120,490 | private static double hslaHue ( double h , double m1 , double m2 ) { h = h < 0 ? h + 1 : ( h > 1 ? h - 1 : h ) ; if ( h * 6 < 1 ) { return m1 + ( m2 - m1 ) * h * 6 ; } else if ( h * 2 < 1 ) { return m2 ; } else if ( h * 3 < 2 ) { return m1 + ( m2 - m1 ) * ( 2F / 3 - h ) * 6 ; } else { return m1 ; } } | Calculate a single color channel of the HSLA function |
120,491 | static double luminance ( double color ) { long argb = Double . doubleToRawLongBits ( color ) ; double r = ( ( argb >> 32 ) & 0xFFFF ) / ( double ) 0xFF00 ; double g = ( ( argb >> 16 ) & 0xFFFF ) / ( double ) 0xFF00 ; double b = ( ( argb ) & 0xFFFF ) / ( double ) 0xFF00 ; return ( 0.2126 * r ) + ( 0.7152 * g ) + ( 0.07... | The less function luminance . |
120,492 | static double luma ( double color ) { long argb = Double . doubleToRawLongBits ( color ) ; double r = ( ( argb >> 32 ) & 0xFFFF ) / ( double ) 0xFF00 ; double g = ( ( argb >> 16 ) & 0xFFFF ) / ( double ) 0xFF00 ; double b = ( ( argb ) & 0xFFFF ) / ( double ) 0xFF00 ; r = ( r <= 0.03928 ) ? r / 12.92 : Math . pow ( ( ( ... | The less function luma . |
120,493 | static double contrast ( double color , double dark , double light , double threshold ) { if ( luma ( dark ) > luma ( light ) ) { double t = light ; light = dark ; dark = t ; } if ( luma ( color ) < threshold ) { return light ; } else { return dark ; } } | The less function contrast . |
120,494 | static HSV toHSV ( double color ) { long argb = Double . doubleToRawLongBits ( color ) ; double a = alpha ( color ) ; double r = clamp ( ( ( argb >> 32 ) & 0xFFFF ) / ( double ) 0xFF00 ) ; double g = clamp ( ( ( argb >> 16 ) & 0xFFFF ) / ( double ) 0xFF00 ) ; double b = clamp ( ( ( argb >> 0 ) & 0xFFFF ) / ( double ) 0... | Create a HSV color . |
120,495 | static double mix ( double color1 , double color2 , double weight ) { long col1 = Double . doubleToRawLongBits ( color1 ) ; long col2 = Double . doubleToRawLongBits ( color2 ) ; int alpha1 = ( int ) ( col1 >>> 48 ) ; int red1 = ( int ) ( col1 >> 32 ) & 0xFFFF ; int green1 = ( int ) ( col1 >> 16 ) & 0xFFFF ; int blue1 =... | Calculate the mix color of 2 colors . |
120,496 | private static double colorBlending ( double color1 , double color2 , int op ) { long argb1 = Double . doubleToRawLongBits ( color1 ) ; long r1 = ( ( argb1 >> 32 ) & 0xFFFF ) ; long g1 = ( ( argb1 >> 16 ) & 0xFFFF ) ; long b1 = ( ( argb1 ) & 0xFFFF ) ; long argb2 = Double . doubleToRawLongBits ( color2 ) ; long r2 = ( ... | Color blending operation |
120,497 | private static long colorBlendingDigit ( long longDigit1 , long longDigit2 , int op ) { switch ( op ) { case MULTIPLY : return longDigit1 * longDigit2 / 0xFF00 ; case SCREEN : return longDigit1 + longDigit2 - longDigit1 * longDigit2 / 0xFF00 ; case OVERLAY : longDigit1 *= 2 ; if ( longDigit1 <= 0xFF00 ) { return colorB... | Color blending operation for a single color channel . |
120,498 | void add ( LessExtend lessExtend , String [ ] mainSelector ) { if ( mainSelector == null || mainSelector [ 0 ] . startsWith ( "@media" ) ) { mainSelector = lessExtend . getSelectors ( ) ; } else { mainSelector = SelectorUtils . merge ( mainSelector , lessExtend . getSelectors ( ) ) ; } String extendingSelector = lessEx... | Is calling on formatting if an extends was include . |
120,499 | String [ ] concatenateExtends ( String [ ] selectors , boolean isReference ) { selectorList . clear ( ) ; for ( String selector : selectors ) { concatenateExtendsRecursive ( selector , isReference , selector ) ; } if ( isReference ) { return selectorList . toArray ( new String [ selectorList . size ( ) ] ) ; } if ( sel... | Add to the given selectors all possible extends and return the resulting selectors . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.