idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
3,200
private CharSequence getHelperText ( final float score ) { if ( ! helperTexts . isEmpty ( ) ) { float interval = 1.0f / helperTexts . size ( ) ; int index = ( int ) Math . floor ( score / interval ) - 1 ; index = Math . max ( index , 0 ) ; index = Math . min ( index , helperTexts . size ( ) - 1 ) ; return helperTexts . get ( index ) ; } return null ; }
Returns the helper text which corresponds to a specific password strength .
3,201
private int getHelperTextColor ( final float score ) { if ( ! helperTextColors . isEmpty ( ) ) { float interval = 1.0f / helperTextColors . size ( ) ; int index = ( int ) Math . floor ( score / interval ) - 1 ; index = Math . max ( index , 0 ) ; index = Math . min ( index , helperTextColors . size ( ) - 1 ) ; return helperTextColors . get ( index ) ; } return regularHelperTextColor ; }
Returns the color of the helper text which corresponds to a specific password strength .
3,202
public final void addConstraint ( final Constraint < CharSequence > constraint ) { Condition . INSTANCE . ensureNotNull ( constraint , "The constraint may not be null" ) ; if ( ! constraints . contains ( constraint ) ) { constraints . add ( constraint ) ; verifyPasswordStrength ( ) ; } }
Adds a new constraint which should be used to verify the password strength .
3,203
public final void addAllConstraints ( final Collection < Constraint < CharSequence > > constraints ) { Condition . INSTANCE . ensureNotNull ( constraints , "The collection may not be null" ) ; for ( Constraint < CharSequence > constraint : constraints ) { addConstraint ( constraint ) ; } }
Adds all constraints which are contained by a specific collection .
3,204
public final void removeConstraint ( final Constraint < CharSequence > constraint ) { Condition . INSTANCE . ensureNotNull ( constraint , "The constraint may not be null" ) ; constraints . remove ( constraint ) ; verifyPasswordStrength ( ) ; }
Removes a specific constraint which should not be used to verify the password strength anymore .
3,205
public final void removeAllConstraints ( final Collection < Constraint < CharSequence > > constraints ) { Condition . INSTANCE . ensureNotNull ( constraints , "The collection may not be null" ) ; for ( Constraint < CharSequence > constraint : constraints ) { removeConstraint ( constraint ) ; } }
Removes all constraints which are contained by a specific collection .
3,206
public final void removeAllConstraints ( final Constraint < CharSequence > ... constraints ) { Condition . INSTANCE . ensureNotNull ( constraints , "The array may not be null" ) ; removeAllConstraints ( Arrays . asList ( constraints ) ) ; }
Removes all constraints which are contained by a specific array .
3,207
public final void addHelperText ( final CharSequence helperText ) { Condition . INSTANCE . ensureNotNull ( helperText , "The helper text may not be null" ) ; Condition . INSTANCE . ensureNotEmpty ( helperText , "The helper text may not be empty" ) ; if ( ! helperTexts . contains ( helperText ) ) { helperTexts . add ( helperText ) ; verifyPasswordStrength ( ) ; } }
Adds a new helper text which should be shown depending on the password strength . Helper texts which have been added later than others are supposed to indicate a higher password strength .
3,208
public final void addAllHelperTexts ( final Collection < CharSequence > helperTexts ) { Condition . INSTANCE . ensureNotNull ( helperTexts , "The collection may not be null" ) ; for ( CharSequence helperText : helperTexts ) { addHelperText ( helperText ) ; } }
Adds all helper texts which are contained by a specific collection . The helper texts are added in the given order .
3,209
public final void removeHelperText ( final CharSequence helperText ) { Condition . INSTANCE . ensureNotNull ( helperText , "The helper text may not be null" ) ; Condition . INSTANCE . ensureNotEmpty ( helperText , "The helper text may not be empty" ) ; helperTexts . remove ( helperText ) ; verifyPasswordStrength ( ) ; }
Removes a specific helper text which should not be shown depending on the password strength anymore .
3,210
public final void addHelperTextColor ( final int color ) { if ( ! helperTextColors . contains ( color ) ) { helperTextColors . add ( color ) ; verifyPasswordStrength ( ) ; } }
Adds a new helper text color which should be used to highlight the helper text which indicates the password strength .
3,211
public final void removeHelperTextColor ( final int color ) { int index = helperTextColors . indexOf ( color ) ; if ( index != - 1 ) { helperTextColors . remove ( index ) ; verifyPasswordStrength ( ) ; } }
Removes a specific helper text color which should not be used to highlight the helper text which indicates the password strength anymore .
3,212
private boolean isAlwaysInserted ( JDBCStorableProperty < ? > property ) { return property . isVersion ( ) ? ( mVersioning == Versioning . AUTO ) : ! property . isAutomatic ( ) ; }
Returns true if property value is always part of insert statement .
3,213
private Map < JDBCStorableProperty < S > , Integer > findLobs ( ) { Map < JDBCStorableProperty < S > , Integer > lobIndexMap = new IdentityHashMap < JDBCStorableProperty < S > , Integer > ( ) ; int lobIndex = 0 ; for ( JDBCStorableProperty < S > property : mAllProperties . values ( ) ) { if ( isLobType ( property ) ) { lobIndexMap . put ( property , lobIndex ++ ) ; } } return lobIndexMap ; }
Finds all Lob properties and maps them to a zero - based index . This information is used to update large Lobs after an insert or update .
3,214
private LocalVariable getJDBCSupport ( CodeBuilder b ) { pushJDBCSupport ( b ) ; LocalVariable supportVar = b . createLocalVariable ( "support" , TypeDesc . forClass ( JDBCSupport . class ) ) ; b . storeLocal ( supportVar ) ; return supportVar ; }
Generates code to get the JDBCSupport instance and store it in a local variable .
3,215
private void pushJDBCSupport ( CodeBuilder b ) { b . loadThis ( ) ; b . loadField ( StorableGenerator . SUPPORT_FIELD_NAME , TypeDesc . forClass ( TriggerSupport . class ) ) ; b . checkCast ( TypeDesc . forClass ( JDBCSupport . class ) ) ; }
Generates code to push the JDBCSupport instance on the stack .
3,216
private LocalVariable getConnection ( CodeBuilder b , LocalVariable capVar ) { b . loadLocal ( capVar ) ; b . invokeInterface ( TypeDesc . forClass ( JDBCConnectionCapability . class ) , "getConnection" , TypeDesc . forClass ( Connection . class ) , null ) ; LocalVariable conVar = b . createLocalVariable ( "con" , TypeDesc . forClass ( Connection . class ) ) ; b . storeLocal ( conVar ) ; return conVar ; }
Generates code to get connection from JDBCConnectionCapability and store it in a local variable .
3,217
private void branchIfDirty ( CodeBuilder b , int propNumber , Label target , boolean branchIfDirty ) { String stateFieldName = StorableGenerator . PROPERTY_STATE_FIELD_NAME + ( propNumber >> 4 ) ; b . loadThis ( ) ; b . loadField ( stateFieldName , TypeDesc . INT ) ; int shift = ( propNumber & 0xf ) * 2 ; b . loadConstant ( StorableGenerator . PROPERTY_STATE_MASK << shift ) ; b . math ( Opcode . IAND ) ; b . loadConstant ( StorableGenerator . PROPERTY_STATE_DIRTY << shift ) ; b . ifComparisonBranch ( target , branchIfDirty ? "==" : "!=" ) ; }
Generates code to branch if a property is dirty .
3,218
public QueryExecutor < S > executor ( Filter < S > filter , OrderingList < S > ordering , QueryHints hints ) throws RepositoryException { final Key < S > key = new Key < S > ( filter , ordering , hints ) ; synchronized ( mPrimaryCache ) { QueryExecutor < S > executor = mPrimaryCache . get ( key ) ; if ( executor != null ) { return executor ; } } SoftValuedCache < Object , QueryExecutor < S > > cache ; synchronized ( mFilterToExecutor ) { cache = mFilterToExecutor . get ( filter ) ; if ( cache == null ) { cache = SoftValuedCache . newCache ( 7 ) ; mFilterToExecutor . put ( filter , cache ) ; } } Object subKey ; if ( hints == null || hints . isEmpty ( ) ) { subKey = ordering ; } else { subKey = new Key ( null , ordering , hints ) ; } QueryExecutor < S > executor ; synchronized ( cache ) { executor = cache . get ( subKey ) ; if ( executor == null ) { executor = mFactory . executor ( filter , ordering , hints ) ; cache . put ( subKey , executor ) ; } } synchronized ( mPrimaryCache ) { mPrimaryCache . put ( key , executor ) ; } return executor ; }
Returns an executor from the cache .
3,219
public < S extends Storable > IndexInfo [ ] getIndexInfo ( Class < S > storableType ) throws RepositoryException { if ( Unindexed . class . isAssignableFrom ( storableType ) ) { return new IndexInfo [ 0 ] ; } Storage < S > masterStorage = mRepository . storageFor ( storableType ) ; IndexAnalysis < S > analysis = mIndexAnalysisPool . get ( masterStorage ) ; IndexInfo [ ] infos = new IndexInfo [ analysis . allIndexInfoMap . size ( ) ] ; return analysis . allIndexInfoMap . values ( ) . toArray ( infos ) ; }
Required by IndexInfoCapability .
3,220
public < S extends Storable > IndexEntryAccessor < S > [ ] getIndexEntryAccessors ( Class < S > storableType ) throws RepositoryException { if ( Unindexed . class . isAssignableFrom ( storableType ) ) { return new IndexEntryAccessor [ 0 ] ; } Storage < S > masterStorage = mRepository . storageFor ( storableType ) ; IndexAnalysis < S > analysis = mIndexAnalysisPool . get ( masterStorage ) ; List < IndexEntryAccessor < S > > accessors = new ArrayList < IndexEntryAccessor < S > > ( analysis . allIndexInfoMap . size ( ) ) ; for ( IndexInfo info : analysis . allIndexInfoMap . values ( ) ) { if ( info instanceof IndexEntryAccessor ) { accessors . add ( ( IndexEntryAccessor < S > ) info ) ; } } return accessors . toArray ( new IndexEntryAccessor [ accessors . size ( ) ] ) ; }
Required by IndexEntryAccessCapability .
3,221
public String getMessage ( ) { String message = super . getMessage ( ) ; if ( mType != null ) { message = mType . getName ( ) + ": " + message ; } return message ; }
Returns first message prefixed with the malformed type .
3,222
public QueryExecutor < S > executor ( Filter < S > filter , OrderingList < S > ordering , QueryHints hints ) throws RepositoryException { return analyze ( filter , ordering , hints ) . createExecutor ( ) ; }
Returns an executor that handles the given query specification .
3,223
private List < Set < ChainedProperty < S > > > getKeys ( ) throws SupportException , RepositoryException { StorableInfo < S > info = StorableIntrospector . examine ( mIndexAnalyzer . getStorableType ( ) ) ; List < Set < ChainedProperty < S > > > keys = new ArrayList < Set < ChainedProperty < S > > > ( ) ; keys . add ( stripOrdering ( info . getPrimaryKey ( ) . getProperties ( ) ) ) ; for ( StorableKey < S > altKey : info . getAlternateKeys ( ) ) { keys . add ( stripOrdering ( altKey . getProperties ( ) ) ) ; } Collection < StorableIndex < S > > indexes = mRepoAccess . storageAccessFor ( getStorableType ( ) ) . getAllIndexes ( ) ; for ( StorableIndex < S > index : indexes ) { if ( ! index . isUnique ( ) ) { continue ; } int propCount = index . getPropertyCount ( ) ; Set < ChainedProperty < S > > props = new LinkedHashSet < ChainedProperty < S > > ( propCount ) ; for ( int i = 0 ; i < propCount ; i ++ ) { props . add ( index . getOrderedProperty ( i ) . getChainedProperty ( ) ) ; } keys . add ( props ) ; } return keys ; }
Returns a list of all primary and alternate keys stripped of ordering .
3,224
private boolean pruneKeys ( List < Set < ChainedProperty < S > > > keys , ChainedProperty < S > property ) { boolean result = false ; for ( Set < ChainedProperty < S > > key : keys ) { key . remove ( property ) ; if ( key . size ( ) == 0 ) { result = true ; continue ; } } return result ; }
Removes the given property from all keys returning true if any key has zero properties as a result .
3,225
private List < IndexedQueryAnalyzer < S > . Result > splitIntoSubResults ( Filter < S > filter , OrderingList < S > ordering , QueryHints hints ) throws SupportException , RepositoryException { Filter < S > dnfFilter = filter . disjunctiveNormalForm ( ) ; Splitter splitter = new Splitter ( ordering , hints ) ; RepositoryException e = dnfFilter . accept ( splitter , null ) ; if ( e != null ) { throw e ; } List < IndexedQueryAnalyzer < S > . Result > subResults = splitter . mSubResults ; IndexedQueryAnalyzer < S > . Result full = null ; for ( IndexedQueryAnalyzer < S > . Result result : subResults ) { if ( ! result . handlesAnything ( ) ) { full = result ; break ; } if ( ! result . getCompositeScore ( ) . getFilteringScore ( ) . hasAnyMatches ( ) ) { if ( full == null ) { full = result ; } } } if ( full == null ) { return subResults ; } List < IndexedQueryAnalyzer < S > . Result > mergedResults = new ArrayList < IndexedQueryAnalyzer < S > . Result > ( ) ; for ( IndexedQueryAnalyzer < S > . Result result : subResults ) { if ( result == full ) { continue ; } boolean exempt = result . getCompositeScore ( ) . getFilteringScore ( ) . hasAnyMatches ( ) ; if ( exempt ) { List < PropertyFilter < S > > subFilters = PropertyFilterList . get ( result . getFilter ( ) ) ; joinCheck : { for ( PropertyFilter < S > subFilter : subFilters ) { if ( subFilter . getChainedProperty ( ) . getChainCount ( ) > 0 ) { break joinCheck ; } } exempt = false ; } } if ( exempt ) { mergedResults . add ( result ) ; } else { full = full . mergeRemainderFilter ( result . getFilter ( ) ) ; } } if ( mergedResults . size ( ) == 0 ) { full = full . withRemainderFilter ( filter . reduce ( ) ) ; } mergedResults . add ( full ) ; return mergedResults ; }
Splits the filter into sub - results and possibly merges them .
3,226
public Layout layoutFor ( Class < ? extends Storable > type , int generation ) throws FetchException , FetchNoneException { StoredLayout storedLayout = mLayoutStorage . query ( "storableTypeName = ? & generation = ?" ) . with ( type . getName ( ) ) . with ( generation ) . loadOne ( ) ; return new Layout ( this , storedLayout ) ; }
Returns the layout for a particular generation of the given type .
3,227
private static int annHashCode ( Annotation ann ) { int hash = 0 ; Method [ ] methods = ann . getClass ( ) . getDeclaredMethods ( ) ; for ( Method m : methods ) { if ( m . getReturnType ( ) == null || m . getReturnType ( ) == void . class ) { continue ; } if ( m . getParameterTypes ( ) . length != 0 ) { continue ; } String name = m . getName ( ) ; if ( name . equals ( "hashCode" ) || name . equals ( "toString" ) || name . equals ( "annotationType" ) ) { continue ; } Object value ; try { value = m . invoke ( ann ) ; } catch ( InvocationTargetException e ) { continue ; } catch ( IllegalAccessException e ) { continue ; } hash += ( 127 * name . hashCode ( ) ) ^ annValueHashCode ( value ) ; } return hash ; }
Returns an annotation hash code using a algorithm similar to the default . The difference is in the handling of class and enum values . The name is chosen for the hash code component instead of the instance because it is stable between invocations of the JVM .
3,228
public List < String > getMessages ( ) { if ( mMessages == null || mMessages . size ( ) == 0 ) { mMessages = Collections . singletonList ( super . getMessage ( ) ) ; } return mMessages ; }
Multiple error messages may be embedded in a MismatchException .
3,229
static < S extends Storable > ClobReplicationTrigger < S > create ( Storage < S > masterStorage ) { Map < String , ? extends StorableProperty < S > > properties = StorableIntrospector . examine ( masterStorage . getStorableType ( ) ) . getDataProperties ( ) ; List < String > clobNames = new ArrayList < String > ( 2 ) ; for ( StorableProperty < S > property : properties . values ( ) ) { if ( property . getType ( ) == Clob . class ) { clobNames . add ( property . getName ( ) ) ; } } if ( clobNames . size ( ) == 0 ) { return null ; } return new ClobReplicationTrigger < S > ( masterStorage , clobNames . toArray ( new String [ clobNames . size ( ) ] ) ) ; }
Returns null if no Clobs need to be replicated .
3,230
protected boolean definePropertyBeanMethods ( ClassFile cf , SyntheticProperty property ) { TypeDesc propertyType = TypeDesc . forClass ( property . getType ( ) ) ; final MethodInfo mi = cf . addMethod ( Modifiers . PUBLIC_ABSTRACT , property . getReadMethodName ( ) , propertyType , null ) ; if ( property . getName ( ) != null ) { Annotation ann = mi . addRuntimeVisibleAnnotation ( TypeDesc . forClass ( Name . class ) ) ; ann . putMemberValue ( "value" , property . getName ( ) ) ; } if ( property . isNullable ( ) ) { mi . addRuntimeVisibleAnnotation ( TypeDesc . forClass ( Nullable . class ) ) ; } boolean versioned = false ; if ( property . isVersion ( ) ) { mi . addRuntimeVisibleAnnotation ( TypeDesc . forClass ( Version . class ) ) ; versioned = true ; } if ( property . getAdapter ( ) != null ) { StorablePropertyAdapter adapter = property . getAdapter ( ) ; Annotation ann = mi . addRuntimeVisibleAnnotation ( TypeDesc . forClass ( adapter . getAnnotation ( ) . getAnnotationType ( ) ) ) ; java . lang . annotation . Annotation jann = adapter . getAnnotation ( ) . getAnnotation ( ) ; if ( jann != null ) { new AnnotationBuilder ( ) . visit ( jann , ann ) ; } } List < String > annotationDescs = property . getAccessorAnnotationDescriptors ( ) ; if ( annotationDescs != null && annotationDescs . size ( ) > 0 ) { for ( String desc : annotationDescs ) { new AnnotationDescParser ( desc ) { protected Annotation buildRootAnnotation ( TypeDesc rootAnnotationType ) { return mi . addRuntimeVisibleAnnotation ( rootAnnotationType ) ; } } . parse ( null ) ; } } cf . addMethod ( Modifiers . PUBLIC_ABSTRACT , property . getWriteMethodName ( ) , null , new TypeDesc [ ] { propertyType } ) ; return versioned ; }
Add the get & set methods for this property
3,231
public static void assertParameterNotNull ( CodeBuilder b , int paramIndex ) { b . loadLocal ( b . getParameter ( paramIndex ) ) ; Label notNull = b . createLabel ( ) ; b . ifNullBranch ( notNull , false ) ; throwException ( b , IllegalArgumentException . class , null ) ; notNull . setLocation ( ) ; }
Generate code to throw an exception if a parameter is null
3,232
public static LocalVariable uneraseGenericParameter ( CodeBuilder b , TypeDesc paramType , final int paramIndex ) { b . loadLocal ( b . getParameter ( paramIndex ) ) ; b . checkCast ( paramType ) ; LocalVariable result = b . createLocalVariable ( null , paramType ) ; b . storeLocal ( result ) ; return result ; }
Generate code to create a local variable containing the specified parameter coerced to the specified type . This is useful for re - interpreting erased generics into the more specific genericized type .
3,233
public static void throwException ( CodeBuilder b , Class type , String message ) { TypeDesc desc = TypeDesc . forClass ( type ) ; b . newObject ( desc ) ; b . dup ( ) ; if ( message == null ) { b . invokeConstructor ( desc , null ) ; } else { b . loadConstant ( message ) ; b . invokeConstructor ( desc , new TypeDesc [ ] { TypeDesc . STRING } ) ; } b . throwObject ( ) ; }
Generate code to throw an exception with an optional message .
3,234
public static void throwConcatException ( CodeBuilder b , Class type , String ... messages ) { if ( messages == null || messages . length == 0 ) { throwException ( b , type , null ) ; return ; } if ( messages . length == 1 ) { throwException ( b , type , messages [ 0 ] ) ; return ; } TypeDesc desc = TypeDesc . forClass ( type ) ; b . newObject ( desc ) ; b . dup ( ) ; TypeDesc [ ] params = new TypeDesc [ ] { TypeDesc . STRING } ; for ( int i = 0 ; i < messages . length ; i ++ ) { b . loadConstant ( String . valueOf ( messages [ i ] ) ) ; if ( i > 0 ) { b . invokeVirtual ( TypeDesc . STRING , "concat" , TypeDesc . STRING , params ) ; } } b . invokeConstructor ( desc , params ) ; b . throwObject ( ) ; }
Generate code to throw an exception with a message concatenated at runtime .
3,235
private static void definePrepareBridge ( ClassFile cf , Class leaf , Class returnClass ) { TypeDesc returnType = TypeDesc . forClass ( returnClass ) ; if ( isPublicMethodFinal ( leaf , PREPARE_METHOD_NAME , returnType , null ) ) { return ; } MethodInfo mi = cf . addMethod ( Modifiers . PUBLIC . toBridge ( true ) , PREPARE_METHOD_NAME , returnType , null ) ; CodeBuilder b = new CodeBuilder ( mi ) ; b . loadThis ( ) ; b . invokeVirtual ( PREPARE_METHOD_NAME , cf . getType ( ) , null ) ; b . returnValue ( returnType ) ; }
Add a prepare bridge method to the classfile for the given type .
3,236
public static boolean isPublicMethodFinal ( Class clazz , String name , TypeDesc retType , TypeDesc [ ] params ) { if ( ! clazz . isInterface ( ) ) { Class [ ] paramClasses ; if ( params == null || params . length == 0 ) { paramClasses = null ; } else { paramClasses = new Class [ params . length ] ; for ( int i = 0 ; i < params . length ; i ++ ) { paramClasses [ i ] = params [ i ] . toClass ( ) ; } } try { Method existing = clazz . getMethod ( name , paramClasses ) ; if ( Modifier . isFinal ( existing . getModifiers ( ) ) ) { if ( retType == null ) { retType = TypeDesc . forClass ( void . class ) ; } if ( TypeDesc . forClass ( existing . getReturnType ( ) ) == retType ) { return true ; } } } catch ( NoSuchMethodException e ) { } } return false ; }
Returns true if a public final method exists which matches the given specification .
3,237
public static void addValueHashCodeCall ( CodeBuilder b , TypeDesc valueType , boolean testForNull , boolean mixIn ) { LocalVariable value = null ; if ( mixIn ) { value = b . createLocalVariable ( null , valueType ) ; b . storeLocal ( value ) ; b . loadConstant ( 31 ) ; b . math ( Opcode . IMUL ) ; b . loadLocal ( value ) ; } switch ( valueType . getTypeCode ( ) ) { case TypeDesc . FLOAT_CODE : b . invokeStatic ( TypeDesc . FLOAT . toObjectType ( ) , "floatToIntBits" , TypeDesc . INT , new TypeDesc [ ] { TypeDesc . FLOAT } ) ; case TypeDesc . INT_CODE : case TypeDesc . CHAR_CODE : case TypeDesc . SHORT_CODE : case TypeDesc . BYTE_CODE : case TypeDesc . BOOLEAN_CODE : if ( mixIn ) { b . math ( Opcode . IADD ) ; } break ; case TypeDesc . DOUBLE_CODE : b . invokeStatic ( TypeDesc . DOUBLE . toObjectType ( ) , "doubleToLongBits" , TypeDesc . LONG , new TypeDesc [ ] { TypeDesc . DOUBLE } ) ; case TypeDesc . LONG_CODE : b . dup2 ( ) ; b . loadConstant ( 32 ) ; b . math ( Opcode . LUSHR ) ; b . math ( Opcode . LXOR ) ; b . convert ( TypeDesc . LONG , TypeDesc . INT ) ; if ( mixIn ) { b . math ( Opcode . IADD ) ; } break ; case TypeDesc . OBJECT_CODE : default : if ( testForNull ) { if ( value == null ) { value = b . createLocalVariable ( null , valueType ) ; b . storeLocal ( value ) ; b . loadLocal ( value ) ; } } if ( mixIn ) { Label isNull = b . createLabel ( ) ; if ( testForNull ) { b . ifNullBranch ( isNull , true ) ; b . loadLocal ( value ) ; } addValueHashCodeCallTo ( b , valueType ) ; b . math ( Opcode . IADD ) ; if ( testForNull ) { isNull . setLocation ( ) ; } } else { Label cont = b . createLabel ( ) ; if ( testForNull ) { Label notNull = b . createLabel ( ) ; b . ifNullBranch ( notNull , false ) ; b . loadConstant ( 0 ) ; b . branch ( cont ) ; notNull . setLocation ( ) ; b . loadLocal ( value ) ; } addValueHashCodeCallTo ( b , valueType ) ; if ( testForNull ) { cont . setLocation ( ) ; } } break ; } }
Generates code to compute a hashcode for a value on the stack consuming the value . After the code executes the stack contains an int hashcode .
3,238
public static void addEqualsCall ( CodeBuilder b , String fieldName , TypeDesc fieldType , boolean testForNull , Label fail , LocalVariable other ) { b . loadThis ( ) ; b . loadField ( fieldName , fieldType ) ; b . loadLocal ( other ) ; b . loadField ( fieldName , fieldType ) ; addValuesEqualCall ( b , fieldType , testForNull , fail , false ) ; }
Generates code to compare a field in this object against the same one in a different instance . Branch to the provided Label if they are not equal .
3,239
public static void addValuesEqualCall ( final CodeBuilder b , final TypeDesc valueType , final boolean testForNull , final Label label , final boolean choice ) { if ( valueType . getTypeCode ( ) != TypeDesc . OBJECT_CODE ) { if ( valueType . getTypeCode ( ) == TypeDesc . FLOAT_CODE ) { b . invokeStatic ( TypeDesc . FLOAT . toObjectType ( ) , "compare" , TypeDesc . INT , new TypeDesc [ ] { TypeDesc . FLOAT , TypeDesc . FLOAT } ) ; b . ifZeroComparisonBranch ( label , choice ? "==" : "!=" ) ; } else if ( valueType . getTypeCode ( ) == TypeDesc . DOUBLE_CODE ) { b . invokeStatic ( TypeDesc . DOUBLE . toObjectType ( ) , "compare" , TypeDesc . INT , new TypeDesc [ ] { TypeDesc . DOUBLE , TypeDesc . DOUBLE } ) ; b . ifZeroComparisonBranch ( label , choice ? "==" : "!=" ) ; } else { b . ifComparisonBranch ( label , choice ? "==" : "!=" , valueType ) ; } return ; } if ( ! testForNull ) { String op = addEqualsCallTo ( b , valueType , choice ) ; b . ifZeroComparisonBranch ( label , op ) ; return ; } Label isNotNull = b . createLabel ( ) ; LocalVariable value = b . createLocalVariable ( null , valueType ) ; b . storeLocal ( value ) ; b . loadLocal ( value ) ; b . ifNullBranch ( isNotNull , false ) ; b . ifNullBranch ( label , choice ) ; Label cont = b . createLabel ( ) ; b . branch ( cont ) ; isNotNull . setLocation ( ) ; if ( compareToType ( valueType ) == null ) { b . loadLocal ( value ) ; b . swap ( ) ; } else { LocalVariable value2 = b . createLocalVariable ( null , valueType ) ; b . storeLocal ( value2 ) ; b . loadLocal ( value2 ) ; b . ifNullBranch ( label , ! choice ) ; b . loadLocal ( value ) ; b . loadLocal ( value2 ) ; } String op = addEqualsCallTo ( b , valueType , choice ) ; b . ifZeroComparisonBranch ( label , op ) ; cont . setLocation ( ) ; }
Generates code to compare two values on the stack and branch to the provided Label if they are not equal . Both values must be of the same type . If they are floating point values NaN is considered equal to NaN which is inconsistent with the usual treatment for NaN .
3,240
public static void initialVersion ( CodeBuilder b , TypeDesc type , int value ) throws SupportException { adjustVersion ( b , type , value , false ) ; }
Generates code to push an initial version property value on the stack .
3,241
public static void incrementVersion ( CodeBuilder b , TypeDesc type ) throws SupportException { adjustVersion ( b , type , 0 , true ) ; }
Generates code to increment a version property value already on the stack .
3,242
public static void blankValue ( CodeBuilder b , TypeDesc type ) { switch ( type . getTypeCode ( ) ) { default : b . loadNull ( ) ; break ; case TypeDesc . BYTE_CODE : case TypeDesc . CHAR_CODE : case TypeDesc . SHORT_CODE : case TypeDesc . INT_CODE : b . loadConstant ( 0 ) ; break ; case TypeDesc . BOOLEAN_CODE : b . loadConstant ( false ) ; break ; case TypeDesc . LONG_CODE : b . loadConstant ( 0L ) ; break ; case TypeDesc . FLOAT_CODE : b . loadConstant ( 0.0f ) ; break ; case TypeDesc . DOUBLE_CODE : b . loadConstant ( 0.0 ) ; break ; } }
Generates code to push a blank value to the stack . For objects it is null and for primitive types it is zero or false .
3,243
public static TypeDesc bindQueryParam ( Class clazz ) { if ( clazz . isPrimitive ( ) ) { TypeDesc type = TypeDesc . forClass ( clazz ) ; switch ( type . getTypeCode ( ) ) { case TypeDesc . INT_CODE : case TypeDesc . LONG_CODE : case TypeDesc . FLOAT_CODE : case TypeDesc . DOUBLE_CODE : case TypeDesc . BOOLEAN_CODE : case TypeDesc . CHAR_CODE : case TypeDesc . BYTE_CODE : case TypeDesc . SHORT_CODE : return type ; } } return TypeDesc . OBJECT ; }
Determines which overloaded with method on Query should be bound to .
3,244
public static void callStringBuilderAppendString ( CodeBuilder b ) { TypeDesc stringBuilder = TypeDesc . forClass ( StringBuilder . class ) ; b . invokeVirtual ( stringBuilder , "append" , stringBuilder , new TypeDesc [ ] { TypeDesc . STRING } ) ; }
Appends a String to a StringBuilder . A StringBuilder and String must be on the stack and a StringBuilder is left on the stack after the call .
3,245
public static void callStringBuilderAppendChar ( CodeBuilder b ) { TypeDesc stringBuilder = TypeDesc . forClass ( StringBuilder . class ) ; b . invokeVirtual ( stringBuilder , "append" , stringBuilder , new TypeDesc [ ] { TypeDesc . CHAR } ) ; }
Appends a char to a StringBuilder . A StringBuilder and char must be on the stack and a StringBuilder is left on the stack after the call .
3,246
public static void callStringBuilderLength ( CodeBuilder b ) { TypeDesc stringBuilder = TypeDesc . forClass ( StringBuilder . class ) ; b . invokeVirtual ( stringBuilder , "length" , TypeDesc . INT , null ) ; }
Calls length on a StringBuilder on the stack leaving an int on the stack .
3,247
public static void callStringBuilderToString ( CodeBuilder b ) { TypeDesc stringBuilder = TypeDesc . forClass ( StringBuilder . class ) ; b . invokeVirtual ( stringBuilder , "toString" , TypeDesc . STRING , null ) ; }
Calls toString on a StringBuilder . A StringBuilder must be on the stack and a String is left on the stack after the call .
3,248
public static < Type > DisjunctiveConstraint < Type > create ( final Constraint < Type > [ ] constraints ) { return new DisjunctiveConstraint < > ( constraints ) ; }
Creates and returns a constraint which allows to combine multiple constraints in a disjunctive manner .
3,249
public final void setConstraints ( final Constraint < Type > [ ] constraints ) { Condition . INSTANCE . ensureNotNull ( constraints , "The constraints may not be null" ) ; Condition . INSTANCE . ensureAtLeast ( constraints . length , 1 , "The constraints may not be empty" ) ; this . constraints = constraints ; }
Sets the single constraints the constraint should consist of .
3,250
public boolean HasAlgorithmID ( AlgorithmID algorithmId ) { CBORObject thisObj = get ( KeyKeys . Algorithm ) ; CBORObject thatObj = ( algorithmId == null ? null : algorithmId . AsCBOR ( ) ) ; boolean result ; if ( thatObj == null ) { result = ( thisObj == null ) ; } else { result = thatObj . equals ( thisObj ) ; } return result ; }
Compares the key s assigned algorithm with the provided value indicating if the values are the same .
3,251
public boolean HasKeyID ( String id ) { CBORObject thatObj = ( id == null ) ? null : CBORObject . FromObject ( id ) ; CBORObject thisObj = get ( KeyKeys . KeyId ) ; boolean result ; if ( thatObj == null ) { result = ( thisObj == null ) ; } else { result = thatObj . equals ( thisObj ) ; } return result ; }
Compares the key s assigned identifier with the provided value indicating if the values are the same .
3,252
public boolean HasKeyType ( CBORObject keyTypeObj ) { CBORObject thatObj = keyTypeObj ; CBORObject thisObj = get ( KeyKeys . KeyType ) ; boolean result ; if ( thatObj == null ) { result = ( thisObj == null ) ; } else { result = thatObj . equals ( thisObj ) ; } return result ; }
Compares the key s assigned key type with the provided value indicating if the values are the same .
3,253
public boolean HasKeyOp ( Integer that ) { CBORObject thisObj = get ( KeyKeys . Key_Ops ) ; boolean result ; if ( that == null ) { result = ( thisObj == null ) ; } else { result = false ; if ( thisObj . getType ( ) == CBORType . Number ) { if ( thisObj . AsInt32 ( ) == that ) { result = true ; } } else if ( thisObj . getType ( ) == CBORType . Array ) { for ( int i = 0 ; i < thisObj . size ( ) ; i ++ ) { if ( ( thisObj . get ( i ) . getType ( ) == CBORType . Number ) && ( thisObj . get ( i ) . AsInt32 ( ) == that ) ) { result = true ; break ; } } } } return result ; }
Compares the key s assigned key operations with the provided value indicating if the provided value was found in the key operation values assigned to the key .
3,254
public OneKey PublicKey ( ) { OneKey newKey = new OneKey ( ) ; CBORObject val = this . get ( KeyKeys . KeyType ) ; if ( val . equals ( KeyKeys . KeyType_Octet ) ) { return null ; } else if ( val . equals ( KeyKeys . KeyType_EC2 ) ) { newKey . add ( KeyKeys . EC2_Curve , get ( KeyKeys . EC2_Curve ) ) ; newKey . add ( KeyKeys . EC2_X , get ( KeyKeys . EC2_X ) ) ; newKey . add ( KeyKeys . EC2_Y , get ( KeyKeys . EC2_Y ) ) ; } else { return null ; } newKey . publicKey = publicKey ; for ( CBORObject obj : keyMap . getKeys ( ) ) { val = keyMap . get ( obj ) ; if ( obj . getType ( ) == CBORType . Number ) { if ( obj . AsInt32 ( ) > 0 ) { newKey . add ( obj , val ) ; } } else if ( obj . getType ( ) == CBORType . TextString ) { newKey . add ( obj , val ) ; } } return newKey ; }
Create a OneKey object with only the public fields . Filters out the private key fields but leaves all positive number labels and text labels along with negative number labels that are public fields .
3,255
public static < S extends Storable > OrderingList < S > get ( Class < S > type , String property ) { OrderingList < S > list = emptyList ( ) ; if ( property != null ) { list = list . concat ( type , property ) ; } return list ; }
Returns a canonical instance composed of the given ordering .
3,256
public OrderingList < S > concat ( OrderingList < S > other ) { if ( size ( ) == 0 ) { return other ; } OrderingList < S > newList = this ; if ( other . size ( ) > 0 ) { for ( OrderedProperty < S > property : other ) { newList = newList . concat ( property ) ; } } return newList ; }
Returns a list which concatenates this one with the other one .
3,257
public OrderingList < S > reduce ( ) { if ( size ( ) == 0 ) { return this ; } Set < ChainedProperty < S > > seen = new HashSet < ChainedProperty < S > > ( ) ; OrderingList < S > newList = emptyList ( ) ; for ( OrderedProperty < S > property : this ) { ChainedProperty < S > chained = property . getChainedProperty ( ) ; if ( ! seen . contains ( chained ) ) { newList = newList . concat ( property ) ; seen . add ( chained ) ; } } return newList ; }
Eliminates redundant ordering properties .
3,258
public OrderingList < S > reverseDirections ( ) { if ( size ( ) == 0 ) { return this ; } OrderingList < S > reversedList = emptyList ( ) ; for ( int i = 0 ; i < size ( ) ; i ++ ) { reversedList = reversedList . concat ( get ( i ) . reverse ( ) ) ; } return reversedList ; }
Returns this list with all orderings in reverse .
3,259
public OrderingList < S > replace ( int index , OrderedProperty < S > property ) { int size = size ( ) ; if ( index < 0 || index >= size ) { throw new IndexOutOfBoundsException ( ) ; } OrderingList < S > newList = emptyList ( ) ; for ( int i = 0 ; i < size ; i ++ ) { newList = newList . concat ( i == index ? property : get ( i ) ) ; } return newList ; }
Returns a list with the given element replaced .
3,260
OrderedProperty < S > [ ] asArray ( ) { if ( mOrderings == null ) { OrderedProperty < S > [ ] orderings = new OrderedProperty [ mSize ] ; OrderingList < S > node = this ; for ( int i = mSize ; -- i >= 0 ; ) { orderings [ i ] = node . mProperty ; node = node . mParent ; } mOrderings = orderings ; } return mOrderings ; }
This method is not public because the array is not a clone .
3,261
String [ ] asStringArray ( ) { if ( mOrderingStrings == null ) { String [ ] orderings = new String [ mSize ] ; OrderingList < S > node = this ; for ( int i = mSize ; -- i >= 0 ; ) { orderings [ i ] = node . mProperty . toString ( ) ; node = node . mParent ; } mOrderingStrings = orderings ; } return mOrderingStrings ; }
Returns the orderings as qualified string property names . Each is prefixed with a + or - .
3,262
public SyntheticStorableReferenceAccess < S > getReferenceAccess ( ) { if ( mReferenceAccess == null ) { Class < ? extends Storable > referenceClass = mBuilder . getStorableClass ( ) ; mReferenceAccess = new SyntheticStorableReferenceAccess < S > ( mMasterStorableClass , referenceClass , this ) ; } return mReferenceAccess ; }
Build and return access to the generated storable reference class .
3,263
public SyntheticProperty addKeyProperty ( String name , Direction direction ) { StorableProperty < S > prop = mMasterStorableInfo . getAllProperties ( ) . get ( name ) ; if ( prop == null ) { throw new IllegalArgumentException ( name + " is not a property of " + mMasterStorableInfo . getName ( ) ) ; } mPrimaryKey . addProperty ( name , direction ) ; SyntheticProperty result = addProperty ( prop ) ; mUserProps . add ( result ) ; return result ; }
Add a property to the primary key which is a member of the Storable type being referenced by this one .
3,264
public void copyToMasterPrimaryKey ( Storable indexEntry , S master ) throws FetchException { getReferenceAccess ( ) . copyToMasterPrimaryKey ( indexEntry , master ) ; }
Sets all the primary key properties of the given master using the applicable properties of the given index entry .
3,265
public void copyFromMaster ( Storable indexEntry , S master ) throws FetchException { getReferenceAccess ( ) . copyFromMaster ( indexEntry , master ) ; }
Sets all the properties of the given index entry using the applicable properties of the given master .
3,266
public boolean isConsistent ( Storable indexEntry , S master ) throws FetchException { return getReferenceAccess ( ) . isConsistent ( indexEntry , master ) ; }
Returns true if the properties of the given index entry match those contained in the master excluding any version property . This will always return true after a call to copyFromMaster .
3,267
private void addSpecialMethods ( ClassFile cf ) throws SupportException { { mCopyToMasterPkMethodName = generateSafeMethodName ( mMasterStorableInfo , COPY_TO_MASTER_PK_PREFIX ) ; mCopyFromMasterMethodName = generateSafeMethodName ( mMasterStorableInfo , COPY_FROM_MASTER_PREFIX ) ; mIsConsistentMethodName = generateSafeMethodName ( mMasterStorableInfo , IS_CONSISTENT_PREFIX ) ; } addCopyMethod ( cf , mCopyFromMasterMethodName ) ; addCopyMethod ( cf , mCopyToMasterPkMethodName ) ; TypeDesc masterStorableType = TypeDesc . forClass ( mMasterStorableClass ) ; { TypeDesc [ ] params = new TypeDesc [ ] { masterStorableType } ; MethodInfo mi = cf . addMethod ( Modifiers . PUBLIC , mIsConsistentMethodName , TypeDesc . BOOLEAN , params ) ; CodeBuilder b = new CodeBuilder ( mi ) ; for ( StorableProperty prop : mCommonProps ) { if ( prop . isVersion ( ) || prop . isDerived ( ) ) { continue ; } Label propsAreEqual = b . createLabel ( ) ; addPropertyTest ( b , prop , b . getParameter ( 0 ) , propsAreEqual ) ; propsAreEqual . setLocation ( ) ; } b . loadConstant ( true ) ; b . returnValue ( TypeDesc . BOOLEAN ) ; } }
Create methods for copying properties and testing properties .
3,268
private String generateSafeMethodName ( StorableInfo info , String prefix ) { Class type = info . getStorableType ( ) ; int value = 0 ; for ( int i = 0 ; i < 100 ; i ++ ) { String name = prefix + value ; if ( ! methodExists ( type , name ) ) { return name ; } value = name . hashCode ( ) ; } throw new InternalError ( "Unable to create unique method name starting with: " + prefix ) ; }
Generates a property name which doesn t clash with any already defined .
3,269
private boolean methodExists ( Class clazz , String name ) { Method [ ] methods = clazz . getDeclaredMethods ( ) ; for ( int i = 0 ; i < methods . length ; i ++ ) { if ( methods [ i ] . getName ( ) . equals ( name ) ) { return true ; } } if ( clazz . getSuperclass ( ) != null && methodExists ( clazz . getSuperclass ( ) , name ) ) { return true ; } Class [ ] interfaces = clazz . getInterfaces ( ) ; for ( int i = 0 ; i < interfaces . length ; i ++ ) { if ( methodExists ( interfaces [ i ] , name ) ) { return true ; } } return false ; }
Look for conflicting method names
3,270
public V remove ( Object key ) { clean ( ) ; ValueRef < K , V > valueRef = mValues . remove ( key ) ; V value ; if ( valueRef != null && ( value = valueRef . get ( ) ) != null ) { valueRef . clear ( ) ; return value ; } return null ; }
Manually remove a value returning the old value .
3,271
public Query < S > withValues ( Object ... values ) { if ( values == null || values . length == 0 ) { return this ; } throw error ( ) ; }
Throws an IllegalStateException unless no values passed in .
3,272
public Query < S > not ( ) throws FetchException { return mFactory . query ( null , null , mOrdering , null ) ; }
Returns a query that fetches everything possibly in a specified order .
3,273
public final void setValidators ( final Validator < Type > ... validators ) { Condition . INSTANCE . ensureNotNull ( validators , "The validators may not be null" ) ; Condition . INSTANCE . ensureAtLeast ( validators . length , 1 , "The validators may not be empty" ) ; this . validators = validators ; }
Sets the single validators the validator should consist of .
3,274
private int selectTypes ( Trigger < ? super S > trigger ) { Class < ? extends Trigger > triggerClass = trigger . getClass ( ) ; int types = 0 ; if ( overridesOneMethod ( triggerClass , INSERT_METHODS ) ) { types |= FOR_INSERT ; } if ( overridesOneMethod ( triggerClass , UPDATE_METHODS ) ) { types |= FOR_UPDATE ; } if ( overridesOneMethod ( triggerClass , DELETE_METHODS ) ) { types |= FOR_DELETE ; } if ( overridesMethod ( triggerClass , AFTER_LOAD_METHOD ) ) { types |= FOR_LOAD ; } return types ; }
Determines which operations the given trigger overrides .
3,275
public static < T extends Storable > QueryExecutor < T > build ( RepositoryAccess repoAccess , ChainedProperty < T > targetToSourceProperty , Filter < T > targetFilter , OrderingList < T > targetOrdering , QueryHints hints ) throws RepositoryException { if ( targetOrdering == null ) { targetOrdering = OrderingList . emptyList ( ) ; } QueryExecutor < T > executor = buildJoin ( repoAccess , targetToSourceProperty , targetFilter , targetOrdering , hints ) ; OrderingList < T > handledOrdering = executor . getOrdering ( ) ; int handledCount = commonOrderingCount ( handledOrdering , targetOrdering ) ; OrderingList < T > remainderOrdering = targetOrdering . subList ( handledCount , targetOrdering . size ( ) ) ; if ( remainderOrdering . size ( ) > 0 ) { SortedQueryExecutor . Support < T > support = repoAccess . storageAccessFor ( targetToSourceProperty . getPrimeProperty ( ) . getEnclosingType ( ) ) ; executor = new SortedQueryExecutor < T > ( support , executor , handledOrdering , remainderOrdering ) ; } return executor ; }
Builds and returns a complex joined excutor against a chained property supporting multi - way joins . Filtering and ordering may also be supplied in order to better distribute work throughout the join .
3,276
private static < T extends Storable > OrderingList mostOrdering ( StorableProperty < T > primeTarget , OrderingList < T > targetOrdering ) { OrderingList handledOrdering = OrderingList . emptyList ( ) ; for ( OrderedProperty < T > targetProp : targetOrdering ) { ChainedProperty < T > chainedProp = targetProp . getChainedProperty ( ) ; if ( chainedProp . getPrimeProperty ( ) . equals ( primeTarget ) ) { handledOrdering = handledOrdering . concat ( OrderedProperty . get ( ( ChainedProperty ) chainedProp . tail ( ) , targetProp . getDirection ( ) ) ) ; } else { break ; } } return handledOrdering ; }
Given a list of chained ordering properties returns the properties stripped of the matching chain prefix for the targetToSourceProperty . As the target ordering is scanned left - to - right if any property is found which doesn t match the targetToSourceProperty the building of the new list stops . In other words it returns a consecutive run of matching properties .
3,277
private static < T extends Storable > OrderingList < T > expectedOrdering ( StorageAccess < T > access , Filter < T > filter , OrderingList < T > ordering ) { List < Filter < T > > split ; if ( filter == null ) { split = Filter . getOpenFilter ( access . getStorableType ( ) ) . disjunctiveNormalFormSplit ( ) ; } else { split = filter . disjunctiveNormalFormSplit ( ) ; } Comparator comparator = CompositeScore . fullComparator ( ) ; CompositeScore bestScore = null ; for ( StorableIndex < T > index : access . getAllIndexes ( ) ) { for ( Filter < T > sub : split ) { CompositeScore candidateScore = CompositeScore . evaluate ( index , sub , ordering ) ; if ( bestScore == null || comparator . compare ( candidateScore , bestScore ) < 0 ) { bestScore = candidateScore ; } } } int handledCount = bestScore == null ? 0 : bestScore . getOrderingScore ( ) . getHandledCount ( ) ; return ordering . subList ( 0 , handledCount ) ; }
Examines the given ordering against available indexes returning the ordering that the best index can provide for free .
3,278
private static < T extends Storable > int commonOrderingCount ( OrderingList < T > orderingA , OrderingList < T > orderingB ) { int commonCount = Math . min ( orderingA . size ( ) , orderingB . size ( ) ) ; for ( int i = 0 ; i < commonCount ; i ++ ) { if ( ! orderingA . get ( i ) . equals ( orderingB . get ( i ) ) ) { return i ; } } return commonCount ; }
Returns the count of exactly matching properties from the two orderings . The match must be consecutive and start at the first property .
3,279
public FilterValues < S > with ( char value ) { PropertyFilterList < S > current = currentProperty ( ) ; Object obj ; try { obj = current . getPropertyFilter ( ) . adaptValue ( value ) ; } catch ( IllegalArgumentException e ) { throw mismatch ( e ) ; } return with ( current , obj ) ; }
Returns a new FilterValues instance with the next blank parameter filled in .
3,280
public FilterValues < S > withValues ( Object ... values ) { if ( values == null ) { return this ; } if ( values . length > getBlankParameterCount ( ) ) { throw new IllegalStateException ( "Too many values supplied" ) ; } FilterValues < S > filterValues = this ; for ( Object value : values ) { filterValues = filterValues . with ( value ) ; } return filterValues ; }
Returns a new FilterValues instance with the next blank parameters filled in .
3,281
public boolean isAssigned ( PropertyFilter < S > propFilter ) { if ( propFilter . isConstant ( ) ) { return true ; } Map < PropertyFilter < S > , Object > map = mValueMap ; if ( map == null ) { FilterValues < S > prevValues = mPrevValues ; if ( prevValues == null ) { return false ; } if ( prevValues . mCurrentProperty . getPreviousRemaining ( ) < 3 ) { do { if ( propFilter == prevValues . mCurrentProperty . getPropertyFilter ( ) ) { return true ; } prevValues = prevValues . mPrevValues ; } while ( prevValues != null ) ; return false ; } map = buildValueMap ( ) ; } return map . containsKey ( propFilter ) ; }
Returns true if a value is assigned to the given PropertyFilter .
3,282
public Object [ ] getSuppliedValues ( ) { FilterValues < S > prevValues = mPrevValues ; if ( prevValues == null ) { return NO_VALUES ; } int i = prevValues . mCurrentProperty . getBlankCount ( ) ; if ( i == 0 ) { return NO_VALUES ; } Object [ ] values = new Object [ i ] ; FilterValues filterValues = this ; while ( true ) { if ( ! filterValues . mPrevValues . mCurrentProperty . getPropertyFilter ( ) . isConstant ( ) ) { values [ -- i ] = filterValues . mPrevValue ; if ( i <= 0 ) { break ; } } filterValues = prevValues ; prevValues = prevValues . mPrevValues ; } return values ; }
Returns all supplied values in this object . Constant filter values are not included .
3,283
public Object [ ] getValuesFor ( Filter < S > filter ) throws IllegalStateException { PropertyFilterList < S > list = filter . getTailPropertyFilterList ( ) ; if ( list == null ) { return NO_VALUES ; } int i = list . getPreviousRemaining ( ) + 1 ; Object [ ] values = new Object [ i ] ; FilterValues filterValues = this ; FilterValues < S > prevValues = mPrevValues ; for ( ; -- i >= 0 ; list = list . getPrevious ( ) ) { PropertyFilter < S > propFilter = list . getPropertyFilter ( ) ; Object value ; if ( prevValues != null && propFilter == prevValues . mCurrentProperty . getPropertyFilter ( ) ) { value = filterValues . mPrevValue ; filterValues = prevValues ; prevValues = prevValues . mPrevValues ; } else { if ( i > 0 || mValueMap != null ) { value = getAssignedValue ( propFilter ) ; } else { filterValues = this ; prevValues = mPrevValues ; findValue : { while ( prevValues != null ) { if ( propFilter == prevValues . mCurrentProperty . getPropertyFilter ( ) ) { value = filterValues . mPrevValue ; break findValue ; } filterValues = prevValues ; prevValues = prevValues . mPrevValues ; } throw valueNotFound ( propFilter ) ; } } } values [ i ] = value ; } return values ; }
Returns all values in this object as required by the given Filter . The given Filter must be composed only of the same PropertyFilter instances as used to construct this object . An IllegalStateException will result otherwise .
3,284
public Object [ ] getSuppliedValuesFor ( Filter < S > filter ) throws IllegalStateException { PropertyFilterList < S > list = filter . getTailPropertyFilterList ( ) ; if ( list == null ) { return NO_VALUES ; } FilterValues < S > prevValues = mPrevValues ; if ( prevValues == null ) { return NO_VALUES ; } int i = list . getPreviousRemaining ( ) + 1 ; int valuesPos = i ; Object [ ] values = new Object [ valuesPos ] ; FilterValues filterValues = this ; for ( ; -- i >= 0 ; list = list . getPrevious ( ) ) { PropertyFilter < S > propFilter = list . getPropertyFilter ( ) ; Object value ; if ( prevValues != null && propFilter == prevValues . mCurrentProperty . getPropertyFilter ( ) ) { value = filterValues . mPrevValue ; filterValues = prevValues ; prevValues = prevValues . mPrevValues ; if ( propFilter . isConstant ( ) ) { continue ; } } else { if ( propFilter . isConstant ( ) ) { continue ; } if ( i > 0 || mValueMap != null ) { if ( isAssigned ( propFilter ) ) { value = getAssignedValue ( propFilter ) ; } else { continue ; } } else { filterValues = this ; prevValues = mPrevValues ; findValue : { while ( prevValues != null ) { if ( propFilter == prevValues . mCurrentProperty . getPropertyFilter ( ) ) { value = filterValues . mPrevValue ; break findValue ; } filterValues = prevValues ; prevValues = prevValues . mPrevValues ; } continue ; } } } values [ -- valuesPos ] = value ; } if ( valuesPos != 0 ) { int newValuesSize = values . length - valuesPos ; if ( newValuesSize == 0 ) { values = NO_VALUES ; } else { Object [ ] newValues = new Object [ newValuesSize ] ; System . arraycopy ( values , valuesPos , newValues , 0 , newValuesSize ) ; values = newValues ; } } return values ; }
Returns all supplied values in this object as required by the given Filter . Constant filter values are not included . The given Filter must be composed only of the same PropertyFilter instances as used to construct this object . An IllegalStateException will result otherwise .
3,285
public final void setCaseSensitivity ( final Case caseSensitivty ) { Condition . INSTANCE . ensureNotNull ( caseSensitivty , "The case sensitivity may not be null" ) ; this . caseSensitivity = caseSensitivty ; }
Sets the case sensitivity which should be used by the validator .
3,286
private View inflateHintView ( final ViewGroup parent ) { TextView view = ( TextView ) LayoutInflater . from ( context ) . inflate ( hintViewId , parent , false ) ; view . setText ( hint ) ; if ( hintColor != null ) { view . setTextColor ( hintColor ) ; } return view ; }
Inflates and returns the view which is used to display the hint .
3,287
public < S extends Storable > Storage < S > getStorage ( Class < S > type ) throws MalformedTypeException , SupportException , RepositoryException { return ( Storage < S > ) super . get ( type ) ; }
Returns a Storage instance for the given Storable type which is lazily created and pooled . If multiple threads are requesting upon the same type concurrently at most one thread attempts to lazily create the Storage . The others wait for it to become available .
3,288
public void captureOrderings ( OrderingList < ? > ordering ) { try { if ( ordering != null ) { for ( OrderedProperty < ? > orderedProperty : ordering ) { ChainedProperty < ? > chained = orderedProperty . getChainedProperty ( ) ; if ( ! chained . isDerived ( ) ) { mRootJoinNode . addJoin ( mRepository , chained , mAliasGenerator ) ; } } } } catch ( RepositoryException e ) { throw new UndeclaredThrowableException ( e ) ; } }
Processes the given property orderings and ensures that they are part of the JoinNode tree .
3,289
public V get ( K key ) throws E { V value = mValues . get ( key ) ; if ( value != null ) { return value ; } Lock lock = mLockPool . get ( key ) ; lock . lock ( ) ; try { value = mValues . get ( key ) ; if ( value == null ) { try { value = create ( key ) ; mValues . put ( key , value ) ; } catch ( Exception e ) { org . cojen . util . ThrowUnchecked . fire ( e ) ; } } } finally { lock . unlock ( ) ; } return value ; }
Returns a value for the given key which is lazily created and pooled . If multiple threads are requesting upon the same key concurrently at most one thread attempts to lazily create the value . The others wait for it to become available .
3,290
public CBORObject EncodeToCBORObject ( ) throws CoseException { CBORObject obj ; obj = EncodeCBORObject ( ) ; if ( emitTag ) { obj = CBORObject . FromObjectAndTag ( obj , messageTag . value ) ; } return obj ; }
Encode the COSE message object to a CBORObject tree . This function call will force cryptographic operations to be executed as needed .
3,291
public static final < Type > NegateConstraint < Type > create ( final Constraint < Type > constraint ) { return new NegateConstraint < > ( constraint ) ; }
Creates and returns a constraint which allows to negate the result of an other constraint .
3,292
public final void setConstraint ( final Constraint < Type > constraint ) { Condition . INSTANCE . ensureNotNull ( constraint , "The constraint may not be null" ) ; this . constraint = constraint ; }
Sets the constraint whose result should be negated .
3,293
public LocalVariable buildKeyEncoding ( CodeAssembler assembler , OrderedProperty < S > [ ] properties , LocalVariable instanceVar , Class < ? > adapterInstanceClass , boolean useReadMethods , LocalVariable partialStartVar , LocalVariable partialEndVar ) throws SupportException { properties = ensureKeyProperties ( properties ) ; return buildEncoding ( Mode . KEY , assembler , extractProperties ( properties ) , extractDirections ( properties ) , instanceVar , adapterInstanceClass , useReadMethods , - 1 , partialStartVar , partialEndVar ) ; }
Generates bytecode instructions to encode properties . The encoding is suitable for key encoding which means it is correctly comparable .
3,294
public LocalVariable buildDataEncoding ( CodeAssembler assembler , StorableProperty < S > [ ] properties , LocalVariable instanceVar , Class < ? > adapterInstanceClass , boolean useReadMethods , int generation ) throws SupportException { properties = ensureDataProperties ( properties ) ; return buildEncoding ( Mode . DATA , assembler , properties , null , instanceVar , adapterInstanceClass , useReadMethods , generation , null , null ) ; }
Generates bytecode instructions to encode properties . The encoding is suitable for data encoding which means it is not correctly comparable but it is more efficient than key encoding . Partial encoding is not supported .
3,295
public LocalVariable buildSerialEncoding ( CodeAssembler assembler , StorableProperty < S > [ ] properties ) throws SupportException { properties = ensureAllProperties ( properties ) ; return buildEncoding ( Mode . SERIAL , assembler , properties , null , null , null , false , - 1 , null , null ) ; }
Generates bytecode instructions to encode properties and their states . This encoding is suitable for short - term serialization only .
3,296
public void buildSerialDecoding ( CodeAssembler assembler , StorableProperty < S > [ ] properties , LocalVariable encodedVar ) throws SupportException { properties = ensureAllProperties ( properties ) ; buildDecoding ( Mode . SERIAL , assembler , properties , null , null , null , false , - 1 , null , encodedVar ) ; }
Generates bytecode instructions to decode properties and their states . A CorruptEncodingException may be thrown from generated code .
3,297
public boolean isSupported ( TypeDesc propertyType ) { if ( propertyType . toPrimitiveType ( ) != null ) { return true ; } if ( propertyType == TypeDesc . STRING || propertyType == TypeDesc . forClass ( byte [ ] . class ) ) { return true ; } Class clazz = propertyType . toClass ( ) ; if ( clazz != null ) { return Lob . class . isAssignableFrom ( clazz ) || BigInteger . class . isAssignableFrom ( clazz ) || BigDecimal . class . isAssignableFrom ( clazz ) ; } return false ; }
Returns true if the type of the given property type is supported . The types currently supported are primitives primitive wrapper objects Strings byte arrays and Lobs .
3,298
@ SuppressWarnings ( "unchecked" ) protected StorableProperty < S > [ ] gatherAllDataProperties ( ) { Map < String , ? extends StorableProperty < S > > map = StorableIntrospector . examine ( mType ) . getDataProperties ( ) ; List < StorableProperty < S > > list = new ArrayList < StorableProperty < S > > ( map . size ( ) ) ; for ( StorableProperty < S > property : map . values ( ) ) { if ( ! property . isDerived ( ) ) { list . add ( property ) ; } } return list . toArray ( new StorableProperty [ list . size ( ) ] ) ; }
Returns all non - derived data properties for storable .
3,299
@ SuppressWarnings ( "unchecked" ) protected StorableProperty < S > [ ] gatherAllProperties ( ) { Map < String , ? extends StorableProperty < S > > map = StorableIntrospector . examine ( mType ) . getAllProperties ( ) ; List < StorableProperty < S > > list = new ArrayList < StorableProperty < S > > ( map . size ( ) ) ; for ( StorableProperty < S > property : map . values ( ) ) { if ( ! property . isJoin ( ) && ! property . isDerived ( ) ) { list . add ( property ) ; } } return list . toArray ( new StorableProperty [ list . size ( ) ] ) ; }
Returns all non - join non - derived properties for storable .