idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
3,500
public Method [ ] findAdaptMethodsFrom ( Class from ) { Method [ ] methods = mAdaptMethods ; List < Method > candidates = new ArrayList < Method > ( methods . length ) ; for ( int i = methods . length ; -- i >= 0 ; ) { Method method = methods [ i ] ; if ( method . getParameterTypes ( ) [ 0 ] . isAssignableFrom ( from )...
Returns all the adapt methods that convert from the given type .
3,501
@ SuppressWarnings ( "unchecked" ) public Method [ ] findAdaptMethodsTo ( Class to ) { Method [ ] methods = mAdaptMethods ; List < Method > candidates = new ArrayList < Method > ( methods . length ) ; for ( int i = methods . length ; -- i >= 0 ; ) { Method method = methods [ i ] ; if ( to . isAssignableFrom ( method . ...
Returns all the adapt methods that convert to the given type .
3,502
public static < Type > ConjunctiveConstraint < Type > create ( final Constraint < Type > [ ] constraints ) { return new ConjunctiveConstraint < > ( constraints ) ; }
Creates and returns a constraint which allows to combine multiple constraints in a conjunctive manner .
3,503
protected < S extends Storable > GenericEncodingStrategy < S > createStrategy ( Class < S > type , StorableIndex < S > pkIndex ) throws SupportException { return new GenericEncodingStrategy < S > ( type , pkIndex ) ; }
Override to return a different EncodingStrategy .
3,504
public static < T > Comparator < T > arrayComparator ( Class < T > arrayType , boolean unsigned ) { if ( ! arrayType . isArray ( ) ) { throw new IllegalArgumentException ( ) ; } Comparator c ; TypeDesc componentType = TypeDesc . forClass ( arrayType . getComponentType ( ) ) ; switch ( componentType . getTypeCode ( ) ) ...
Returns a comparator which can sort single or multi - dimensional arrays of primitves or Comparables .
3,505
public static < S extends Storable > Filter < S > filterFor ( Class < S > type , String expression ) { SoftValuedCache < Object , Filter < S > > filterCache = getFilterCache ( type ) ; synchronized ( filterCache ) { Filter < S > filter = filterCache . get ( expression ) ; if ( filter == null ) { filter = new FilterPars...
Returns a cached filter instance that operates on the given type and filter expression .
3,506
public static < S extends Storable > OpenFilter < S > getOpenFilter ( Class < S > type ) { SoftValuedCache < Object , Filter < S > > filterCache = getFilterCache ( type ) ; synchronized ( filterCache ) { Filter < S > filter = filterCache . get ( OPEN_KEY ) ; if ( filter == null ) { filter = OpenFilter . getCanonical ( ...
Returns a cached filter instance that operates on the given type which allows all results to pass through .
3,507
public static < S extends Storable > ClosedFilter < S > getClosedFilter ( Class < S > type ) { SoftValuedCache < Object , Filter < S > > filterCache = getFilterCache ( type ) ; synchronized ( filterCache ) { Filter < S > filter = filterCache . get ( CLOSED_KEY ) ; if ( filter == null ) { filter = ClosedFilter . getCano...
Returns a cached filter instance that operates on the given type which prevents any results from passing through .
3,508
public FilterValues < S > initialFilterValues ( ) { FilterValues < S > filterValues = mFilterValues ; if ( filterValues == null ) { buildFilterValues ( ) ; filterValues = mFilterValues ; } return filterValues ; }
Returns a FilterValues instance for assigning values to a Filter . Returns null if Filter has no parameters .
3,509
PropertyFilterList < S > getTailPropertyFilterList ( ) { PropertyFilterList < S > tail = mTailPropertyFilterList ; if ( tail == null ) { buildFilterValues ( ) ; tail = mTailPropertyFilterList ; } return tail ; }
Returns tail of linked list and so it can only be traversed by getting previous nodes .
3,510
public final Filter < S > andExists ( String propertyName , Filter < ? > subFilter ) { ChainedProperty < S > prop = new FilterParser < S > ( mType , propertyName ) . parseChainedProperty ( ) ; return and ( ExistsFilter . build ( prop , subFilter , false ) ) ; }
Returns a combined filter instance that accepts records which are only accepted by this filter and the exists test applied to a join .
3,511
public final Filter < S > andNotExists ( String propertyName , Filter < ? > subFilter ) { ChainedProperty < S > prop = new FilterParser < S > ( mType , propertyName ) . parseChainedProperty ( ) ; return and ( ExistsFilter . build ( prop , subFilter , true ) ) ; }
Returns a combined filter instance that accepts records which are only accepted by this filter and the not exists test applied to a join .
3,512
public final Filter < S > orExists ( String propertyName , Filter < ? > subFilter ) { ChainedProperty < S > prop = new FilterParser < S > ( mType , propertyName ) . parseChainedProperty ( ) ; return or ( ExistsFilter . build ( prop , subFilter , false ) ) ; }
Returns a combined filter instance that accepts records which are accepted either by this filter or the exists test applied to a join .
3,513
public final Filter < S > orNotExists ( String propertyName , Filter < ? > subFilter ) { ChainedProperty < S > prop = new FilterParser < S > ( mType , propertyName ) . parseChainedProperty ( ) ; return or ( ExistsFilter . build ( prop , subFilter , true ) ) ; }
Returns a combined filter instance that accepts records which are accepted either by this filter or the not exists test applied to a join .
3,514
public List < Filter < S > > disjunctiveNormalFormSplit ( ) { final List < Filter < S > > list = new ArrayList < Filter < S > > ( ) ; disjunctiveNormalForm ( ) . accept ( new Visitor < S , Object , Object > ( ) { public Object visit ( AndFilter < S > filter , Object param ) { list . add ( filter ) ; return null ; } pub...
Splits the filter from its disjunctive normal form . Or ng the filters together produces the full disjunctive normal form .
3,515
public List < Filter < S > > conjunctiveNormalFormSplit ( ) { final List < Filter < S > > list = new ArrayList < Filter < S > > ( ) ; conjunctiveNormalForm ( ) . accept ( new Visitor < S , Object , Object > ( ) { public Object visit ( OrFilter < S > filter , Object param ) { list . add ( filter ) ; return null ; } publ...
Splits the filter from its conjunctive normal form . And ng the filters together produces the full conjunctive normal form .
3,516
NotJoined notJoinedFromCNF ( ChainedProperty < S > joinProperty ) { return new NotJoined ( getOpenFilter ( joinProperty . getLastProperty ( ) . getJoinedType ( ) ) , this ) ; }
Should only be called on a filter in conjunctive normal form .
3,517
public static int decodeInt ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { int value = ( src [ srcOffset ] << 24 ) | ( ( src [ srcOffset + 1 ] & 0xff ) << 16 ) | ( ( src [ srcOffset + 2 ] & 0xff ) << 8 ) | ( src [ srcOffset + 3 ] & 0xff ) ; return value ^ 0x80000000 ; } catch ( IndexOutOfBound...
Decodes a signed integer from exactly 4 bytes .
3,518
public static Integer decodeIntegerObj ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { int b = src [ srcOffset ] ; if ( b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW ) { return null ; } return decodeInt ( src , srcOffset + 1 ) ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncodingExc...
Decodes a signed Integer object from exactly 1 or 5 bytes . If null is returned then 1 byte was read .
3,519
public static long decodeLong ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { return ( ( ( long ) ( ( ( src [ srcOffset ] ) << 24 ) | ( ( src [ srcOffset + 1 ] & 0xff ) << 16 ) | ( ( src [ srcOffset + 2 ] & 0xff ) << 8 ) | ( ( src [ srcOffset + 3 ] & 0xff ) ) ) ^ 0x80000000 ) << 32 ) | ( ( ( lo...
Decodes a signed long from exactly 8 bytes .
3,520
public static Long decodeLongObj ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { int b = src [ srcOffset ] ; if ( b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW ) { return null ; } return decodeLong ( src , srcOffset + 1 ) ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncodingExceptio...
Decodes a signed Long object from exactly 1 or 9 bytes . If null is returned then 1 byte was read .
3,521
public static byte decodeByte ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { return ( byte ) ( src [ srcOffset ] ^ 0x80 ) ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncodingException ( null , e ) ; } }
Decodes a signed byte from exactly 1 byte .
3,522
public static Byte decodeByteObj ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { int b = src [ srcOffset ] ; if ( b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW ) { return null ; } return decodeByte ( src , srcOffset + 1 ) ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncodingExceptio...
Decodes a signed Byte object from exactly 1 or 2 bytes . If null is returned then 1 byte was read .
3,523
public static short decodeShort ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { return ( short ) ( ( ( src [ srcOffset ] << 8 ) | ( src [ srcOffset + 1 ] & 0xff ) ) ^ 0x8000 ) ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncodingException ( null , e ) ; } }
Decodes a signed short from exactly 2 bytes .
3,524
public static Short decodeShortObj ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { int b = src [ srcOffset ] ; if ( b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW ) { return null ; } return decodeShort ( src , srcOffset + 1 ) ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncodingExcep...
Decodes a signed Short object from exactly 1 or 3 bytes . If null is returned then 1 byte was read .
3,525
public static char decodeChar ( 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 .
3,526
public static Character decodeCharacterObj ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { int b = src [ srcOffset ] ; if ( b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW ) { return null ; } return decodeChar ( src , srcOffset + 1 ) ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncodi...
Decodes a Character object from exactly 1 or 3 bytes . If null is returned then 1 byte was read .
3,527
public static boolean decodeBoolean ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { return src [ srcOffset ] == ( byte ) 128 ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncodingException ( null , e ) ; } }
Decodes a boolean from exactly 1 byte .
3,528
public static Boolean decodeBooleanObj ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { try { switch ( src [ srcOffset ] ) { case NULL_BYTE_LOW : case NULL_BYTE_HIGH : return null ; case ( byte ) 128 : return Boolean . TRUE ; default : return Boolean . FALSE ; } } catch ( IndexOutOfBoundsException e )...
Decodes a Boolean object from exactly 1 byte .
3,529
public static float decodeFloat ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { int bits = decodeFloatBits ( src , srcOffset ) ; bits ^= ( bits < 0 ) ? 0x80000000 : 0xffffffff ; return Float . intBitsToFloat ( bits ) ; }
Decodes a float from exactly 4 bytes .
3,530
public static double decodeDouble ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { long bits = decodeDoubleBits ( src , srcOffset ) ; bits ^= ( bits < 0 ) ? 0x8000000000000000L : 0xffffffffffffffffL ; return Double . longBitsToDouble ( bits ) ; }
Decodes a double from exactly 8 bytes .
3,531
public static int decode ( byte [ ] src , int srcOffset , BigInteger [ ] valueRef ) throws CorruptEncodingException { byte [ ] [ ] bytesRef = new byte [ 1 ] [ ] ; int amt = decode ( src , srcOffset , bytesRef ) ; valueRef [ 0 ] = ( bytesRef [ 0 ] == null ) ? null : new BigInteger ( bytesRef [ 0 ] ) ; return amt ; }
Decodes a BigInteger .
3,532
public static int decode ( byte [ ] src , int srcOffset , BigDecimal [ ] valueRef ) throws CorruptEncodingException { try { final int originalOffset = srcOffset ; int b = src [ srcOffset ++ ] & 0xff ; if ( b >= 0xf8 ) { valueRef [ 0 ] = null ; return 1 ; } int scale ; if ( b <= 0x7f ) { scale = b ; } else if ( b <= 0xb...
Decodes a BigDecimal .
3,533
public static int decode ( byte [ ] src , int srcOffset , byte [ ] [ ] valueRef ) throws CorruptEncodingException { try { final int originalOffset = srcOffset ; int b = src [ srcOffset ++ ] & 0xff ; if ( b >= 0xf8 ) { valueRef [ 0 ] = null ; return 1 ; } int valueLength ; if ( b <= 0x7f ) { valueLength = b ; } else if ...
Decodes the given byte array .
3,534
public static void readFully ( InputStream in , byte [ ] b ) throws IOException , EOFException { final int length = b . length ; int total = 0 ; while ( total < length ) { int amt = in . read ( b , total , length - total ) ; if ( amt < 0 ) { throw new EOFException ( ) ; } total += amt ; } }
Reads as many bytes from the stream as is necessary to fill the given byte array . An EOFException is thrown if the stream end is encountered .
3,535
public static < Type > Constraint < Type > conjunctive ( final Constraint < Type > ... constraints ) { return ConjunctiveConstraint . create ( constraints ) ; }
Creates and returns a constraint which allows to combine multiple constraints in a conjunctive manner . Only if all single constraints are satisfied the resulting constraint will also be satisfied .
3,536
public static < Type > Constraint < Type > disjunctive ( final Constraint < Type > ... constraints ) { return DisjunctiveConstraint . create ( constraints ) ; }
Creates and returns a constraint which allows to combine multiple constraints in a disjunctive manner . If at least one constraint is satisfied the resulting constraint will also be satisfied .
3,537
public static < S extends Storable > SyntheticStorableReferenceAccess < S > getIndexAccess ( StorableIndex < S > index ) throws SupportException { index = index . clustered ( false ) ; synchronized ( cCache ) { SyntheticStorableReferenceAccess < S > access = cCache . get ( index ) ; if ( access != null ) { return acces...
Returns a new or cached index access instance . The caching of accessors is soft so if no references remain to a given instance it may be garbage collected . A subsequent call will return a newly created instance .
3,538
public void forceCheckpoint ( ) throws PersistException { if ( mCheckpointer != null ) { mCheckpointer . forceCheckpoint ( ) ; } else { try { env_checkpoint ( ) ; } catch ( Exception e ) { throw toPersistException ( e ) ; } } }
Forces a checkpoint to run now even if checkpointer is suspended or disabled . If a checkpoint is in progress then this method will block until it is finished and then run another checkpoint . This method does not return until the requested checkpoint has finished .
3,539
String getDatabaseName ( String dbName ) { if ( mFileNameMap == null ) { return null ; } String name = mFileNameMap . get ( dbName ) ; if ( name == null && dbName != null ) { name = mFileNameMap . get ( null ) ; } if ( name == null ) { return null ; } if ( mDatabaseHook != null ) { try { dbName = mDatabaseHook . databa...
Returns null if name should not be used .
3,540
Integer getDatabasePageSize ( Class < ? extends Storable > type ) { if ( mDatabasePageSizes == null ) { return null ; } Integer size = mDatabasePageSizes . get ( type ) ; if ( size == null && type != null ) { size = mDatabasePageSizes . get ( null ) ; } return size ; }
Returns the desired page size for the given type or null for default .
3,541
Txn txn_begin ( Txn parent , IsolationLevel level , int timeout , TimeUnit unit ) throws Exception { return txn_begin ( parent , level ) ; }
Subclass should override this method to actually apply the timeout
3,542
@ SuppressWarnings ( "unchecked" ) public static < S extends Storable > ChainedProperty < S > get ( StorableProperty < S > prime ) { return ( ChainedProperty < S > ) cCanonical . put ( new ChainedProperty < S > ( prime , null , null ) ) ; }
Returns a canonical instance which has no chain .
3,543
public boolean isNullable ( ) { if ( mPrime . isNullable ( ) ) { return true ; } if ( mChain != null ) { for ( StorableProperty < ? > prop : mChain ) { if ( prop . isNullable ( ) ) { return true ; } } } return false ; }
Returns true if any property in the chain can be null .
3,544
public boolean isDerived ( ) { if ( mPrime . isDerived ( ) ) { return true ; } if ( mChain != null ) { for ( StorableProperty < ? > prop : mChain ) { if ( prop . isDerived ( ) ) { return true ; } } } return false ; }
Returns true if any property in the chain is derived .
3,545
public boolean isOuterJoin ( int index ) throws IndexOutOfBoundsException { if ( index < 0 ) { throw new IndexOutOfBoundsException ( ) ; } if ( mOuterJoin == null ) { if ( index > getChainCount ( ) ) { throw new IndexOutOfBoundsException ( ) ; } return false ; } return mOuterJoin [ index ] ; }
Returns true if the property at the given index should be treated as an outer join . Index zero is the prime property .
3,546
public ChainedProperty < S > trim ( ) { if ( getChainCount ( ) == 0 ) { throw new IllegalStateException ( ) ; } if ( getChainCount ( ) == 1 ) { if ( ! isOuterJoin ( 0 ) ) { return get ( mPrime ) ; } else { return get ( mPrime , null , new boolean [ ] { true } ) ; } } StorableProperty < ? > [ ] newChain = new StorablePr...
Returns a new ChainedProperty with the last property in the chain removed .
3,547
public ChainedProperty < ? > tail ( ) { if ( getChainCount ( ) == 0 ) { throw new IllegalStateException ( ) ; } if ( getChainCount ( ) == 1 ) { if ( ! isOuterJoin ( 1 ) ) { return get ( mChain [ 0 ] ) ; } else { return get ( mChain [ 0 ] , null , new boolean [ ] { true } ) ; } } StorableProperty < ? > [ ] newChain = ne...
Returns a new ChainedProperty which contains everything that follows this ChainedProperty s prime property .
3,548
private static boolean identityEquals ( Object [ ] a , Object [ ] a2 ) { if ( a == a2 ) { return true ; } if ( a == null || a2 == null ) { return false ; } int length = a . length ; if ( a2 . length != length ) { return false ; } for ( int i = 0 ; i < length ; i ++ ) { if ( a [ i ] != a2 [ i ] ) { return false ; } } re...
Compares objects for equality using == operator instead of equals method .
3,549
public void appendTo ( Appendable app ) throws IOException { appendPropTo ( app , mPrime . getName ( ) , isOuterJoin ( 0 ) ) ; StorableProperty < ? > [ ] chain = mChain ; if ( chain != null ) { for ( int i = 0 ; i < chain . length ; i ++ ) { app . append ( '.' ) ; appendPropTo ( app , chain [ i ] . getName ( ) , isOute...
Appends the chained property formatted as name . subname . subsubname . This format is parseable only if the chain is composed of valid many - to - one joins .
3,550
public boolean verify ( PrintStream out ) throws RepositoryException { final StorableCodecFactory codecFactory = mStorableCodecFactory ; final String name = mName ; final boolean readOnly = mReadOnly ; final boolean runCheckpointer = mRunCheckpointer ; final boolean runDeadlockDetector = mRunDeadlockDetector ; final bo...
Opens the BDB environment checks if it is corrupt and then closes it . Only one process should open the environment for verification . Expect it to take a long time .
3,551
public void setProduct ( String product ) { mProduct = product == null ? DEFAULT_PRODUCT : BDBProduct . forString ( product ) ; }
Sets the BDB product to use which defaults to JE . Also supported is DB and DB_HA . If not supported an IllegalArgumentException is thrown .
3,552
public void setEnvironmentHomeFile ( File envHome ) { try { envHome = envHome . getCanonicalFile ( ) ; } catch ( IOException e ) { } mEnvHome = envHome ; }
Sets the repository environment home directory which is required .
3,553
public void setFileName ( String filename , String typeName ) { mSingleFileName = null ; if ( mFileNames == null ) { mFileNames = new HashMap < String , String > ( ) ; } mFileNames . put ( typeName , filename ) ; }
Specify the file that a BDB database should reside in except for log files and caches . The filename is relative to the environment home unless data directories have been specified . For BDBRepositories that are log files only this configuration is ignored .
3,554
public void setDatabasePageSize ( Integer bytes , Class < ? extends Storable > type ) { if ( mDatabasePageSizes == null ) { mDatabasePageSizes = new HashMap < Class < ? > , Integer > ( ) ; } mDatabasePageSizes . put ( type , bytes ) ; }
Sets the desired page size for a given type . If not specified the page size applies to all types .
3,555
public void setCompressor ( String type , String compressionType ) { mStorableCodecFactory = null ; compressionType = compressionType . toUpperCase ( ) ; if ( mCompressionMap == null ) { mCompressionMap = new HashMap < String , CompressionType > ( ) ; } CompressionType compressionEnum = CompressionType . valueOf ( comp...
Set the compressor for the given class overriding a custom StorableCodecFactory .
3,556
public String getCompressor ( String type ) { if ( mCompressionMap == null ) { return null ; } return mCompressionMap . get ( type ) . toString ( ) ; }
Return the compressor used for the given storable .
3,557
@ SuppressWarnings ( "unchecked" ) private Constructor < BDBRepository > getRepositoryConstructor ( ) throws ClassCastException , ClassNotFoundException , NoSuchMethodException { String packageName ; { String thisClassName = getClass ( ) . getName ( ) ; packageName = thisClassName . substring ( 0 , thisClassName . last...
Looks up appropriate repository via reflection whose name is derived from the BDB product string .
3,558
public boolean canMergeRemainderOrdering ( OrderingScore < S > other ) { if ( this == other || ( getHandledCount ( ) == 0 && other . getHandledCount ( ) == 0 ) ) { return true ; } if ( isIndexClustered ( ) == other . isIndexClustered ( ) && getIndexPropertyCount ( ) == other . getIndexPropertyCount ( ) && shouldReverse...
Returns true if the given score uses an index exactly the same as this one . The only allowed differences are in the count of remainder orderings .
3,559
public OrderingList < S > mergeRemainderOrdering ( OrderingScore < S > other ) { OrderingList < S > thisRemainderOrdering = getRemainderOrdering ( ) ; if ( this == other ) { return thisRemainderOrdering ; } OrderingList < S > otherRemainderOrdering = other . getRemainderOrdering ( ) ; if ( thisRemainderOrdering . size ...
Merges the remainder orderings of this score with the one given . Call canMergeRemainderOrdering first to verify if the merge makes any sense .
3,560
protected void fillBytes ( int value , long count ) throws BitStreamException { if ( count < PAD_LIMIT ) { for ( int i = 0 ; i < count ; i ++ ) writeByte ( value ) ; return ; } byte b = ( byte ) value ; byte [ ] buffer = getBuffer ( b ) ; int len ; if ( buffer == null ) { len = count > PAD_BUFFER ? PAD_BUFFER : ( int )...
Writes a single value repeatedly into the sequence .
3,561
private void executeOperation ( DbUnitDatabasePopulator populator , DataSource dataSource ) throws Exception { Connection connection = null ; try { connection = getConnection ( dataSource ) ; populator . populate ( connection ) ; } finally { if ( connection != null && ! isConnectionTransactional ( connection , dataSour...
Execute a DBUbit operation
3,562
public BitVector range ( int from , int to ) { if ( from < 0 ) throw new IllegalArgumentException ( ) ; if ( to < from ) throw new IllegalArgumentException ( ) ; from += start ; to += start ; if ( to > finish ) throw new IllegalArgumentException ( ) ; return new BitVector ( from , to , bits , mutable ) ; }
bypasses duplicate for efficiency
3,563
private void perform ( int operation , int position , long bs , int length ) { checkBitsLength ( length ) ; position = adjPosition ( position ) ; checkMutable ( ) ; performAdj ( operation , position , bs , length ) ; }
assumes address size is size of long
3,564
private void setBitsImpl ( int position , long value , int length ) { int i = position >> ADDRESS_BITS ; int s = position & ADDRESS_MASK ; long m = length == ADDRESS_SIZE ? - 1L : ( 1L << length ) - 1L ; long v = value & m ; performAdjSet ( length , i , s , m , v ) ; }
length guaranteed to be non - zero
3,565
private void performSetAdj ( int position , boolean value ) { checkMutable ( ) ; final int i = position >> ADDRESS_BITS ; final long m = 1L << ( position & ADDRESS_MASK ) ; if ( value ) { bits [ i ] |= m ; } else { bits [ i ] &= ~ m ; } }
specialized implementation for the common case of setting an individual bit
3,566
private boolean getThenPerformAdj ( int operation , int position , boolean value ) { checkMutable ( ) ; final int i = position >> ADDRESS_BITS ; final long m = 1L << ( position & ADDRESS_MASK ) ; final long v = bits [ i ] & m ; switch ( operation ) { case SET : if ( value ) { bits [ i ] |= m ; } else { bits [ i ] &= ~ ...
separate implementation from performAdj is an optimization
3,567
public BitsoWithdrawal [ ] getWithdrawals ( String [ ] withdrawalsIds , String ... queryParameters ) throws BitsoAPIException , BitsoPayloadException , BitsoServerException { String request = "/api/v3/withdrawals" ; if ( ( withdrawalsIds != null ) && ( queryParameters != null && queryParameters . length > 0 ) ) { retur...
The request needs withdrawalsIds or queryParameters not both . In case both parameters are provided null will be returned
3,568
public BitsoFunding [ ] getFundings ( String [ ] fundingssIds , String ... queryParameters ) throws BitsoAPIException , BitsoPayloadException , BitsoServerException { String request = "/api/v3/fundings" ; if ( ( fundingssIds != null && ( queryParameters != null && queryParameters . length > 0 ) ) ) { return null ; } if...
The request needs fundingssIds or queryParameters not both . In case both parameters are provided null will be returned
3,569
public BitsoTrade [ ] getUserTrades ( String [ ] tradesIds , String ... queryParameters ) throws BitsoAPIException , BitsoPayloadException , BitsoServerException { String request = "/api/v3/user_trades" ; if ( ( tradesIds != null && ( queryParameters != null && queryParameters . length > 0 ) ) ) { return null ; } if ( ...
The request needs tradesIds or queryParameters not both . In case both parameters are provided null will be returned
3,570
static void writeBits ( WriteStream writer , long bits , int count ) { for ( int i = ( count - 1 ) & ~ 7 ; i >= 0 ; i -= 8 ) { writer . writeByte ( ( byte ) ( bits >>> i ) ) ; } }
not does not mask off the supplied long - that is responsibility of caller
3,571
static long readBits ( ReadStream reader , int count ) { long bits = 0L ; for ( int i = ( count - 1 ) >> 3 ; i >= 0 ; i -- ) { bits <<= 8 ; bits |= reader . readByte ( ) & 0xff ; } return bits ; }
not does not mask off the returned long - that is responsibility of caller
3,572
private ITableMetaData mergeTableMetaData ( List < Column > columnsToMerge , ITableMetaData originalMetaData ) throws DataSetException { Column [ ] columns = new Column [ originalMetaData . getColumns ( ) . length + columnsToMerge . size ( ) ] ; System . arraycopy ( originalMetaData . getColumns ( ) , 0 , columns , 0 ,...
merges the existing columns with the potentially new ones .
3,573
protected void handleMissingColumns ( Attributes attributes ) throws DataSetException { List < Column > columnsToMerge = new ArrayList < Column > ( ) ; ITableMetaData activeMetaData = getActiveMetaData ( ) ; int attributeLength = attributes . getLength ( ) ; for ( int i = 0 ; i < attributeLength ; i ++ ) { try { active...
parses the attributes in the current row and checks whether a new column is found .
3,574
public static < T , K extends Enum < K > > CSVParserBuilder < T , K > aParser ( Function < CSVRecord , T > mapper ) { CSVParserBuilder < T , K > builder = new CSVParserBuilder < T , K > ( ) ; builder . recordMapper = mapper ; return builder ; }
Create new parser using supplied mapping function .
3,575
public static < T , K extends Enum < K > > CSVParserBuilder < T , K > aParser ( Function < CSVRecordWithHeader < K > , T > mapper , Class < K > fields ) { CSVParserBuilder < T , K > builder = new CSVParserBuilder < T , K > ( ) ; builder . recordWithHeaderMapper = mapper ; builder . subsetView = FieldSubsetView . forSou...
Create new header - aware parser using supplied mapping function .
3,576
public CSVParserBuilder < T , K > usingExplicitHeader ( String ... header ) { Objects . requireNonNull ( subsetView ) ; this . subsetView = FieldSubsetView . forExplicitHeader ( subsetView . getFieldSubset ( ) , header ) ; return this ; }
Use supplied header and do not take header from the source .
3,577
public CSVParserBuilder < T , K > usingSeparatorWithNoQuotes ( char separator ) { this . metadata = new CSVFileMetadata ( separator , Optional . empty ( ) ) ; return this ; }
Use specified character as field separator .
3,578
public CSVParserBuilder < T , K > usingSeparatorWithQuote ( char separator , char quote ) { this . metadata = new CSVFileMetadata ( separator , Optional . of ( quote ) ) ; return this ; }
Use specified characters as field separator and quote character . Quote character can be escaped by preceding it with another quote character .
3,579
public CSVParser < T > build ( ) { return subsetView == null ? new QuickCSVParser < T , K > ( bufferSize , metadata , recordMapper , charset ) : new QuickCSVParser < T , K > ( bufferSize , metadata , recordWithHeaderMapper , subsetView , charset ) ; }
Construct parser using current setting
3,580
protected void writeByte ( int value ) throws BitStreamException { try { out . write ( value ) ; } catch ( IOException e ) { throw new BitStreamException ( e ) ; } }
byte based methods
3,581
public static BigDecimal getFeeInPercentage ( BigDecimal thirtyDayVolume ) { if ( thirtyDayVolume . compareTo ( new BigDecimal ( "1" ) ) <= 0 ) { return new BigDecimal ( "1" ) ; } else if ( thirtyDayVolume . compareTo ( new BigDecimal ( "2.5" ) ) <= 0 ) { return new BigDecimal ( "0.95" ) ; } else if ( thirtyDayVolume ....
Accessed July 28 2015
3,582
public static BitWriter writerTo ( int [ ] ints , long size ) { if ( ints == null ) throw new IllegalArgumentException ( "null ints" ) ; if ( size < 0 ) throw new IllegalArgumentException ( "negative size" ) ; long maxSize = ( ( long ) ints . length ) << 5 ; if ( size > maxSize ) throw new IllegalArgumentException ( "s...
Writes bits to an array of ints up - to a specified limit .
3,583
static int compareLexical ( BitStore a , BitStore b ) { int aSize = a . size ( ) ; int bSize = b . size ( ) ; int diff = a . size ( ) - b . size ( ) ; ListIterator < Integer > as = a . ones ( ) . positions ( aSize ) ; ListIterator < Integer > bs = b . ones ( ) . positions ( bSize ) ; while ( true ) { boolean ap = as . ...
expects a strictly longer than b
3,584
static int gcd ( int a , int b ) { while ( a != b ) { if ( a > b ) { int na = a % b ; if ( na == 0 ) return b ; a = na ; } else { int nb = b % a ; if ( nb == 0 ) return a ; b = nb ; } } return a ; }
duplicated here to avoid dependencies
3,585
private static void transferImpl ( BitReader reader , BitWriter writer , long count ) { while ( count >= 64 ) { long bits = reader . readLong ( 64 ) ; writer . write ( bits , 64 ) ; count -= 64 ; } if ( count != 0L ) { long bits = reader . readLong ( ( int ) count ) ; writer . write ( bits , ( int ) count ) ; } }
private static methods
3,586
private void doWrite ( int bits , int count ) { int frontBits = ( ( int ) position ) & 31 ; int firstInt = ( int ) ( position >> 5 ) ; int sumBits = count + frontBits ; if ( sumBits <= 32 ) { int i = ints [ firstInt ] ; int mask = frontMask ( frontBits ) | backMask ( sumBits ) ; i &= mask ; i |= ( bits << ( 32 - sumBit...
assumes count is non - zero
3,587
public static void write ( IDataSet dataSet , OutputStream out ) throws IOException , DataSetException { logger . debug ( "write(dataSet={}, out={}) - start" , dataSet , out ) ; FlatXmlWriter datasetWriter = new FlatXmlWriter ( out ) ; datasetWriter . setIncludeEmptyTable ( true ) ; datasetWriter . write ( dataSet ) ; ...
Write the specified dataset to the specified output stream as xml .
3,588
private boolean hasStep ( final SlideContent slideContent ) { boolean res = false ; for ( final S step : getStepList ( ) ) { if ( step . name ( ) . equalsIgnoreCase ( slideContent . getName ( ) ) ) { res = true ; } } return res ; }
Check if step defined in xml exist into current step list .
3,589
public SlideContent getDefaultContent ( ) { SlideContent res = null ; if ( getSlide ( ) . getContent ( ) != null && ! getSlide ( ) . getContent ( ) . isEmpty ( ) ) { res = getSlide ( ) . getContent ( ) . get ( 0 ) ; } return res ; }
Return the default content or null .
3,590
public SlideContent getContent ( final SlideStep slideStep ) { SlideContent res = null ; if ( getSlide ( ) . getContent ( ) != null && ! getSlide ( ) . getContent ( ) . isEmpty ( ) ) { for ( final SlideContent sc : getSlide ( ) . getContent ( ) ) { if ( sc . getName ( ) != null && ! sc . getName ( ) . isEmpty ( ) && sc...
Return the default content or null for the given step .
3,591
private Animation buildAnimation ( final AnimationType animationType ) { Animation animation = null ; switch ( animationType ) { case MOVE_TO_RIGHT : animation = buildHorizontalAnimation ( 0 , 2000 , 0 , 0 ) ; break ; case MOVE_TO_LEFT : animation = buildHorizontalAnimation ( 0 , - 2000 , 0 , 0 ) ; break ; case MOVE_TO...
Build an animation .
3,592
private double findAngle ( final double fromX , final double fromY , final double toX , final double toY ) { final double yDelta = toY - fromY ; final double y = Math . sin ( yDelta ) * Math . cos ( toX ) ; final double x = Math . cos ( fromX ) * Math . sin ( toX ) - Math . sin ( fromX ) * Math . cos ( toX ) * Math . c...
Return the right angle for the given coordinate .
3,593
@ SuppressWarnings ( "unchecked" ) private void callCommand ( final Wave wave ) { final Command command = wave . contains ( JRebirthWaves . REUSE_COMMAND ) && wave . get ( JRebirthWaves . REUSE_COMMAND ) ? globalFacade ( ) . commandFacade ( ) . retrieve ( ( Class < Command > ) wave . componentClass ( ) ) : globalFacade...
Call dynamically a command .
3,594
@ SuppressWarnings ( "unchecked" ) private void returnData ( final Wave wave ) { final Service service = globalFacade ( ) . serviceFacade ( ) . retrieve ( ( Class < Service > ) wave . componentClass ( ) ) ; if ( service == null ) { LOGGER . error ( SERVICE_NOT_FOUND_ERROR , wave . toString ( ) ) ; this . unprocessedWav...
Call a service method by using a task worker .
3,595
private void processUndefinedWave ( final Wave wave ) throws WaveException { LOGGER . info ( NOTIFIER_CONSUMES , wave . toString ( ) ) ; wave . status ( Status . Consumed ) ; if ( this . notifierMap . containsKey ( wave . waveType ( ) ) ) { final WaveSubscription ws = this . notifierMap . get ( wave . waveType ( ) ) ; ...
Dispatch a standard wave which could be handled by a custom method of the component .
3,596
public static boolean checkMethodSignature ( final Method method , final List < WaveItem < ? > > wParams ) { boolean isCompliant = false ; final Type [ ] mParams = method . getGenericParameterTypes ( ) ; if ( wParams . isEmpty ( ) && Wave . class . isAssignableFrom ( ClassUtility . getClassFromType ( mParams [ 0 ] ) ) ...
Compare method parameters with wave parameters .
3,597
public static ColorItem create ( final ColorParams colorParams ) { return ColorItemImpl . create ( ) . uid ( colorIdGenerator . incrementAndGet ( ) ) . set ( colorParams ) ; }
Build a color item .
3,598
public static FontItem create ( final FontParams fontParams ) { return FontItemImpl . create ( ) . uid ( fontIdGenerator . incrementAndGet ( ) ) . set ( fontParams ) ; }
Build a font item .
3,599
public static ImageItem create ( final ImageParams imageParams ) { return ImageItemImpl . create ( ) . uid ( imageIdGenerator . incrementAndGet ( ) ) . set ( imageParams ) ; }
Build an image item .