idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
36,200
public void addEvents ( Matrix events ) { int seriesCount = getSeriesCount ( ) ; for ( int r = 0 ; r < events . getRowCount ( ) ; r ++ ) { long timestamp = events . getAsLong ( r , 0 ) ; for ( int c = 1 ; c < events . getColumnCount ( ) ; c ++ ) { double value = events . getAsDouble ( r , c ) ; addEvent ( timestamp , s...
Adds the events of a new Matrix to the time series . The first column of the matrix must contain the timestamps .
107
25
36,201
public void fill ( final double [ ] [ ] data , final int startRow , final int startCol ) { final int rows = data . length ; final int cols = data [ 0 ] . length ; verifyTrue ( startRow < rows && startRow < getRowCount ( ) , "illegal startRow: %s" , startRow ) ; verifyTrue ( startCol < cols && startCol < getColumnCount ...
Populate matrix with given data .
232
7
36,202
double [ ] getBlockData ( int row , int column ) { int blockNumber = layout . getBlockNumber ( row , column ) ; double [ ] block = data [ blockNumber ] ; if ( null == block ) { block = new double [ layout . getBlockSize ( row , column ) ] ; data [ blockNumber ] = block ; } return data [ blockNumber ] ; }
Get block holding the specified row and column . If none exist create one .
81
15
36,203
public Matrix mtimes ( Matrix m2 ) { if ( m2 instanceof DenseDoubleMatrix2D ) { final DenseDoubleMatrix2D result = new BlockDenseDoubleMatrix2D ( ( int ) getRowCount ( ) , ( int ) m2 . getColumnCount ( ) , layout . blockStripe , BlockOrder . ROWMAJOR ) ; Mtimes . DENSEDOUBLEMATRIX2D . calc ( this , ( DenseDoubleMatrix2...
Shortcut to create a BlockMatrix for target
130
9
36,204
public static final int nextInteger ( int min , int max ) { return min == max ? min : min + getRandom ( ) . nextInt ( max - min ) ; }
Returns a random value in the desired interval
37
8
36,205
public final < V > SynchronizedGenericMatrix < V > synchronizedMatrix ( GenericMatrix < V > matrix ) { return new SynchronizedGenericMatrix < V > ( matrix ) ; }
Wraps another Matrix so that all methods are executed synchronized .
39
12
36,206
public static boolean canSwapRows ( Matrix matrix , int row1 , int row2 , int col1 ) { boolean response = true ; for ( int col = 0 ; col < col1 ; ++ col ) { if ( 0 == matrix . getAsDouble ( row1 , col ) ) { if ( 0 != matrix . getAsDouble ( row2 , col ) ) { response = false ; break ; } } } return response ; }
Check to see if a non - zero and a zero value in the rows leading up to this column can be swapped . This is part of the bandwidth reduction algorithm .
93
33
36,207
public static boolean canSwapCols ( Matrix matrix , int col1 , int col2 , int row1 ) { boolean response = true ; for ( int row = row1 + 1 ; row < matrix . getRowCount ( ) ; ++ row ) { if ( 0 == matrix . getAsDouble ( row , col1 ) ) { if ( 0 != matrix . getAsDouble ( row , col2 ) ) { response = false ; break ; } } } ret...
Check to see if columns can be swapped - part of the bandwidth reduction algorithm .
101
16
36,208
public static Matrix reduce ( Matrix source ) { Matrix response = Matrix . Factory . zeros ( source . getRowCount ( ) , 1 ) ; for ( int row = 0 ; row < source . getRowCount ( ) ; ++ row ) { response . setAsDouble ( row , row , 0 ) ; } return source . getRowCount ( ) == source . getColumnCount ( ) ? Ginv . reduce ( sour...
Mathematical operator to reduce the bandwidth of a HusoMatrix . The HusoMatrix must be a square HusoMatrix or no operations are performed .
95
31
36,209
public Matrix [ ] svd ( ) { GMatrix m = ( GMatrix ) matrix . clone ( ) ; int nrows = ( int ) getRowCount ( ) ; int ncols = ( int ) getColumnCount ( ) ; GMatrix u = new GMatrix ( nrows , nrows ) ; GMatrix s = new GMatrix ( nrows , ncols ) ; GMatrix v = new GMatrix ( ncols , ncols ) ; m . SVD ( u , s , v ) ; Matrix U = n...
in S all entries on the diagonal are 1
180
9
36,210
public Matrix [ ] lu ( ) { if ( isSquare ( ) ) { GMatrix m = ( GMatrix ) matrix . clone ( ) ; GMatrix lu = ( GMatrix ) matrix . clone ( ) ; GVector piv = new GVector ( matrix . getNumCol ( ) ) ; m . LUD ( lu , piv ) ; Matrix l = new VecMathDenseDoubleMatrix2D ( lu ) . tril ( Ret . NEW , 0 ) ; for ( int i = ( int ) l . ...
non - singular matrices only
302
6
36,211
private int selectBlocksPerTaskDimJ ( int blockStripe , int iMax , int jMax , int kMax ) { int adjust = ( jMax % blockStripe > 0 ) ? 1 : 0 ; if ( jMax < ( 5 * blockStripe ) || jMax <= iMax ) { // do not break this dimension into parallel tasks return jMax / blockStripe + adjust ; } else { // assume 2 parallel tasks ret...
- if set too large then may not fully exploit parallelism
130
12
36,212
public String initializedGroupStatus ( ) throws Exception { String status = null ; if ( clusteringEnabled ) { initClusterNodeStatus ( ) ; status = updateNodeStatus ( ) ; } return status ; }
Called from ClusterSyncManagerLeaderListener
43
8
36,213
@ Override @ SuppressWarnings ( "unchecked" ) protected void restoreState ( Object [ ] objects ) { if ( objects != null && objects . length != 0 ) { variable = ( Variable ) objects [ 0 ] ; constants = ( List < Variable > ) objects [ 1 ] ; lastObjectHash = ( Map < String , Object > ) objects [ 2 ] ; } }
This method is used to restore from the persisted state
81
10
36,214
private static final long gatherLongLE ( final byte [ ] data , final int index ) { int i1 = gatherIntLE ( data , index ) ; long l2 = gatherIntLE ( data , index + 4 ) ; return uintToLong ( i1 ) | ( l2 << 32 ) ; }
gather a long from the specified index into the byte array
64
12
36,215
private static final long gatherPartialLongLE ( final byte [ ] data , final int index , final int available ) { if ( available >= 4 ) { int i = gatherIntLE ( data , index ) ; long l = uintToLong ( i ) ; int left = available - 4 ; if ( left == 0 ) { return l ; } int i2 = gatherPartialIntLE ( data , index + 4 , left ) ; ...
gather a partial long from the specified index using the specified number of bytes into the byte array
134
19
36,216
private static final int gatherIntLE ( final byte [ ] data , final int index ) { int i = data [ index ] & 0xFF ; i |= ( data [ index + 1 ] & 0xFF ) << 8 ; i |= ( data [ index + 2 ] & 0xFF ) << 16 ; i |= ( data [ index + 3 ] << 24 ) ; return i ; }
gather an int from the specified index into the byte array
85
12
36,217
private static final int gatherPartialIntLE ( final byte [ ] data , final int index , final int available ) { int i = data [ index ] & 0xFF ; if ( available > 1 ) { i |= ( data [ index + 1 ] & 0xFF ) << 8 ; if ( available > 2 ) { i |= ( data [ index + 2 ] & 0xFF ) << 16 ; } } return i ; }
gather a partial int from the specified index using the specified number of bytes into the byte array
93
19
36,218
public static Map < Method , Method > findManagedMethods ( Class < ? > clazz ) { Map < Method , Method > result = new HashMap <> ( ) ; // gather all publicly available methods // this returns everything, even if it's declared in a parent for ( Method method : clazz . getMethods ( ) ) { // skip methods that are used int...
Find methods that are tagged as managed somewhere in the hierarchy
172
11
36,219
public Map < String , Exception > unexportAllAndReportMissing ( ) { Map < String , Exception > errors = new HashMap <> ( ) ; synchronized ( exportedObjects ) { List < ObjectName > toRemove = new ArrayList <> ( exportedObjects . size ( ) ) ; for ( ObjectName objectName : exportedObjects . keySet ( ) ) { try { server . u...
Unexports all MBeans that have been exported through this MBeanExporter .
194
19
36,220
public static int byteArrayToInt ( final byte [ ] byteArray , final int startPos , final int length ) { if ( byteArray == null ) { throw new IllegalArgumentException ( "Parameter 'byteArray' cannot be null" ) ; } if ( length <= 0 || length > 4 ) { throw new IllegalArgumentException ( "Length must be between 1 and 4. Le...
Method used to convert byte array to int
176
8
36,221
private static String formatByte ( final byte [ ] pByte , final boolean pSpace , final boolean pTruncate ) { String result ; if ( pByte == null ) { result = "" ; } else { int i = 0 ; if ( pTruncate ) { while ( i < pByte . length && pByte [ i ] == 0 ) { i ++ ; } } if ( i < pByte . length ) { int sizeMultiplier = pSpace ...
Private method to format bytes to hexa string
321
9
36,222
public static byte [ ] fromString ( final String pData ) { if ( pData == null ) { throw new IllegalArgumentException ( "Argument can't be null" ) ; } StringBuilder sb = new StringBuilder ( pData ) ; int j = 0 ; for ( int i = 0 ; i < sb . length ( ) ; i ++ ) { if ( ! Character . isWhitespace ( sb . charAt ( i ) ) ) { sb...
Method to get bytes form string
272
6
36,223
public static boolean matchBitByBitIndex ( final int pVal , final int pBitIndex ) { if ( pBitIndex < 0 || pBitIndex > MAX_BIT_INTEGER ) { throw new IllegalArgumentException ( "parameter 'pBitIndex' must be between 0 and 31. pBitIndex=" + pBitIndex ) ; } return ( pVal & 1 << pBitIndex ) != 0 ; }
Test if bit at given index of given value is = 1 .
90
13
36,224
public static byte setBit ( final byte pData , final int pBitIndex , final boolean pOn ) { if ( pBitIndex < 0 || pBitIndex > 7 ) { throw new IllegalArgumentException ( "parameter 'pBitIndex' must be between 0 and 7. pBitIndex=" + pBitIndex ) ; } byte ret = pData ; if ( pOn ) { // Set bit ret |= 1 << pBitIndex ; } else ...
Method used to set a bit index to 1 or 0 .
119
12
36,225
public static String toBinary ( final byte [ ] pBytes ) { String ret = null ; if ( pBytes != null && pBytes . length > 0 ) { BigInteger val = new BigInteger ( bytesToStringNoSpace ( pBytes ) , HEXA ) ; StringBuilder build = new StringBuilder ( val . toString ( 2 ) ) ; // left pad with 0 to fit byte size for ( int i = b...
Convert byte array to binary String
139
7
36,226
public byte [ ] getData ( ) { byte [ ] ret = new byte [ byteTab . length ] ; System . arraycopy ( byteTab , 0 , ret , 0 , byteTab . length ) ; return ret ; }
Method to get all data
47
5
36,227
public byte getMask ( final int pIndex , final int pLength ) { byte ret = ( byte ) DEFAULT_VALUE ; // Add X 0 to the left ret = ( byte ) ( ret << pIndex ) ; ret = ( byte ) ( ( ret & DEFAULT_VALUE ) >> pIndex ) ; // Add X 0 to the right int dec = BYTE_SIZE - ( pLength + pIndex ) ; if ( dec > 0 ) { ret = ( byte ) ( ret >...
This method is used to get a mask dynamically
122
9
36,228
public byte [ ] getNextByte ( final int pSize , final boolean pShift ) { byte [ ] tab = new byte [ ( int ) Math . ceil ( pSize / BYTE_SIZE_F ) ] ; if ( currentBitIndex % BYTE_SIZE != 0 ) { int index = 0 ; int max = currentBitIndex + pSize ; while ( currentBitIndex < max ) { int mod = currentBitIndex % BYTE_SIZE ; int m...
Method to get The next bytes with the specified size
434
10
36,229
public Date getNextDate ( final int pSize , final String pPattern , final boolean pUseBcd ) { Date date = null ; // create date formatter SimpleDateFormat sdf = new SimpleDateFormat ( pPattern ) ; // get String String dateTxt = null ; if ( pUseBcd ) { dateTxt = getNextHexaString ( pSize ) ; } else { dateTxt = getNextSt...
Method to get the next date
155
6
36,230
public long getNextLongSigned ( final int pLength ) { if ( pLength > Long . SIZE ) { throw new IllegalArgumentException ( "Long overflow with length > 64" ) ; } long decimal = getNextLong ( pLength ) ; long signMask = 1 << pLength - 1 ; if ( ( decimal & signMask ) != 0 ) { return - ( signMask - ( signMask ^ decimal ) )...
Method used to get get a signed long with the specified size
96
12
36,231
public long getNextLong ( final int pLength ) { // allocate Size of Integer ByteBuffer buffer = ByteBuffer . allocate ( BYTE_SIZE * 2 ) ; // final value long finalValue = 0 ; // Incremental value long currentValue = 0 ; // Size to read int readSize = pLength ; // length max of the index int max = currentBitIndex + pLen...
This method is used to get a long with the specified size
305
12
36,232
public String getNextString ( final int pSize , final Charset pCharset ) { return new String ( getNextByte ( pSize , true ) , pCharset ) ; }
This method is used to get the next String with the specified size
42
13
36,233
public void resetNextBits ( final int pLength ) { int max = currentBitIndex + pLength ; while ( currentBitIndex < max ) { int mod = currentBitIndex % BYTE_SIZE ; int length = Math . min ( max - currentBitIndex , BYTE_SIZE - mod ) ; byteTab [ currentBitIndex / BYTE_SIZE ] &= ~ getMask ( mod , length ) ; currentBitIndex ...
Set to 0 the next N bits
96
7
36,234
public void setNextByte ( final byte [ ] pValue , final int pLength , final boolean pPadBefore ) { int totalSize = ( int ) Math . ceil ( pLength / BYTE_SIZE_F ) ; ByteBuffer buffer = ByteBuffer . allocate ( totalSize ) ; int size = Math . max ( totalSize - pValue . length , 0 ) ; if ( pPadBefore ) { for ( int i = 0 ; i...
Method to write bytes with the max length
422
8
36,235
public void setNextDate ( final Date pValue , final String pPattern , final boolean pUseBcd ) { // create date formatter SimpleDateFormat sdf = new SimpleDateFormat ( pPattern ) ; String value = sdf . format ( pValue ) ; if ( pUseBcd ) { setNextHexaString ( value , value . length ( ) * 4 ) ; } else { setNextString ( va...
Method to write a date
102
5
36,236
public void setNextLong ( final long pValue , final int pLength ) { if ( pLength > Long . SIZE ) { throw new IllegalArgumentException ( "Long overflow with length > 64" ) ; } setNextValue ( pValue , pLength , Long . SIZE - 1 ) ; }
Add Long to the current position with the specified size
65
10
36,237
protected void setNextValue ( final long pValue , final int pLength , final int pMaxSize ) { long value = pValue ; // Set to max value if pValue cannot be stored on pLength bits. long bitMax = ( long ) Math . pow ( 2 , Math . min ( pLength , pMaxSize ) ) ; if ( pValue > bitMax ) { value = bitMax - 1 ; } // size to wrot...
Add Value to the current position with the specified size
273
10
36,238
public void setNextInteger ( final int pValue , final int pLength ) { if ( pLength > Integer . SIZE ) { throw new IllegalArgumentException ( "Integer overflow with length > 32" ) ; } setNextValue ( pValue , pLength , Integer . SIZE - 1 ) ; }
Add Integer to the current position with the specified size
65
10
36,239
public void setNextString ( final String pValue , final int pLength , final boolean pPaddedBefore ) { setNextByte ( pValue . getBytes ( Charset . defaultCharset ( ) ) , pLength , pPaddedBefore ) ; }
Method to write a String
56
5
36,240
public void setResult ( R result ) { try { lock . lock ( ) ; this . result = result ; notifyHaveResult ( ) ; } finally { lock . unlock ( ) ; } }
Set the result value and notify about operation completion .
40
10
36,241
public void failure ( Throwable failure ) { try { lock . lock ( ) ; this . failure = failure ; notifyHaveResult ( ) ; } finally { lock . unlock ( ) ; } }
Notify about the failure occured during asynchronous operation execution .
40
12
36,242
void clean ( QNode pred , QNode s ) { Thread w = s . waiter ; if ( w != null ) { // Wake up thread s . waiter = null ; if ( w != Thread . currentThread ( ) ) { LockSupport . unpark ( w ) ; } } /* * At any given time, exactly one node on list cannot be * deleted -- the last inserted node. To accommodate this, if * we ca...
Gets rid of cancelled node s with original predecessor pred .
272
12
36,243
private QNode reclean ( ) { /* * cleanMe is, or at one time was, predecessor of cancelled * node s that was the tail so could not be unspliced. If s * is no longer the tail, try to unsplice if necessary and * make cleanMe slot available. This differs from similar * code in clean() because we must check that pred still ...
Tries to unsplice the cancelled node held in cleanMe that was previously uncleanable because it was at tail .
244
25
36,244
static StorageCache initCache ( Configuration configuration ) { if ( configuration . getBoolean ( Configuration . CACHE_ENABLED ) && configuration . getLong ( Configuration . CACHE_BYTES ) > 0 ) { return new StorageCache ( configuration ) ; } else { return new DisabledCache ( ) ; } }
Factory to create and initialize the cache .
68
8
36,245
public synchronized void registerSerializer ( Serializer serializer ) { Class objClass = getSerializerType ( serializer ) ; if ( ! serializers . containsKey ( objClass ) ) { int index = COUNTER . getAndIncrement ( ) ; serializers . put ( objClass , new SerializerWrapper ( index , serializer ) ) ; if ( serializersArray ...
Registers the serializer .
173
6
36,246
static void serialize ( DataOutput out , Serializers serializers ) throws IOException { StringBuilder msg = new StringBuilder ( String . format ( "Serialize %d serializer classes:" , serializers . serializers . values ( ) . size ( ) ) ) ; int size = serializers . serializers . values ( ) . size ( ) ; out . writeInt ( s...
Serializes this class into a data output .
187
9
36,247
private void readObject ( ObjectInputStream in ) throws IOException , ClassNotFoundException { // Init COUNTER = new AtomicInteger ( ) ; serializers = new HashMap < Class , SerializerWrapper > ( ) ; serializersArray = new Serializer [ 0 ] ; deserialize ( in , this ) ; }
Deserializes this instance from an input stream .
68
10
36,248
static void deserialize ( DataInput in , Serializers serializers ) throws IOException , ClassNotFoundException { int size = in . readInt ( ) ; if ( size > 0 ) { StringBuilder msg = new StringBuilder ( String . format ( "Deserialize %d serializer classes:" , size ) ) ; if ( serializers . serializersArray . length < size...
Deserializes this class from a data input .
349
10
36,249
Serializer getSerializer ( int index ) { if ( index >= serializersArray . length ) { throw new IllegalArgumentException ( String . format ( "The serializer can't be found at index %d" , index ) ) ; } return serializersArray [ index ] ; }
Returns the serializer given the index .
60
8
36,250
private static Class < ? > getSerializerType ( Object instance ) { Type type = instance . getClass ( ) . getGenericInterfaces ( ) [ 0 ] ; if ( type instanceof ParameterizedType ) { Class < ? > cls = null ; Type clsType = ( ( ParameterizedType ) type ) . getActualTypeArguments ( ) [ 0 ] ; if ( clsType instanceof Generic...
Returns the serializer s generic type .
243
8
36,251
public byte [ ] get ( byte [ ] key ) throws IOException { int keyLength = key . length ; if ( keyLength >= slots . length || keyCounts [ keyLength ] == 0 ) { return null ; } long hash = ( long ) hashUtils . hash ( key ) ; int numSlots = slots [ keyLength ] ; int slotSize = slotSizes [ keyLength ] ; int indexOffset = in...
Get the value for the given key or null
252
9
36,252
public void close ( ) throws IOException { channel . close ( ) ; mappedFile . close ( ) ; indexBuffer = null ; dataBuffers = null ; mappedFile = null ; channel = null ; System . gc ( ) ; }
Close the reader channel
50
4
36,253
private byte [ ] getMMapBytes ( long offset ) throws IOException { //Read the first 4 bytes to get the size of the data ByteBuffer buf = getDataBuffer ( offset ) ; int maxLen = ( int ) Math . min ( 5 , dataSize - offset ) ; int size ; if ( buf . remaining ( ) >= maxLen ) { //Continuous read int pos = buf . position ( )...
Read the data at the given offset the data can be spread over multiple data buffers
371
16
36,254
private byte [ ] getDiskBytes ( long offset ) throws IOException { mappedFile . seek ( dataOffset + offset ) ; //Get size of data int size = LongPacker . unpackInt ( mappedFile ) ; //Create output bytes byte [ ] res = new byte [ size ] ; //Read data if ( mappedFile . read ( res ) == - 1 ) { throw new EOFException ( ) ;...
Get data from disk
91
4
36,255
private ByteBuffer getDataBuffer ( long index ) { ByteBuffer buf = dataBuffers [ ( int ) ( index / segmentSize ) ] ; buf . position ( ( int ) ( index % segmentSize ) ) ; return buf ; }
Return the data buffer for the given position
49
8
36,256
private void ensureAvail ( int n ) { if ( pos + n >= buf . length ) { int newSize = Math . max ( pos + n , buf . length * 2 ) ; buf = Arrays . copyOf ( buf , newSize ) ; } }
make sure there will be enought space in buffer to write N bytes
56
14
36,257
static public int unpackInt ( DataInput is ) throws IOException { for ( int offset = 0 , result = 0 ; offset < 32 ; offset += 7 ) { int b = is . readUnsignedByte ( ) ; result |= ( b & 0x7F ) << offset ; if ( ( b & 0x80 ) == 0 ) { return result ; } } throw new Error ( "Malformed integer." ) ; }
Unpack positive int value from the input stream .
91
10
36,258
static public int unpackInt ( ByteBuffer bb ) throws IOException { for ( int offset = 0 , result = 0 ; offset < 32 ; offset += 7 ) { int b = bb . get ( ) & 0xffff ; result |= ( b & 0x7F ) << offset ; if ( ( b & 0x80 ) == 0 ) { return result ; } } throw new Error ( "Malformed integer." ) ; }
Unpack positive int value from the input byte buffer .
94
11
36,259
private void mergeFiles ( List < File > inputFiles , OutputStream outputStream ) throws IOException { long startTime = System . nanoTime ( ) ; //Merge files for ( File f : inputFiles ) { if ( f . exists ( ) ) { FileInputStream fileInputStream = new FileInputStream ( f ) ; BufferedInputStream bufferedInputStream = new B...
Merge files to the provided fileChannel
275
8
36,260
private DataOutputStream getDataStream ( int keyLength ) throws IOException { // Resize array if necessary if ( dataStreams . length <= keyLength ) { dataStreams = Arrays . copyOf ( dataStreams , keyLength + 1 ) ; dataFiles = Arrays . copyOf ( dataFiles , keyLength + 1 ) ; } DataOutputStream dos = dataStreams [ keyLeng...
Get the data stream for the specified keyLength create it if needed
187
13
36,261
private DataOutputStream getIndexStream ( int keyLength ) throws IOException { // Resize array if necessary if ( indexStreams . length <= keyLength ) { indexStreams = Arrays . copyOf ( indexStreams , keyLength + 1 ) ; indexFiles = Arrays . copyOf ( indexFiles , keyLength + 1 ) ; keyCounts = Arrays . copyOf ( keyCounts ...
Get the index stream for the specified keyLength create it if needed
285
13
36,262
static int execute ( Arg arguments , PrintStream stream , PrintStream errorStream ) { if ( arguments == null ) { return 2 ; } if ( arguments . checkBcryptHash != null ) { // verify mode BCrypt . Result result = BCrypt . verifyer ( ) . verify ( arguments . password , arguments . checkBcryptHash ) ; if ( ! result . valid...
Execute the given arguments and executes the appropriate actions
242
10
36,263
public static Hasher with ( Version version , SecureRandom secureRandom , LongPasswordStrategy longPasswordStrategy ) { return new Hasher ( version , secureRandom , longPasswordStrategy ) ; }
Create a new instance with custom version secureRandom and long password strategy
41
13
36,264
private static int streamToWord ( byte [ ] data , int [ ] offp ) { int i ; int word = 0 ; int off = offp [ 0 ] ; for ( i = 0 ; i < 4 ; i ++ ) { word = ( word << 8 ) | ( data [ off ] & 0xff ) ; off = ( off + 1 ) % data . length ; } offp [ 0 ] = off ; return word ; }
Cyclically extract a word of key material
93
9
36,265
private void encipher ( int [ ] P , int [ ] S , int [ ] lr , int off ) { int i , n , l = lr [ off ] , r = lr [ off + 1 ] ; l ^= P [ 0 ] ; for ( i = 0 ; i <= BLOWFISH_NUM_ROUNDS - 2 ; ) { // Feistel substitution on left word n = S [ ( l >> 24 ) & 0xff ] ; n += S [ 0x100 | ( ( l >> 16 ) & 0xff ) ] ; n ^= S [ 0x200 | ( ( ...
Blowfish encipher a single 64 - bit block encoded as two 32 - bit halves
295
18
36,266
protected void expand ( int min_size_needed ) { LogEntry [ ] new_entries = new LogEntry [ Math . max ( entries . length + INCR , entries . length + min_size_needed ) ] ; System . arraycopy ( entries , 0 , new_entries , 0 , entries . length ) ; entries = new_entries ; }
Lock must be held to call this method
77
8
36,267
public V remove ( K key ) throws Exception { return invoke ( REMOVE , key , null , true ) ; }
Removes a key - value pair from the state machine . The data is not removed directly from the hashmap but an update is sent via RAFT and the actual removal from the hashmap is only done when that change has been committed .
25
48
36,268
public void printMetadata ( ) throws Exception { log . info ( "-----------------" ) ; log . info ( "RAFT Log Metadata" ) ; log . info ( "-----------------" ) ; byte [ ] firstAppendedBytes = db . get ( FIRSTAPPENDED ) ; log . info ( "First Appended: %d" , fromByteArrayToInt ( firstAppendedBytes ) ) ; byte [ ] lastAppend...
Useful in debugging
254
4
36,269
public Counter getOrCreateCounter ( String name , long initial_value ) throws Exception { Object existing_value = allow_dirty_reads ? _get ( name ) : invoke ( Command . get , name , false ) ; if ( existing_value != null ) counters . put ( name , ( Long ) existing_value ) ; else { Object retval = invoke ( Command . crea...
Returns an existing counter or creates a new one if none exists
122
12
36,270
protected int getFirstIndexOfConflictingTerm ( int start_index , int conflicting_term ) { Log log = raft . log_impl ; int first = Math . max ( 1 , log . firstAppended ( ) ) , last = log . lastAppended ( ) ; int retval = Math . min ( start_index , last ) ; for ( int i = retval ; i >= first ; i -- ) { LogEntry entry = lo...
Finds the first index at which conflicting_term starts going back from start_index towards the head of the log
128
23
36,271
public static boolean isNumber ( JsonNode node , boolean isTypeLoose ) { if ( node . isNumber ( ) ) { return true ; } else if ( isTypeLoose ) { if ( TypeFactory . getValueNodeType ( node ) == JsonType . STRING ) { return isNumeric ( node . textValue ( ) ) ; } } return false ; }
Check if the type of the JsonNode s value is number based on the status of typeLoose flag .
81
23
36,272
private boolean isTypeLooseContainsInEnum ( JsonNode node ) { if ( TypeFactory . getValueNodeType ( node ) == JsonType . STRING ) { String nodeText = node . textValue ( ) ; for ( JsonNode n : nodes ) { String value = n . asText ( ) ; if ( value != null && value . equals ( nodeText ) ) { return true ; } } } return false...
Check whether enum contains the value of the JsonNode if the typeLoose is enabled .
95
19
36,273
public Writer sheet ( String sheetName ) { if ( StringUtil . isEmpty ( sheetName ) ) { throw new IllegalArgumentException ( "sheet cannot be empty" ) ; } this . sheetName = sheetName ; return this ; }
Configure the name of the sheet to be written . The default is Sheet0 .
51
17
36,274
public Writer withTemplate ( File template ) { if ( null == template || ! template . exists ( ) ) { throw new IllegalArgumentException ( "template file not exist" ) ; } this . template = template ; return this ; }
Specify to write an Excel table from a template file
49
11
36,275
public void to ( File file ) throws WriterException { try { this . to ( new FileOutputStream ( file ) ) ; } catch ( FileNotFoundException e ) { throw new WriterException ( e ) ; } }
Write an Excel document to a file
46
7
36,276
public void to ( OutputStream outputStream ) throws WriterException { if ( ! withRaw && ( null == rows || rows . isEmpty ( ) ) ) { throw new WriterException ( "write rows cannot be empty, please check it" ) ; } if ( excelType == ExcelType . XLSX ) { new WriterWith2007 ( outputStream ) . writeSheet ( this ) ; } if ( exc...
Write an Excel document to the output stream
141
8
36,277
public Reader < T > from ( File fromFile ) { if ( null == fromFile || ! fromFile . exists ( ) ) { throw new IllegalArgumentException ( "excel file must be exist" ) ; } this . fromFile = fromFile ; return this ; }
Read row data from an Excel file
58
7
36,278
public Reader < T > sheet ( String sheetName ) { if ( StringUtil . isEmpty ( sheetName ) ) { throw new IllegalArgumentException ( "sheet cannot be empty" ) ; } this . sheetName = sheetName ; return this ; }
Set the name of the sheet to be read . If you set the name sheet will be invalid .
54
20
36,279
public Stream < T > asStream ( ) { if ( modelType == null ) { throw new IllegalArgumentException ( "modelType can be not null" ) ; } if ( fromFile == null && fromStream == null ) { throw new IllegalArgumentException ( "Excel source not is null" ) ; } if ( fromFile != null ) { return ReaderFactory . readByFile ( this ) ...
Return the read result as a Stream
102
7
36,280
public List < T > asList ( ) throws ReaderException { Stream < T > stream = this . asStream ( ) ; return stream . collect ( toList ( ) ) ; }
Convert the read result to a List
38
8
36,281
private static void applyTypeface ( ViewGroup viewGroup , TypefaceCollection typefaceCollection ) { for ( int i = 0 ; i < viewGroup . getChildCount ( ) ; i ++ ) { View childView = viewGroup . getChildAt ( i ) ; if ( childView instanceof ViewGroup ) { applyTypeface ( ( ViewGroup ) childView , typefaceCollection ) ; } el...
Apply typeface to all ViewGroup childs
100
9
36,282
private static void applyForView ( View view , TypefaceCollection typefaceCollection ) { if ( view instanceof TextView ) { TextView textView = ( TextView ) view ; Typeface oldTypeface = textView . getTypeface ( ) ; final int style = oldTypeface == null ? Typeface . NORMAL : oldTypeface . getStyle ( ) ; textView . setTy...
Apply typeface to single view
129
6
36,283
public PermissionProfile createPermissionProfile ( String accountId , PermissionProfile permissionProfile ) throws ApiException { return createPermissionProfile ( accountId , permissionProfile , null ) ; }
Creates a new permission profile in the specified account .
40
11
36,284
public Brand getBrand ( String accountId , String brandId ) throws ApiException { return getBrand ( accountId , brandId , null ) ; }
Get information for a specific brand .
32
7
36,285
public PermissionProfile getPermissionProfile ( String accountId , String permissionProfileId ) throws ApiException { return getPermissionProfile ( accountId , permissionProfileId , null ) ; }
Returns a permissions profile in the specified account .
40
9
36,286
public ConsumerDisclosure updateConsumerDisclosure ( String accountId , String langCode , ConsumerDisclosure consumerDisclosure ) throws ApiException { return updateConsumerDisclosure ( accountId , langCode , consumerDisclosure , null ) ; }
Update Consumer Disclosure .
49
4
36,287
public CustomFields updateCustomField ( String accountId , String customFieldId , CustomField customField ) throws ApiException { return updateCustomField ( accountId , customFieldId , customField , null ) ; }
Updates an existing account custom field .
46
8
36,288
public PermissionProfile updatePermissionProfile ( String accountId , String permissionProfileId , PermissionProfile permissionProfile ) throws ApiException { return updatePermissionProfile ( accountId , permissionProfileId , permissionProfile , null ) ; }
Updates a permission profile within the specified account .
49
10
36,289
public CloudStorageProviders getProvider ( String accountId , String userId , String serviceId ) throws ApiException { return getProvider ( accountId , userId , serviceId , null ) ; }
Gets the specified Cloud Storage Provider configuration for the User . Retrieves the list of cloud storage providers enabled for the account and the configuration information for the user .
42
33
36,290
public ExternalFolder listFolders ( String accountId , String userId , String serviceId ) throws ApiException { return listFolders ( accountId , userId , serviceId , null ) ; }
Retrieves a list of all the items in a specified folder from the specified cloud storage provider . Retrieves a list of all the items in a specified folder from the specified cloud storage provider .
44
40
36,291
public BulkEnvelopeStatus get ( String accountId , String batchId ) throws ApiException { return get ( accountId , batchId , null ) ; }
Gets the status of a specified bulk send operation . Retrieves the status information of a single bulk recipient batch . A bulk recipient batch is the set of envelopes sent from a single bulk recipient file .
34
42
36,292
public BulkRecipientsResponse getRecipients ( String accountId , String envelopeId , String recipientId ) throws ApiException { return getRecipients ( accountId , envelopeId , recipientId , null ) ; }
Gets the bulk recipient file from an envelope . Retrieves the bulk recipient file information from an envelope that has a bulk recipient .
47
27
36,293
public ChunkedUploadResponse getChunkedUpload ( String accountId , String chunkedUploadId ) throws ApiException { return getChunkedUpload ( accountId , chunkedUploadId , null ) ; }
Retrieves the current metadata of a ChunkedUpload .
46
13
36,294
public ConsumerDisclosure getConsumerDisclosureDefault ( String accountId , String envelopeId , String recipientId ) throws ApiException { return getConsumerDisclosureDefault ( accountId , envelopeId , recipientId , null ) ; }
Gets the Electronic Record and Signature Disclosure associated with the account . Retrieves the Electronic Record and Signature Disclosure with html formatting associated with the account . You can use an optional query string to set the language for the disclosure .
47
45
36,295
public byte [ ] getDocumentPageImage ( String accountId , String envelopeId , String documentId , String pageNumber ) throws ApiException { return getDocumentPageImage ( accountId , envelopeId , documentId , pageNumber , null ) ; }
Gets a page image from an envelope for display . Retrieves a page image for display from the specified envelope .
52
24
36,296
public Envelope getEnvelope ( String accountId , String envelopeId ) throws ApiException { return getEnvelope ( accountId , envelopeId , null ) ; }
Gets the status of a envelope . Retrieves the overall status for the specified envelope .
38
19
36,297
public Tabs listTabs ( String accountId , String envelopeId , String recipientId ) throws ApiException { return listTabs ( accountId , envelopeId , recipientId , null ) ; }
Gets the tabs information for a signer or sign - in - person recipient in an envelope . Retrieves information about the tabs associated with a recipient in a draft envelope .
42
36
36,298
public TemplateInformation listTemplates ( String accountId , String envelopeId ) throws ApiException { return listTemplates ( accountId , envelopeId , null ) ; }
Get List of Templates used in an Envelope This returns a list of the server - side templates their name and ID used in an envelope .
35
30
36,299
public TemplateInformation listTemplatesForDocument ( String accountId , String envelopeId , String documentId ) throws ApiException { return listTemplatesForDocument ( accountId , envelopeId , documentId , null ) ; }
Gets the templates associated with a document in an existing envelope . Retrieves the templates associated with a document in the specified envelope .
46
27