idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
3,300 | private void loadBlankValue ( CodeAssembler a , TypeDesc type ) { switch ( type . getTypeCode ( ) ) { case TypeDesc . OBJECT_CODE : a . loadNull ( ) ; break ; case TypeDesc . LONG_CODE : a . loadConstant ( 0L ) ; break ; case TypeDesc . FLOAT_CODE : a . loadConstant ( 0.0f ) ; break ; case TypeDesc . DOUBLE_CODE : a . ... | Generates code that loads zero false or null to the stack . |
3,301 | private int staticEncodingLength ( GenericPropertyInfo info ) { TypeDesc type = info . getStorageType ( ) ; TypeDesc primType = type . toPrimitiveType ( ) ; if ( primType == null ) { if ( info . isLob ( ) ) { return 8 ; } } else { if ( info . isNullable ( ) ) { switch ( primType . getTypeCode ( ) ) { case TypeDesc . BY... | Returns a negative value if encoding is variable . The minimum static amount is computed from the one s compliment . Of the types with variable encoding lengths only for primitives is the minimum static amount returned more than zero . |
3,302 | private int encodeProperty ( CodeAssembler a , TypeDesc type , Mode mode , boolean descending ) { TypeDesc [ ] params = new TypeDesc [ ] { type , TypeDesc . forClass ( byte [ ] . class ) , TypeDesc . INT } ; if ( type . isPrimitive ( ) ) { if ( mode == Mode . KEY && descending ) { a . invokeStatic ( KeyEncoder . class ... | Generates code that calls an encoding method in DataEncoder or KeyEncoder . Parameters must already be on the stack . |
3,303 | private void encodeGeneration ( CodeAssembler a , LocalVariable encodedVar , int offset , int generation ) { if ( offset < 0 ) { throw new IllegalArgumentException ( ) ; } if ( generation < 0 ) { return ; } if ( generation < 128 ) { a . loadLocal ( encodedVar ) ; a . loadConstant ( offset ) ; a . loadConstant ( ( byte ... | Generates code that stores a one or four byte generation value into a byte array referenced by the local variable . |
3,304 | private void getLobLocator ( CodeAssembler a , StorablePropertyInfo info ) { if ( ! info . isLob ( ) ) { throw new IllegalArgumentException ( ) ; } a . invokeInterface ( TypeDesc . forClass ( RawSupport . class ) , "getLocator" , TypeDesc . LONG , new TypeDesc [ ] { info . getStorageType ( ) } ) ; } | Generates code to get a Lob locator value from RawSupport . RawSupport instance and Lob instance must be on the stack . Result is a long locator value on the stack . |
3,305 | private void getLobFromLocator ( CodeAssembler a , StorablePropertyInfo info ) { if ( ! info . isLob ( ) ) { throw new IllegalArgumentException ( ) ; } TypeDesc type = info . getStorageType ( ) ; String name ; if ( Blob . class . isAssignableFrom ( type . toClass ( ) ) ) { name = "getBlob" ; } else if ( Clob . class . ... | Generates code to get a Lob from a locator from RawSupport . RawSupport instance Storable instance property name and long locator must be on the stack . Result is a Lob on the stack which may be null . |
3,306 | protected void pushDecodingInstanceVar ( CodeAssembler a , int ordinal , LocalVariable instanceVar ) { if ( instanceVar == null ) { a . loadThis ( ) ; } else if ( instanceVar . getType ( ) != TypeDesc . forClass ( Object [ ] . class ) ) { a . loadLocal ( instanceVar ) ; } else { a . loadLocal ( instanceVar ) ; a . load... | Push decoding instanceVar to stack in preparation to calling storePropertyValue . |
3,307 | private void decodeGeneration ( CodeAssembler a , LocalVariable encodedVar , int offset , int generation , Label altGenerationHandler ) { if ( offset < 0 ) { throw new IllegalArgumentException ( ) ; } if ( generation < 0 ) { return ; } LocalVariable actualGeneration = a . createLocalVariable ( null , TypeDesc . INT ) ;... | Generates code that ensures a matching generation value exists in the byte array referenced by the local variable throwing a CorruptEncodingException otherwise . |
3,308 | protected boolean checkSliceArguments ( long from , Long to ) { if ( from < 0 ) { throw new IllegalArgumentException ( "Slice from is negative: " + from ) ; } if ( to == null ) { if ( from == 0 ) { return false ; } } else if ( from > to ) { throw new IllegalArgumentException ( "Slice from is more than to: " + from + " ... | Called by sliced fetch to ensure that arguments are valid . |
3,309 | public void execute ( Runnable task , long timeoutMillis ) throws RejectedExecutionException { if ( task == null ) { throw new NullPointerException ( "Cannot accept null task" ) ; } synchronized ( this ) { if ( mState != STATE_RUNNING && mState != STATE_NOT_STARTED ) { throw new RejectedExecutionException ( "Task queue... | Enqueue a task to run . |
3,310 | public synchronized void shutdown ( ) { if ( mState == STATE_STOPPED ) { return ; } if ( mState == STATE_NOT_STARTED ) { mState = STATE_STOPPED ; return ; } mState = STATE_SHOULD_STOP ; mQueue . offer ( STOP_TASK ) ; } | Indicate that this task queue thread should finish running its enqueued tasks and then exit . Enqueueing new tasks will result in a RejectedExecutionException being thrown . Join on this thread to wait for it to exit . |
3,311 | public void reset ( int initialValue ) throws FetchException , PersistException { synchronized ( mStoredSequence ) { Transaction txn = mRepository . enterTopTransaction ( null ) ; txn . setForUpdate ( true ) ; try { boolean doUpdate = mStoredSequence . tryLoad ( ) ; mStoredSequence . setInitialValue ( initialValue ) ; ... | Reset the sequence . |
3,312 | public boolean returnReservedValues ( ) throws FetchException , PersistException { synchronized ( mStoredSequence ) { if ( mHasReservedValues ) { Transaction txn = mRepository . enterTopTransaction ( null ) ; txn . setForUpdate ( true ) ; try { StoredSequence current = mStorage . prepare ( ) ; current . setName ( mStor... | Allow any unused reserved values to be returned for re - use . If the repository is shared by other processes then reserved values might not be returnable . |
3,313 | private long nextUnadjustedValue ( ) throws FetchException , PersistException { if ( mHasReservedValues ) { long next = mNextValue + mIncrement ; mNextValue = next ; if ( next < mStoredSequence . getNextValue ( ) ) { return next ; } mHasReservedValues = false ; } Transaction txn = mRepository . enterTopTransaction ( nu... | Assumes caller has synchronized on mStoredSequence |
3,314 | public Annotation parse ( Annotation rootAnnotation ) { mPos = 0 ; if ( parseTag ( ) != TAG_ANNOTATION ) { throw error ( "Malformed" ) ; } TypeDesc rootAnnotationType = parseTypeDesc ( ) ; if ( rootAnnotation == null ) { rootAnnotation = buildRootAnnotation ( rootAnnotationType ) ; } else if ( ! rootAnnotationType . eq... | Parses the given annotation returning the root annotation that received the results . |
3,315 | public static < S extends Storable > Cursor < S > applyFilter ( Cursor < S > cursor , Class < S > type , String filter , Object ... filterValues ) { Filter < S > f = Filter . filterFor ( type , filter ) . bind ( ) ; FilterValues < S > fv = f . initialFilterValues ( ) . withValues ( filterValues ) ; return applyFilter (... | Returns a Cursor that is filtered by the given filter expression and values . |
3,316 | public static < S extends Storable > Cursor < S > applyFilter ( Filter < S > filter , FilterValues < S > filterValues , Cursor < S > cursor ) { if ( filter . isOpen ( ) ) { return cursor ; } if ( filter . isClosed ( ) ) { throw new IllegalArgumentException ( ) ; } filter = filter . bind ( ) ; Object [ ] values = filter... | Returns a Cursor that is filtered by the given Filter and FilterValues . The given Filter must be composed only of the same PropertyFilter instances as used to construct the FilterValues . An IllegalStateException will result otherwise . |
3,317 | public FetchException toFetchException ( Throwable e ) { FetchException fe = transformIntoFetchException ( e ) ; if ( fe != null ) { return fe ; } Throwable cause = e . getCause ( ) ; if ( cause != null ) { fe = transformIntoFetchException ( cause ) ; if ( fe != null ) { return fe ; } } else { cause = e ; } return new ... | Transforms the given throwable into an appropriate fetch exception . If it already is a fetch exception it is simply casted . |
3,318 | public PersistException toPersistException ( Throwable e ) { PersistException pe = transformIntoPersistException ( e ) ; if ( pe != null ) { return pe ; } Throwable cause = e . getCause ( ) ; if ( cause != null ) { pe = transformIntoPersistException ( cause ) ; if ( pe != null ) { return pe ; } } else { cause = e ; } r... | Transforms the given throwable into an appropriate persist exception . If it already is a persist exception it is simply casted . |
3,319 | public RepositoryException toRepositoryException ( Throwable e ) { RepositoryException re = transformIntoRepositoryException ( e ) ; if ( re != null ) { return re ; } Throwable cause = e . getCause ( ) ; if ( cause != null ) { re = transformIntoRepositoryException ( cause ) ; if ( re != null ) { return re ; } } else { ... | Transforms the given throwable into an appropriate repository exception . If it already is a repository exception it is simply casted . |
3,320 | public List < LayoutProperty > getDataProperties ( ) throws FetchException { List < LayoutProperty > all = getAllProperties ( ) ; List < LayoutProperty > data = new ArrayList < LayoutProperty > ( all . size ( ) - 1 ) ; for ( LayoutProperty property : all ) { if ( ! property . isPrimaryKeyMember ( ) ) { data . add ( pro... | Returns all the non - primary key properties of this layout in their proper order . |
3,321 | public List < LayoutProperty > getAllProperties ( ) throws FetchException { List < LayoutProperty > all = mAllProperties ; if ( all == null ) { Cursor < StoredLayoutProperty > cursor = mLayoutFactory . mPropertyStorage . query ( "layoutID = ?" ) . with ( mStoredLayout . getLayoutID ( ) ) . orderBy ( "ordinal" ) . fetch... | Returns all the properties of this layout in their proper order . |
3,322 | public Layout getGeneration ( int generation ) throws FetchNoneException , FetchException { try { Storage < StoredLayoutEquivalence > equivStorage = mLayoutFactory . mRepository . storageFor ( StoredLayoutEquivalence . class ) ; StoredLayoutEquivalence equiv = equivStorage . prepare ( ) ; equiv . setStorableTypeName ( ... | Returns the layout for a particular generation of this layout s type . |
3,323 | public Layout previousGeneration ( ) throws FetchException { Cursor < StoredLayout > cursor = mLayoutFactory . mLayoutStorage . query ( "storableTypeName = ? & generation < ?" ) . with ( getStorableTypeName ( ) ) . with ( getGeneration ( ) ) . orderBy ( "-generation" ) . fetch ( ) ; try { if ( cursor . hasNext ( ) ) { ... | Returns the previous known generation of the storable s layout or null if none . |
3,324 | public Class < ? extends Storable > reconstruct ( ClassLoader loader ) throws FetchException , SupportException { Class < ? extends Storable > reconstructed = reconstruct ( this , loader ) ; mLayoutFactory . registerReconstructed ( reconstructed , this ) ; return reconstructed ; } | Reconstructs the storable type defined by this layout by returning an auto - generated class . The reconstructed storable type will not contain everything in the original but rather the minimum required to decode persisted instances . |
3,325 | public boolean equalLayouts ( Layout layout ) throws FetchException { if ( this == layout ) { return true ; } return getStorableTypeName ( ) . equals ( layout . getStorableTypeName ( ) ) && getAllProperties ( ) . equals ( layout . getAllProperties ( ) ) && Arrays . equals ( mStoredLayout . getExtraData ( ) , layout . m... | Returns true if the given layout matches this one . Layout ID generation and creation info is not considered in the comparison . |
3,326 | void insert ( boolean readOnly , int generation ) throws PersistException { if ( mAllProperties == null ) { throw new IllegalStateException ( ) ; } mStoredLayout . setGeneration ( generation ) ; if ( readOnly ) { return ; } try { mStoredLayout . insert ( ) ; } catch ( UniqueConstraintException e ) { StoredLayout existi... | Assumes caller is in a transaction . |
3,327 | protected void DecodeFromCBORObject ( CBORObject obj ) throws CoseException { if ( obj . size ( ) != 4 ) throw new CoseException ( "Invalid SignMessage structure" ) ; if ( obj . get ( 0 ) . getType ( ) == CBORType . ByteString ) { rgbProtected = obj . get ( 0 ) . GetByteString ( ) ; if ( obj . get ( 0 ) . GetByteString... | Internal function used in creating a SignMessage object from a byte string . |
3,328 | protected CBORObject EncodeCBORObject ( ) throws CoseException { sign ( ) ; CBORObject obj = CBORObject . NewArray ( ) ; obj . Add ( rgbProtected ) ; obj . Add ( objUnprotected ) ; if ( emitContent ) obj . Add ( rgbContent ) ; else obj . Add ( null ) ; CBORObject signers = CBORObject . NewArray ( ) ; obj . Add ( signer... | Internal function used to create a serialization of a COSE_Sign message |
3,329 | public void sign ( ) throws CoseException { if ( rgbProtected == null ) { if ( objProtected . size ( ) == 0 ) rgbProtected = new byte [ 0 ] ; else rgbProtected = objProtected . EncodeToBytes ( ) ; } for ( Signer r : signerList ) { r . sign ( rgbProtected , rgbContent ) ; } ProcessCounterSignatures ( ) ; } | Causes a signature to be created for every signer that does not already have one . |
3,330 | public boolean validate ( Signer signerToUse ) throws CoseException { for ( Signer r : signerList ) { if ( r == signerToUse ) { return r . validate ( rgbProtected , rgbContent ) ; } } throw new CoseException ( "Signer not found" ) ; } | Validate the signature on a message for a specific signer . The signer is required to be one of the Signer objects attached to the message . The key must be attached to the signer before making this call . |
3,331 | public DataSource getDataSource ( ) throws ConfigurationException { if ( mDataSource == null ) { if ( mDriverClassName != null && mURL != null ) { try { mDataSource = new SimpleDataSource ( mDriverClassName , mURL , mUsername , mPassword ) ; } catch ( SQLException e ) { Throwable cause = e . getCause ( ) ; if ( cause =... | Returns the source of JDBC connections which defaults to a non - pooling source if driver class driver URL username and password are all supplied . |
3,332 | public void setSuppressReload ( boolean suppress , String className ) { if ( mSuppressReloadMap == null ) { mSuppressReloadMap = new HashMap < String , Boolean > ( ) ; } mSuppressReloadMap . put ( className , suppress ) ; } | By default JDBCRepository reloads Storables after every insert or update . This ensures that any applied defaults or triggered changes are available to the Storable . If the database has no such defaults or triggers suppressing reload can improve performance . |
3,333 | public static Integer decodeIntegerObjDesc ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { int b = src [ srcOffset ] ; if ( b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW ) { return null ; } return decodeIntDesc ( src , srcOffset + 1 ) ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEnc... | Decodes a signed Integer object from exactly 1 or 5 bytes as encoded for descending order . If null is returned then 1 byte was read . |
3,334 | public static Long decodeLongObjDesc ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { int b = src [ srcOffset ] ; if ( b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW ) { return null ; } return decodeLongDesc ( src , srcOffset + 1 ) ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncoding... | Decodes a signed Long object from exactly 1 or 9 bytes as encoded for descending order . If null is returned then 1 byte was read . |
3,335 | public static byte decodeByteDesc ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { return ( byte ) ( src [ srcOffset ] ^ 0x7f ) ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncodingException ( null , e ) ; } } | Decodes a signed byte from exactly 1 byte as encoded for descending order . |
3,336 | public static Byte decodeByteObjDesc ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { int b = src [ srcOffset ] ; if ( b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW ) { return null ; } return decodeByteDesc ( src , srcOffset + 1 ) ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncoding... | Decodes a signed Byte object from exactly 1 or 2 bytes as encoded for descending order . If null is returned then 1 byte was read . |
3,337 | public static short decodeShortDesc ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { return ( short ) ( ( ( src [ srcOffset ] << 8 ) | ( src [ srcOffset + 1 ] & 0xff ) ) ^ 0x7fff ) ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncodingException ( null , e ) ; } } | Decodes a signed short from exactly 2 bytes as encoded for descending order . |
3,338 | public static Short decodeShortObjDesc ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { int b = src [ srcOffset ] ; if ( b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW ) { return null ; } return decodeShortDesc ( src , srcOffset + 1 ) ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncod... | Decodes a signed Short object from exactly 1 or 3 bytes as encoded for descending order . If null is returned then 1 byte was read . |
3,339 | public static char decodeCharDesc ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { return ( char ) ~ ( ( src [ srcOffset ] << 8 ) | ( src [ srcOffset + 1 ] & 0xff ) ) ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncodingException ( null , e ) ; } } | Decodes a char from exactly 2 bytes as encoded for descending order . |
3,340 | public static Character decodeCharacterObjDesc ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { int b = src [ srcOffset ] ; if ( b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW ) { return null ; } return decodeCharDesc ( src , srcOffset + 1 ) ; } catch ( IndexOutOfBoundsException e ) { throw new Corru... | Decodes a Character object from exactly 1 or 3 bytes as encoded for descending order . If null is returned then 1 byte was read . |
3,341 | public static boolean decodeBooleanDesc ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { return src [ srcOffset ] == 127 ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncodingException ( null , e ) ; } } | Decodes a boolean from exactly 1 byte as encoded for descending order . |
3,342 | public static float decodeFloatDesc ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { int bits = DataDecoder . decodeFloatBits ( src , srcOffset ) ; if ( bits >= 0 ) { bits ^= 0x7fffffff ; } return Float . intBitsToFloat ( bits ) ; } | Decodes a float from exactly 4 bytes as encoded for descending order . |
3,343 | public static double decodeDoubleDesc ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { long bits = DataDecoder . decodeDoubleBits ( src , srcOffset ) ; if ( bits >= 0 ) { bits ^= 0x7fffffffffffffffL ; } return Double . longBitsToDouble ( bits ) ; } | Decodes a double from exactly 8 bytes as encoded for descending order . |
3,344 | public static int decode ( byte [ ] src , int srcOffset , BigInteger [ ] valueRef ) throws CorruptEncodingException { int headerSize ; int bytesLength ; byte [ ] bytes ; try { int header = src [ srcOffset ] ; if ( header == NULL_BYTE_HIGH || header == NULL_BYTE_LOW ) { valueRef [ 0 ] = null ; return 1 ; } header &= 0xf... | Decodes the given BigInteger as originally encoded for ascending order . |
3,345 | public static int decodeDesc ( byte [ ] src , int srcOffset , BigInteger [ ] valueRef ) throws CorruptEncodingException { int headerSize ; int bytesLength ; byte [ ] bytes ; try { int header = src [ srcOffset ] ; if ( header == NULL_BYTE_HIGH || header == NULL_BYTE_LOW ) { valueRef [ 0 ] = null ; return 1 ; } header &=... | Decodes the given BigInteger as originally encoded for descending order . |
3,346 | public static int decode ( byte [ ] src , int srcOffset , BigDecimal [ ] valueRef ) throws CorruptEncodingException { return decode ( src , srcOffset , valueRef , 0 ) ; } | Decodes the given BigDecimal as originally encoded for ascending order . |
3,347 | public static int decode ( byte [ ] src , int srcOffset , byte [ ] [ ] valueRef ) throws CorruptEncodingException { try { return decode ( src , srcOffset , valueRef , 0 ) ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncodingException ( null , e ) ; } } | Decodes the given byte array as originally encoded for ascending order . The decoding stops when any kind of terminator or illegal byte has been read . The decoded bytes are stored in valueRef . |
3,348 | public Filter < S > getFilter ( ) { Filter < S > filter = null ; for ( QueryExecutor < S > executor : mExecutors ) { Filter < S > subFilter = executor . getFilter ( ) ; filter = filter == null ? subFilter : filter . or ( subFilter ) ; } return filter ; } | Returns the combined filter of the wrapped executors . |
3,349 | public boolean printNative ( Appendable app , int indentLevel , FilterValues < S > values ) throws IOException { boolean result = false ; for ( QueryExecutor < S > executor : mExecutors ) { result |= executor . printNative ( app , indentLevel , values ) ; } return result ; } | Prints native queries of the wrapped executors . |
3,350 | @ SuppressWarnings ( "unchecked" ) public static < S extends Storable > StorableIndex < S > parseNameDescriptor ( String desc , StorableInfo < S > info ) throws IllegalArgumentException { String name = info . getStorableType ( ) . getName ( ) ; if ( ! desc . startsWith ( name ) ) { throw new IllegalArgumentException ( ... | Parses an index descriptor and returns an index object . |
3,351 | private static int nextSep ( String desc , int pos ) { int pos2 = desc . length ( ) ; int candidate = desc . indexOf ( '+' , pos ) ; if ( candidate > 0 ) { pos2 = candidate ; } candidate = desc . indexOf ( '-' , pos ) ; if ( candidate > 0 ) { pos2 = Math . min ( candidate , pos2 ) ; } candidate = desc . indexOf ( '~' ,... | Find the first subsequent occurrance of + - or ~ in the string or the end of line if none are there |
3,352 | public OrderedProperty < S > getOrderedProperty ( int index ) { return OrderedProperty . get ( mProperties [ index ] , mDirections [ index ] ) ; } | Returns a specific property in this index with the direction folded in . |
3,353 | @ SuppressWarnings ( "unchecked" ) public OrderedProperty < S > [ ] getOrderedProperties ( ) { OrderedProperty < S > [ ] ordered = new OrderedProperty [ mProperties . length ] ; for ( int i = mProperties . length ; -- i >= 0 ; ) { ordered [ i ] = OrderedProperty . get ( mProperties [ i ] , mDirections [ i ] ) ; } retur... | Returns a new array with all the properties in it with directions folded in . |
3,354 | public StorableIndex < S > unique ( boolean unique ) { if ( unique == mUnique ) { return this ; } return new StorableIndex < S > ( mProperties , mDirections , unique , mClustered , false ) ; } | Returns a StorableIndex instance which is unique or not . |
3,355 | public StorableIndex < S > clustered ( boolean clustered ) { if ( clustered == mClustered ) { return this ; } return new StorableIndex < S > ( mProperties , mDirections , mUnique , clustered , false ) ; } | Returns a StorableIndex instance which is clustered or not . |
3,356 | public StorableIndex < S > reverse ( ) { Direction [ ] directions = mDirections ; specified : { for ( int i = directions . length ; -- i >= 0 ; ) { if ( directions [ i ] != Direction . UNSPECIFIED ) { break specified ; } } return this ; } directions = directions . clone ( ) ; for ( int i = directions . length ; -- i >=... | Returns a StorableIndex instance with all the properties reversed . |
3,357 | public StorableIndex < S > setDefaultDirection ( Direction direction ) { Direction [ ] directions = mDirections ; unspecified : { for ( int i = directions . length ; -- i >= 0 ; ) { if ( directions [ i ] == Direction . UNSPECIFIED ) { break unspecified ; } } return this ; } directions = directions . clone ( ) ; for ( i... | Returns a StorableIndex instance with all unspecified directions set to the given direction . Returns this if all directions are already specified . |
3,358 | public StorableIndex < S > uniquify ( StorableKey < S > key ) { if ( key == null ) { throw new IllegalArgumentException ( ) ; } if ( isUnique ( ) ) { return this ; } StorableIndex < S > index = this ; for ( OrderedProperty < S > keyProp : key . getProperties ( ) ) { index = index . addProperty ( keyProp . getChainedPro... | Returns a StorableIndex which is unique possibly by appending properties from the given key . If index is already unique it is returned as - is . |
3,359 | public String getTypeDescriptor ( ) { StringBuilder b = new StringBuilder ( ) ; int count = getPropertyCount ( ) ; for ( int i = 0 ; i < count ; i ++ ) { StorableProperty property = getProperty ( i ) ; if ( property . isNullable ( ) ) { b . append ( 'N' ) ; } b . append ( TypeDesc . forClass ( property . getType ( ) ) ... | Converts this index into a parseable type descriptor string which basically consists of Java type descriptors appended together . There is one slight difference . Types which may be null are prefixed with a N character . |
3,360 | public void appendTo ( Appendable app ) throws IOException { app . append ( "{properties=[" ) ; int length = mProperties . length ; for ( int i = 0 ; i < length ; i ++ ) { if ( i > 0 ) { app . append ( ", " ) ; } app . append ( mDirections [ i ] . toCharacter ( ) ) ; app . append ( mProperties [ i ] . getName ( ) ) ; }... | Appends the same results as toString but without the StorableIndex prefix . |
3,361 | private void obtainMaxNumberOfCharacters ( final TypedArray typedArray ) { setMaxNumberOfCharacters ( typedArray . getInt ( R . styleable . EditText_maxNumberOfCharacters , DEFAULT_MAX_NUMBER_OF_CHARACTERS ) ) ; } | Obtains the maximum number of characters the edit text should be allowed to contain from a specific typed array . |
3,362 | private TextWatcher createTextChangeListener ( ) { return new TextWatcher ( ) { public final void beforeTextChanged ( final CharSequence s , final int start , final int count , final int after ) { } public final void onTextChanged ( final CharSequence s , final int start , final int before , final int count ) { } publi... | Creates and returns a listener which allows to validate the value of the view when its text has been changed . |
3,363 | private CharSequence getMaxNumberOfCharactersMessage ( ) { int maxLength = getMaxNumberOfCharacters ( ) ; int currentLength = getView ( ) . length ( ) ; return String . format ( getResources ( ) . getString ( R . string . edit_text_size_violation_error_message ) , currentLength , maxLength ) ; } | Returns the message which shows how many characters in relation to the maximum number of characters the edit text is allowed to contain have already been entered . |
3,364 | public final void setMaxNumberOfCharacters ( final int maxNumberOfCharacters ) { if ( maxNumberOfCharacters != - 1 ) { Condition . INSTANCE . ensureAtLeast ( maxNumberOfCharacters , 1 , "The maximum number of characters must be at least 1" ) ; } this . maxNumberOfCharacters = maxNumberOfCharacters ; adaptMaxNumberOfCha... | Sets the maximum number of characters the edit text should be allowed to contain . |
3,365 | public void copyToMasterPrimaryKey ( Storable reference , S master ) throws FetchException { try { mCopyToMasterPkMethod . invoke ( reference , master ) ; } catch ( Exception e ) { ThrowUnchecked . fireFirstDeclaredCause ( e , FetchException . class ) ; } } | Sets all the primary key properties of the given master using the applicable properties of the given reference . |
3,366 | public void copyFromMaster ( Storable reference , S master ) throws FetchException { try { mCopyFromMasterMethod . invoke ( reference , master ) ; } catch ( Exception e ) { ThrowUnchecked . fireFirstDeclaredCause ( e , FetchException . class ) ; } } | Sets all the properties of the given reference using the applicable properties of the given master . |
3,367 | public boolean isConsistent ( Storable reference , S master ) throws FetchException { try { return ( Boolean ) mIsConsistentMethod . invoke ( reference , master ) ; } catch ( Exception e ) { ThrowUnchecked . fireFirstDeclaredCause ( e , FetchException . class ) ; return false ; } } | Returns true if the properties of the given reference match those contained in the master excluding any version property . This will always return true after a call to copyFromMaster . |
3,368 | public static < S extends Storable > OrderedProperty < S > parse ( StorableInfo < S > info , String str ) throws IllegalArgumentException { return parse ( info , str , Direction . ASCENDING ) ; } | Parses an ordering property which may start with a + or - to indicate direction . Prefix of ~ indicates unspecified direction . If ordering prefix not specified default direction is ascending . |
3,369 | public static < S extends Storable > OrderedProperty < S > parse ( StorableInfo < S > info , String str , Direction defaultDirection ) throws IllegalArgumentException { if ( info == null || str == null || defaultDirection == null ) { throw new IllegalArgumentException ( ) ; } Direction direction = defaultDirection ; if... | Parses an ordering property which may start with a + or - to indicate direction . Prefix of ~ indicates unspecified direction . |
3,370 | public void addAccessorAnnotationDescriptor ( String annotationDesc ) { if ( mAnnotationDescs == null ) { mAnnotationDescs = new ArrayList < String > ( 4 ) ; } mAnnotationDescs . add ( annotationDesc ) ; } | Add an arbitrary annotation to the property accessor method as specified by a descriptor . |
3,371 | public List < String > getAccessorAnnotationDescriptors ( ) { if ( mAnnotationDescs == null ) { return Collections . emptyList ( ) ; } return Collections . unmodifiableList ( mAnnotationDescs ) ; } | Returns all the added accessor annotation descriptors in an unmodifiable list . |
3,372 | public TransactionScope < Txn > localScope ( ) { TransactionScope < Txn > scope = mLocalScope . get ( ) ; if ( scope == null ) { int state ; synchronized ( this ) { state = mState ; scope = new TransactionScope < Txn > ( this , state != OPEN ) ; mAllScopes . put ( scope , null ) ; } mLocalScope . set ( scope ) ; if ( s... | Returns the thread - local TransactionScope creating it if needed . |
3,373 | public synchronized void close ( boolean suspend ) throws RepositoryException { if ( mState == SUSPENDED ) { return ; } if ( suspend ) { for ( TransactionScope < ? > scope : mAllScopes . keySet ( ) ) { scope . getLock ( ) . lock ( ) ; } } mState = suspend ? SUSPENDED : CLOSED ; for ( TransactionScope < ? > scope : mAll... | Closes all transaction scopes . Should be called only when repository is closed . |
3,374 | @ SuppressWarnings ( "unchecked" ) public static < S extends Storable > JDBCStorableInfo < S > examine ( Class < S > type , DataSource ds , String catalog , String schema ) throws SQLException , SupportException { return examine ( type , ds , catalog , schema , null , false ) ; } | Examines the given class and returns a JDBCStorableInfo describing it . A MalformedTypeException is thrown for a variety of reasons if the given class is not a well - defined Storable type or if it can t match up with an entity in the external database . |
3,375 | private static AccessInfo getAccessInfo ( StorableProperty property , int dataType , String dataTypeName , int columnSize , int decimalDigits ) { AccessInfo info = getAccessInfo ( property . getType ( ) , dataType , dataTypeName , columnSize , decimalDigits ) ; if ( info != null ) { return info ; } if ( dataType == jav... | Figures out how to best access the given property or returns null if not supported . An adapter may be applied . |
3,376 | private static void appendToSentence ( StringBuilder buf , String [ ] names ) { for ( int i = 0 ; i < names . length ; i ++ ) { if ( i > 0 ) { if ( i + 1 >= names . length ) { buf . append ( " or " ) ; } else { buf . append ( ", " ) ; } } buf . append ( '"' ) ; buf . append ( names [ i ] ) ; buf . append ( '"' ) ; } } | Appends words to a sentence as an or list . |
3,377 | static String [ ] generateAliases ( String base ) { int length = base . length ( ) ; if ( length <= 1 ) { return new String [ ] { base . toUpperCase ( ) , base . toLowerCase ( ) } ; } ArrayList < String > aliases = new ArrayList < String > ( 4 ) ; StringBuilder buf = new StringBuilder ( ) ; int i ; for ( i = 0 ; i < le... | Generates aliases for the given name converting camel case form into various underscore forms . |
3,378 | public QueryHints with ( QueryHint hint , Object value ) { if ( hint == null ) { throw new IllegalArgumentException ( "Null hint" ) ; } if ( value == null ) { throw new IllegalArgumentException ( "Null value" ) ; } EnumMap < QueryHint , Object > map ; if ( mMap == null ) { map = new EnumMap < QueryHint , Object > ( Que... | Returns a new QueryHints object with the given hint and value . |
3,379 | public QueryHints without ( QueryHint hint ) { if ( hint == null || mMap == null || ! mMap . containsKey ( hint ) ) { return this ; } EnumMap < QueryHint , Object > map = mMap . clone ( ) ; map . remove ( hint ) ; if ( map . size ( ) == 0 ) { map = null ; } return new QueryHints ( map ) ; } | Returns a new QueryHints object without the given hint . |
3,380 | public Object get ( QueryHint hint ) { return hint == null ? null : ( mMap == null ? null : mMap . get ( hint ) ) ; } | Returns null if hint is not provided . |
3,381 | protected int toNext ( int amount ) throws FetchException { if ( amount <= 1 ) { return ( amount <= 0 ) ? 0 : ( toNext ( ) ? 1 : 0 ) ; } int count = 0 ; disableKeyAndValue ( ) ; try { while ( amount > 0 ) { if ( toNext ( ) ) { count ++ ; amount -- ; } else { break ; } } } finally { enableKeyAndValue ( ) ; } return coun... | Move the cursor to the next available entry incrementing by the amount given . The actual amount incremented is returned . If the amount is less then requested the cursor must be positioned after the last available entry . Subclasses may wish to override this method with a faster implementation . |
3,382 | protected boolean toNextKey ( ) throws FetchException { byte [ ] initialKey = getCurrentKey ( ) ; if ( initialKey == null ) { return false ; } disableValue ( ) ; try { while ( true ) { if ( toNext ( ) ) { byte [ ] currentKey = getCurrentKey ( ) ; if ( currentKey == null ) { return false ; } if ( compareKeysPartially ( ... | Move the cursor to the next unique key returning false if none . If false is returned the cursor must be positioned after the last available entry . Subclasses may wish to override this method with a faster implementation . |
3,383 | protected int toPrevious ( int amount ) throws FetchException { if ( amount <= 1 ) { return ( amount <= 0 ) ? 0 : ( toPrevious ( ) ? 1 : 0 ) ; } int count = 0 ; disableKeyAndValue ( ) ; try { while ( amount > 0 ) { if ( toPrevious ( ) ) { count ++ ; amount -- ; } else { break ; } } } finally { enableKeyAndValue ( ) ; }... | Move the cursor to the previous available entry decrementing by the amount given . The actual amount decremented is returned . If the amount is less then requested the cursor must be positioned before the first available entry . Subclasses may wish to override this method with a faster implementation . |
3,384 | protected boolean toPreviousKey ( ) throws FetchException { byte [ ] initialKey = getCurrentKey ( ) ; if ( initialKey == null ) { return false ; } disableValue ( ) ; try { while ( true ) { if ( toPrevious ( ) ) { byte [ ] currentKey = getCurrentKey ( ) ; if ( currentKey == null ) { return false ; } if ( compareKeysPart... | Move the cursor to the previous unique key returning false if none . If false is returned the cursor must be positioned before the first available entry . Subclasses may wish to override this method with a faster implementation . |
3,385 | private boolean toBoundedFirst ( ) throws FetchException { if ( mStartBound == null ) { if ( ! toFirst ( ) ) { return false ; } } else { if ( ! toFirst ( mStartBound . clone ( ) ) ) { return false ; } if ( ! mInclusiveStart ) { byte [ ] currentKey = getCurrentKey ( ) ; if ( currentKey == null ) { return false ; } if ( ... | Calls toFirst but considers start and end bounds . |
3,386 | private boolean toBoundedLast ( ) throws FetchException { if ( mEndBound == null ) { if ( ! toLast ( ) ) { return false ; } } else { if ( ! toLast ( mEndBound . clone ( ) ) ) { return false ; } if ( ! mInclusiveEnd ) { byte [ ] currentKey = getCurrentKey ( ) ; if ( currentKey == null ) { return false ; } if ( compareKe... | for preserving key . |
3,387 | private void obtainHintColor ( final TypedArray typedArray ) { ColorStateList colors = typedArray . getColorStateList ( R . styleable . Spinner_android_textColorHint ) ; if ( colors == null ) { TypedArray styledAttributes = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( new int [ ] { android . R . attr . text... | Obtains the color of the hint which should be shown when no item is selected from a specific typed array . |
3,388 | private OnItemSelectedListener createItemSelectedListener ( ) { return new OnItemSelectedListener ( ) { public void onItemSelected ( final AdapterView < ? > parent , final View view , final int position , final long id ) { if ( getOnItemSelectedListener ( ) != null ) { getOnItemSelectedListener ( ) . onItemSelected ( p... | Creates and returns a listener which allows to validate the value of the view when the selected item has been changed . |
3,389 | public final void setHint ( final CharSequence hint ) { this . hint = hint ; if ( getAdapter ( ) != null ) { ProxySpinnerAdapter proxyAdapter = ( ProxySpinnerAdapter ) getAdapter ( ) ; setAdapter ( proxyAdapter . getAdapter ( ) ) ; } } | Sets the hint which should be displayed when no item is selected . |
3,390 | public final void setHintTextColor ( final ColorStateList colors ) { this . hintColor = colors ; if ( getAdapter ( ) != null ) { ProxySpinnerAdapter proxyAdapter = ( ProxySpinnerAdapter ) getAdapter ( ) ; setAdapter ( proxyAdapter . getAdapter ( ) ) ; } } | Sets the color of the hint which should be displayed when no item is selected . |
3,391 | @ TargetApi ( Build . VERSION_CODES . JELLY_BEAN ) public final void setPopupBackgroundDrawable ( final Drawable background ) { getView ( ) . setPopupBackgroundDrawable ( background ) ; } | Set the background drawable for the spinner s popup window of choices . Only valid in MODE_DROPDOWN ; this method is a no - op in other modes . |
3,392 | public static < S extends Storable > FilteringScore < S > evaluate ( StorableIndex < S > index , Filter < S > filter ) { if ( index == null ) { throw new IllegalArgumentException ( "Index required" ) ; } return evaluate ( index . getOrderedProperties ( ) , index . isUnique ( ) , index . isClustered ( ) , filter ) ; } | Evaluates the given index for its filtering capabilities against the given filter . |
3,393 | static int nullCompare ( Object first , Object second ) { if ( first == null ) { if ( second != null ) { return 1 ; } } else if ( second == null ) { return - 1 ; } return 0 ; } | Comparison orders null high . |
3,394 | static < S extends Storable > List < Filter < S > > split ( Filter < S > filter ) { return filter == null ? null : filter . conjunctiveNormalFormSplit ( ) ; } | Splits the filter from its conjunctive normal form . And ng the filters together produces the original filter . |
3,395 | public Filter < S > getHandledFilter ( ) { Filter < S > identity = getIdentityFilter ( ) ; Filter < S > rangeStart = buildCompositeFilter ( getRangeStartFilters ( ) ) ; Filter < S > rangeEnd = buildCompositeFilter ( getRangeEndFilters ( ) ) ; return and ( and ( identity , rangeStart ) , rangeEnd ) ; } | Returns the composite handled filter or null if no matches at all . |
3,396 | public Filter < S > getCoveringRemainderFilter ( ) { if ( mCoveringRemainderFilter == null ) { List < ? extends Filter < S > > remainderFilters = mRemainderFilters ; List < ? extends Filter < S > > coveringFilters = mCoveringFilters ; if ( coveringFilters . size ( ) < remainderFilters . size ( ) ) { Filter < S > compos... | Returns the composite remainder filter without including the covering filter . Returns null if no remainder . |
3,397 | public boolean canMergeRemainderFilter ( FilteringScore < S > other ) { if ( this == other || ( ! hasAnyMatches ( ) && ! other . hasAnyMatches ( ) ) ) { return true ; } return isIndexClustered ( ) == other . isIndexClustered ( ) && isIndexUnique ( ) == other . isIndexUnique ( ) && getIndexPropertyCount ( ) == other . g... | Returns true if the given score uses an index exactly the same as this one . The only allowed differences are in the remainder filter . |
3,398 | public Filter < S > mergeRemainderFilter ( FilteringScore < S > other ) { Filter < S > thisRemainderFilter = getRemainderFilter ( ) ; if ( this == other ) { return thisRemainderFilter ; } Filter < S > otherRemainderFilter = other . getRemainderFilter ( ) ; if ( thisRemainderFilter == null ) { return otherRemainderFilte... | Merges the remainder filter of this score with the one given using an or operation . Call canMergeRemainderFilter first to verify if the merge makes any sense . Returns null if no remainder filter at all . |
3,399 | private List < Filter < S > > findCoveringMatches ( ) { List < Filter < S > > coveringFilters = null ; boolean check = ! mRemainderFilters . isEmpty ( ) && ( mIdentityFilters . size ( ) > 0 || mRangeStartFilters . size ( ) > 0 || mRangeEndFilters . size ( ) > 0 ) ; if ( check ) { for ( Filter < S > subFilter : mRemaind... | Finds covering matches from the remainder . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.