idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
41,700
public void getData ( long id , MapDataChangesHandler handler , MapDataFactory factory ) { osm . makeAuthenticatedRequest ( CHANGESET + "/" + id + "/download" , null , new MapDataChangesParser ( handler , factory ) ) ; }
Get map data changes associated with the given changeset .
57
11
41,701
public long create ( final String name , final GpsTraceDetails . Visibility visibility , final String description , final List < String > tags , final Iterable < GpsTrackpoint > trackpoints ) { checkFieldLength ( "Name" , name ) ; checkFieldLength ( "Description" , description ) ; checkTagsLength ( tags ) ; /* * upload...
Upload a new trace of trackpoints .
336
8
41,702
public long create ( String name , GpsTraceDetails . Visibility visibility , String description , final Iterable < GpsTrackpoint > trackpoints ) { return create ( name , visibility , description , null , trackpoints ) ; }
Upload a new trace with no tags
49
7
41,703
public void update ( long id , GpsTraceDetails . Visibility visibility , String description , List < String > tags ) { checkFieldLength ( "Description" , description ) ; checkTagsLength ( tags ) ; GpsTraceWriter writer = new GpsTraceWriter ( id , visibility , description , tags ) ; osm . makeAuthenticatedRequest ( GPX ...
Change the visibility description and tags of a GPS trace . description and tags may be null if there should be none .
92
23
41,704
public GpsTraceDetails get ( long id ) { SingleElementHandler < GpsTraceDetails > handler = new SingleElementHandler <> ( ) ; try { osm . makeAuthenticatedRequest ( GPX + "/" + id , "GET" , new GpsTracesParser ( handler ) ) ; } catch ( OsmNotFoundException e ) { return null ; } return handler . get ( ) ; }
Get information about a given GPS trace or null if it does not exist .
89
15
41,705
public void getData ( long id , Handler < GpsTrackpoint > handler ) { osm . makeAuthenticatedRequest ( GPX + "/" + id + "/data" , "GET" , new GpxTrackParser ( handler ) ) ; }
Get all trackpoints contained in the given trace id . Note that the trace is a GPX file so there is potentially much more information in there than simply the trackpoints . However this method only parses the trackpoints and ignores everything else .
53
49
41,706
public Note create ( LatLon pos , String text ) { if ( text . isEmpty ( ) ) { throw new IllegalArgumentException ( "Text may not be empty" ) ; } String data = "lat=" + numberFormat . format ( pos . getLatitude ( ) ) + "&lon=" + numberFormat . format ( pos . getLongitude ( ) ) + "&text=" + urlEncode ( text ) ; String ca...
Create a new note at the given location
153
8
41,707
public Note reopen ( long id , String reason ) { SingleElementHandler < Note > noteHandler = new SingleElementHandler <> ( ) ; makeSingleNoteRequest ( id , "reopen" , reason , new NotesParser ( noteHandler ) ) ; return noteHandler . get ( ) ; }
Reopen the given note with the given reason . The reason is optional .
61
15
41,708
public void getAll ( BoundingBox bounds , Handler < Note > handler , int limit , int hideClosedNoteAfter ) { getAll ( bounds , null , handler , limit , hideClosedNoteAfter ) ; }
Retrieve all notes in the given area and feed them to the given handler .
46
16
41,709
public void getAll ( BoundingBox bounds , String search , Handler < Note > handler , int limit , int hideClosedNoteAfter ) { if ( limit <= 0 || limit > 10000 ) { throw new IllegalArgumentException ( "limit must be within 1 and 10000" ) ; } if ( bounds . crosses180thMeridian ( ) ) { throw new IllegalArgumentException ( ...
Retrieve those notes in the given area that match the given search string
233
14
41,710
public void find ( Handler < Note > handler , QueryNotesFilters filters ) { String query = filters != null ? "?" + filters . toParamString ( ) : "" ; osm . makeAuthenticatedRequest ( NOTES + "/search" + query , null , new NotesParser ( handler ) ) ; }
Get a number of notes that match the given filters .
65
11
41,711
public long updateMap ( Map < String , String > tags , Iterable < Element > elements , Handler < DiffElement > handler ) { tags . put ( "created_by" , osm . getUserAgent ( ) ) ; long changesetId = openChangeset ( tags ) ; /* the try-finally is not really necessary because the server closes an open changeset after 24 ho...
Opens a changeset uploads the data closes the changeset and subscribes the user to it .
132
21
41,712
public void uploadChanges ( long changesetId , Iterable < Element > elements , Handler < DiffElement > handler ) { MapDataDiffParser parser = null ; if ( handler != null ) { parser = new MapDataDiffParser ( handler ) ; } osm . makeAuthenticatedRequest ( "changeset/" + changesetId + "/upload" , "POST" , new MapDataChang...
Upload changes into an opened changeset .
94
8
41,713
public void setAll ( Map < String , String > preferences ) { // check it before sending it to the server in order to be able to raise a precise exception for ( Map . Entry < String , String > preference : preferences . entrySet ( ) ) { checkPreferenceKeyLength ( preference . getKey ( ) ) ; checkPreferenceValueLength ( ...
Sets all the given preference keys to the given preference values .
222
13
41,714
public void set ( String key , String value ) { String urlKey = urlEncode ( key ) ; checkPreferenceKeyLength ( urlKey ) ; checkPreferenceValueLength ( value ) ; osm . makeAuthenticatedRequest ( USERPREFS + urlKey , "PUT" , new PlainTextWriter ( value ) ) ; }
Sets the given preference key to the given preference value .
71
12
41,715
public void delete ( String key ) { String urlKey = urlEncode ( key ) ; checkPreferenceKeyLength ( urlKey ) ; osm . makeAuthenticatedRequest ( USERPREFS + urlKey , "DELETE" ) ; }
Deletes the given preference key from the user preferences
53
10
41,716
public QueryChangesetsFilters byOpenSomeTimeBetween ( Date createdBefore , Date closedAfter ) { params . put ( "time" , dateFormat . format ( closedAfter ) + "," + dateFormat . format ( createdBefore ) ) ; return this ; }
Filter by changesets that have at one time been open during the given time range
55
16
41,717
public R call ( ) throws BackendException { while ( hasNext ) { pagesProcessed ++ ; next ( ) ; } delegate . updatePagesHistogram ( apiName , tableName , pagesProcessed ) ; return getMergedPages ( ) ; }
Paginates through pages of an entity .
53
9
41,718
private ScanContext grab ( ) throws ExecutionException , InterruptedException { final Future < ScanContext > ret = exec . take ( ) ; final ScanRequest originalRequest = ret . get ( ) . getScanRequest ( ) ; final int segment = originalRequest . getSegment ( ) ; final ScanSegmentWorker sw = workers [ segment ] ; if ( sw ...
This method gets a segmentedScanResult and submits the next scan request for that segment if there is one .
138
23
41,719
public boolean contains ( final AbstractDynamoDbStore store , final StaticBuffer key , final StaticBuffer column ) { return expectedValues . containsKey ( store ) && expectedValues . get ( store ) . containsKey ( key ) && expectedValues . get ( store ) . get ( key ) . containsKey ( column ) ; }
Determins whether a particular key and column are part of this transaction
68
14
41,720
public StaticBuffer get ( final AbstractDynamoDbStore store , final StaticBuffer key , final StaticBuffer column ) { // This method assumes the caller has called contains(..) and received a positive response return expectedValues . get ( store ) . get ( key ) . get ( column ) ; }
Gets the expected value for a particular key and column if any
62
13
41,721
public void putKeyColumnOnlyIfItIsNotYetChangedInTx ( final AbstractDynamoDbStore store , final StaticBuffer key , final StaticBuffer column , final StaticBuffer expectedValue ) { expectedValues . computeIfAbsent ( store , s -> new HashMap <> ( ) ) ; expectedValues . get ( store ) . computeIfAbsent ( key , k -> new Has...
Puts the expected value for a particular key and column
137
11
41,722
public CreateTableRequest getTableSchema ( ) { return new CreateTableRequest ( ) . withTableName ( tableName ) . withProvisionedThroughput ( new ProvisionedThroughput ( client . readCapacity ( tableName ) , client . writeCapacity ( tableName ) ) ) ; }
Creates the schemata for the DynamoDB table or tables each store requires . Implementations should override and reuse this logic
63
25
41,723
private int calculateExpressionBasedUpdateSize ( final UpdateItemRequest request ) { if ( request == null || request . getUpdateExpression ( ) == null ) { throw new IllegalArgumentException ( "request did not use update expression" ) ; } int size = calculateItemSizeInBytes ( request . getKey ( ) ) ; for ( AttributeValu...
This method calculates a lower bound of the size of a new item created with UpdateItem UpdateExpression . It does not account for the size of the attribute names of the document paths in the attribute names map and it assumes that the UpdateExpression only uses the SET action to assign to top - level attributes .
107
62
41,724
public static Map < String , AttributeValue > cloneItem ( final Map < String , AttributeValue > item ) { if ( item == null ) { return null ; } final Map < String , AttributeValue > clonedItem = Maps . newHashMap ( ) ; final IdentityHashMap < AttributeValue , AttributeValue > sourceDestinationMap = new IdentityHashMap <...
Helper method that clones an item
191
6
41,725
private static int calculateAttributeSizeInBytes ( final AttributeValue value ) { int attrValSize = 0 ; if ( value == null ) { return attrValSize ; } if ( value . getB ( ) != null ) { final ByteBuffer b = value . getB ( ) ; attrValSize += b . remaining ( ) ; } else if ( value . getS ( ) != null ) { final String s = val...
Calculate attribute value size
620
6
41,726
private void readObject ( ObjectInputStream ois ) { try { ois . defaultReadObject ( ) ; pauseLock = new ReentrantLock ( ) ; pauseLock . newCondition ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } }
makes findbugs happy but unused
60
6
41,727
public < T > void addListenerIfPending ( final Class < T > clazz , final Object requestCacheKey , final PendingRequestListener < T > requestListener ) { addListenerIfPending ( clazz , requestCacheKey , ( RequestListener < T > ) requestListener ) ; }
Add listener to a pending request if it exists . If no such request exists this method calls onRequestNotFound on the listener . If a request identified by clazz and requestCacheKey it will receive an additional listener .
62
44
41,728
public < T > void execute ( final CachedSpiceRequest < T > cachedSpiceRequest , final RequestListener < T > requestListener ) { addRequestListenerToListOfRequestListeners ( cachedSpiceRequest , requestListener ) ; Ln . d ( "adding request to request queue" ) ; this . requestQueue . add ( cachedSpiceRequest ) ; }
Execute a request put the result in cache and register listeners to notify when request is finished .
78
19
41,729
public < U , T extends U > void putInCache ( final Class < U > clazz , final Object requestCacheKey , final T data , RequestListener < U > listener ) { @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) final SpiceRequest < U > spiceRequest = new SpiceRequest ( clazz ) { @ Override public U loadDataFromNetwork ( ) thr...
Adds some data to the cache asynchronously .
158
10
41,730
public < T > void cancel ( final Class < T > clazz , final Object requestCacheKey ) { final SpiceRequest < T > request = new SpiceRequest < T > ( clazz ) { @ Override public T loadDataFromNetwork ( ) throws Exception { return null ; } } ; final CachedSpiceRequest < T > cachedSpiceRequest = new CachedSpiceRequest < T > ...
Cancel a pending request if it exists . If no such request exists this method does nothing . If a request identified by clazz and requestCacheKey exists it will be cancelled and its associated listeners will get notified . This method is asynchronous .
145
48
41,731
protected void dontNotifyAnyRequestListenersInternal ( ) { lockSendRequestsToService . lock ( ) ; try { if ( spiceService == null ) { return ; } synchronized ( mapRequestToLaunchToRequestListener ) { if ( ! mapRequestToLaunchToRequestListener . isEmpty ( ) ) { for ( final CachedSpiceRequest < ? > cachedSpiceRequest : m...
Remove all listeners of requests . All requests that have not been yet passed to the service will see their of listeners cleaned . For all requests that have been passed to the service we ask the service to remove their listeners .
287
43
41,732
private void removeListenersOfAllPendingCachedRequests ( ) throws InterruptedException { synchronized ( mapPendingRequestToRequestListener ) { if ( ! mapPendingRequestToRequestListener . isEmpty ( ) ) { for ( final CachedSpiceRequest < ? > cachedSpiceRequest : mapPendingRequestToRequestListener . keySet ( ) ) { final S...
Asynchronously ask service to remove all listeners of pending requests .
213
13
41,733
public Future < Boolean > isDataInCache ( Class < ? > clazz , final Object cacheKey , long cacheExpiryDuration ) throws CacheCreationException { return executeCommand ( new IsDataInCacheCommand ( this , clazz , cacheKey , cacheExpiryDuration ) ) ; }
Tests whether some data is present in cache or not .
63
12
41,734
public Future < Date > getDateOfDataInCache ( Class < ? > clazz , final Object cacheKey ) throws CacheCreationException { return executeCommand ( new GetDateOfDataInCacheCommand ( this , clazz , cacheKey ) ) ; }
Returns the last date of storage of a given data into the cache .
54
14
41,735
public void dumpState ( ) { executorService . execute ( new Runnable ( ) { @ Override public void run ( ) { lockSendRequestsToService . lock ( ) ; try { final StringBuilder stringBuilder = new StringBuilder ( ) ; stringBuilder . append ( "[SpiceManager : " ) ; stringBuilder . append ( "Requests to be launched : \n" ) ;...
Dumps request processor state .
214
6
41,736
public void notifyObserversOfRequestFailure ( CachedSpiceRequest < ? > request ) { RequestProcessingContext requestProcessingContext = new RequestProcessingContext ( ) ; requestProcessingContext . setExecutionThread ( Thread . currentThread ( ) ) ; post ( new RequestFailedNotifier ( request , spiceServiceListenerList ,...
Notify interested observers that the request failed .
80
9
41,737
public < T > void notifyObserversOfRequestSuccess ( CachedSpiceRequest < T > request ) { RequestProcessingContext requestProcessingContext = new RequestProcessingContext ( ) ; requestProcessingContext . setExecutionThread ( Thread . currentThread ( ) ) ; post ( new RequestSucceededNotifier < T > ( request , spiceServic...
Notify interested observers that the request succeeded .
88
9
41,738
public void notifyObserversOfRequestCancellation ( CachedSpiceRequest < ? > request ) { RequestProcessingContext requestProcessingContext = new RequestProcessingContext ( ) ; requestProcessingContext . setExecutionThread ( Thread . currentThread ( ) ) ; post ( new RequestCancelledNotifier ( request , spiceServiceListen...
Notify interested observers that the request was cancelled .
84
10
41,739
public void notifyObserversOfRequestProgress ( CachedSpiceRequest < ? > request , RequestProgress requestProgress ) { RequestProcessingContext requestProcessingContext = new RequestProcessingContext ( ) ; requestProcessingContext . setExecutionThread ( Thread . currentThread ( ) ) ; requestProcessingContext . setReques...
Notify interested observers of request progress .
97
8
41,740
public void notifyObserversOfRequestProcessed ( CachedSpiceRequest < ? > request , Set < RequestListener < ? > > requestListeners ) { RequestProcessingContext requestProcessingContext = new RequestProcessingContext ( ) ; requestProcessingContext . setExecutionThread ( Thread . currentThread ( ) ) ; requestProcessingCon...
Notify interested observers of request completion .
108
8
41,741
protected void post ( Runnable runnable ) { Ln . d ( "Message queue is " + messageQueue ) ; if ( messageQueue == null ) { return ; } messageQueue . postAtTime ( runnable , SystemClock . uptimeMillis ( ) ) ; }
Add the request update to the observer message queue .
61
10
41,742
public void setCacheFolder ( File cacheFolder ) throws CacheCreationException { if ( cacheFolder == null ) { cacheFolder = new File ( getApplication ( ) . getCacheDir ( ) , DEFAULT_ROOT_CACHE_DIR ) ; } synchronized ( cacheFolder . getAbsolutePath ( ) . intern ( ) ) { if ( ! cacheFolder . exists ( ) && ! cacheFolder . m...
Set the cacheFolder to use .
135
7
41,743
@ Override public Future < ? > submit ( Runnable task ) { if ( task == null ) { throw new NullPointerException ( ) ; } RunnableFuture < Object > ftask = newTaskFor ( task , null ) ; execute ( ftask ) ; return ftask ; }
form JDK 1 . 6 to ensure backward compatibility
63
10
41,744
public KafkaProducer < String , String > createStringProducer ( Properties overrideConfig ) { return createProducer ( new StringSerializer ( ) , new StringSerializer ( ) , overrideConfig ) ; }
Create a producer that writes String keys and values
43
9
41,745
public < K , V > void produce ( String topic , KafkaProducer < K , V > producer , Map < K , V > data ) { data . forEach ( ( k , v ) -> producer . send ( new ProducerRecord <> ( topic , k , v ) ) ) ; producer . flush ( ) ; }
Produce data to the specified topic
68
7
41,746
public void produceStrings ( String topic , String ... values ) { try ( KafkaProducer < String , String > producer = createStringProducer ( ) ) { Map < String , String > data = Arrays . stream ( values ) . collect ( Collectors . toMap ( k -> String . valueOf ( k . hashCode ( ) ) , Function . identity ( ) ) ) ; produce ...
Convenience method to produce a set of strings to the specified topic
92
14
41,747
public KafkaConsumer < String , String > createStringConsumer ( Properties overrideConfig ) { return createConsumer ( new StringDeserializer ( ) , new StringDeserializer ( ) , overrideConfig ) ; }
Create a consumer that reads strings
42
6
41,748
public < K , V > ListenableFuture < List < ConsumerRecord < K , V > > > consume ( String topic , KafkaConsumer < K , V > consumer , int numMessagesToConsume ) { consumer . subscribe ( Lists . newArrayList ( topic ) ) ; ListeningExecutorService executor = MoreExecutors . listeningDecorator ( Executors . newSingleThreadE...
Attempt to consume the specified number of messages
113
8
41,749
public ListenableFuture < List < String > > consumeStrings ( String topic , int numMessagesToConsume ) { KafkaConsumer < String , String > consumer = createStringConsumer ( ) ; ListenableFuture < List < ConsumerRecord < String , String > > > records = consume ( topic , consumer , numMessagesToConsume ) ; return Futures...
Consume specified number of string messages
98
7
41,750
public static EphemeralKafkaBroker create ( int kafkaPort , int zookeeperPort , Properties overrideBrokerProperties ) { return new EphemeralKafkaBroker ( kafkaPort , zookeeperPort , overrideBrokerProperties ) ; }
Create a new ephemeral Kafka broker with the specified broker port Zookeeper port and config overrides .
61
22
41,751
public Optional < String > getLogDir ( ) { return brokerStarted ? Optional . of ( kafkaLogDir . toString ( ) ) : Optional . empty ( ) ; }
Get the path to the Kafka log directory
39
8
41,752
public Optional < String > getZookeeperConnectString ( ) { return brokerStarted ? Optional . of ( zookeeper . getConnectString ( ) ) : Optional . empty ( ) ; }
Get the current Zookeeper connection string
42
8
41,753
public Optional < String > getBrokerList ( ) { return brokerStarted ? Optional . of ( LOCALHOST + ":" + kafkaPort ) : Optional . empty ( ) ; }
Get the current broker list string
42
6
41,754
public static < E extends Exception , E2 extends Exception > void parse ( final Connection conn , final String sql , final long offset , final long count , final int processThreadNum , final int queueSize , final Try . Consumer < Object [ ] , E > rowParser , final Try . Runnable < E2 > onComplete ) throws UncheckedSQLE...
Parse the ResultSet obtained by executing query with the specified Connection and sql .
175
16
41,755
public static < E extends Exception , E2 extends Exception > void parse ( final PreparedStatement stmt , final long offset , final long count , final int processThreadNum , final int queueSize , final Try . Consumer < Object [ ] , E > rowParser , final Try . Runnable < E2 > onComplete ) throws UncheckedSQLException , E...
Parse the ResultSet obtained by executing query with the specified PreparedStatement .
158
16
41,756
public static < E extends Exception , E2 extends Exception > void parse ( final ResultSet rs , long offset , long count , final int processThreadNum , final int queueSize , final Try . Consumer < Object [ ] , E > rowParser , final Try . Runnable < E2 > onComplete ) throws UncheckedSQLException , E , E2 { final Iterator...
Parse the ResultSet .
341
6
41,757
@ Override public void close ( ) throws SQLException { if ( ( id == null ) || ( poolableConn == null ) ) { internalStmt . close ( ) ; } else { poolableConn . cachePreparedStatement ( this ) ; } }
Method close .
56
3
41,758
@ Override public boolean execute ( ) throws SQLException { boolean isOk = false ; try { boolean result = internalStmt . execute ( ) ; isOk = true ; return result ; } finally { poolableConn . updateLastSQLExecutionTime ( isOk ) ; } }
Method execute .
64
3
41,759
@ Override public ResultSet executeQuery ( String sql ) throws SQLException { boolean isOk = false ; try { final ResultSet result = wrap ( internalStmt . executeQuery ( sql ) ) ; isOk = true ; return result ; } finally { poolableConn . updateLastSQLExecutionTime ( isOk ) ; } }
Method executeQuery .
75
4
41,760
@ Override public void setArray ( int parameterIndex , Array x ) throws SQLException { internalStmt . setArray ( parameterIndex , x ) ; }
Method setArray .
35
4
41,761
@ Override public void setAsciiStream ( int parameterIndex , InputStream x , int length ) throws SQLException { internalStmt . setAsciiStream ( parameterIndex , x , length ) ; }
Method setAsciiStream .
47
7
41,762
@ Override public void setBigDecimal ( int parameterIndex , BigDecimal x ) throws SQLException { internalStmt . setBigDecimal ( parameterIndex , x ) ; }
Method setBigDecimal .
41
6
41,763
@ Override public void setBinaryStream ( int parameterIndex , InputStream x ) throws SQLException { internalStmt . setBinaryStream ( parameterIndex , x ) ; }
Method setBinaryStream .
40
6
41,764
@ Override public void setDate ( int parameterIndex , Date x ) throws SQLException { internalStmt . setDate ( parameterIndex , x ) ; }
Method setDate .
35
4
41,765
@ Override public void setNCharacterStream ( int parameterIndex , Reader value ) throws SQLException { internalStmt . setNCharacterStream ( parameterIndex , value ) ; }
Method setNCharacterStream .
39
6
41,766
@ Override public void setNString ( int parameterIndex , String value ) throws SQLException { internalStmt . setNString ( parameterIndex , value ) ; }
Method setNString .
37
5
41,767
@ Override public void setRef ( int parameterIndex , Ref x ) throws SQLException { internalStmt . setRef ( parameterIndex , x ) ; }
Method setRef .
35
4
41,768
@ Override public void setRowId ( int parameterIndex , RowId x ) throws SQLException { internalStmt . setRowId ( parameterIndex , x ) ; }
Method setRowId .
38
5
41,769
@ Override public void setSQLXML ( int parameterIndex , SQLXML xmlObject ) throws SQLException { internalStmt . setSQLXML ( parameterIndex , xmlObject ) ; }
Method setSQLXML .
43
6
41,770
@ Override public void setString ( int parameterIndex , String x ) throws SQLException { internalStmt . setString ( parameterIndex , x ) ; }
Method setString .
35
4
41,771
@ Override public void setTime ( int parameterIndex , Time x ) throws SQLException { internalStmt . setTime ( parameterIndex , x ) ; }
Method setTime .
35
4
41,772
@ Override public void setTimestamp ( int parameterIndex , Timestamp x ) throws SQLException { internalStmt . setTimestamp ( parameterIndex , x ) ; }
Method setTimestamp .
38
5
41,773
@ Override public void setURL ( int parameterIndex , URL x ) throws SQLException { internalStmt . setURL ( parameterIndex , x ) ; }
Method setURL .
35
4
41,774
public boolean cancelAll ( boolean mayInterruptIfRunning ) { boolean res = true ; if ( N . notNullOrEmpty ( upFutures ) ) { for ( ContinuableFuture < ? > preFuture : upFutures ) { res = res & preFuture . cancelAll ( mayInterruptIfRunning ) ; } } return cancel ( mayInterruptIfRunning ) && res ; }
Cancel this future and all the previous stage future recursively .
83
14
41,775
public boolean isAllCancelled ( ) { boolean res = true ; if ( N . notNullOrEmpty ( upFutures ) ) { for ( ContinuableFuture < ? > preFuture : upFutures ) { res = res & preFuture . isAllCancelled ( ) ; } } return isCancelled ( ) && res ; }
Returns true if this future and all previous stage futures have been recursively cancelled otherwise false is returned .
76
21
41,776
@ Override public int read ( ) throws IOException { int b = in . read ( ) ; if ( b != - 1 ) { hasher . put ( ( byte ) b ) ; } return b ; }
Reads the next byte of data from the underlying input stream and updates the hasher with the byte read .
45
22
41,777
@ Override public int read ( byte [ ] bytes , int off , int len ) throws IOException { int numOfBytesRead = in . read ( bytes , off , len ) ; if ( numOfBytesRead != - 1 ) { hasher . put ( bytes , off , numOfBytesRead ) ; } return numOfBytesRead ; }
Reads the specified bytes of data from the underlying input stream and updates the hasher with the bytes read .
73
22
41,778
public static < T > SortedSet < HBaseColumn < T > > asSortedSet ( T value , long version ) { return asSortedSet ( value , version , DESC_HBASE_COLUMN_COMPARATOR ) ; }
Returns a sorted set descended by version
54
7
41,779
public static < T > SortedMap < Long , HBaseColumn < T > > asSortedMap ( T value ) { return asSortedMap ( value , DESC_HBASE_VERSION_COMPARATOR ) ; }
Returns a sorted map descended by version
49
7
41,780
@ SafeVarargs @ NullSafe public static < T > List < T > asList ( T ... a ) { return N . isNullOrEmpty ( a ) ? N . < T > emptyList ( ) : Arrays . asList ( a ) ; }
Returns a fixed - size list backed by the specified array if it s not null or empty otherwise an immutable empty list is returned .
55
26
41,781
@ SuppressWarnings ( "deprecation" ) public CQLBuilder set ( final Object entity ) { if ( entity instanceof String ) { return set ( N . asArray ( ( String ) entity ) ) ; } else if ( entity instanceof Map ) { return set ( ( Map < String , Object > ) entity ) ; } else { this . entityClass = entity . getClass ( ) ; if ( N...
Only the dirty properties will be set into the result CQL if the specified entity is a dirty marker entity .
228
22
41,782
public boolean remove ( Object key , Object value ) { final Object curValue = get ( key ) ; if ( ! Objects . equals ( curValue , value ) || ( curValue == null && ! containsKey ( key ) ) ) { return false ; } remove ( key ) ; return true ; }
Removes the entry for the specified key only if it is currently mapped to the specified value .
62
19
41,783
public boolean replace ( K key , V oldValue , V newValue ) { Object curValue = get ( key ) ; if ( ! Objects . equals ( curValue , oldValue ) || ( curValue == null && ! containsKey ( key ) ) ) { return false ; } put ( key , newValue ) ; return true ; }
Replaces the entry for the specified key only if currently mapped to the specified value .
70
17
41,784
@ Override public Stream < T > queued ( int queueSize ) { final Iterator < T > iter = iterator ( ) ; if ( iter instanceof QueuedIterator && ( ( QueuedIterator < ? extends T > ) iter ) . max ( ) >= queueSize ) { return newStream ( elements , sorted , cmp ) ; } else { return newStream ( Stream . parallelConcatt ( Arrays ...
Returns a Stream with elements from a temporary queue which is filled by reading the elements from the specified iterator asynchronously .
108
24
41,785
@ SequentialOnly public BiIterator < K , V > iterator ( ) { final ObjIterator < Entry < K , V > > iter = s . iterator ( ) ; final BooleanSupplier hasNext = new BooleanSupplier ( ) { @ Override public boolean getAsBoolean ( ) { return iter . hasNext ( ) ; } } ; final Consumer < Pair < K , V > > output = new Consumer < P...
Remember to close this Stream after the iteration is done if required .
167
13
41,786
public static String removePattern ( final String source , final String regex ) { return replacePattern ( source , regex , N . EMPTY_STRING ) ; }
Removes each substring of the source String that matches the given regular expression using the DOTALL option .
33
21
41,787
static long fingerprint ( byte [ ] bytes , int offset , int length ) { if ( length <= 32 ) { if ( length <= 16 ) { return hashLength0to16 ( bytes , offset , length ) ; } else { return hashLength17to32 ( bytes , offset , length ) ; } } else if ( length <= 64 ) { return hashLength33To64 ( bytes , offset , length ) ; } el...
End of public functions .
103
5
41,788
public DBSequence getDBSequence ( final String tableName , final String seqName , final long startVal , final int seqBufferSize ) { return new DBSequence ( this , tableName , seqName , startVal , seqBufferSize ) ; }
Supports global sequence by db table .
57
8
41,789
@ Override public void close ( ) throws IOException { try { if ( _ds != null && _ds . isClosed ( ) == false ) { _ds . close ( ) ; } } finally { if ( _dsm != null && _dsm . isClosed ( ) == false ) { _dsm . close ( ) ; } } }
Close the underline data source
76
6
41,790
protected void evict ( ) { lock . lock ( ) ; Map < K , E > removingObjects = null ; try { for ( Map . Entry < K , E > entry : pool . entrySet ( ) ) { if ( entry . getValue ( ) . activityPrint ( ) . isExpired ( ) ) { if ( removingObjects == null ) { removingObjects = Objectory . createMap ( ) ; } removingObjects . put (...
scan the object pool to find the idle object which inactive time greater than permitted the inactive time for it or it s time out .
249
26
41,791
@ SafeVarargs public static Map < String , AttributeValue > asItem ( Object ... a ) { if ( 0 != ( a . length % 2 ) ) { throw new IllegalArgumentException ( "The parameters must be the pairs of property name and value, or Map, or an entity class with getter/setter methods." ) ; } final Map < String , AttributeValue > it...
May misused with toItem
154
6
41,792
@ SafeVarargs public static Map < String , AttributeValueUpdate > asUpdateItem ( Object ... a ) { if ( 0 != ( a . length % 2 ) ) { throw new IllegalArgumentException ( "The parameters must be the pairs of property name and value, or Map, or an entity class with getter/setter methods." ) ; } final Map < String , Attribu...
May misused with toUpdateItem
158
7
41,793
public static Map < String , AttributeValueUpdate > toUpdateItem ( final Object entity ) { return toUpdateItem ( entity , NamingPolicy . LOWER_CAMEL_CASE ) ; }
Only the dirty properties will be set to the result Map if the specified entity is a dirty marker entity .
43
21
41,794
public void moveRow ( Object rowKey , int newRowIndex ) { checkFrozen ( ) ; this . checkRowIndex ( newRowIndex ) ; final int rowIndex = this . getRowIndex ( rowKey ) ; final List < R > tmp = new ArrayList <> ( rowLength ( ) ) ; tmp . addAll ( _rowKeySet ) ; tmp . add ( newRowIndex , tmp . remove ( rowIndex ) ) ; _rowKe...
Move the specified row to the new position .
171
9
41,795
public void swapRows ( Object rowKeyA , Object rowKeyB ) { checkFrozen ( ) ; final int rowIndexA = this . getRowIndex ( rowKeyA ) ; final int rowIndexB = this . getRowIndex ( rowKeyB ) ; final List < R > tmp = new ArrayList <> ( rowLength ( ) ) ; tmp . addAll ( _rowKeySet ) ; final R tmpRowKeyA = tmp . get ( rowIndexA ...
Swap the positions of the two specified rows .
281
10
41,796
public void moveColumn ( Object columnKey , int newColumnIndex ) { checkFrozen ( ) ; this . checkColumnIndex ( newColumnIndex ) ; final int columnIndex = this . getColumnIndex ( columnKey ) ; final List < C > tmp = new ArrayList <> ( columnLength ( ) ) ; tmp . addAll ( _columnKeySet ) ; tmp . add ( newColumnIndex , tmp...
Move the specified column to the new position .
161
9
41,797
public void swapColumns ( Object columnKeyA , Object columnKeyB ) { checkFrozen ( ) ; final int columnIndexA = this . getColumnIndex ( columnKeyA ) ; final int columnIndexB = this . getColumnIndex ( columnKeyB ) ; final List < C > tmp = new ArrayList <> ( rowLength ( ) ) ; tmp . addAll ( _columnKeySet ) ; final C tmpCo...
Swap the positions of the two specified columns .
276
10
41,798
private static int mulPosAndCheck ( final int x , final int y ) { /* assert x>=0 && y>=0; */ final long m = ( long ) x * ( long ) y ; if ( m > Integer . MAX_VALUE ) { throw new ArithmeticException ( "overflow: mulPos" ) ; } return ( int ) m ; }
Multiply two non - negative integers checking for overflow .
78
12
41,799
private static int addAndCheck ( final int x , final int y ) { final long s = ( long ) x + ( long ) y ; if ( s < Integer . MIN_VALUE || s > Integer . MAX_VALUE ) { throw new ArithmeticException ( "overflow: add" ) ; } return ( int ) s ; }
Add two integers checking for overflow .
71
7