idx
int64 0
34.9k
| question
stringlengths 12
26.4k
| target
stringlengths 15
2.3k
|
---|---|---|
700 | public void updatePacketSize ( final BigDecimal packetSize ) { mRepeatPacketSize = mRepeatPacketSize . add ( packetSize ) ; } | Update total packet size to be downloaded/uploaded. |
701 | private String base_phone_number ( ) throws ParseException { StringBuilder s = new StringBuilder ( ) ; if ( debug ) dbg_enter ( "base_phone_number" ) ; try { int lc = 0 ; while ( lexer . hasMoreChars ( ) ) { char w = lexer . lookAhead ( 0 ) ; if ( Lexer . isDigit ( w ) || w == '-' || w == '.' || w == '(' || w == ')' ) { lexer . consume ( 1 ) ; s . append ( w ) ; lc ++ ; } else if ( lc > 0 ) break ; else throw createParseException ( "unexpected " + w ) ; } return s . toString ( ) ; } finally { if ( debug ) dbg_leave ( "base_phone_number" ) ; } } | Parser for the base phone number. |
702 | public org . smpte_ra . schemas . st2067_2_2016 . ContentVersionType buildContentVersionType ( String id , org . smpte_ra . schemas . st2067_2_2016 . UserTextType value ) { ContentVersionType contentVersionType = new ContentVersionType ( ) ; contentVersionType . setId ( id ) ; contentVersionType . setLabelText ( value ) ; return contentVersionType ; } | A method to construct a ContentVersionType object conforming to the 2016 schema |
703 | protected void refillBuffer ( ) { if ( pendinglen > 0 || eof ) return ; try { offset = 0 ; pendinglen = stream . read ( buf ) ; if ( pendinglen < 0 ) { close ( ) ; return ; } else return ; } catch ( IOException e ) { throw new PngjInputException ( e ) ; } } | If there are not pending bytes to be consumed tries to fill the buffer with bytes from the stream. |
704 | private static InputStream openSystemFile ( String filename ) throws FileNotFoundException { try { return new FileInputStream ( filename ) ; } catch ( FileNotFoundException e ) { String resname = filename . replace ( File . separatorChar , '/' ) ; InputStream result = ClassLoader . getSystemResourceAsStream ( resname ) ; if ( result == null ) { throw e ; } return result ; } } | Private copy from FileUtil, to avoid cross-dependencies. Try to open a file, first trying the file system, then falling back to the classpath. |
705 | static Pair < byte [ ] , Long > decomposeName ( Column column ) { ByteBuffer nameBuffer ; if ( column . isSetName ( ) ) { nameBuffer = column . bufferForName ( ) ; } else { nameBuffer = ByteBuffer . wrap ( column . getName ( ) ) ; } return decompose ( nameBuffer ) ; } | Convenience method to get the name buffer for the specified column and decompose it into the name and timestamp. |
706 | public RequestHandle delete ( String url , ResponseHandlerInterface responseHandler ) { return delete ( null , url , responseHandler ) ; } | Perform a HTTP DELETE request. |
707 | public void addLanguage ( String languageId ) { query . append ( " +languageId:" + languageId ) ; } | Adds a language limit to the query |
708 | public static List < BaseMqttMessage > processMessageLog ( final List < LoggedMqttMessage > list , final ProgressUpdater progress , final long current , final long max ) { final List < BaseMqttMessage > mqttMessageList = new ArrayList < BaseMqttMessage > ( ) ; long item = 0 ; for ( final LoggedMqttMessage loggedMessage : list ) { if ( progress != null ) { if ( progress . isCancelled ( ) ) { logger . info ( "Task cancelled!" ) ; return null ; } item ++ ; if ( item % 1000 == 0 ) { progress . update ( current + item , max ) ; } } mqttMessageList . add ( convertToBaseMqttMessage ( loggedMessage ) ) ; } logger . info ( "Message audit log - processed {} MQTT messages" , list . size ( ) ) ; return mqttMessageList ; } | Turns the given list of LoggedMqttMessages into ReceivedMqttMessages. |
709 | public RequestHandle delete ( Context context , String url , Header [ ] headers , RequestParams params , ResponseHandlerInterface responseHandler ) { HttpDelete httpDelete = new HttpDelete ( getUrlWithQueryString ( isUrlEncodingEnabled , url , params ) ) ; if ( headers != null ) httpDelete . setHeaders ( headers ) ; return sendRequest ( httpClient , httpContext , httpDelete , null , responseHandler , context ) ; } | Perform a HTTP DELETE request. |
710 | public int [ ] updateRemainingAttributes ( int [ ] selectedAttributes , int bestAttribute ) { int [ ] remainingAttributes ; if ( columnTable . representsNominalAttribute ( bestAttribute ) ) { remainingAttributes = removeAttribute ( bestAttribute , selectedAttributes ) ; } else { remainingAttributes = selectedAttributes ; } return remainingAttributes ; } | If the bestAttribute is nominal, its number is removed from the selectedAttributes, otherwise it stays the same. |
711 | public final void addElement ( int value ) { if ( ( m_firstFree + 1 ) >= m_mapSize ) { m_mapSize += m_blocksize ; int newMap [ ] = new int [ m_mapSize ] ; System . arraycopy ( m_map , 0 , newMap , 0 , m_firstFree + 1 ) ; m_map = newMap ; } m_map [ m_firstFree ] = value ; m_firstFree ++ ; } | Append a int onto the vector. |
712 | int parseTrBlockContent ( int currentOffset , char openQuote , char closeQuote ) { int blockStartOffset = currentOffset ; CharSequence buffer = getBuffer ( ) ; int bufferEnd = getBufferEnd ( ) ; boolean isEscaped = false ; boolean isQuoteDiffers = openQuote != closeQuote ; int quotesLevel = 0 ; while ( currentOffset < bufferEnd ) { char currentChar = buffer . charAt ( currentOffset ) ; if ( ! isEscaped && quotesLevel == 0 && currentChar == closeQuote ) { if ( currentOffset > blockStartOffset ) { pushPreparsedToken ( blockStartOffset , currentOffset , STRING_CONTENT ) ; } break ; } if ( isQuoteDiffers && ! isEscaped ) { if ( currentChar == openQuote ) { quotesLevel ++ ; } else if ( currentChar == closeQuote ) { quotesLevel -- ; } } isEscaped = ( currentChar == '\\' && ! isEscaped ) ; currentOffset ++ ; } return currentOffset ; } | Parsing tr block content till close quote |
713 | public boolean itemExists ( String name ) throws JMSException { HashMap body = ( HashMap ) Body ; return body . containsKey ( name ) ; } | Check if an item exists in this MapMessage |
714 | @ Override public boolean eIsSet ( int featureID ) { switch ( featureID ) { case SexecPackage . STEP__COMMENT : return COMMENT_EDEFAULT == null ? comment != null : ! COMMENT_EDEFAULT . equals ( comment ) ; case SexecPackage . STEP__CALLER : return caller != null && ! caller . isEmpty ( ) ; } return super . eIsSet ( featureID ) ; } | <!-- begin-user-doc --> <!-- end-user-doc --> |
715 | public String toDisplayString ( ) { return toDisplayString ( Locale . getDefault ( ) ) ; } | Gets localized string describing the key using the default locale. |
716 | public boolean orAndAndNot ( BitVector orset , BitVector andset , BitVector andnotset ) { boolean ret = false ; long [ ] a = null , b = null , c = null , d = null , e = null ; int al , bl , cl , dl ; a = this . bits ; al = a . length ; if ( orset == null ) { bl = 0 ; } else { b = orset . bits ; bl = b . length ; } if ( andset == null ) { cl = 0 ; } else { c = andset . bits ; cl = c . length ; } if ( andnotset == null ) { dl = 0 ; } else { d = andnotset . bits ; dl = d . length ; } if ( al < bl ) { e = new long [ bl ] ; System . arraycopy ( a , 0 , e , 0 , al ) ; this . bits = e ; } else { e = a ; } int i = 0 ; long l ; if ( c == null ) { if ( dl <= bl ) { while ( i < dl ) { l = b [ i ] & ~ d [ i ] ; if ( ( l & ~ e [ i ] ) != 0 ) ret = true ; e [ i ] |= l ; i ++ ; } while ( i < bl ) { l = b [ i ] ; if ( ( l & ~ e [ i ] ) != 0 ) ret = true ; e [ i ] |= l ; i ++ ; } } else { while ( i < bl ) { l = b [ i ] & ~ d [ i ] ; if ( ( l & ~ e [ i ] ) != 0 ) ret = true ; e [ i ] |= l ; i ++ ; } } } else if ( bl <= cl && bl <= dl ) { while ( i < bl ) { l = b [ i ] & c [ i ] & ~ d [ i ] ; if ( ( l & ~ e [ i ] ) != 0 ) ret = true ; e [ i ] |= l ; i ++ ; } } else if ( cl <= bl && cl <= dl ) { while ( i < cl ) { l = b [ i ] & c [ i ] & ~ d [ i ] ; if ( ( l & ~ e [ i ] ) != 0 ) ret = true ; e [ i ] |= l ; i ++ ; } } else { while ( i < dl ) { l = b [ i ] & c [ i ] & ~ d [ i ] ; if ( ( l & ~ e [ i ] ) != 0 ) ret = true ; e [ i ] |= l ; i ++ ; } int shorter = cl ; if ( bl < shorter ) shorter = bl ; while ( i < shorter ) { l = b [ i ] & c [ i ] ; if ( ( l & ~ e [ i ] ) != 0 ) ret = true ; e [ i ] |= l ; i ++ ; } } return ret ; } | Computes this = this OR ((orset AND andset ) AND (NOT andnotset)) Returns true iff this is modified. |
717 | private boolean conditionCH1 ( String value , int index ) { return ( ( contains ( value , 0 , 4 , "VAN " , "VON " ) || contains ( value , 0 , 3 , "SCH" ) ) || contains ( value , index - 2 , 6 , "ORCHES" , "ARCHIT" , "ORCHID" ) || contains ( value , index + 2 , 1 , "T" , "S" ) || ( ( contains ( value , index - 1 , 1 , "A" , "O" , "U" , "E" ) || index == 0 ) && ( contains ( value , index + 2 , 1 , L_R_N_M_B_H_F_V_W_SPACE ) || index + 1 == value . length ( ) - 1 ) ) ) ; } | Complex condition 1 for 'CH' |
718 | public void removeElements ( final int from , final int to ) { CharArrays . ensureFromTo ( size , from , to ) ; System . arraycopy ( a , to , a , from , size - to ) ; size -= ( to - from ) ; } | Removes elements of this type-specific list using optimized system calls. |
719 | public synchronized void add ( Date x , double y ) { super . add ( x . getTime ( ) , y ) ; } | Adds a new value to the series. |
720 | public void addChangeListener ( ChangeListener l ) { m_ChangeListeners . add ( l ) ; } | Adds a ChangeListener to the panel |
721 | public static String smartQuote ( String s ) { if ( s . contains ( " " ) ) { return dumbQuote ( s ) ; } else { return s ; } } | Quotes string when spaces are detected |
722 | public ReadInitialConnectPacket ( final ReadPacketFetcher packetFetcher ) throws IOException , QueryException { Buffer buffer = packetFetcher . getReusableBuffer ( ) ; if ( buffer . getByteAt ( 0 ) == Packet . ERROR ) { ErrorPacket errorPacket = new ErrorPacket ( buffer ) ; throw new QueryException ( errorPacket . getMessage ( ) ) ; } protocolVersion = buffer . readByte ( ) ; serverVersion = buffer . readString ( StandardCharsets . US_ASCII ) ; serverThreadId = buffer . readInt ( ) ; final byte [ ] seed1 = buffer . readRawBytes ( 8 ) ; buffer . skipByte ( ) ; int serverCapabilities2FirstBytes = buffer . readShort ( ) ; serverLanguage = buffer . readByte ( ) ; serverStatus = buffer . readShort ( ) ; int serverCapabilities4FirstBytes = serverCapabilities2FirstBytes + ( buffer . readShort ( ) << 16 ) ; int saltLength = 0 ; if ( ( serverCapabilities4FirstBytes & MariaDbServerCapabilities . PLUGIN_AUTH ) != 0 ) { saltLength = Math . max ( 12 , buffer . readByte ( ) - 9 ) ; } else { buffer . skipByte ( ) ; } buffer . skipBytes ( 6 ) ; long mariaDbAdditionalCapacities = buffer . readInt ( ) ; if ( ( serverCapabilities4FirstBytes & MariaDbServerCapabilities . SECURE_CONNECTION ) != 0 ) { final byte [ ] seed2 = buffer . readRawBytes ( saltLength ) ; seed = Utils . copyWithLength ( seed1 , seed1 . length + seed2 . length ) ; System . arraycopy ( seed2 , 0 , seed , seed1 . length , seed2 . length ) ; } else { seed = Utils . copyWithLength ( seed1 , seed1 . length ) ; } buffer . skipByte ( ) ; if ( ( serverCapabilities4FirstBytes & MariaDbServerCapabilities . PLUGIN_AUTH ) != 0 ) { pluginName = buffer . readString ( StandardCharsets . US_ASCII ) ; if ( serverVersion . startsWith ( MARIADB_RPL_HACK_PREFIX ) ) { serverCapabilities = ( serverCapabilities4FirstBytes & 0xffffffffL ) + ( mariaDbAdditionalCapacities << 32 ) ; serverVersion = serverVersion . substring ( MARIADB_RPL_HACK_PREFIX . length ( ) ) ; } else { serverCapabilities = serverCapabilities4FirstBytes & 0xffffffffL ; } } else { serverCapabilities = serverCapabilities4FirstBytes & 0xffffffffL ; } } | Read database initial stream. |
723 | static boolean sleep ( final double howMuch ) { try { Thread . sleep ( ( int ) ( 1000 * howMuch ) ) ; return true ; } catch ( @ SuppressWarnings ( "unused" ) final InterruptedException __ ) { return false ; } } | The current SpartanMovie is not releaseable. Some big changes should be made. |
724 | public static Rectangle2D toAwtRectangle ( final Rectangle rect ) { final Rectangle2D rect2d = new Rectangle2D . Double ( ) ; rect2d . setRect ( rect . x , rect . y , rect . width , rect . height ) ; return rect2d ; } | Transform a swt Rectangle instance into an awt one. |
725 | private void testBug71396StatementMultiCheck ( Connection testConn , String [ ] queries , int [ ] expRowCount ) throws SQLException { if ( queries . length != expRowCount . length ) { fail ( "Bad arguments!" ) ; } Statement testStmt = testConn . createStatement ( ) ; testBug71396StatementMultiCheck ( testStmt , queries , expRowCount ) ; testStmt . close ( ) ; } | Executes a set of queries using a Statement (newly created) and tests if the results count is the expected. |
726 | public String KNNTipText ( ) { return "How many neighbours are used to determine the width of the " + "weighting function (<= 0 means all neighbours)." ; } | Returns the tip text for this property. |
727 | public void removeProtocols ( final Set < String > protocols ) { if ( protocols != null && _protocols != null ) { HashSet < String > removeProtocols = new HashSet < String > ( ) ; removeProtocols . addAll ( protocols ) ; _protocols . removeAll ( removeProtocols ) ; } } | remove the protocols from set of protocols in VirtualPool. |
728 | private List < File > findDuplicateFiles ( List < File > files ) { HashSet < File > sourceFileSet = new HashSet < > ( ) ; List < File > duplicateFiles = new ArrayList < > ( ) ; for ( File file : files ) { if ( ! sourceFileSet . contains ( file ) ) { sourceFileSet . add ( file ) ; } else { duplicateFiles . add ( file ) ; } } return duplicateFiles ; } | Returns a list of all duplicate files found in the specified list of files. |
729 | public static byte [ ] bitmapToJpg ( final Bitmap image , final int quality ) { if ( image == null ) return null ; ByteArrayOutputStream ba = new ByteArrayOutputStream ( ) ; if ( image . compress ( CompressFormat . JPEG , quality , ba ) ) return ba . toByteArray ( ) ; else return null ; } | Bitmap into compressed jpeg |
730 | public Class < ? > loadClass ( String name ) throws ClassNotFoundException { return initClassLoader . loadClass ( name ) ; } | Return the class with the given name. |
731 | public boolean addAll ( Collection c ) { Object [ ] a = c . toArray ( ) ; int numNew = a . length ; ensureCapacity ( size + numNew ) ; System . arraycopy ( a , 0 , elementData , size , numNew ) ; size += numNew ; return numNew != 0 ; } | Appends all of the elements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator. The behavior of this operation is undefined if the specified Collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified Collection is this list, and this list is nonempty.) |
732 | private void deleteFileIfEmpty ( ) throws IOException { if ( Files . size ( preferencesFilePath ) == 0 ) { Files . delete ( preferencesFilePath ) ; } } | It may happen that the file is empty when the process is forcibly killed, so remove the file if that happened. |
733 | public static < T extends Throwable > T readStackTrace ( T throwable , StreamInput in ) throws IOException { final int stackTraceElements = in . readVInt ( ) ; StackTraceElement [ ] stackTrace = new StackTraceElement [ stackTraceElements ] ; for ( int i = 0 ; i < stackTraceElements ; i ++ ) { final String declaringClasss = in . readString ( ) ; final String fileName = in . readOptionalString ( ) ; final String methodName = in . readString ( ) ; final int lineNumber = in . readVInt ( ) ; stackTrace [ i ] = new StackTraceElement ( declaringClasss , methodName , fileName , lineNumber ) ; } throwable . setStackTrace ( stackTrace ) ; int numSuppressed = in . readVInt ( ) ; for ( int i = 0 ; i < numSuppressed ; i ++ ) { throwable . addSuppressed ( in . readThrowable ( ) ) ; } return throwable ; } | Deserializes stacktrace elements as well as suppressed exceptions from the given output stream and adds it to the given exception. |
734 | public static int scan ( long v ) { if ( v == 0 ) { return - 1 ; } return Long . numberOfTrailingZeros ( v ) ; } | Utility method with defined return value for 0. |
735 | public int outputSequenceCount ( ) { return outRegressionSeqs . size ( ) + outErrorSeqs . size ( ) ; } | Returns the total number of test sequences generated to output, including both regression tests and error-revealing tests. |
736 | private void writeOutputFiles ( ) { if ( config . getOutputNetworkFile ( ) != null && config . getOutputScheduleFile ( ) != null ) { try { ScheduleTools . writeTransitSchedule ( schedule , config . getOutputScheduleFile ( ) ) ; NetworkTools . writeNetwork ( network , config . getOutputNetworkFile ( ) ) ; } catch ( Exception e ) { log . error ( "Cannot write to output directory! Trying to write schedule and network file in working directory" ) ; long t = System . nanoTime ( ) / 1000000 ; try { ScheduleTools . writeTransitSchedule ( schedule , t + "schedule.xml.gz" ) ; NetworkTools . writeNetwork ( network , t + "network.xml.gz" ) ; } catch ( Exception e1 ) { throw new RuntimeException ( "Files could not be written in working directory" ) ; } } if ( config . getOutputStreetNetworkFile ( ) != null ) { NetworkTools . writeNetwork ( NetworkTools . filterNetworkByLinkMode ( network , Collections . singleton ( TransportMode . car ) ) , config . getOutputStreetNetworkFile ( ) ) ; } } else { log . info ( "" ) ; log . info ( "No output paths defined, schedule and network are not written to files." ) ; } } | Write the schedule and network to output files (if defined in config) |
737 | public static int valueOf ( String name ) { for ( int opcode = 0 ; opcode < nameArray . length ; ++ opcode ) { if ( name . equalsIgnoreCase ( nameArray [ opcode ] ) ) { return opcode ; } } throw new IllegalArgumentException ( "No opcode for " + name ) ; } | Gets the opcode corresponding to a given mnemonic. |
738 | public void fixupVariables ( java . util . Vector vars , int globalsSize ) { if ( null != m_argVec ) { int nArgs = m_argVec . size ( ) ; for ( int i = 0 ; i < nArgs ; i ++ ) { Expression arg = ( Expression ) m_argVec . elementAt ( i ) ; arg . fixupVariables ( vars , globalsSize ) ; } } } | This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time. |
739 | public boolean cancelTask ( Task task ) { for ( ThreadRunnable threadRunnable : runableMap . keySet ( ) ) { if ( threadRunnable . task == task ) { Future future = runableMap . remove ( threadRunnable ) ; if ( future != null ) { future . cancel ( true ) ; } return true ; } } return false ; } | Cancel a single task |
740 | static String internalToBinaryClassName ( String className ) { if ( className == null ) { return null ; } else { return className . replace ( '/' , '.' ) ; } } | Utility that returns the fully qualified binary class name from a path-like FQCN. E.g. it returns android.view.View from android/view/View. |
741 | public static String readString ( File file ) throws IOException { FileInputStream in = new FileInputStream ( file ) ; try { return readString ( in ) ; } finally { in . close ( ) ; } } | Read the contents as a string from the given file. |
742 | private QueryExp buildOptionalQueryExp ( final String [ ] attributes , final Object [ ] values ) { QueryExp queryExp = null ; for ( int i = 0 ; i < attributes . length ; i ++ ) { if ( values [ i ] instanceof Boolean ) { if ( queryExp == null ) { queryExp = Query . eq ( Query . attr ( attributes [ i ] ) , Query . value ( ( ( Boolean ) values [ i ] ) ) ) ; } else { queryExp = Query . and ( queryExp , Query . eq ( Query . attr ( attributes [ i ] ) , Query . value ( ( ( Boolean ) values [ i ] ) ) ) ) ; } } else if ( values [ i ] instanceof Number ) { if ( queryExp == null ) { queryExp = Query . eq ( Query . attr ( attributes [ i ] ) , Query . value ( ( Number ) values [ i ] ) ) ; } else { queryExp = Query . and ( queryExp , Query . eq ( Query . attr ( attributes [ i ] ) , Query . value ( ( Number ) values [ i ] ) ) ) ; } } else if ( values [ i ] instanceof String ) { if ( queryExp == null ) { queryExp = Query . eq ( Query . attr ( attributes [ i ] ) , Query . value ( ( String ) values [ i ] ) ) ; } else { queryExp = Query . and ( queryExp , Query . eq ( Query . attr ( attributes [ i ] ) , Query . value ( ( String ) values [ i ] ) ) ) ; } } } return queryExp ; } | Builds an optional QueryExp to aid in matching the correct MBean using additional attributes with the specified values. Returns null if no attributes and values were specified during construction. |
743 | public boolean hasValue ( ) { return ! values . isEmpty ( ) ; } | Indicates whether this argument has at least one value. |
744 | protected static CompareOp convertToHBaseCompareOp ( ComparisonOperator comp ) { if ( comp == ComparisonOperator . EQUAL || comp == ComparisonOperator . LIKE || comp == ComparisonOperator . CONTAINS || comp == ComparisonOperator . IN || comp == ComparisonOperator . IS ) { return CompareOp . EQUAL ; } else if ( comp == ComparisonOperator . LESS ) { return CompareOp . LESS ; } else if ( comp == ComparisonOperator . LESS_OR_EQUAL ) { return CompareOp . LESS_OR_EQUAL ; } else if ( comp == ComparisonOperator . GREATER ) { return CompareOp . GREATER ; } else if ( comp == ComparisonOperator . GREATER_OR_EQUAL ) { return CompareOp . GREATER_OR_EQUAL ; } else if ( comp == ComparisonOperator . NOT_EQUAL || comp == ComparisonOperator . NOT_LIKE || comp == ComparisonOperator . NOT_CONTAINS || comp == ComparisonOperator . IS_NOT || comp == ComparisonOperator . NOT_IN ) { return CompareOp . NOT_EQUAL ; } else { LOG . error ( "{} operation is not supported now\n" , comp ) ; throw new IllegalArgumentException ( "Illegal operation: " + comp + ", avaliable options: " + Arrays . toString ( ComparisonOperator . values ( ) ) ) ; } } | Convert ComparisonOperator to native HBase CompareOp Support: =, =~,CONTAINS,<,<=,>,>=,!=,!=~ |
745 | public TBase < TBase < ? , ? > , TFieldIdEnum > newArgs ( List < Object > args ) { requireNonNull ( args , "args" ) ; final TBase < TBase < ? , ? > , TFieldIdEnum > newArgs = newArgs ( ) ; final int size = args . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { newArgs . setFieldValue ( argFields [ i ] , args . get ( i ) ) ; } return newArgs ; } | Returns a new arguments instance. |
746 | protected void doWrite ( HttpServletRequest request , HttpServletResponse response , String tunnelUUID ) throws GuacamoleException { GuacamoleTunnel tunnel = getTunnel ( tunnelUUID ) ; response . setContentType ( "application/octet-stream" ) ; response . setHeader ( "Cache-Control" , "no-cache" ) ; response . setContentLength ( 0 ) ; try { GuacamoleWriter writer = tunnel . acquireWriter ( ) ; Reader input = new InputStreamReader ( request . getInputStream ( ) , "UTF-8" ) ; try { int length ; char [ ] buffer = new char [ 8192 ] ; while ( tunnel . isOpen ( ) && ( length = input . read ( buffer , 0 , buffer . length ) ) != - 1 ) writer . write ( buffer , 0 , length ) ; } finally { input . close ( ) ; } } catch ( GuacamoleConnectionClosedException e ) { logger . debug ( "Connection to guacd closed." , e ) ; } catch ( IOException e ) { deregisterTunnel ( tunnel ) ; tunnel . close ( ) ; throw new GuacamoleServerException ( "I/O Error sending data to server: " + e . getMessage ( ) , e ) ; } finally { tunnel . releaseWriter ( ) ; } } | Called whenever the JavaScript Guacamole client makes a write request. This function should in general not be overridden, as it already contains a proper implementation of the write operation. |
747 | public final void testAddAllHelperTextsFromArray ( ) { CharSequence helperText1 = "helperText1" ; CharSequence helperText2 = "helperText2" ; CharSequence [ ] helperTexts1 = new CharSequence [ 2 ] ; helperTexts1 [ 0 ] = helperText1 ; helperTexts1 [ 1 ] = helperText2 ; PasswordEditText passwordEditText = new PasswordEditText ( getContext ( ) ) ; passwordEditText . addAllHelperTexts ( helperTexts1 ) ; passwordEditText . addAllHelperTexts ( helperTexts1 ) ; Collection < CharSequence > helperTexts2 = passwordEditText . getHelperTexts ( ) ; assertEquals ( helperTexts1 . length , helperTexts2 . size ( ) ) ; Iterator < CharSequence > iterator = helperTexts2 . iterator ( ) ; assertEquals ( helperText1 , iterator . next ( ) ) ; assertEquals ( helperText2 , iterator . next ( ) ) ; } | Tests the functionality of the method, which allows to add all helper texts, which are contained by an array. |
748 | public static < T extends Object & Comparable < ? super T > > T min ( Collection < ? extends T > collection ) { Iterator < ? extends T > it = collection . iterator ( ) ; T min = it . next ( ) ; while ( it . hasNext ( ) ) { T next = it . next ( ) ; if ( min . compareTo ( next ) > 0 ) { min = next ; } } return min ; } | Searches the specified collection for the minimum element. |
749 | public static String join ( List < ? > things , String delim ) { StringBuilder builder = new StringBuilder ( ) ; boolean first = true ; for ( Object thing : things ) { if ( first ) { first = false ; } else { builder . append ( delim ) ; } builder . append ( thing . toString ( ) ) ; } return builder . toString ( ) ; } | Returns a list joined together by the provided delimiter, for example, ["a", "b", "c"] could be joined into "a,b,c" |
750 | private void addURLToken ( String url , String text ) { addToken ( tokenForUrl ( url , text ) ) ; } | Adds the appropriate token for the given URL. This might be a simple link or it might be a recognized media type. |
751 | public void addSystemClass ( SootClass sc ) { allSystemClasses . add ( sc ) ; } | Add the given class to the list of system classes. Used when new classes are created. |
752 | public FloatBuffer put ( float [ ] src , int srcOffset , int floatCount ) { Arrays . checkOffsetAndCount ( src . length , srcOffset , floatCount ) ; if ( floatCount > remaining ( ) ) { throw new BufferOverflowException ( ) ; } for ( int i = srcOffset ; i < srcOffset + floatCount ; ++ i ) { put ( src [ i ] ) ; } return this ; } | Writes floats from the given float array, starting from the specified offset, to the current position and increases the position by the number of floats written. |
753 | @ SuppressWarnings ( "cast" ) @ Override public boolean contains ( final Object obj ) { if ( null != obj ) { Iterator < E > it = new ArrayDequeIterator < E > ( ) ; while ( it . hasNext ( ) ) { if ( obj . equals ( ( E ) it . next ( ) ) ) { return true ; } } } return false ; } | Returns true if the specified element is in the deque. |
754 | public IPv4AddrIV ( final IPv4Address value ) { super ( DTE . Extension ) ; this . value = value ; } | Ctor with internal value specified. |
755 | public void logAndSystemOut ( String message ) { logAndSystemOut ( message , null ) ; } | Sends the message to both logger and System.out (for unit report) |
756 | static char randomChar ( ) { return ( char ) TestUtil . nextInt ( random ( ) , 'a' , 'z' ) ; } | returns random character (a-z) |
757 | public static void overScrollBy ( final PullToRefreshBase < ? > view , final int deltaX , final int scrollX , final int deltaY , final int scrollY , final int scrollRange , final int fuzzyThreshold , final float scaleFactor , final boolean isTouchEvent ) { final int deltaValue , currentScrollValue , scrollValue ; switch ( view . getPullToRefreshScrollDirection ( ) ) { case HORIZONTAL : deltaValue = deltaX ; scrollValue = scrollX ; currentScrollValue = view . getScrollX ( ) ; break ; case VERTICAL : default : deltaValue = deltaY ; scrollValue = scrollY ; currentScrollValue = view . getScrollY ( ) ; break ; } if ( view . isPullToRefreshOverScrollEnabled ( ) && ! view . isRefreshing ( ) ) { final Mode mode = view . getMode ( ) ; if ( mode . permitsPullToRefresh ( ) && ! isTouchEvent && deltaValue != 0 ) { final int newScrollValue = ( deltaValue + scrollValue ) ; if ( PullToRefreshBase . DEBUG ) { Log . d ( LOG_TAG , "OverScroll. DeltaX: " + deltaX + ", ScrollX: " + scrollX + ", DeltaY: " + deltaY + ", ScrollY: " + scrollY + ", NewY: " + newScrollValue + ", ScrollRange: " + scrollRange + ", CurrentScroll: " + currentScrollValue ) ; } if ( newScrollValue < ( 0 - fuzzyThreshold ) ) { if ( mode . showHeaderLoadingLayout ( ) ) { if ( currentScrollValue == 0 ) { view . setState ( State . OVERSCROLLING ) ; } view . setHeaderScroll ( ( int ) ( scaleFactor * ( currentScrollValue + newScrollValue ) ) ) ; } } else if ( newScrollValue > ( scrollRange + fuzzyThreshold ) ) { if ( mode . showFooterLoadingLayout ( ) ) { if ( currentScrollValue == 0 ) { view . setState ( State . OVERSCROLLING ) ; } view . setHeaderScroll ( ( int ) ( scaleFactor * ( currentScrollValue + newScrollValue - scrollRange ) ) ) ; } } else if ( Math . abs ( newScrollValue ) <= fuzzyThreshold || Math . abs ( newScrollValue - scrollRange ) <= fuzzyThreshold ) { view . setState ( State . RESET ) ; } } else if ( isTouchEvent && State . OVERSCROLLING == view . getState ( ) ) { view . setState ( State . RESET ) ; } } } | Helper method for Overscrolling that encapsulates all of the necessary function. This is the advanced version of the call. |
758 | private static void attemptRetryOnException ( String logPrefix , Request < ? > request , VolleyError exception ) throws VolleyError { RetryPolicy retryPolicy = request . getRetryPolicy ( ) ; int oldTimeout = request . getTimeoutMs ( ) ; try { retryPolicy . retry ( exception ) ; } catch ( VolleyError e ) { request . addMarker ( String . format ( "%s-timeout-giveup [timeout=%s]" , logPrefix , oldTimeout ) ) ; throw e ; } request . addMarker ( String . format ( "%s-retry [timeout=%s]" , logPrefix , oldTimeout ) ) ; } | Attempts to prepare the request for a retry. If there are no more attempts remaining in the request's retry policy, a timeout exception is thrown. |
759 | protected int read ( ) throws IOException { if ( offset == buffer . length ) { throw new ASN1Exception ( "Unexpected end of encoding" ) ; } if ( in == null ) { return buffer [ offset ++ ] & 0xFF ; } else { int octet = in . read ( ) ; if ( octet == - 1 ) { throw new ASN1Exception ( "Unexpected end of encoding" ) ; } buffer [ offset ++ ] = ( byte ) octet ; return octet ; } } | Reads the next encoded byte from the encoded input stream. |
760 | private void initializeKeyMap ( AccessProfile accessProfile ) { _keyMap . put ( Constants . dbClient , _dbClient ) ; _keyMap . put ( Constants . ACCESSPROFILE , accessProfile ) ; _keyMap . put ( Constants . PROPS , accessProfile . getProps ( ) ) ; _keyMap . put ( Constants . _serialID , accessProfile . getserialID ( ) ) ; _keyMap . put ( Constants . _nativeGUIDs , Sets . newHashSet ( ) ) ; } | populate keyMap with required attributes. |
761 | public void removeClickingListener ( OnWheelClickedListener listener ) { clickingListeners . remove ( listener ) ; } | Removes wheel clicking listener |
762 | public static BoundingBox create ( Vector coords ) { int length = coords . size ( ) ; if ( length <= 0 ) { throw new RuntimeException ( "There must be at least 1 coordinate." ) ; } Coord [ ] coordsArray = new Coord [ length ] ; coords . copyInto ( coordsArray ) ; return create ( coordsArray ) ; } | / create a smallest bounding box that contains all of the given coordinates |
763 | private static void decodeHanziSegment ( BitSource bits , StringBuilder result , int count ) throws FormatException { if ( count * 13 > bits . available ( ) ) { throw FormatException . getFormatInstance ( ) ; } byte [ ] buffer = new byte [ 2 * count ] ; int offset = 0 ; while ( count > 0 ) { int twoBytes = bits . readBits ( 13 ) ; int assembledTwoBytes = ( ( twoBytes / 0x060 ) << 8 ) | ( twoBytes % 0x060 ) ; if ( assembledTwoBytes < 0x003BF ) { assembledTwoBytes += 0x0A1A1 ; } else { assembledTwoBytes += 0x0A6A1 ; } buffer [ offset ] = ( byte ) ( ( assembledTwoBytes > > 8 ) & 0xFF ) ; buffer [ offset + 1 ] = ( byte ) ( assembledTwoBytes & 0xFF ) ; offset += 2 ; count -- ; } try { result . append ( new String ( buffer , StringUtils . GB2312 ) ) ; } catch ( UnsupportedEncodingException uee ) { throw FormatException . getFormatInstance ( ) ; } } | See specification GBT 18284-2000 |
764 | public static boolean isEmpty ( CharSequence str ) { if ( str == null || str . length ( ) == 0 ) return true ; else return false ; } | Returns true if the string is null or 0-length. |
765 | public PercentEscaper ( String safeChars , boolean plusForSpace ) { if ( safeChars . matches ( ".*[0-9A-Za-z].*" ) ) { throw new IllegalArgumentException ( "Alphanumeric characters are always 'safe' and should not be " + "explicitly specified" ) ; } if ( plusForSpace && safeChars . contains ( " " ) ) { throw new IllegalArgumentException ( "plusForSpace cannot be specified when space is a 'safe' character" ) ; } if ( safeChars . contains ( "%" ) ) { throw new IllegalArgumentException ( "The '%' character cannot be specified as 'safe'" ) ; } this . plusForSpace = plusForSpace ; this . safeOctets = createSafeOctets ( safeChars ) ; } | Constructs a URI escaper with the specified safe characters and optional handling of the space character. |
766 | public FSFont resolveFont ( SharedContext ctx , String [ ] families , float size , IdentValue weight , IdentValue style , IdentValue variant ) { List < Font > fonts = new ArrayList < Font > ( 3 ) ; if ( families != null ) { for ( int i = 0 ; i < families . length ; i ++ ) { Font font = resolveFont ( ctx , families [ i ] , size , weight , style , variant ) ; if ( font != null ) { fonts . add ( font ) ; } } } String family = "SansSerif" ; if ( style == IdentValue . ITALIC ) { family = "Serif" ; } Font fnt = createFont ( ctx , availableFontsHash . get ( family ) , size , weight , style , variant ) ; instanceHash . put ( getFontInstanceHashName ( ctx , family , size , weight , style , variant ) , fnt ) ; fonts . add ( fnt ) ; return new AWTFSFont ( fonts , size ) ; } | Resolves a list of font families. |
767 | private int [ ] parseMonths ( String line ) { int [ ] months = new int [ 12 ] ; String [ ] numbers = line . split ( "\\s" ) ; if ( numbers . length != 12 ) { throw new IllegalArgumentException ( "wrong number of months on line: " + Arrays . toString ( numbers ) + "; count: " + numbers . length ) ; } for ( int i = 0 ; i < 12 ; i ++ ) { try { months [ i ] = Integer . valueOf ( numbers [ i ] ) ; } catch ( NumberFormatException nfe ) { throw new IllegalArgumentException ( "bad key: " + numbers [ i ] ) ; } } return months ; } | Parses the 12 months lengths from a property value for a specific year. |
768 | private static int findClosest ( int desiredFactor , Set < Integer > factors ) { int bestFactor = 1 ; int bestDelta = desiredFactor ; for ( Integer factor : factors ) { int testDelta = Math . abs ( desiredFactor - factor ) ; if ( testDelta < bestDelta ) { bestDelta = testDelta ; bestFactor = factor ; } } return bestFactor ; } | Finds the factor that is closest to the desired factor, from an ordered list of factors. |
769 | private static long dosToJavaTime ( long dtime ) { @ SuppressWarnings ( "deprecation" ) Date d = new Date ( ( int ) ( ( ( dtime > > 25 ) & 0x7f ) + 80 ) , ( int ) ( ( ( dtime > > 21 ) & 0x0f ) - 1 ) , ( int ) ( ( dtime > > 16 ) & 0x1f ) , ( int ) ( ( dtime > > 11 ) & 0x1f ) , ( int ) ( ( dtime > > 5 ) & 0x3f ) , ( int ) ( ( dtime << 1 ) & 0x3e ) ) ; return d . getTime ( ) ; } | Converts DOS time to Java time (number of milliseconds since epoch). |
770 | private void overshadowRect ( final Rectangle2D rect , final Graphics2D g ) { Graphics2D g2 = ( Graphics2D ) g . create ( ) ; g2 . setColor ( GRAY_OUT ) ; g2 . fill ( rect ) ; g2 . dispose ( ) ; } | Shadows the given rectangle. Gives a disabled look to the given area. |
771 | private SecurityFunctionEntity createSecurityFunctionEntity ( String code ) { SecurityFunctionEntity securityFunctionEntity = new SecurityFunctionEntity ( ) ; securityFunctionEntity . setCode ( code ) ; return herdDao . saveAndRefresh ( securityFunctionEntity ) ; } | Creates and persists a security function entity. |
772 | public static < T > List < T > toList ( T obj1 ) { List < T > list = new LinkedList < T > ( ) ; list . add ( obj1 ) ; return list ; } | Create a list from passed objX parameters |
773 | public String toString ( final String name , final String header ) { final Map < String , Integer > items = contents . get ( name ) ; final StringBuilder sb = new StringBuilder ( header + "\n" ) ; for ( final Entry < String , Integer > entry : items . entrySet ( ) ) { sb . append ( entry . getKey ( ) + " \t" + entry . getValue ( ) + "\n" ) ; } return sb . toString ( ) ; } | converts a shop into a human readable form |
774 | private void processEMail ( ) { } | Create Reauest / Updates from EMail |
775 | SpeedPredictor ( ) { times = new double [ VECTOR_LENGTH ] ; WtWindowManager wm = WtWindowManager . getInstance ( ) ; prediction = MathHelper . parseDoubleDefault ( wm . getProperty ( SPEED_PROPERTY , Double . toString ( INITIAL_PREDICTED_SPEED ) ) , INITIAL_PREDICTED_SPEED ) ; jitter = MathHelper . parseDouble ( wm . getProperty ( JITTER_PROPERTY , "0.0" ) ) ; double average = TURN_LENGTH / prediction ; for ( int i = 0 ; i < VECTOR_LENGTH ; i ++ ) { times [ i ] = average ; } } | Create a new SpeedPredictor with default initial prediction and history corresponding to that. |
776 | @ Deactivate public void deactivate ( ComponentContext context ) { logger . debug ( "OpenIDM Config for Authentication {} is deactivated." , config . get ( Constants . SERVICE_PID ) ) ; config = null ; authenticators . clear ( ) ; if ( authFilterWrapper != null ) { try { authFilterWrapper . reset ( ) ; } catch ( Exception ex ) { logger . warn ( "Failure reported during unregistering of authentication filter: {}" , ex . getMessage ( ) , ex ) ; } } } | Nulls the stored authentication JsonValue. |
777 | public static String [ ] splitOptions ( String quotedOptionString ) throws Exception { Vector < String > optionsVec = new Vector < String > ( ) ; String str = new String ( quotedOptionString ) ; int i ; while ( true ) { i = 0 ; while ( ( i < str . length ( ) ) && ( Character . isWhitespace ( str . charAt ( i ) ) ) ) i ++ ; str = str . substring ( i ) ; if ( str . length ( ) == 0 ) break ; if ( str . charAt ( 0 ) == '"' ) { i = 1 ; while ( i < str . length ( ) ) { if ( str . charAt ( i ) == str . charAt ( 0 ) ) break ; if ( str . charAt ( i ) == '\\' ) { i += 1 ; if ( i >= str . length ( ) ) throw new Exception ( "String should not finish with \\" ) ; } i += 1 ; } if ( i >= str . length ( ) ) throw new Exception ( "Quote parse error." ) ; String optStr = str . substring ( 1 , i ) ; optStr = unbackQuoteChars ( optStr ) ; optionsVec . addElement ( optStr ) ; str = str . substring ( i + 1 ) ; } else { i = 0 ; while ( ( i < str . length ( ) ) && ( ! Character . isWhitespace ( str . charAt ( i ) ) ) ) i ++ ; String optStr = str . substring ( 0 , i ) ; optionsVec . addElement ( optStr ) ; str = str . substring ( i ) ; } } String [ ] options = new String [ optionsVec . size ( ) ] ; for ( i = 0 ; i < optionsVec . size ( ) ; i ++ ) { options [ i ] = ( String ) optionsVec . elementAt ( i ) ; } return options ; } | Split up a string containing options into an array of strings, one for each option. |
778 | public void write ( ArrayList < KeyValue > metadata , long imageStart , Raster raster , DataType dataType ) throws IOException { OutputStream oStream = new FileOutputStream ( filePath ) ; if ( oStream != null ) { outputStream = new BufferedOutputStream ( oStream ) ; } LabelParser parser = new LabelParser ( ) ; BufferedWriter writer = new BufferedWriter ( new OutputStreamWriter ( outputStream ) ) ; long size = parser . writeObject ( writer , metadata , "" ) ; long pad = imageStart - size ; for ( int i = 0 ; i < pad ; ++ i ) { writer . write ( ' ' ) ; } writer . flush ( ) ; dataStream = new DataOutputStream ( outputStream ) ; writeRaster ( raster , dataType ) ; } | Write a raster to a file. |
779 | static void cleanUp ( IR ir ) { for ( Enumeration < Instruction > e = ir . forwardInstrEnumerator ( ) ; e . hasMoreElements ( ) ; ) { Instruction s = e . nextElement ( ) ; if ( s . operator ( ) == PI ) { RegisterOperand result = GuardedUnary . getResult ( s ) ; Operator mv = IRTools . getMoveOp ( result . getType ( ) ) ; Operand val = GuardedUnary . getVal ( s ) ; Move . mutate ( s , mv , result , val ) ; } } ir . actualSSAOptions = null ; } | Change all PI nodes to INT_MOVE instructions <p> Side effect: invalidates SSA state |
780 | public String generateFileName ( ) { return new UniqueTestId ( ) . id + "_" + getCurrentTestClassName ( ) + "_" + getCurrentTestMethodName ( ) + "_" + getCurrentTestMethodLineNumber ( ) ; } | Generates the filename for screenshot |
781 | public BackupUploadStatus queryBackupUploadStatus ( ) { CoordinatorClient coordinatorClient = coordinator . getCoordinatorClient ( ) ; Configuration cfg = coordinatorClient . queryConfiguration ( coordinatorClient . getSiteId ( ) , BackupConstants . BACKUP_UPLOAD_STATUS , Constants . GLOBAL_ID ) ; Map < String , String > allItems = ( cfg == null ) ? new HashMap < String , String > ( ) : cfg . getAllConfigs ( false ) ; BackupUploadStatus uploadStatus = new BackupUploadStatus ( allItems ) ; log . info ( "Upload status is: {}" , uploadStatus ) ; return uploadStatus ; } | Query upload status from ZK |
782 | @ Override public int process ( Callback [ ] callbacks , int state ) throws LoginException { switch ( state ) { case ISAuthConstants . LOGIN_START : { setUserSessionProperty ( JwtSessionModule . TOKEN_IDLE_TIME_IN_MINUTES_CLAIM_KEY , tokenIdleTime . toString ( ) ) ; setUserSessionProperty ( JwtSessionModule . MAX_TOKEN_LIFE_IN_MINUTES_KEY , maxTokenLife . toString ( ) ) ; setUserSessionProperty ( ENFORCE_CLIENT_IP_SETTING_KEY , Boolean . toString ( enforceClientIP ) ) ; setUserSessionProperty ( SECURE_COOKIE_KEY , Boolean . toString ( secureCookie ) ) ; setUserSessionProperty ( HTTP_ONLY_COOKIE_KEY , Boolean . toString ( httpOnlyCookie ) ) ; if ( cookieName != null ) { setUserSessionProperty ( COOKIE_NAME_KEY , cookieName ) ; } String cookieDomainsString = "" ; for ( String cookieDomain : cookieDomains ) { cookieDomainsString += cookieDomain + "," ; } setUserSessionProperty ( COOKIE_DOMAINS_KEY , cookieDomainsString ) ; setUserSessionProperty ( HMAC_KEY , encryptedHmacKey ) ; final Subject clientSubject = new Subject ( ) ; MessageInfo messageInfo = persistentCookieModuleWrapper . prepareMessageInfo ( getHttpServletRequest ( ) , getHttpServletResponse ( ) ) ; if ( process ( messageInfo , clientSubject , callbacks ) ) { if ( principal != null ) { setAuthenticatingUserName ( principal . getName ( ) ) ; } return ISAuthConstants . LOGIN_SUCCEED ; } throw new AuthLoginException ( AUTH_RESOURCE_BUNDLE_NAME , "cookieNotValid" , null ) ; } default : { throw new AuthLoginException ( AUTH_RESOURCE_BUNDLE_NAME , "incorrectState" , null ) ; } } } | Overridden as to call different method on underlying JASPI JwtSessionModule. |
783 | private int distance2 ( Point p0 , Point p1 ) { int d0 = Math . abs ( p0 . x - p1 . x ) ; int d1 = Math . abs ( p0 . y - p1 . y ) ; return d0 * d0 + d1 * d1 ; } | Returns the distance to the power of 2 between two points |
784 | public JsonWriter ( ODataUri oDataUri , EntityDataModel entityDataModel ) { this . odataUri = checkNotNull ( oDataUri ) ; this . entityDataModel = checkNotNull ( entityDataModel ) ; expandedProperties . addAll ( asJavaList ( getSimpleExpandPropertyNames ( oDataUri ) ) ) ; } | Create an OData JSON Writer. |
785 | protected static Die die ( String why ) { return new Die ( why ) ; } | Create a new exception to indicate we won't continue. |
786 | public Builder withSolrXml ( Path solrXml ) { try { this . solrxml = new String ( Files . readAllBytes ( solrXml ) , Charset . defaultCharset ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } return this ; } | Read solr.xml from the provided path |
787 | public double doubleValue ( ) { if ( val instanceof Long || val instanceof Integer ) { return ( double ) ( val . longValue ( ) ) ; } return val . doubleValue ( ) ; } | Returns a double numeric value |
788 | public static String encode ( String string ) { byte [ ] bytes ; try { bytes = string . getBytes ( PREFERRED_ENCODING ) ; } catch ( UnsupportedEncodingException e ) { bytes = string . getBytes ( ) ; } return encodeBytes ( bytes ) ; } | Encode string as a byte array in Base64 annotation. |
789 | public void prune ( ) { ConstPool cp = compact0 ( ) ; ArrayList newAttributes = new ArrayList ( ) ; AttributeInfo invisibleAnnotations = getAttribute ( AnnotationsAttribute . invisibleTag ) ; if ( invisibleAnnotations != null ) { invisibleAnnotations = invisibleAnnotations . copy ( cp , null ) ; newAttributes . add ( invisibleAnnotations ) ; } AttributeInfo visibleAnnotations = getAttribute ( AnnotationsAttribute . visibleTag ) ; if ( visibleAnnotations != null ) { visibleAnnotations = visibleAnnotations . copy ( cp , null ) ; newAttributes . add ( visibleAnnotations ) ; } AttributeInfo signature = getAttribute ( SignatureAttribute . tag ) ; if ( signature != null ) { signature = signature . copy ( cp , null ) ; newAttributes . add ( signature ) ; } ArrayList list = methods ; int n = list . size ( ) ; for ( int i = 0 ; i < n ; ++ i ) { MethodInfo minfo = ( MethodInfo ) list . get ( i ) ; minfo . prune ( cp ) ; } list = fields ; n = list . size ( ) ; for ( int i = 0 ; i < n ; ++ i ) { FieldInfo finfo = ( FieldInfo ) list . get ( i ) ; finfo . prune ( cp ) ; } attributes = newAttributes ; constPool = cp ; } | Discards all attributes, associated with both the class file and the members such as a code attribute and exceptions attribute. The unused constant pool entries are also discarded (a new packed constant pool is constructed). |
790 | public void endGroup ( ) { stream . println ( "</group>" ) ; } | Ends the current group. |
791 | public void testFloatValueMinusZero ( ) { String a = "-123809648392384754573567356745735.63567890295784902768787678287E-400" ; BigDecimal aNumber = new BigDecimal ( a ) ; int minusZero = - 2147483648 ; float result = aNumber . floatValue ( ) ; assertTrue ( "incorrect value" , Float . floatToIntBits ( result ) == minusZero ) ; } | Float value of a small negative BigDecimal |
792 | public static ParameterType makeFileParameterType ( ParameterHandler parameterHandler , String parameterName , String description , PortProvider portProvider , String ... fileExtensions ) { return makeFileParameterType ( parameterHandler , parameterName , description , portProvider , false , fileExtensions ) ; } | Creates the file parameter named by fileParameterName that depends on whether or not the port returned by the given PortProvider is connected. |
793 | public void save ( String key , Object data , boolean isEncrypted , String encryptKey ) { key = safetyKey ( key ) ; String wrapperJSONSerialized ; if ( data instanceof Record ) { Type type = jolyglot . newParameterizedType ( data . getClass ( ) , Object . class ) ; wrapperJSONSerialized = jolyglot . toJson ( data , type ) ; } else { wrapperJSONSerialized = jolyglot . toJson ( data ) ; } FileWriter fileWriter = null ; try { File file = new File ( cacheDirectory , key ) ; fileWriter = new FileWriter ( file , false ) ; fileWriter . write ( wrapperJSONSerialized ) ; fileWriter . flush ( ) ; fileWriter . close ( ) ; fileWriter = null ; if ( isEncrypted ) { fileEncryptor . encrypt ( encryptKey , new File ( cacheDirectory , key ) ) ; } } catch ( Exception e ) { throw new RuntimeException ( e ) ; } finally { try { if ( fileWriter != null ) { fileWriter . flush ( ) ; fileWriter . close ( ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } } } | Save in disk the object passed. |
794 | private void backupScreens ( BackupDataOutput data ) throws IOException { ContentResolver cr = mContext . getContentResolver ( ) ; Cursor cursor = cr . query ( LauncherSettings . WorkspaceScreens . CONTENT_URI , SCREEN_PROJECTION , null , null , null ) ; try { cursor . moveToPosition ( - 1 ) ; if ( DEBUG ) Log . d ( TAG , "dumping screens after: " + mLastBackupRestoreTime ) ; while ( cursor . moveToNext ( ) ) { final long id = cursor . getLong ( ID_INDEX ) ; final long updateTime = cursor . getLong ( ID_MODIFIED ) ; Key key = getKey ( Key . SCREEN , id ) ; mKeys . add ( key ) ; final String backupKey = keyToBackupKey ( key ) ; if ( ! mExistingKeys . contains ( backupKey ) || updateTime >= mLastBackupRestoreTime ) { writeRowToBackup ( key , packScreen ( cursor ) , data ) ; } else { if ( VERBOSE ) Log . v ( TAG , "screen already backup up " + id ) ; } } } finally { cursor . close ( ) ; } } | Write all modified screens to the data stream. |
795 | public static double simpleTest ( double [ ] test ) { double scale = 1. / ( test . length + 1. ) ; double maxdev = Double . NEGATIVE_INFINITY ; for ( int i = 0 ; i < test . length ; i ++ ) { double expected = ( i + 1. ) * scale ; double dev = Math . abs ( test [ i ] - expected ) ; if ( dev > maxdev ) { maxdev = dev ; } } return Math . abs ( maxdev ) ; } | Simplest version of the test: test if a sorted array is approximately uniform distributed on [0:1]. |
796 | private void openLine ( boolean firstEntry ) throws IOException { if ( firstEntry ) { out . append ( '\"' ) ; } } | Begin the entry for a new line. |
797 | private long [ ] convertToArray ( Map < String , Long > map , int size , boolean unitOffset ) { long [ ] values = new long [ size ] ; int arrayOffset = unitOffset ? - 1 : 0 ; for ( Map . Entry < String , Long > cursor : map . entrySet ( ) ) { int offset = Integer . parseInt ( cursor . getKey ( ) ) + arrayOffset ; values [ offset ] = cursor . getValue ( ) ; } return values ; } | Will convert a (possibly sparse) map whose keys are String versions of numbers between 0 and size, to an array. |
798 | private static void sortAnonymous ( List < IType > anonymous , IType anonType ) { SourceOffsetComparator sourceComparator = new SourceOffsetComparator ( ) ; final AnonymClassComparator classComparator = new AnonymClassComparator ( anonType , sourceComparator ) ; Collections . sort ( anonymous , classComparator ) ; } | Sort given anonymous classes in order like java compiler would generate output classes, in context of given anonymous type |
799 | public static boolean isDefaultUseInternalBrowser ( ) { return BrowserUtil . canUseInternalWebBrowser ( ) ; } | Returns whether the internal browser is used by default |
Subsets and Splits