idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
37,900
public Fingerprint circleErrorColor ( int circleError ) { this . circleError = circleError ; this . circleView . setBackgroundTintList ( ColorStateList . valueOf ( getContext ( ) . getColor ( circleError ) ) ) ; return this ; }
Set the fingerprint circular background color in error state .
37,901
public static boolean isAvailable ( Context context ) { FingerprintManager fingerprintManager = ( FingerprintManager ) context . getSystemService ( Context . FINGERPRINT_SERVICE ) ; if ( fingerprintManager != null ) { return ( fingerprintManager . isHardwareDetected ( ) && fingerprintManager . hasEnrolledFingerprints (...
Check if fingerprint authentication is supported by the device and if a fingerprint is enrolled in the device .
37,902
public void authenticate ( ) { if ( fingerprintSecureCallback != null ) { if ( cryptoObject != null ) { throw new RuntimeException ( "If you specify a CryptoObject you have to use FingerprintCallback" ) ; } cryptoObject = cipherHelper . getEncryptionCryptoObject ( ) ; if ( cryptoObject == null ) { fingerprintSecureCall...
start fingerprint scan
37,903
public static boolean isAvailable ( Context context ) { FingerprintManager manager = ( FingerprintManager ) context . getSystemService ( Context . FINGERPRINT_SERVICE ) ; return ( manager != null && manager . isHardwareDetected ( ) && manager . hasEnrolledFingerprints ( ) ) ; }
Check if a fingerprint scanner is available and if at least one finger is enrolled in the phone .
37,904
public FingerprintDialog callback ( FingerprintDialogSecureCallback fingerprintDialogSecureCallback , String KEY_NAME ) { this . fingerprintDialogSecureCallback = fingerprintDialogSecureCallback ; this . fingerprint . callback ( fingerprintSecureCallback , KEY_NAME ) ; return this ; }
Set a callback for secured authentication .
37,905
public FingerprintDialog tryLimit ( int limit , final FailAuthCounterDialogCallback counterCallback ) { this . fingerprint . tryLimit ( limit , new FailAuthCounterCallback ( ) { public void onTryLimitReached ( Fingerprint fingerprint ) { counterCallback . onTryLimitReached ( FingerprintDialog . this ) ; } } ) ; return ...
Set a fail limit . Android blocks automatically when 5 attempts failed .
37,906
public void show ( ) { if ( title == null || message == null ) { throw new RuntimeException ( "Title or message cannot be null." ) ; } dialogView = layoutInflater . inflate ( R . layout . password_dialog , null ) ; ( ( TextView ) dialogView . findViewById ( R . id . password_dialog_title ) ) . setText ( title ) ; ( ( T...
Show the password dialog
37,907
public void register ( boolean hasHistory , boolean usingHash , boolean usingColonForParametersInUrl ) { this . hasHistory = hasHistory ; this . usingHash = usingHash ; this . usingColonForParametersInUrl = usingColonForParametersInUrl ; }
Do NOT cll this method!
37,908
public String toDebugString ( ) { String name = this . getClass ( ) . getName ( ) ; name = name . substring ( name . lastIndexOf ( "." ) + 1 ) ; return "event: " + name + ":" ; }
This is a method used primarily for debugging . It gives a string representation of the event details . This does not override the toString method because the compiler cannot always optimize toString out correctly . Event types should override as desired .
37,909
@ SuppressWarnings ( "unchecked" ) public < S extends AbstractCompositeController < ? , ? , ? > > S getComposite ( String name ) { return ( S ) this . getComposites ( ) . get ( name ) ; }
Returns the composite stored under the composite name .
37,910
public boolean extendsClassOrInterface ( Types types , TypeMirror typeMirror , TypeMirror toImplement ) { String clearedToImplement = this . removeGenericsFromClassName ( toImplement . toString ( ) ) ; Set < TypeMirror > setOfSuperType = this . getFlattenedSupertypeHierarchy ( types , typeMirror ) ; for ( TypeMirror mi...
checks if a class or interface is implemented .
37,911
public void removeHandlers ( ) { Iterator < HandlerRegistration > it = registrations . iterator ( ) ; while ( it . hasNext ( ) ) { HandlerRegistration r = it . next ( ) ; it . remove ( ) ; r . removeHandler ( ) ; } }
Remove all handlers that have been added through this wrapper .
37,912
public < C extends AbstractComponentController < ? , ? , ? > > void storeInCache ( C controller ) { ControllerFactory . get ( ) . storeInCache ( controller ) ; controller . setCached ( true ) ; }
Stores the instance of the controller in the cache so that it can be reused the next time the route is called .
37,913
public < C extends AbstractComponentController < ? , ? , ? > > void removeFromCache ( C controller ) { ControllerFactory . get ( ) . removeFromCache ( controller ) ; controller . setCached ( false ) ; }
Removes a controller from the chache
37,914
public static void logNewUrl ( String newUrl ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "Router: new url ->>" ) . append ( newUrl ) . append ( "<<" ) ; ClientLogger . get ( ) . logSimple ( sb . toString ( ) , 0 ) ; }
Log s the new URL on the browser s console
37,915
private void onFinishLoading ( ) { String hashOnStart = this . plugin . getStartRoute ( isUsingHash ( ) ) ; if ( hashOnStart != null && hashOnStart . trim ( ) . length ( ) > 0 ) { ClientLogger . get ( ) . logDetailed ( "AbstractApplication: handle history (hash at start: >>" + hashOnStart + "<<" , 1 ) ; RouteResult rou...
Once the loader did his job we will continue
37,916
public static void setLocalVar ( ExecutionContext context , String name , Object value ) { LexicalEnvironment localEnv = context . getLexicalEnvironment ( ) ; localEnv . getRecord ( ) . createMutableBinding ( context , name , false ) ; localEnv . getRecord ( ) . setMutableBinding ( context , name , value , false ) ; }
A convenience for module providers . Sets a scoped variable on the provided ExecutionContext .
37,917
public static Object getLocalVar ( ExecutionContext context , String name ) { LexicalEnvironment localEnv = context . getLexicalEnvironment ( ) ; if ( localEnv . getRecord ( ) . hasBinding ( context , name ) ) { return localEnv . getRecord ( ) . getBindingValue ( context , name , false ) ; } return null ; }
A convenience for module providers . Gets a scoped variable from the provided ExecutionContext
37,918
protected String normalizeName ( String originalName ) { if ( originalName == null || originalName . endsWith ( ".js" ) ) { return originalName ; } return originalName + ".js" ; }
Helper method . Since module names should not include the . js extension but the actual modules themselves usually do .
37,919
private BasicBlock buildExitBasicBlock ( Stack < ExceptionRegion > nestedExceptionRegions , BasicBlock firstBB , List < BasicBlock > returnBBs , List < BasicBlock > exceptionBBs , boolean nextIsFallThrough , BasicBlock currBB , BasicBlock entryBB ) { exitBB = createBB ( nestedExceptionRegions ) ; graph . addEdge ( entr...
Create special empty exit BasicBlock that all BasicBlocks will eventually flow into . All Edges to this dummy BasicBlock will get marked with an edge type of EXIT .
37,920
public LocalVariable findVariable ( String name , int depth ) { LocalVariable variable = localVariables . get ( name ) ; if ( variable != null ) { if ( depth != 0 ) { return new LocalVariable ( name , variable . getOffset ( ) , depth ) ; } return variable ; } if ( parent != null ) { return parent . findVariable ( name ...
Tries to find a variable or returns null if it cannot . This will walk all scopes to find a captured variable .
37,921
public Variable acquireLocalVariable ( String name ) { int depth = 0 ; LocalVariable variable = findVariable ( name , depth ) ; if ( variable == null ) { variable = new LocalVariable ( name , localVariablesIndex , 0 ) ; localVariables . put ( name , variable ) ; localVariablesIndex ++ ; } return variable ; }
Return an existing variable or return a new one made in this scope .
37,922
protected File findFile ( List < String > loadPaths , String moduleName ) { String fileName = normalizeName ( moduleName ) ; File file = new File ( moduleName ) ; if ( file . isAbsolute ( ) ) { if ( file . exists ( ) ) { return file ; } } for ( String loadPath : loadPaths ) { file = new File ( loadPath , fileName ) ; i...
Finds the module file based on the known load paths .
37,923
private static void addJumpIfNextNotDestination ( CFG cfg , BasicBlock next , Instruction lastInstr , BasicBlock current ) { Iterator < BasicBlock > outs = cfg . getOutgoingDestinations ( current ) . iterator ( ) ; BasicBlock target = outs . hasNext ( ) ? outs . next ( ) : null ; if ( target != null && ! outs . hasNext...
If there is no jump at add of block and the next block is not destination insert a valid jump
37,924
public List < Variable > getUsedVariables ( ) { ArrayList < Variable > vars = new ArrayList < Variable > ( ) ; for ( Operand o : getOperands ( ) ) { o . addUsedVariables ( vars ) ; } return vars ; }
List of all variables used by this instruction .
37,925
public static Stream < Integer > range ( final int from , final int to , final int step ) { return new Stream < Integer > ( ) { public Iterator < Integer > iterator ( ) { return new ReadOnlyIterator < Integer > ( ) { int value = from ; public boolean hasNext ( ) { return value < to ; } public Integer next ( ) { final i...
Creates a stream that contains a given number of integers starting from a given number .
37,926
public static < T > Optional < T > of ( T value ) { return value == null ? ( Optional < T > ) EMPTY : new Optional < > ( value ) ; }
Returns an optional for a given value
37,927
public T or ( Func0 < T > func1 ) { return value != null ? value : func1 . call ( ) ; }
Returns value of uses a given factory if the value does not exist .
37,928
public < R > Optional < R > map ( Func1 < T , R > func1 ) { return value == null ? Optional . < R > empty ( ) : Optional . of ( func1 . call ( value ) ) ; }
Transforms the value if exists returns empty Optional otherwise .
37,929
public static < K , V > SolidMap < K , V > map ( K key , V value , Object ... pairs ) { if ( pairs . length % 2 != 0 ) throw new IllegalArgumentException ( "SolidMap.map(...) takes even number of arguments" ) ; LinkedHashMap < K , V > m = new LinkedHashMap < > ( ) ; m . put ( key , value ) ; for ( int i = 0 ; i < pairs...
Creates a map using interleaving keys and values .
37,930
public static < T > Stream < T > of ( final T value ) { return new Stream < T > ( ) { public Iterator < T > iterator ( ) { return new ReadOnlyIterator < T > ( ) { boolean has = true ; public boolean hasNext ( ) { return has ; } public T next ( ) { has = false ; return value ; } } ; } } ; }
Returns a stream with just one given element .
37,931
public < R > R collect ( Func1 < Iterable < T > , R > collector ) { return collector . call ( this ) ; }
Converts the current stream into any value with a given method .
37,932
public < R > Stream < R > map ( final Func1 < ? super T , ? extends R > func ) { return new Stream < R > ( ) { public Iterator < R > iterator ( ) { return new ReadOnlyIterator < R > ( ) { Iterator < T > iterator = Stream . this . iterator ( ) ; public boolean hasNext ( ) { return iterator . hasNext ( ) ; } public R nex...
Returns a new stream that contains items that has been returned by a given function for each item in the current stream .
37,933
public Stream < T > merge ( final T value ) { return new Stream < T > ( ) { public Iterator < T > iterator ( ) { return new ReadOnlyIterator < T > ( ) { Iterator < T > iterator = Stream . this . iterator ( ) ; boolean completed ; public boolean hasNext ( ) { return iterator . hasNext ( ) || ! completed ; } public T nex...
Returns a new stream that contains all items of the current stream with addition of a given item .
37,934
public Stream < T > separate ( final T value ) { return filter ( new Func1 < T , Boolean > ( ) { public Boolean call ( T it ) { return ( ( it == null ) ? ( value != null ) : ! it . equals ( value ) ) ; } } ) ; }
Returns a new stream that contains all items of the current stream except of a given item .
37,935
public Stream < T > merge ( final Iterable < ? extends T > with ) { return new Stream < T > ( ) { public Iterator < T > iterator ( ) { return new ReadOnlyIterator < T > ( ) { Iterator < T > iterator = Stream . this . iterator ( ) ; Iterator < ? extends T > withIterator = with . iterator ( ) ; public boolean hasNext ( )...
Adds items from another stream to the end of the current stream .
37,936
public < S , R > Stream < R > zipWith ( final Iterable < ? extends S > with , final Func2 < ? super T , ? super S , ? extends R > func ) { return new Stream < R > ( ) { public Iterator < R > iterator ( ) { return new ReadOnlyIterator < R > ( ) { Iterator < T > iterator = Stream . this . iterator ( ) ; Iterator < ? exte...
Returns a new stream that contains items that has been received by sequentially combining items of the streams into pairs and then applying given function to each pair of items .
37,937
public Stream < T > separate ( Iterable < T > from ) { final ArrayList < T > list = ToArrayList . < T > toArrayList ( ) . call ( from ) ; return filter ( new Func1 < T , Boolean > ( ) { public Boolean call ( T it ) { return ! list . contains ( it ) ; } } ) ; }
Returns a stream that includes only that items of the current stream that do not exist in a given stream .
37,938
public Stream < T > take ( final int count ) { return new Stream < T > ( ) { public Iterator < T > iterator ( ) { return new ReadOnlyIterator < T > ( ) { Iterator < T > iterator = Stream . this . iterator ( ) ; int left = count ; public boolean hasNext ( ) { return left > 0 && iterator . hasNext ( ) ; } public T next (...
Creates a new stream that contains only the first given amount of items of the current stream .
37,939
public Stream < T > skip ( final int count ) { return new Stream < T > ( ) { public Iterator < T > iterator ( ) { Iterator < T > iterator = Stream . this . iterator ( ) ; for ( int skip = count ; skip > 0 && iterator . hasNext ( ) ; skip -- ) iterator . next ( ) ; return iterator ; } } ; }
Creates a new stream that contains elements of the current stream with a given number of them skipped from the beginning .
37,940
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 .
37,941
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 .
37,942
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 .
37,943
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 .
37,944
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 .
37,945
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 .
37,946
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 .
37,947
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
37,948
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 .
37,949
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 .
37,950
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 .
37,951
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 .
37,952
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 .
37,953
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 .
37,954
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 .
37,955
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
37,956
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
37,957
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
37,958
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 .
37,959
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?
37,960
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?
37,961
public static < T > void insertListBatched ( Connection connection , Iterable < T > iterable ) throws SQLException { OrmWriter . insertListBatched ( connection , iterable ) ; }
Insert a collection of objects using JDBC batching .
37,962
public static < T > T insertObject ( Connection connection , T target ) throws SQLException { return OrmWriter . insertObject ( connection , target ) ; }
Insert an annotated object into the database .
37,963
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 .
37,964
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 .
37,965
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 .
37,966
protected static boolean isIgnoredColumn ( final Set < String > ignoredColumns , final String columnName ) { return ignoredColumns . stream ( ) . anyMatch ( s -> s . equalsIgnoreCase ( columnName ) ) ; }
Case insensitive comparison .
37,967
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 .
37,968
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 .
37,969
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 .
37,970
public static < T > T insertObject ( T object ) { return SqlClosure . sqlExecute ( c -> OrmElf . insertObject ( c , object ) ) ; }
Inserts the given object into the database .
37,971
public static < T > T updateObject ( T object ) { return SqlClosure . sqlExecute ( c -> OrmElf . updateObject ( c , object ) ) ; }
Updates the given object in the database .
37,972
public static < T > int deleteObject ( T object ) { return SqlClosure . sqlExecute ( c -> OrmElf . deleteObject ( c , object ) ) ; }
Delete the given object in the database .
37,973
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 .
37,974
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 .
37,975
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 .
37,976
public static int executeUpdate ( final String sql , final Object ... args ) { return SqlClosure . sqlExecute ( c -> executeUpdate ( c , sql , args ) ) ; }
Executes an update or insert statement .
37,977
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 .
37,978
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 .
37,979
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 .
37,980
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
37,981
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 .
37,982
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 .
37,983
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
37,984
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 .
37,985
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 .
37,986
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 .
37,987
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 .
37,988
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 .
37,989
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 .
37,990
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 .
37,991
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 .
37,992
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
37,993
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 .
37,994
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
37,995
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 .
37,996
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 .
37,997
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 .
37,998
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 .
37,999
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 .