idx
int64 0
34.9k
| question
stringlengths 12
26.4k
| target
stringlengths 15
2.3k
|
---|---|---|
34,400 | @ Override public void onBackup ( ParcelFileDescriptor oldState , BackupDataOutput data , ParcelFileDescriptor newState ) throws IOException { long savedFileSize = - 1 ; long savedCrc = - 1 ; int savedVersion = - 1 ; DataInputStream in = new DataInputStream ( new FileInputStream ( oldState . getFileDescriptor ( ) ) ) ; try { savedFileSize = in . readLong ( ) ; savedCrc = in . readLong ( ) ; savedVersion = in . readInt ( ) ; } catch ( EOFException e ) { return ; } finally { if ( in != null ) { in . close ( ) ; } } writeBackupState ( savedFileSize , savedCrc , newState ) ; } | This simply preserves the existing state as we now prefer Chrome Sync to handle bookmark backup. |
34,401 | public static boolean isAssociatedToAnyRpVplexTypes ( Volume volume , DbClient dbClient ) { return isAssociatedToRpVplexType ( volume , dbClient , PersonalityTypes . SOURCE , PersonalityTypes . TARGET , PersonalityTypes . METADATA ) ; } | Determines if a Volume is being referenced as an associated volume by an RP+VPlex volume of any personality type (SOURCE, TARGET, METADATA). |
34,402 | private void readObject ( ObjectInputStream oos ) throws IOException , ClassNotFoundException { iInstant = ( MutableDateTime ) oos . readObject ( ) ; DateTimeFieldType type = ( DateTimeFieldType ) oos . readObject ( ) ; iField = type . getField ( iInstant . getChronology ( ) ) ; } | Reads the property from a safe serialization format. |
34,403 | private void expandTo ( int size ) { final double [ ] tempArray = new double [ size ] ; System . arraycopy ( internalArray , 0 , tempArray , 0 , internalArray . length ) ; internalArray = tempArray ; } | Expands the internal storage array to the specified size. |
34,404 | private void save ( char ch ) { updateCoordinates ( ch ) ; _saved . append ( ch ) ; } | Saves specified character to the temporary buffer. |
34,405 | private static DecoderResult createDecoderResultFromAmbiguousValues ( int ecLevel , int [ ] codewords , int [ ] erasureArray , int [ ] ambiguousIndexes , int [ ] [ ] ambiguousIndexValues ) throws FormatException , ChecksumException { int [ ] ambiguousIndexCount = new int [ ambiguousIndexes . length ] ; int tries = 100 ; while ( tries -- > 0 ) { for ( int i = 0 ; i < ambiguousIndexCount . length ; i ++ ) { codewords [ ambiguousIndexes [ i ] ] = ambiguousIndexValues [ i ] [ ambiguousIndexCount [ i ] ] ; } try { return decodeCodewords ( codewords , ecLevel , erasureArray ) ; } catch ( ChecksumException ignored ) { } if ( ambiguousIndexCount . length == 0 ) { throw ChecksumException . getChecksumInstance ( ) ; } for ( int i = 0 ; i < ambiguousIndexCount . length ; i ++ ) { if ( ambiguousIndexCount [ i ] < ambiguousIndexValues [ i ] . length - 1 ) { ambiguousIndexCount [ i ] ++ ; break ; } else { ambiguousIndexCount [ i ] = 0 ; if ( i == ambiguousIndexCount . length - 1 ) { throw ChecksumException . getChecksumInstance ( ) ; } } } } throw ChecksumException . getChecksumInstance ( ) ; } | This method deals with the fact, that the decoding process doesn't always yield a single most likely value. The current error correction implementation doesn't deal with erasures very well, so it's better to provide a value for these ambiguous codewords instead of treating it as an erasure. The problem is that we don't know which of the ambiguous values to choose. We try decode using the first value, and if that fails, we use another of the ambiguous values and try to decode again. This usually only happens on very hard to read and decode barcodes, so decoding the normal barcodes is not affected by this. |
34,406 | private boolean positionSign ( Entity sign ) { for ( int y = 125 ; y <= 127 ; y ++ ) { for ( int x = 80 ; x > 51 ; x -- ) { if ( ! zone . collides ( sign , x , y ) ) { sign . setPosition ( x , y ) ; zone . add ( sign ) ; return true ; } } } return false ; } | position the sign at an empty spot |
34,407 | public static void touch ( File file ) throws IOException { if ( ! file . exists ( ) ) { OutputStream out = openOutputStream ( file ) ; IOUtils . closeQuietly ( out ) ; } boolean success = file . setLastModified ( System . currentTimeMillis ( ) ) ; if ( ! success ) { throw new IOException ( "Unable to set the last modification time for " + file ) ; } } | Implements the same behaviour as the "touch" utility on Unix. It creates a new file with size 0 or, if the file exists already, it is opened and closed without modifying it, but updating the file date and time. <p/> NOTE: As from v1.3, this method throws an IOException if the last modified date of the file cannot be set. Also, as from v1.3 this method creates parent directories if they do not exist. |
34,408 | public void testDivisionKnuthIsNormalized ( ) { byte aBytes [ ] = { - 9 , - 8 , - 7 , - 6 , - 5 , - 4 , - 3 , - 2 , - 1 , 0 , 1 , 2 , 3 , 4 , 5 } ; byte bBytes [ ] = { - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } ; int aSign = - 1 ; int bSign = - 1 ; byte rBytes [ ] = { 0 , - 9 , - 8 , - 7 , - 6 , - 5 , - 4 , - 3 } ; BigInteger aNumber = new BigInteger ( aSign , aBytes ) ; BigInteger bNumber = new BigInteger ( bSign , bBytes ) ; BigInteger result = aNumber . divide ( bNumber ) ; byte resBytes [ ] = new byte [ rBytes . length ] ; resBytes = result . toByteArray ( ) ; for ( int i = 0 ; i < resBytes . length ; i ++ ) { assertTrue ( resBytes [ i ] == rBytes [ i ] ) ; } assertEquals ( "incorrect sign" , 1 , result . signum ( ) ) ; } | Verifies the case when the divisor is already normalized. |
34,409 | public String queryCatalogClassName ( ) { String className = System . getProperty ( pClassname ) ; if ( className == null ) { if ( resources == null ) readProperties ( ) ; if ( resources == null ) return null ; try { return resources . getString ( "catalog-class-name" ) ; } catch ( MissingResourceException e ) { return null ; } } return className ; } | Obtain the Catalog class name setting from the properties. |
34,410 | public String encodeBody ( ) { StringBuffer s = new StringBuffer ( ) ; if ( retryAfter != null ) s . append ( retryAfter ) ; if ( comment != null ) s . append ( SP + LPAREN + comment + RPAREN ) ; if ( ! parameters . isEmpty ( ) ) { s . append ( SEMICOLON + parameters . encode ( ) ) ; } return s . toString ( ) ; } | Encode body of this into cannonical form. |
34,411 | public BatchedImageRequest ( Request < ? > request , ImageContainer container ) { mRequest = request ; mContainers . add ( container ) ; } | Constructs a new BatchedImageRequest object |
34,412 | public static int findBeforeNewLineChar ( CharSequence s , int start ) { for ( int i = start - 1 ; i > 0 ; i -- ) { if ( s . charAt ( i ) == '\n' ) { return i ; } } return - 1 ; } | find '\n' before "start" position |
34,413 | private AggregatorUtils ( ) { } | Don't instantiate this class. |
34,414 | public void addSubFilter ( SubFilter subFilter ) { subFilters . add ( subFilter ) ; } | Adds a Subfilter to the Main Filter |
34,415 | static Object newInstance ( String className , ClassLoader cl , boolean doFallback ) throws ConfigurationError { try { Class providerClass = findProviderClass ( className , cl , doFallback ) ; Object instance = providerClass . newInstance ( ) ; debugPrintln ( "created new instance of " + providerClass + " using ClassLoader: " + cl ) ; return instance ; } catch ( ClassNotFoundException x ) { throw new ConfigurationError ( "Provider " + className + " not found" , x ) ; } catch ( Exception x ) { throw new ConfigurationError ( "Provider " + className + " could not be instantiated: " + x , x ) ; } } | Create an instance of a class using the specified ClassLoader |
34,416 | @ Override public boolean covers ( Instance datum ) { boolean isCover = true ; for ( int i = 0 ; i < m_Antds . size ( ) ; i ++ ) { Antd antd = m_Antds . get ( i ) ; if ( ! antd . covers ( datum ) ) { isCover = false ; break ; } } return isCover ; } | Whether the instance covered by this rule |
34,417 | private void activatePart ( ) { if ( ! isFocused ( ) ) { setFocus ( true ) ; if ( delegate != null ) { delegate . activatePart ( ) ; } } } | Ensures the view is activated when clicking the mouse. |
34,418 | public static int binarySearch ( float [ ] array , int startIndex , int endIndex , float value ) { checkIndexForBinarySearch ( array . length , startIndex , endIndex ) ; int intBits = Float . floatToIntBits ( value ) ; int low = startIndex , mid = - 1 , high = endIndex - 1 ; while ( low <= high ) { mid = ( low + high ) > > > 1 ; if ( lessThan ( array [ mid ] , value ) ) { low = mid + 1 ; } else if ( intBits == Float . floatToIntBits ( array [ mid ] ) ) { return mid ; } else { high = mid - 1 ; } } if ( mid < 0 ) { int insertPoint = endIndex ; for ( int index = startIndex ; index < endIndex ; index ++ ) { if ( value < array [ index ] ) { insertPoint = index ; } } return - insertPoint - 1 ; } return - mid - ( lessThan ( value , array [ mid ] ) ? 1 : 2 ) ; } | Performs a binary search for the specified element in a part of the specified sorted array. |
34,419 | public static String paddedHashCode ( Object o ) { String s = "0000000000" ; if ( o != null ) { s = PADDED_HASH_FORMAT . format ( o . hashCode ( ) ) ; } return s ; } | Description of the Method |
34,420 | public void addCPItem ( CP cp ) { String uniq = cp . getUniq ( ) ; CP intern ; if ( ( intern = ( CP ) ( cpe . get ( uniq ) ) ) == null ) { cpe . put ( uniq , cp ) ; cp . resolve ( this ) ; } } | This is the method to add CPE items to a class. CPE items for a class are "uniquefied". Ie, if you add a CPE items whose contents already exist in the class, only one entry is finally written out when the class is written. |
34,421 | public static Enumeration < String > listStemmers ( ) { initStemmers ( ) ; return m_Stemmers . elements ( ) ; } | returns an enumeration over all currently stored stemmer names. |
34,422 | public boolean isValid ( ) { return wind != null && condition != null && ! condition . isEmpty ( ) ; } | Determine the validity of the current weather |
34,423 | public String buildUri ( String representationId , int segmentNumber , int bandwidth , long time ) { StringBuilder builder = new StringBuilder ( ) ; for ( int i = 0 ; i < identifierCount ; i ++ ) { builder . append ( urlPieces [ i ] ) ; if ( identifiers [ i ] == REPRESENTATION_ID ) { builder . append ( representationId ) ; } else if ( identifiers [ i ] == NUMBER_ID ) { builder . append ( String . format ( identifierFormatTags [ i ] , segmentNumber ) ) ; } else if ( identifiers [ i ] == BANDWIDTH_ID ) { builder . append ( String . format ( identifierFormatTags [ i ] , bandwidth ) ) ; } else if ( identifiers [ i ] == TIME_ID ) { builder . append ( String . format ( identifierFormatTags [ i ] , time ) ) ; } } builder . append ( urlPieces [ identifierCount ] ) ; return builder . toString ( ) ; } | Constructs a Uri from the template, substituting in the provided arguments. <p> Arguments whose corresponding identifiers are not present in the template will be ignored. |
34,424 | static void clearInstanceCache ( ) { synchronized ( INSTANCE_CACHE ) { INSTANCE_CACHE . clear ( ) ; } } | For unit testing only |
34,425 | public void writeEndOfClass ( ) { out . println ( "}" ) ; } | writes the closing of the class definition |
34,426 | public ActionsList < T > add ( Func2 func2 , T element ) { return addAll ( func2 , Arrays . asList ( element ) ) ; } | Func2 will be called for every iteration until its condition returns true. When true, the element is added to the cache at the position of the current iteration. |
34,427 | private void writeAttribute ( java . lang . String prefix , java . lang . String namespace , java . lang . String attName , java . lang . String attValue , javax . xml . stream . XMLStreamWriter xmlWriter ) throws javax . xml . stream . XMLStreamException { if ( xmlWriter . getPrefix ( namespace ) == null ) { xmlWriter . writeNamespace ( prefix , namespace ) ; xmlWriter . setPrefix ( prefix , namespace ) ; } xmlWriter . writeAttribute ( namespace , attName , attValue ) ; } | Util method to write an attribute with the ns prefix |
34,428 | protected static String fixURI ( String str ) { str = str . replace ( java . io . File . separatorChar , '/' ) ; StringBuffer sb = null ; if ( str . length ( ) >= 2 ) { char ch1 = str . charAt ( 1 ) ; if ( ch1 == ':' ) { char ch0 = Character . toUpperCase ( str . charAt ( 0 ) ) ; if ( ch0 >= 'A' && ch0 <= 'Z' ) { sb = new StringBuffer ( str . length ( ) + 8 ) ; sb . append ( "file:///" ) ; } } else if ( ch1 == '/' && str . charAt ( 0 ) == '/' ) { sb = new StringBuffer ( str . length ( ) + 5 ) ; sb . append ( "file:" ) ; } } int pos = str . indexOf ( ' ' ) ; if ( pos < 0 ) { if ( sb != null ) { sb . append ( str ) ; str = sb . toString ( ) ; } } else { if ( sb == null ) sb = new StringBuffer ( str . length ( ) ) ; for ( int i = 0 ; i < pos ; i ++ ) sb . append ( str . charAt ( i ) ) ; sb . append ( "%20" ) ; for ( int i = pos + 1 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == ' ' ) sb . append ( "%20" ) ; else sb . append ( str . charAt ( i ) ) ; } str = sb . toString ( ) ; } return str ; } | Fixes a platform dependent filename to standard URI form. |
34,429 | public static boolean isInvoiceType ( GenericValue invoice , String inputTypeId ) throws GenericEntityException { if ( invoice == null ) { return false ; } GenericValue invoiceType = invoice . getRelatedOne ( "InvoiceType" , true ) ; if ( invoiceType == null ) { throw new GenericEntityException ( "Cannot find InvoiceType for invoiceId " + invoice . getString ( "invoiceId" ) ) ; } String invoiceTypeId = invoiceType . getString ( "invoiceTypeId" ) ; if ( inputTypeId . equals ( invoiceTypeId ) ) { return true ; } return isInvoiceTypeRecurse ( invoiceType , inputTypeId ) ; } | Checks if a invoice is of a specified InvoiceType.invoiceTypeId. Return false if invoice is null. It's better to use more specific calls like isPurchaseInvoice(). |
34,430 | private long toLong ( InetAddress inetAddress ) { byte [ ] address = inetAddress . getAddress ( ) ; long result = 0 ; for ( int i = 0 ; i < address . length ; i ++ ) { result <<= 8 ; result |= address [ i ] & BYTE_MASK ; } return result ; } | Converts an IP address into a long |
34,431 | public void destroy ( ) { try { raf . close ( ) ; } catch ( IOException e ) { log . error ( e , e ) ; } if ( ! file . delete ( ) ) log . warn ( "Could not delete file: " + file ) ; } | Hook used by the unit tests to destroy their test files. |
34,432 | private void updateView ( ) { Map < String , List < String > > attributes = dataObject . getAttributes ( ) ; final String artifactId = getAttribute ( ARTIFACT_ID ) ; if ( ! artifactId . isEmpty ( ) ) { view . setArtifactId ( artifactId ) ; } if ( attributes . get ( GROUP_ID ) != null ) { view . setGroupId ( getAttribute ( GROUP_ID ) ) ; } else { view . setGroupId ( getAttribute ( PARENT_GROUP_ID ) ) ; } if ( attributes . get ( VERSION ) != null ) { view . setVersion ( getAttribute ( VERSION ) ) ; } else { view . setVersion ( getAttribute ( PARENT_VERSION ) ) ; } view . setPackaging ( getAttribute ( PACKAGING ) ) ; } | Updates view from data-object. |
34,433 | private StreamInfo parseStream ( JSONObject stream , boolean follows ) { if ( stream == null ) { LOGGER . warning ( "Error parsing stream: Should be JSONObject, not null" ) ; return null ; } Number viewersTemp ; String status ; String game ; String name ; String display_name ; long timeStarted = - 1 ; long userId = - 1 ; boolean noChannelObject = false ; try { viewersTemp = ( Number ) stream . get ( "viewers" ) ; JSONObject channel = ( JSONObject ) stream . get ( "channel" ) ; if ( channel == null ) { LOGGER . warning ( "Error parsing StreamInfo: channel null" ) ; return null ; } status = ( String ) channel . get ( "status" ) ; game = ( String ) channel . get ( "game" ) ; name = ( String ) channel . get ( "name" ) ; display_name = ( String ) channel . get ( "display_name" ) ; userId = JSONUtil . getLong ( channel , "_id" , - 1 ) ; if ( ! channel . containsKey ( "status" ) ) { LOGGER . warning ( "Error parsing StreamInfo: no channel object (" + name + ")" ) ; noChannelObject = true ; } } catch ( ClassCastException ex ) { LOGGER . warning ( "Error parsing StreamInfo: unpexected type" ) ; return null ; } if ( name == null || name . isEmpty ( ) ) { LOGGER . warning ( "Error parsing StreamInfo: name null or empty" ) ; return null ; } if ( viewersTemp == null ) { LOGGER . warning ( "Error parsing StreamInfo: viewercount null (" + name + ")" ) ; return null ; } try { timeStarted = Util . parseTime ( ( String ) stream . get ( "created_at" ) ) ; } catch ( java . text . ParseException | NullPointerException | ClassCastException ex ) { LOGGER . warning ( "Warning parsing StreamInfo: could not parse created_at (" + ex + ")" ) ; } int viewers = viewersTemp . intValue ( ) ; if ( viewers < 0 ) { viewers = 0 ; LOGGER . warning ( "Warning: Viewercount should not be negative, set to 0 (" + name + ")." ) ; } StreamInfo streamInfo = getStreamInfo ( name ) ; if ( noChannelObject ) { status = streamInfo . getStatus ( ) ; game = streamInfo . getGame ( ) ; } streamInfo . setDisplayName ( display_name ) ; if ( streamInfo . setUserId ( userId ) ) { api . setUserId ( name , userId ) ; } if ( follows ) { streamInfo . setFollowed ( status , game , viewers , timeStarted ) ; } else { streamInfo . set ( status , game , viewers , timeStarted ) ; } return streamInfo ; } | Parse a stream object into a StreamInfo object. This gets the name of the stream and gets the appropriate StreamInfo object, in which it then loads the other extracted data like status, game, viewercount. This is used for both the response from /streams/:channel/ as well as /streams?channel=[..] |
34,434 | @ Override public void startAttlist ( String elementName , Augmentations augs ) throws XNIException { } | The start of an attribute list. |
34,435 | @ SuppressWarnings ( "fallthrough" ) private int findHeaderEnd ( byte [ ] bs ) { boolean newline = true ; int len = bs . length ; for ( int i = 0 ; i < len ; i ++ ) { switch ( bs [ i ] ) { case '\r' : if ( i < len - 1 && bs [ i + 1 ] == '\n' ) i ++ ; case '\n' : if ( newline ) return i + 1 ; newline = true ; break ; default : newline = false ; } } return len ; } | Find the length of header inside bs. The header is a multiple (>=0) lines of attributes plus an empty line. The empty line is included in the header. |
34,436 | public static Matrix covarianceMatrix ( Vec mean , DataSet dataSet ) { Matrix covariance = new DenseMatrix ( mean . length ( ) , mean . length ( ) ) ; covarianceMatrix ( mean , dataSet , covariance ) ; return covariance ; } | Computes the weighted covariance matrix of the data set |
34,437 | private static void decodeAnsiX12Segment ( BitSource bits , StringBuilder result ) throws FormatException { int [ ] cValues = new int [ 3 ] ; do { if ( bits . available ( ) == 8 ) { return ; } int firstByte = bits . readBits ( 8 ) ; if ( firstByte == 254 ) { return ; } parseTwoBytes ( firstByte , bits . readBits ( 8 ) , cValues ) ; for ( int i = 0 ; i < 3 ; i ++ ) { int cValue = cValues [ i ] ; if ( cValue == 0 ) { result . append ( '\r' ) ; } else if ( cValue == 1 ) { result . append ( '*' ) ; } else if ( cValue == 2 ) { result . append ( '>' ) ; } else if ( cValue == 3 ) { result . append ( ' ' ) ; } else if ( cValue < 14 ) { result . append ( ( char ) ( cValue + 44 ) ) ; } else if ( cValue < 40 ) { result . append ( ( char ) ( cValue + 51 ) ) ; } else { throw FormatException . getFormatInstance ( ) ; } } } while ( bits . available ( ) > 0 ) ; } | See ISO 16022:2006, 5.2.7 |
34,438 | public boolean isBlockBanned ( Block block ) { return blockBanList . contains ( block ) ; } | Checks if the block is banned from being a seal |
34,439 | public void endDrawing ( GL10 gl ) { gl . glDisable ( GL10 . GL_ALPHA_TEST ) ; gl . glMatrixMode ( GL10 . GL_PROJECTION ) ; gl . glPopMatrix ( ) ; gl . glMatrixMode ( GL10 . GL_MODELVIEW ) ; gl . glPopMatrix ( ) ; gl . glDisable ( GL10 . GL_TEXTURE_2D ) ; gl . glColor4x ( FixedPoint . ONE , FixedPoint . ONE , FixedPoint . ONE , FixedPoint . ONE ) ; } | Ends the drawing and restores the OpenGL state. |
34,440 | public int size ( ) { synchronized ( eventsList ) { return eventsList . size ( ) ; } } | Obtains the number of events in this track. |
34,441 | public static void jsonObjectsEquals ( JSONObject o1 , JSONObject o2 ) throws JSONException { if ( o1 != o2 ) { if ( o1 . length ( ) != o2 . length ( ) ) { fail ( "JSONObjects length differ: " + o1 . length ( ) + " / " + o2 . length ( ) ) ; } @ SuppressWarnings ( "unchecked" ) Iterator < String > o1Keys = o1 . keys ( ) ; while ( o1Keys . hasNext ( ) ) { String key = o1Keys . next ( ) ; Object o1Value = o1 . get ( key ) ; Object o2Value = o2 . get ( key ) ; if ( ! jsonValueEquals ( o1Value , o2Value ) ) { fail ( "JSONObject '" + key + "' values differ: " + o1Value + " / " + o2Value ) ; } } } } | Assert that two JSONObjects are equals without enforcing field order. |
34,442 | public void removeLimitLine ( LimitLine l ) { mLimitLines . remove ( l ) ; } | Removes the specified LimitLine from the axis. |
34,443 | private static String H ( String data ) { try { MessageDigest digest = MessageDigest . getInstance ( "MD5" ) ; return toHexString ( digest . digest ( data . getBytes ( ) ) ) ; } catch ( NoSuchAlgorithmException ex ) { throw new RuntimeException ( "Failed to instantiate an MD5 algorithm" , ex ) ; } } | Defined in rfc 2617 as H(data) = MD5(data); |
34,444 | Map < Integer , Integer > strippedWhitespaceUpToColumn ( String intro ) { Map < Integer , Integer > stripped = new TreeMap < > ( ) ; boolean countingWhitespace = false ; int col = 0 ; int count = 0 ; for ( char c : intro . toCharArray ( ) ) { if ( c == '\n' && ! countingWhitespace ) { countingWhitespace = true ; } else if ( countingWhitespace ) { if ( Character . isWhitespace ( c ) ) count ++ ; else countingWhitespace = false ; } stripped . put ( col , count ) ; col ++ ; } return stripped ; } | Help count how much newline and margin whitespace we have stripped up to a particular index so we know how to offset anchors |
34,445 | private List < Runnable > drainQueue ( ) { BlockingQueue < Runnable > q = workQueue ; List < Runnable > taskList = new ArrayList < Runnable > ( ) ; q . drainTo ( taskList ) ; if ( ! q . isEmpty ( ) ) { for ( Runnable r : q . toArray ( new Runnable [ 0 ] ) ) { if ( q . remove ( r ) ) taskList . add ( r ) ; } } return taskList ; } | Drains the task queue into a new list, normally using drainTo. But if the queue is a DelayQueue or any other kind of queue for which poll or drainTo may fail to remove some elements, it deletes them one by one. |
34,446 | private void updateProgress ( String progressLabel , int progress ) { if ( myHost != null && ( ( progress != previousProgress ) || ( ! progressLabel . equals ( previousProgressLabel ) ) ) ) { myHost . updateProgress ( progressLabel , progress ) ; } previousProgress = progress ; previousProgressLabel = progressLabel ; } | Used to communicate a progress update between a plugin tool and the main Whitebox user interface. |
34,447 | public boolean isMine ( Wallet wallet ) { try { Script script = getScriptPubKey ( ) ; if ( script . isSentToRawPubKey ( ) ) { byte [ ] pubkey = script . getPubKey ( ) ; return wallet . isPubKeyMine ( pubkey ) ; } else { byte [ ] pubkeyHash = script . getPubKeyHash ( ) ; return wallet . isPubKeyHashMine ( pubkeyHash ) ; } } catch ( ScriptException e ) { log . debug ( "Could not parse tx output script: {}" , e . toString ( ) ) ; return false ; } } | Returns true if this output is to a key, or an address we have the keys for, in the wallet. |
34,448 | @ Override public String toString ( ) { StringBuffer buf = new StringBuffer ( ) ; boolean first = true ; for ( FilterPredClause clause : clauses ) { if ( first ) first = false ; else { buf . append ( ' ' ) ; buf . append ( boolOp ) ; buf . append ( ' ' ) ; } buf . append ( clause ) ; } return buf . toString ( ) ; } | Returns the string representation of this FilterPred. |
34,449 | public static void realTransform ( double data [ ] , boolean inverse ) { double c1 = 0.5 ; int n = data . length ; double twoPi = - MathUtils . TWOPI ; if ( inverse ) twoPi = MathUtils . TWOPI ; double delta = twoPi / n ; double wStepReal = Math . cos ( delta ) ; double wStepImag = Math . sin ( delta ) ; double wReal = wStepReal ; double wImag = wStepImag ; double c2 ; if ( ! inverse ) { c2 = - 0.5 ; transform ( data , false ) ; } else { c2 = 0.5 ; } int n4 = n > > 2 ; for ( int i = 1 ; i < n4 ; i ++ ) { int twoI = i << 1 ; int twoIPlus1 = twoI + 1 ; int nMinusTwoI = n - twoI ; int nMinusTwoIPlus1 = nMinusTwoI + 1 ; double h1r = c1 * ( data [ twoI ] + data [ nMinusTwoI ] ) ; double h1i = c1 * ( data [ twoIPlus1 ] - data [ nMinusTwoIPlus1 ] ) ; double h2r = - c2 * ( data [ twoIPlus1 ] + data [ nMinusTwoIPlus1 ] ) ; double h2i = c2 * ( data [ twoI ] - data [ nMinusTwoI ] ) ; data [ twoI ] = h1r + wReal * h2r - wImag * h2i ; data [ twoIPlus1 ] = h1i + wReal * h2i + wImag * h2r ; data [ nMinusTwoI ] = h1r - wReal * h2r + wImag * h2i ; data [ nMinusTwoIPlus1 ] = - h1i + wReal * h2i + wImag * h2r ; double oldWReal = wReal ; wReal = oldWReal * wStepReal - wImag * wStepImag ; wImag = oldWReal * wStepImag + wImag * wStepReal ; } if ( ! inverse ) { double tmp = data [ 0 ] ; data [ 0 ] += data [ 1 ] ; data [ 1 ] = tmp - data [ 1 ] ; data [ n / 2 + 1 ] = - data [ n / 2 + 1 ] ; } else { double tmp = data [ 0 ] ; data [ 0 ] = 0.5 * ( tmp + data [ 1 ] ) ; data [ 1 ] = 0.5 * ( tmp - data [ 1 ] ) ; data [ n / 2 + 1 ] = - data [ n / 2 + 1 ] ; transform ( data , true ) ; } } | Calculates the Fourier transform of a set of n real-valued data points. Replaces this data (which is stored in array data[1..n]) by the positive frequency half of its complex Fourier transform. The real-valued first and last components of the complex transform are returned as elements data[1] and data[2], respectively. n must be a power of 2. This routine also calculates the inverse transform of a complex data array if it is the transform of real data. (Result in this case must be multiplied by 2/n.) |
34,450 | public FeatureFlag forName ( String name ) throws BadApiRequestException { FeatureFlag flag = NAMES_TO_VALUES . get ( name . toUpperCase ( Locale . ENGLISH ) ) ; return flag != null ? flag : Utils . < FeatureFlag > insteadThrowRuntime ( new BadApiRequestException ( "Invalid feature flag: " + name ) ) ; } | Get a registered FeatureFlag by name. |
34,451 | public void testMaxGreater ( ) { byte aBytes [ ] = { 12 , 56 , 100 , - 2 , - 76 , 89 , 45 , 91 , 3 , - 15 , 35 , 26 , 3 , 91 } ; byte bBytes [ ] = { 45 , 91 , 3 , - 15 , 35 , 26 , 3 , 91 } ; int aSign = 1 ; int bSign = 1 ; byte rBytes [ ] = { 12 , 56 , 100 , - 2 , - 76 , 89 , 45 , 91 , 3 , - 15 , 35 , 26 , 3 , 91 } ; BigInteger aNumber = new BigInteger ( aSign , aBytes ) ; BigInteger bNumber = new BigInteger ( bSign , bBytes ) ; BigInteger result = aNumber . max ( bNumber ) ; byte resBytes [ ] = new byte [ rBytes . length ] ; resBytes = result . toByteArray ( ) ; for ( int i = 0 ; i < resBytes . length ; i ++ ) { assertTrue ( resBytes [ i ] == rBytes [ i ] ) ; } assertTrue ( "incorrect sign" , result . signum ( ) == 1 ) ; } | max(BigInteger val). the first is greater. |
34,452 | private static final int computeDirection ( int from , int to ) { int dx = Position . getX ( to ) - Position . getX ( from ) ; int dy = Position . getY ( to ) - Position . getY ( from ) ; if ( dx == 0 ) { if ( dy == 0 ) return 0 ; return ( dy > 0 ) ? 8 : - 8 ; } if ( dy == 0 ) return ( dx > 0 ) ? 1 : - 1 ; if ( Math . abs ( dx ) == Math . abs ( dy ) ) return ( ( dy > 0 ) ? 8 : - 8 ) + ( dx > 0 ? 1 : - 1 ) ; if ( Math . abs ( dx * dy ) == 2 ) return dy * 8 + dx ; return 0 ; } | If there is a piece type that can move from "from" to "to", return the corresponding direction, 8*dy+dx. |
34,453 | public void testEntityReferenceSetTextContent ( ) throws TransformerException { document = builder . newDocument ( ) ; Element root = document . createElement ( "menu" ) ; document . appendChild ( root ) ; EntityReference entityReference = document . createEntityReference ( "sp" ) ; root . appendChild ( entityReference ) ; try { entityReference . setTextContent ( "Lite Syrup" ) ; fail ( ) ; } catch ( DOMException e ) { } } | Tests setTextContent on entity references. Although the other tests can act on a parsed DOM, this needs to use a programmatically constructed DOM because the parser may have replaced the entity reference with the corresponding text. |
34,454 | @ KnownFailure ( "not supported" ) public void testUpdate7 ( ) throws SQLException { DatabaseCreator . fillFKStrictTable ( conn ) ; statement . executeUpdate ( "UPDATE " + DatabaseCreator . FKSTRICT_TABLE + " SET value = 'updated' WHERE name_id = ANY (SELECT id FROM " + DatabaseCreator . PARENT_TABLE + " WHERE id > 1)" ) ; ResultSet r = statement . executeQuery ( "SELECT COUNT(*) FROM " + DatabaseCreator . FKSTRICT_TABLE + " WHERE value = 'updated';" ) ; r . next ( ) ; assertEquals ( "Should be 1 row" , 1 , r . getInt ( 1 ) ) ; r . close ( ) ; } | UpdateFunctionalityTest2#testUpdate7(). Updates table using subquery in WHERE clause TODO Foreign key functionality is not supported |
34,455 | public void addSatallite ( SatelliteBase satallite ) { satallites . add ( satallite ) ; if ( satallite . canTick ( ) ) tickingSatallites . add ( satallite ) ; } | Adds a satellite orbiting this body |
34,456 | public static void rotateM ( float [ ] m , int mOffset , float a , float x , float y , float z ) { synchronized ( TEMP_MATRIX_ARRAY ) { setRotateM ( TEMP_MATRIX_ARRAY , 0 , a , x , y , z ) ; multiplyMM ( TEMP_MATRIX_ARRAY , 16 , m , mOffset , TEMP_MATRIX_ARRAY , 0 ) ; System . arraycopy ( TEMP_MATRIX_ARRAY , 16 , m , mOffset , 16 ) ; } } | Rotates matrix m in place by angle a (in degrees) around the axis (x, y, z) |
34,457 | public PerDirectorySuite ( Class < ? > klass ) throws Throwable { super ( klass , Collections . < Runner > emptyList ( ) ) ; final TestClass testClass = getTestClass ( ) ; final Class < ? > javaTestClass = testClass . getJavaClass ( ) ; final List < List < File > > parametersList = getParametersList ( testClass ) ; for ( List < File > parameters : parametersList ) { runners . add ( new PerParameterSetTestRunner ( javaTestClass , parameters ) ) ; } } | Only called reflectively. Do not use programmatically. |
34,458 | public LetterValidator ( @ NonNull final CharSequence errorMessage , @ NonNull final Case caseSensitivity , final boolean allowSpaces , @ NonNull final char ... allowedCharacters ) { super ( errorMessage ) ; setCaseSensitivity ( caseSensitivity ) ; allowSpaces ( allowSpaces ) ; setAllowedCharacters ( allowedCharacters ) ; } | Creates a new validator, which allows to validate texts to ensure, that they only contain letters. |
34,459 | private byte [ ] entityToBytes ( HttpEntity entity ) throws IOException , ServerError { PoolingByteArrayOutputStream bytes = new PoolingByteArrayOutputStream ( mPool , ( int ) entity . getContentLength ( ) ) ; byte [ ] buffer = null ; try { InputStream in = entity . getContent ( ) ; if ( in == null ) { throw new ServerError ( ) ; } buffer = mPool . getBuf ( 1024 ) ; int count ; while ( ( count = in . read ( buffer ) ) != - 1 ) { bytes . write ( buffer , 0 , count ) ; } return bytes . toByteArray ( ) ; } finally { try { entity . consumeContent ( ) ; } catch ( IOException e ) { VolleyLog . v ( "Error occured when calling consumingContent" ) ; } mPool . returnBuf ( buffer ) ; bytes . close ( ) ; } } | Reads the contents of HttpEntity into a byte[]. |
34,460 | public static void printRawLines ( PrintWriter writer , String msg ) { int nl ; while ( ( nl = msg . indexOf ( '\n' ) ) != - 1 ) { writer . println ( msg . substring ( 0 , nl ) ) ; msg = msg . substring ( nl + 1 ) ; } if ( msg . length ( ) != 0 ) writer . println ( msg ) ; } | Print the text of a message, translating newlines appropriately for the platform. |
34,461 | public static void write ( OutStream out , List records ) throws IOException { for ( Iterator enumerator = records . iterator ( ) ; enumerator . hasNext ( ) ; ) { ButtonRecord2 rec = ( ButtonRecord2 ) enumerator . next ( ) ; rec . write ( out ) ; } out . writeUI8 ( 0 ) ; } | Write a button record array |
34,462 | public long first ( ) { return startDate . getTime ( ) ; } | Returns the first recurrence. |
34,463 | public Cuboid ( Location l1 ) { this ( l1 , l1 ) ; } | Construct a one-block Cuboid at the given Location of the Cuboid. |
34,464 | static byte [ ] decode_base64 ( String s , int maxolen ) throws IllegalArgumentException { ByteArrayOutputStream out = new ByteArrayOutputStream ( maxolen ) ; int off = 0 , slen = s . length ( ) , olen = 0 ; byte c1 , c2 , c3 , c4 , o ; if ( maxolen <= 0 ) { throw new IllegalArgumentException ( "Invalid maxolen" ) ; } while ( off < slen - 1 && olen < maxolen ) { c1 = char64 ( s . charAt ( off ++ ) ) ; c2 = char64 ( s . charAt ( off ++ ) ) ; if ( c1 == - 1 || c2 == - 1 ) { break ; } o = ( byte ) ( c1 << 2 ) ; o |= ( c2 & 0x30 ) > > 4 ; out . write ( o ) ; if ( ++ olen >= maxolen || off >= slen ) { break ; } c3 = char64 ( s . charAt ( off ++ ) ) ; if ( c3 == - 1 ) { break ; } o = ( byte ) ( ( c2 & 0x0f ) << 4 ) ; o |= ( c3 & 0x3c ) > > 2 ; out . write ( o ) ; if ( ++ olen >= maxolen || off >= slen ) { break ; } c4 = char64 ( s . charAt ( off ++ ) ) ; o = ( byte ) ( ( c3 & 0x03 ) << 6 ) ; o |= c4 ; out . write ( o ) ; ++ olen ; } return out . toByteArray ( ) ; } | Decode a string encoded using bcrypt's base64 scheme to a byte array. Note that this is *not* compatible with the standard MIME-base64 encoding. |
34,465 | void expireInvite ( final String name ) { JComponent button = invites . get ( name ) ; if ( button != null ) { inviteContainer . remove ( button ) ; inviteContainer . revalidate ( ) ; } invites . remove ( name ) ; } | Remove the join button of an invite. |
34,466 | public void writeExif ( InputStream jpegStream , String exifOutFileName ) throws FileNotFoundException , IOException { if ( jpegStream == null || exifOutFileName == null ) { throw new IllegalArgumentException ( NULL_ARGUMENT_STRING ) ; } OutputStream s = null ; try { s = getExifWriterStream ( exifOutFileName ) ; doExifStreamIO ( jpegStream , s ) ; s . flush ( ) ; } catch ( IOException e ) { closeSilently ( s ) ; throw e ; } s . close ( ) ; } | Writes the tags from this ExifInterface object into a jpeg stream, removing prior exif tags. |
34,467 | public void stopAutoHideTimer ( ) { autoHideTimer . stop ( ) ; } | Stops the timer that scrolls notifications and hides the window. |
34,468 | public static void correctLocation ( JSONObject map ) { String location = map . has ( "location" ) ? ( String ) map . get ( "location" ) : null ; if ( location != null && location . length ( ) > 0 ) { String location_country = map . has ( "location_country" ) ? ( String ) map . get ( "location_country" ) : null ; if ( location_country != null && location_country . length ( ) > 0 ) { if ( location . endsWith ( ", " + location_country ) ) { location = location . substring ( 0 , location . length ( ) - location_country . length ( ) - 2 ) ; map . put ( "location" , location ) ; } } } } | beautify given location information. This should only be called before an export is done, not for storage |
34,469 | int adjustTextWidth ( int width ) { maxTextWidth = Math . max ( maxTextWidth , width ) ; return maxTextWidth ; } | Adjusts the width needed to display the maximum menu item string. |
34,470 | public void testLotsOfBindings ( ) throws Exception { doTestLotsOfBindings ( Byte . MAX_VALUE - 1 ) ; doTestLotsOfBindings ( Byte . MAX_VALUE ) ; doTestLotsOfBindings ( Byte . MAX_VALUE + 1 ) ; } | tests huge amounts of variables in the expression |
34,471 | public AsyncServerRequest ( RequestType type , GeneratedMessage req , boolean requireCommonRequest ) { Request . Builder reqBuilder = Request . newBuilder ( ) ; reqBuilder . setRequestMessage ( req . toByteString ( ) ) ; reqBuilder . setRequestType ( type ) ; this . type = type ; this . request = reqBuilder . build ( ) ; this . requireCommonRequest = requireCommonRequest ; } | Instantiates a new Server request. |
34,472 | private void updateProgress ( String progressLabel , int progress ) { if ( myHost != null && ( ( progress != previousProgress ) || ( ! progressLabel . equals ( previousProgressLabel ) ) ) ) { myHost . updateProgress ( progressLabel , progress ) ; } previousProgress = progress ; previousProgressLabel = progressLabel ; } | Used to communicate a progress update between a plugin tool and the main Whitebox user interface. |
34,473 | public void increment ( int position , double weight ) { leftLabelWeights [ position ] += weight ; rightLabelWeights [ position ] -= weight ; leftWeight += weight ; rightWeight -= weight ; } | Increments the left label weights at the given position by the given weight and decrements the right label weights. Updates the sum of all left and right label weights respectively. |
34,474 | private String sendStatusRequestWithRetry ( ModifiableSolrParams params , int maxCounter ) throws SolrServerException , IOException { String message = null ; while ( maxCounter -- > 0 ) { final NamedList r = sendRequest ( params ) ; final NamedList status = ( NamedList ) r . get ( "status" ) ; final RequestStatusState state = RequestStatusState . fromKey ( ( String ) status . get ( "state" ) ) ; message = ( String ) status . get ( "msg" ) ; if ( state == RequestStatusState . COMPLETED || state == RequestStatusState . FAILED ) { return message ; } try { Thread . sleep ( 1000 ) ; } catch ( InterruptedException e ) { } } return message ; } | Helper method to send a status request with specific retry limit and return the message/null from the success response. |
34,475 | private void enableDisableSpacingFields ( ) { if ( manuallySetNumColumns . isSelected ( ) ) { tfNumColumns . setEnabled ( true ) ; } else { tfNumColumns . setEnabled ( false ) ; } } | Enable or disable spacing fields depending on whether the layout is in manual columns mode. |
34,476 | SparseArray ( Class < L > linearArrayType , int [ ] linearIndices , int [ ] rowIndices , int [ ] colIndices , L real , L imag , int numRows , int numCols ) { _numRows = numRows ; _numCols = numCols ; _baseComponentType = linearArrayType . getComponentType ( ) ; _outputArrayType = ( Class < L [ ] > ) ArrayUtils . getArrayClass ( _baseComponentType , 2 ) ; _linearIndices = linearIndices ; _rowIndices = rowIndices ; _colIndices = colIndices ; _realValues = linearArrayType . cast ( real ) ; _imagValues = linearArrayType . cast ( imag ) ; } | Data from MATLAB. Provided as the indices, linear arrays of values, and dimensions. The indices are expected to be sorted in increasing value and the real and imaginary values are to correspond to these indices. |
34,477 | public static Location fromTimeZone ( TimeZone timeZone ) { if ( timeZone == null ) { throw new IllegalArgumentException ( Logger . logMessage ( Logger . ERROR , "Location" , "fromTimeZone" , "The time zone is null" ) ) ; } double millisPerHour = 3.6e6 ; int offsetMillis = timeZone . getRawOffset ( ) ; int offsetHours = ( int ) ( offsetMillis / millisPerHour ) ; double lat = timeZoneLatitudes . get ( offsetHours , 0 ) ; double lon = 180 * offsetHours / 12 ; return new Location ( lat , lon ) ; } | Constructs an approximate location for a specified time zone. Used when selecting an initial navigator position based on the device's current time zone. |
34,478 | public MD5 ( Object ob ) { this ( ) ; Update ( ob . toString ( ) ) ; } | Initialize class, and update hash with ob.toString() |
34,479 | public static Map < String , Object > createDataResourceAndText ( DispatchContext dctx , Map < String , ? extends Object > rcontext ) { Map < String , Object > context = UtilMisc . makeMapWritable ( rcontext ) ; Map < String , Object > result = FastMap . newInstance ( ) ; Map < String , Object > thisResult = createDataResourceMethod ( dctx , context ) ; if ( thisResult . get ( ModelService . RESPONSE_MESSAGE ) != null ) { return ServiceUtil . returnError ( ( String ) thisResult . get ( ModelService . ERROR_MESSAGE ) ) ; } result . put ( "dataResourceId" , thisResult . get ( "dataResourceId" ) ) ; context . put ( "dataResourceId" , thisResult . get ( "dataResourceId" ) ) ; String dataResourceTypeId = ( String ) context . get ( "dataResourceTypeId" ) ; if ( dataResourceTypeId != null && dataResourceTypeId . equals ( "ELECTRONIC_TEXT" ) ) { thisResult = createElectronicText ( dctx , context ) ; if ( thisResult . get ( ModelService . RESPONSE_MESSAGE ) != null ) { return ServiceUtil . returnError ( ( String ) thisResult . get ( ModelService . ERROR_MESSAGE ) ) ; } } return result ; } | A top-level service for creating a DataResource and ElectronicText together. |
34,480 | public static ArrayList < String > matches ( String text ) { return matches ( text , ALL ) ; } | It finds urls inside the text and return the matched ones |
34,481 | public void addChild ( Job childJob ) { childJobs . add ( childJob ) ; } | Add the specified job as a child job. |
34,482 | public void testNextLongBounded2 ( ) { SplittableRandom sr = new SplittableRandom ( ) ; for ( long least = - 86028121 ; least < MAX_LONG_BOUND ; least += 982451653L ) { for ( long bound = least + 2 ; bound > least && bound < MAX_LONG_BOUND ; bound += Math . abs ( bound * 7919 ) ) { long f = sr . nextLong ( least , bound ) ; assertTrue ( least <= f && f < bound ) ; int i = 0 ; long j ; while ( i < NCALLS && ( j = sr . nextLong ( least , bound ) ) == f ) { assertTrue ( least <= j && j < bound ) ; ++ i ; } assertTrue ( i < NCALLS ) ; } } } | nextLong(least, bound) returns least <= value < bound; repeated calls produce at least two distinct results |
34,483 | protected void prepareForFlush ( ) { doneLock = new ReentrantLock ( ) ; doneCondition = doneLock . newCondition ( ) ; doneLock . lock ( ) ; } | Internally used to indicate that the client thread will wait for this message to have been sent before continuing |
34,484 | private void recalculatPreferredSize ( ) { int maxX = 0 ; int maxY = 0 ; for ( GraphicalNode gn : myGraphicalNodes ) { int x = gn . x + NODE_WIDTH ; int y = gn . y + NODE_HEIGHT ; maxX = Math . max ( maxX , x ) ; maxY = Math . max ( maxY , y ) ; } setPreferredSize ( new Dimension ( maxX , maxY ) ) ; myMaxX = maxX ; myMaxY = maxY ; } | Recalculate preferred size so that graphics fit with nodes positions. |
34,485 | private String computeJavadocIndent ( IDocument document , int line , JavaHeuristicScanner scanner , ITypedRegion partition ) throws BadLocationException { if ( line == 0 ) return null ; final IRegion lineInfo = document . getLineInformation ( line ) ; final int lineStart = lineInfo . getOffset ( ) ; final int lineLength = lineInfo . getLength ( ) ; final int lineEnd = lineStart + lineLength ; int nonWS = scanner . findNonWhitespaceForwardInAnyPartition ( lineStart , lineEnd ) ; if ( nonWS == JavaHeuristicScanner . NOT_FOUND || document . getChar ( nonWS ) != '*' ) { if ( nonWS == JavaHeuristicScanner . NOT_FOUND ) return document . get ( lineStart , lineLength ) ; return document . get ( lineStart , nonWS - lineStart ) ; } IRegion previousLine = document . getLineInformation ( line - 1 ) ; int previousLineStart = previousLine . getOffset ( ) ; int previousLineLength = previousLine . getLength ( ) ; int previousLineEnd = previousLineStart + previousLineLength ; StringBuffer buf = new StringBuffer ( ) ; int previousLineNonWS = scanner . findNonWhitespaceForwardInAnyPartition ( previousLineStart , previousLineEnd ) ; if ( previousLineNonWS == JavaHeuristicScanner . NOT_FOUND || document . getChar ( previousLineNonWS ) != '*' ) { previousLine = document . getLineInformationOfOffset ( partition . getOffset ( ) ) ; previousLineStart = previousLine . getOffset ( ) ; previousLineLength = previousLine . getLength ( ) ; previousLineEnd = previousLineStart + previousLineLength ; previousLineNonWS = scanner . findNonWhitespaceForwardInAnyPartition ( previousLineStart , previousLineEnd ) ; if ( previousLineNonWS == JavaHeuristicScanner . NOT_FOUND ) previousLineNonWS = previousLineEnd ; buf . append ( ' ' ) ; } String indentation = document . get ( previousLineStart , previousLineNonWS - previousLineStart ) ; buf . insert ( 0 , indentation ) ; return buf . toString ( ) ; } | Computes and returns the indentation for a javadoc line. The line must be inside a javadoc comment. |
34,486 | void sendBit5Baud ( boolean bitValue ) throws IOException { SerialExt . setBreak ( bitValue ? 0 : 1 ) ; try { Thread . sleep ( 200 ) ; } catch ( InterruptedException e ) { log . error ( null , e ) ; } } | send a single bit with 5 baud bit width |
34,487 | public static String removeFromEndOfString ( String source , String stringToRemove ) { if ( stringToRemove == null ) { return source ; } String result = source ; if ( source != null && source . endsWith ( stringToRemove ) ) { result = source . substring ( 0 , source . length ( ) - 1 ) ; } return result ; } | Remove the stringToRemove from source when existing |
34,488 | public void accept ( Context context ) { if ( null != callReference ) { RespokeCall call = callReference . get ( ) ; if ( null != call ) { call . directConnectionDidAccept ( context ) ; } } } | Accept the direct connection and start the process of obtaining media. |
34,489 | public void push ( final double value ) { long bits = Double . doubleToLongBits ( value ) ; if ( bits == 0L || bits == 0x3ff0000000000000L ) { mv . visitInsn ( Opcodes . DCONST_0 + ( int ) value ) ; } else { mv . visitLdcInsn ( new Double ( value ) ) ; } } | Generates the instruction to push the given value on the stack. |
34,490 | public mxHierarchicalLayout ( mxGraph graph ) { this ( graph , SwingConstants . NORTH ) ; } | Constructs a hierarchical layout |
34,491 | public void testRun ( ) throws Exception { StringWriter sw = new StringWriter ( ) ; PrintWriter pw = new PrintWriter ( sw , true ) ; final int MAX_DOCS = atLeast ( 225 ) ; doTest ( random ( ) , pw , false , MAX_DOCS ) ; pw . close ( ) ; sw . close ( ) ; String multiFileOutput = sw . toString ( ) ; sw = new StringWriter ( ) ; pw = new PrintWriter ( sw , true ) ; doTest ( random ( ) , pw , true , MAX_DOCS ) ; pw . close ( ) ; sw . close ( ) ; String singleFileOutput = sw . toString ( ) ; assertEquals ( multiFileOutput , singleFileOutput ) ; } | This test compares search results when using and not using compound files. TODO: There is rudimentary search result validation as well, but it is simply based on asserting the output observed in the old test case, without really knowing if the output is correct. Someone needs to validate this output and make any changes to the checkHits method. |
34,492 | public void simulateMethod ( SootMethod method , ReferenceVariable thisVar , ReferenceVariable returnVar , ReferenceVariable params [ ] ) { String subSignature = method . getSubSignature ( ) ; if ( subSignature . equals ( "java.lang.Class[] getClassContext()" ) ) { java_util_ResourceBundle_getClassContext ( method , thisVar , returnVar , params ) ; return ; } else { defaultMethod ( method , thisVar , returnVar , params ) ; return ; } } | Implements the abstract method simulateMethod. It distributes the request to the corresponding methods by signatures. |
34,493 | public final void addChangeListener ( ChangeListener listener ) { if ( ! listeners . contains ( listener ) ) listeners . add ( listener ) ; } | Add a ChangeListener. Use settingsValid() method to read the state. To be called in EDT. |
34,494 | private static void decodeBase256Segment ( BitSource bits , StringBuilder result , Collection < byte [ ] > byteSegments ) throws FormatException { int codewordPosition = 1 + bits . getByteOffset ( ) ; int d1 = unrandomize255State ( bits . readBits ( 8 ) , codewordPosition ++ ) ; int count ; if ( d1 == 0 ) { count = bits . available ( ) / 8 ; } else if ( d1 < 250 ) { count = d1 ; } else { count = 250 * ( d1 - 249 ) + unrandomize255State ( bits . readBits ( 8 ) , codewordPosition ++ ) ; } if ( count < 0 ) { throw FormatException . getFormatInstance ( ) ; } byte [ ] bytes = new byte [ count ] ; for ( int i = 0 ; i < count ; i ++ ) { if ( bits . available ( ) < 8 ) { throw FormatException . getFormatInstance ( ) ; } bytes [ i ] = ( byte ) unrandomize255State ( bits . readBits ( 8 ) , codewordPosition ++ ) ; } byteSegments . add ( bytes ) ; try { result . append ( new String ( bytes , "ISO8859_1" ) ) ; } catch ( UnsupportedEncodingException uee ) { throw new IllegalStateException ( "Platform does not support required encoding: " + uee ) ; } } | See ISO 16022:2006, 5.2.9 and Annex B, B.2 |
34,495 | public float length ( int u , int v ) { if ( u == v ) return 0 ; else return 1f / ( v - u ) ; } | The length between two nodes u and v. In a phrase graph, this length is equal to 1.0/(v-u). |
34,496 | public static int executeUpdate ( String sql , Object [ ] params , boolean ignoreError , String trxName , int timeOut ) { if ( sql == null || sql . length ( ) == 0 ) throw new IllegalArgumentException ( "Required parameter missing - " + sql ) ; verifyTrx ( trxName , sql ) ; int no = - 1 ; CPreparedStatement cs = ProxyFactory . newCPreparedStatement ( ResultSet . TYPE_FORWARD_ONLY , ResultSet . CONCUR_UPDATABLE , sql , trxName ) ; try { setParameters ( cs , params ) ; if ( timeOut > 0 ) cs . setQueryTimeout ( timeOut ) ; no = cs . executeUpdate ( ) ; if ( trxName == null ) { cs . commit ( ) ; } } catch ( Exception e ) { e = getSQLException ( e ) ; if ( ignoreError ) log . log ( Level . SEVERE , cs . getSql ( ) + " [" + trxName + "] - " + e . getMessage ( ) ) ; else { log . log ( Level . SEVERE , cs . getSql ( ) + " [" + trxName + "]" , e ) ; log . saveError ( "DBExecuteError" , e ) ; } } finally { try { cs . close ( ) ; } catch ( SQLException e2 ) { log . log ( Level . SEVERE , "Cannot close statement" ) ; } } return no ; } | Execute Update. saves "DBExecuteError" in Log |
34,497 | public void test_commonTest_01 ( ) { SSLContextSpiImpl ssl = new SSLContextSpiImpl ( ) ; try { SSLSessionContext slsc = ssl . engineGetClientSessionContext ( ) ; fail ( "RuntimeException wasn't thrown" ) ; } catch ( RuntimeException re ) { String str = re . getMessage ( ) ; if ( ! str . equals ( "Not initialiazed" ) ) fail ( "Incorrect exception message: " + str ) ; } catch ( Exception e ) { fail ( "Incorrect exception " + e + " was thrown" ) ; } try { SSLSessionContext slsc = ssl . engineGetServerSessionContext ( ) ; fail ( "RuntimeException wasn't thrown" ) ; } catch ( RuntimeException re ) { String str = re . getMessage ( ) ; if ( ! str . equals ( "Not initialiazed" ) ) fail ( "Incorrect exception message: " + str ) ; } catch ( Exception e ) { fail ( "Incorrect exception " + e + " was thrown" ) ; } try { SSLServerSocketFactory sssf = ssl . engineGetServerSocketFactory ( ) ; fail ( "RuntimeException wasn't thrown" ) ; } catch ( RuntimeException re ) { String str = re . getMessage ( ) ; if ( ! str . equals ( "Not initialiazed" ) ) fail ( "Incorrect exception message: " + str ) ; } catch ( Exception e ) { fail ( "Incorrect exception " + e + " was thrown" ) ; } try { SSLSocketFactory ssf = ssl . engineGetSocketFactory ( ) ; fail ( "RuntimeException wasn't thrown" ) ; } catch ( RuntimeException re ) { String str = re . getMessage ( ) ; if ( ! str . equals ( "Not initialiazed" ) ) fail ( "Incorrect exception message: " + str ) ; } catch ( Exception e ) { fail ( "Incorrect exception " + e + " was thrown" ) ; } } | SSLContextSpi#engineGetClientSessionContext() SSLContextSpi#engineGetServerSessionContext() SSLContextSpi#engineGetServerSocketFactory() SSLContextSpi#engineGetSocketFactory() Verify exception when SSLContextSpi object wasn't initialiazed. |
34,498 | public static void reset ( ) { threadLocal . remove ( ) ; } | Reset the current request and clear all fields. |
34,499 | public BitArray resize ( long size ) { bytes . resize ( Math . max ( size / 8 + 8 , 8 ) ) ; this . size = size ; return this ; } | Resizes the bit array to a new count. |