idx
int64 0
34.9k
| question
stringlengths 12
26.4k
| target
stringlengths 15
2.3k
|
---|---|---|
34,300 | public CharSeq replaceAll ( String regex , String replacement ) { return CharSeq . of ( str . replaceAll ( regex , replacement ) ) ; } | Return a new CharSeq by replacing each substring of this CharSeq that matches the given regular expression with the given String replacement. |
34,301 | private void doubleCapacity ( ) { int p = head ; int n = elements . length ; int r = n - p ; int newCapacity = n << 1 ; if ( newCapacity < 0 ) throw new IllegalStateException ( "Sorry, deque too big" ) ; Object [ ] a = new Object [ newCapacity ] ; System . arraycopy ( elements , p , a , 0 , r ) ; System . arraycopy ( elements , 0 , a , r , p ) ; elements = a ; head = 0 ; tail = n ; } | Double the capacity of this deque. Call only when full, i.e., when head and tail have wrapped around to become equal. |
34,302 | public static File makeTempDir ( ) throws IOException { File temp = File . createTempFile ( "wwj" , null ) ; if ( ! temp . delete ( ) ) return null ; if ( ! temp . mkdir ( ) ) return null ; return temp ; } | Create a directory in the computer's temp directory. |
34,303 | public static SelectionResult ensureSelectionResult ( final Database db ) { List < SelectionResult > selections = ResultUtil . filterResults ( db . getHierarchy ( ) , db , SelectionResult . class ) ; if ( ! selections . isEmpty ( ) ) { return selections . get ( 0 ) ; } SelectionResult sel = new SelectionResult ( ) ; addChildResult ( db , sel ) ; return sel ; } | Ensure that there also is a selection container object. |
34,304 | private int generateNonce ( ) { return RANDOM . nextInt ( ) ; } | Generates a nonce (number used once). |
34,305 | public Builder clear ( ) { localeBuilder . clear ( ) ; return this ; } | Resets the builder to its initial, empty state. |
34,306 | public String readFragmentedUTF ( ) throws IOException { StringBuffer result = new StringBuffer ( super . readUTF ( ) ) ; boolean fragmentFlag = super . readBoolean ( ) ; while ( fragmentFlag != END_REACHED ) { result . append ( super . readUTF ( ) ) ; fragmentFlag = super . readBoolean ( ) ; } return result . toString ( ) ; } | Read a fragmented UTF-8 String |
34,307 | protected void appendByteType ( StringBuilder sb , FieldType fieldType , int fieldWidth ) { sb . append ( "TINYINT" ) ; } | Output the SQL type for a Java byte. |
34,308 | public String fromBase64 ( String toDecode ) { try { byte [ ] bytes = Base64 . decodeBase64 ( toDecode . trim ( ) ) ; return new String ( bytes , Charset . forName ( "utf-8" ) ) ; } catch ( Exception e ) { LOG . error ( "Error base64 decoding " + toDecode + ": " + e ) ; } return toDecode ; } | Returns a string's decoded from base 64 |
34,309 | public void close ( ) throws IOException { RAStream localRaf = ras ; if ( localRaf != null ) { synchronized ( localRaf ) { ras = null ; localRaf . close ( ) ; } if ( fileToDeleteOnClose != null ) { fileToDeleteOnClose . delete ( ) ; fileToDeleteOnClose = null ; } } } | Closes this zip file. This method is idempotent. This method may cause I/O if the zip file needs to be deleted. |
34,310 | public ValidationException ( File file , String message ) { super ( MessageFormat . format ( "{0} ({1})" , ( message == null ? "file validation failed" : message ) , file ) ) ; this . file = file ; } | Constructs an exception indicating the specified file could not be validated. |
34,311 | public final void yyclose ( ) throws java . io . IOException { zzAtEOF = true ; zzEndRead = zzStartRead ; if ( zzReader != null ) zzReader . close ( ) ; } | Closes the input stream. |
34,312 | public static String collapse ( String name ) { if ( name == null ) { return null ; } int breakPoint = name . lastIndexOf ( '.' ) ; if ( breakPoint < 0 ) { return name ; } return collapseQualifier ( name . substring ( 0 , breakPoint ) , true ) + name . substring ( breakPoint ) ; } | Collapses a name. Mainly intended for use with classnames, where an example might serve best to explain. Imagine you have a class named 'org.hibernate.internal.util.StringHelper'; calling collapse on that classname will result in 'o.h.u.StringHelper'. |
34,313 | public static boolean isExpired ( ) { return getInstance ( ) . expired ; } | Is the license expired? |
34,314 | protected String doIt ( ) throws Exception { CreatePOS ( ) ; createAdmin ( ) ; return "@OK@" ; } | Process create a new Terminal POS |
34,315 | public void endElement ( ) throws SAXException { writePendingText ( ) ; String uri = getCurrentElementUri ( ) ; String local = getCurrentElementLocal ( ) ; String prefix = nsContext . getPrefix ( uri ) ; _assert ( prefix != null ) ; String qname ; if ( prefix . length ( ) != 0 ) qname = prefix + ':' + local ; else qname = local ; writer . endElement ( uri , local , qname ) ; nsContext . iterateDeclaredPrefixes ( endPrefixCallback ) ; popElement ( ) ; textBuf . setLength ( 0 ) ; nsContext . endElement ( ) ; } | Ends marshalling of an element. Pops the internal stack. |
34,316 | public JDBCPieDataset ( String url , String driverName , String user , String password ) throws SQLException , ClassNotFoundException { Class . forName ( driverName ) ; this . connection = DriverManager . getConnection ( url , user , password ) ; } | Creates a new JDBCPieDataset and establishes a new database connection. |
34,317 | private static void createFixedPartitionList ( int primaryIndex ) { fpaList . clear ( ) ; if ( primaryIndex == 1 ) { fpaList . add ( FixedPartitionAttributes . createFixedPartition ( "Q1" , true , 3 ) ) ; fpaList . add ( FixedPartitionAttributes . createFixedPartition ( "Q2" , 3 ) ) ; fpaList . add ( FixedPartitionAttributes . createFixedPartition ( "Q3" , 3 ) ) ; } if ( primaryIndex == 2 ) { fpaList . add ( FixedPartitionAttributes . createFixedPartition ( "Q1" , 3 ) ) ; fpaList . add ( FixedPartitionAttributes . createFixedPartition ( "Q2" , true , 3 ) ) ; fpaList . add ( FixedPartitionAttributes . createFixedPartition ( "Q3" , 3 ) ) ; } if ( primaryIndex == 3 ) { fpaList . add ( FixedPartitionAttributes . createFixedPartition ( "Q1" , 3 ) ) ; fpaList . add ( FixedPartitionAttributes . createFixedPartition ( "Q2" , 3 ) ) ; fpaList . add ( FixedPartitionAttributes . createFixedPartition ( "Q3" , true , 3 ) ) ; } } | creates a Fixed Partition List to be used for Fixed Partition Region |
34,318 | private void parseBindElements ( XmlReader . Element e , ItemElement ie , String referVariable ) { final Array < XmlReader . Element > binds = e . getChildrenByName ( XmlElementNames . BIND ) ; if ( binds == null || binds . size == 0 ) return ; BindElement be ; XmlReader . Element bindEle ; List < PropertyElement > props ; for ( int i = 0 , size = binds . size ; i < size ; i ++ ) { be = new BindElement ( XmlElementNames . BIND ) ; bindEle = binds . get ( i ) ; String id = bindEle . getAttribute ( XmlKeys . ID , null ) ; if ( ! TextUtils . isEmpty ( id ) ) { be . setId ( id ) ; } String refer = bindEle . getAttribute ( XmlKeys . REFER_VARIABLE , null ) ; if ( ! TextUtils . isEmpty ( refer ) ) { be . setReferVariable ( refer ) ; } refer = DataBindUtil . mergeReferVariable ( referVariable , refer ) ; props = parsePropertyElements ( bindEle , refer , id , true ) ; if ( props != null && props . size ( ) > 0 ) { be . setPropertyElements ( props ) ; } parseImageProperty ( be , bindEle , refer , id ) ; ie . addBindElement ( be ) ; } } | parse bind element and add it to the target ItemElement |
34,319 | public T withRatingColors ( final double min , final double max ) { if ( min >= max ) { throw new IllegalArgumentException ( String . format ( "Rating limits wrong. min (%s) has to be lower than max (%s)." , min , max ) ) ; } this . withColors = true ; this . minValue = min ; this . maxValue = max ; return ( T ) this ; } | Sets the rating colors for this cell renderer, based on a min and a max value. |
34,320 | public static void close ( ) throws SQLException { if ( connection != null ) { connection . close ( ) ; } } | Closes the database connection. |
34,321 | private void needNewBuffer ( int newcount ) { if ( currentBufferIndex < buffers . size ( ) - 1 ) { filledBufferSum += currentBuffer . length ; currentBufferIndex ++ ; currentBuffer = buffers . get ( currentBufferIndex ) ; } else { int newBufferSize ; if ( currentBuffer == null ) { newBufferSize = newcount ; filledBufferSum = 0 ; } else { newBufferSize = Math . max ( currentBuffer . length << 1 , newcount - filledBufferSum ) ; filledBufferSum += currentBuffer . length ; } currentBufferIndex ++ ; currentBuffer = new byte [ newBufferSize ] ; buffers . add ( currentBuffer ) ; } } | Makes a new buffer available either by allocating a new one or re-cycling an existing one. |
34,322 | public boolean equals ( Object o ) { if ( o instanceof CoverageCharVdt ) { CoverageCharVdt civ = ( CoverageCharVdt ) o ; return ( ( attribute == civ . attribute ) && ( value == civ . value ) ) ; } else { return false ; } } | Override the equals method. Two CoverageIntVdts are equal if and only iff their respective attribute and value members are equal. |
34,323 | public void closeTag ( ) { String tag = openTags . pop ( ) ; indent . setLength ( indent . length ( ) - INDENT_STR . length ( ) ) ; writer . println ( indent + "</" + tag + ">" ) ; } | Closes the corresponding XML tag |
34,324 | public void encode ( OutputStream out ) throws IOException { DerOutputStream tmp = new DerOutputStream ( ) ; if ( this . extensionValue == null ) { extensionId = PKIXExtensions . AuthorityKey_Id ; critical = false ; encodeThis ( ) ; } super . encode ( tmp ) ; out . write ( tmp . toByteArray ( ) ) ; } | Write the extension to the OutputStream. |
34,325 | public void testNegPosSameLength ( ) { byte aBytes [ ] = { - 128 , 56 , 100 , - 2 , - 76 , 89 , 45 , 91 , 3 , - 15 , 35 , 26 , - 117 } ; byte bBytes [ ] = { - 2 , - 3 , - 4 , - 4 , 5 , 14 , 23 , 39 , 48 , 57 , 66 , 5 , 14 , 23 } ; int aSign = - 1 ; int bSign = 1 ; byte rBytes [ ] = { 0 , - 2 , 125 , - 60 , - 104 , 1 , 10 , 6 , 2 , 32 , 56 , 2 , 4 , 4 , 21 } ; BigInteger aNumber = new BigInteger ( aSign , aBytes ) ; BigInteger bNumber = new BigInteger ( bSign , bBytes ) ; BigInteger result = aNumber . and ( 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 ( ) ) ; } | And for two numbers of different signs and the same length |
34,326 | @ Override public String toString ( ) { StringBuffer sb = new StringBuffer ( ) ; sb . append ( clientId ) ; sb . append ( "\n " ) ; switch ( status ) { case CONNECTED : sb . append ( context . getString ( R . string . connection_connected_to ) ) ; break ; case DISCONNECTED : sb . append ( context . getString ( R . string . connection_disconnected_from ) ) ; break ; case NONE : sb . append ( context . getString ( R . string . connection_unknown_status ) ) ; break ; case CONNECTING : sb . append ( context . getString ( R . string . connection_connecting_to ) ) ; break ; case DISCONNECTING : sb . append ( context . getString ( R . string . connection_disconnecting_from ) ) ; break ; case ERROR : sb . append ( context . getString ( R . string . connection_error_connecting_to ) ) ; } sb . append ( " " ) ; sb . append ( host ) ; return sb . toString ( ) ; } | A string representing the state of the client this connection object represents |
34,327 | protected int calculateBreakPosition ( int p0 , Token tokenList , float x0 ) { int p = p0 ; RSyntaxTextArea textArea = ( RSyntaxTextArea ) getContainer ( ) ; float currentWidth = getWidth ( ) ; if ( currentWidth == Integer . MAX_VALUE ) currentWidth = getPreferredSpan ( X_AXIS ) ; currentWidth = Math . max ( currentWidth , MIN_WIDTH ) ; Token t = tokenList ; while ( t != null && t . isPaintable ( ) ) { float tokenWidth = t . getWidth ( textArea , this , x0 ) ; if ( tokenWidth > currentWidth ) { if ( p == p0 ) { return t . getOffsetBeforeX ( textArea , this , 0 , currentWidth ) ; } return t . isWhitespace ( ) ? p + t . textCount : p ; } currentWidth -= tokenWidth ; x0 += tokenWidth ; p += t . textCount ; t = t . getNextToken ( ) ; } return p + 1 ; } | This is called by the nested wrapped line views to determine the break location. This can be reimplemented to alter the breaking behavior. It will either break at word or character boundaries depending upon the break argument given at construction. |
34,328 | public void fling ( int startX , int startY , int velocityX , int velocityY , int minX , int maxX , int minY , int maxY , int overX , int overY , long time ) { if ( mFlywheel && ! isFinished ( ) ) { float oldVelocityX = mScrollerX . mCurrVelocity ; float oldVelocityY = mScrollerY . mCurrVelocity ; if ( Math . signum ( velocityX ) == Math . signum ( oldVelocityX ) && Math . signum ( velocityY ) == Math . signum ( oldVelocityY ) ) { velocityX += oldVelocityX ; velocityY += oldVelocityY ; } } mMode = FLING_MODE ; mScrollerX . fling ( startX , velocityX , minX , maxX , overX , time ) ; mScrollerY . fling ( startY , velocityY , minY , maxY , overY , time ) ; } | Start scrolling based on a fling gesture. The distance traveled will depend on the initial velocity of the fling. |
34,329 | private int findBin ( double value ) { return FastMath . min ( FastMath . max ( ( int ) FastMath . ceil ( ( value - min ) / delta ) - 1 , 0 ) , binCount - 1 ) ; } | Returns the index of the bin to which the given value belongs |
34,330 | private static int NewShortArray ( JNIEnvironment env , int length ) { if ( traceJNI ) VM . sysWrite ( "JNI called: NewShortArray \n" ) ; RuntimeEntrypoints . checkJNICountDownToGC ( ) ; try { short [ ] newArray = new short [ length ] ; return env . pushJNIRef ( newArray ) ; } catch ( Throwable unexpected ) { if ( traceJNI ) unexpected . printStackTrace ( System . err ) ; env . recordException ( unexpected ) ; return 0 ; } } | NewShortArray: create a new short array |
34,331 | 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,332 | @ Override public synchronized boolean equals ( Object object ) { if ( this == object ) { return true ; } if ( object instanceof List ) { List < ? > list = ( List < ? > ) object ; if ( list . size ( ) != elementCount ) { return false ; } int index = 0 ; Iterator < ? > it = list . iterator ( ) ; while ( it . hasNext ( ) ) { Object e1 = elementData [ index ++ ] , e2 = it . next ( ) ; if ( ! ( e1 == null ? e2 == null : e1 . equals ( e2 ) ) ) { return false ; } } return true ; } return false ; } | Compares the specified object to this vector and returns if they are equal. The object must be a List which contains the same objects in the same order. |
34,333 | public static void assertSupportedCipherSuites ( Set < String > expected , String [ ] cipherSuites ) { Set < String > remainingCipherSuites = assertValidCipherSuites ( expected , cipherSuites ) ; assertEquals ( "Missing cipher suites" , Collections . EMPTY_SET , remainingCipherSuites ) ; assertEquals ( expected . size ( ) , cipherSuites . length ) ; } | After using assertValidCipherSuites on cipherSuites, assertSupportedCipherSuites additionally verifies that all supported cipher suites where in the input array. |
34,334 | public int compareTo ( Rule that ) { int answer = compareInt ( this . importPrecedence , that . importPrecedence ) ; if ( answer == 0 ) { answer = Double . compare ( this . priority , that . priority ) ; if ( answer == 0 ) { answer = compareInt ( this . appearenceCount , that . appearenceCount ) ; } } return answer ; } | Compares two rules in XSLT processing model order assuming that the modes are equal. |
34,335 | public static Class resolvePrimitiveClassName ( String name ) { Class result = null ; if ( name != null && name . length ( ) <= 8 ) { result = primitiveTypeNameMap . get ( name ) ; } return result ; } | Resolve the given class name as primitive class, if appropriate. |
34,336 | protected ArrayList < FoldingCellView > prepareViewsForAnimation ( ArrayList < Integer > viewHeights , Bitmap titleViewBitmap , Bitmap contentViewBitmap ) { if ( viewHeights == null || viewHeights . isEmpty ( ) ) throw new IllegalStateException ( "ViewHeights array must be not null and not empty" ) ; ArrayList < FoldingCellView > partsList = new ArrayList < > ( ) ; int partWidth = titleViewBitmap . getWidth ( ) ; int yOffset = 0 ; for ( int i = 0 ; i < viewHeights . size ( ) ; i ++ ) { int partHeight = viewHeights . get ( i ) ; Bitmap partBitmap = Bitmap . createBitmap ( partWidth , partHeight , Bitmap . Config . ARGB_8888 ) ; Canvas canvas = new Canvas ( partBitmap ) ; Rect srcRect = new Rect ( 0 , yOffset , partWidth , yOffset + partHeight ) ; Rect destRect = new Rect ( 0 , 0 , partWidth , partHeight ) ; canvas . drawBitmap ( contentViewBitmap , srcRect , destRect , null ) ; ImageView backView = createImageViewFromBitmap ( partBitmap ) ; ImageView frontView = null ; if ( i < viewHeights . size ( ) - 1 ) { frontView = ( i == 0 ) ? createImageViewFromBitmap ( titleViewBitmap ) : createBackSideView ( viewHeights . get ( i + 1 ) ) ; } partsList . add ( new FoldingCellView ( frontView , backView , getContext ( ) ) ) ; yOffset = yOffset + partHeight ; } return partsList ; } | Create and prepare list of FoldingCellViews with different bitmap parts for fold animation |
34,337 | public static boolean needsUID ( String classname ) { boolean result ; try { result = needsUID ( Class . forName ( classname ) ) ; } catch ( Exception e ) { result = false ; } return result ; } | checks whether a class needs to declare a serialVersionUID, i.e., it implements the java.io.Serializable interface but doesn't declare a serialVersionUID. |
34,338 | public void testPowNegativeNumToOddExp ( ) { byte aBytes [ ] = { 50 , - 26 , 90 , 69 , 120 , 32 , 63 , - 103 , - 14 , 35 } ; int aSign = - 1 ; int exp = 5 ; byte rBytes [ ] = { - 21 , - 94 , - 42 , - 15 , - 127 , 113 , - 50 , - 88 , 115 , - 35 , 3 , 59 , - 92 , 111 , - 75 , 103 , - 42 , 41 , 34 , - 114 , 99 , - 32 , 105 , - 59 , 127 , 45 , 108 , 74 , - 93 , 105 , 33 , 12 , - 5 , - 20 , 17 , - 21 , - 119 , - 127 , - 115 , 27 , - 122 , 26 , - 67 , 109 , - 125 , 16 , 91 , - 70 , 109 } ; BigInteger aNumber = new BigInteger ( aSign , aBytes ) ; BigInteger result = aNumber . pow ( exp ) ; 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 ( ) ) ; } | Exponentiation of a negative number to an odd exponent. |
34,339 | public void addAttribute ( Object name , Object value ) { table . put ( name , value ) ; } | Adds an attribute to the list. |
34,340 | public void saveSelectionDetail ( ) { int row = p_table . getSelectedRow ( ) ; if ( row == - 1 ) return ; Integer ID = getSelectedRowKey ( ) ; Env . setContext ( Env . getCtx ( ) , p_WindowNo , Env . TAB_INFO , "A_Asset_ID" , ID == null ? "0" : ID . toString ( ) ) ; } | Save Selection Details Get Location/Partner Info |
34,341 | @ Override public boolean equals ( final Object o ) { if ( this == o ) return true ; if ( ! ( o instanceof Header ) ) { return false ; } return name . equals ( ( ( Header ) o ) . name ) ; } | Equal if the headers have the same data. |
34,342 | final public void redirect ( String url ) { resp . setHeader ( "Location" , url ) ; setStatus ( HttpServletResponse . SC_MOVED_TEMPORARILY ) ; } | response and redirect to the url |
34,343 | public static void println ( short x ) { out . println ( x ) ; } | Prints a short integer to standard output and then terminates the line. |
34,344 | public void test_transferTo_couldDelete ( ) throws Exception { writeDataToFile ( fileOfReadOnlyFileChannel ) ; writeDataToFile ( fileOfWriteOnlyFileChannel ) ; readOnlyFileChannel . transferTo ( 0 , 2 , writeOnlyFileChannel ) ; readOnlyFileChannel . close ( ) ; writeOnlyFileChannel . close ( ) ; boolean rDel = fileOfReadOnlyFileChannel . delete ( ) ; boolean wDel = fileOfWriteOnlyFileChannel . delete ( ) ; assertTrue ( "File " + readOnlyFileChannel + " exists" , rDel ) ; assertTrue ( "File " + writeOnlyFileChannel + " exists" , wDel ) ; } | Regression test for Harmony-3324 Make sure we could delete the file after we called transferTo() method. |
34,345 | public String toString ( ) { StringBuilder sb = new StringBuilder ( super . toString ( ) ) ; sb . append ( "<" ) ; if ( intervals != null ) { for ( IInterval i : intervals ) { sb . append ( i ) ; sb . append ( ',' ) ; } } sb . append ( ">" ) ; return sb . toString ( ) ; } | Reasonable extension to toString() method. |
34,346 | public EnvVarModel ( EnvironmentManagerInterface envMgr ) { this . envMgr = envMgr ; if ( columns . isEmpty ( ) ) { columns . add ( Localisation . getString ( EnvVarDlg . class , "EnvVarModel.name" ) ) ; columns . add ( Localisation . getString ( EnvVarDlg . class , "EnvVarModel.type" ) ) ; columns . add ( Localisation . getString ( EnvVarDlg . class , "EnvVarModel.value" ) ) ; } } | Instantiates a new env var model. |
34,347 | public synchronized int write ( InputStream in ) throws IOException { int readCount = 0 ; int inBufferPos = count - filledBufferSum ; int n = in . read ( currentBuffer , inBufferPos , currentBuffer . length - inBufferPos ) ; while ( n != - 1 ) { readCount += n ; inBufferPos += n ; count += n ; if ( inBufferPos == currentBuffer . length ) { needNewBuffer ( currentBuffer . length ) ; inBufferPos = 0 ; } n = in . read ( currentBuffer , inBufferPos , currentBuffer . length - inBufferPos ) ; } return readCount ; } | Writes the entire contents of the specified input stream to this byte stream. Bytes from the input stream are read directly into the internal buffers of this streams. |
34,348 | private void refreshMarkers ( ) { removeAll ( ) ; Map markerMap = new HashMap ( ) ; List notices = textArea . getParserNotices ( ) ; for ( Iterator i = notices . iterator ( ) ; i . hasNext ( ) ; ) { ParserNotice notice = ( ParserNotice ) i . next ( ) ; if ( notice . getLevel ( ) <= levelThreshold || ( notice instanceof TaskNotice ) ) { Integer key = new Integer ( notice . getLine ( ) ) ; Marker m = ( Marker ) markerMap . get ( key ) ; if ( m == null ) { m = new Marker ( notice ) ; m . addMouseListener ( listener ) ; markerMap . put ( key , m ) ; add ( m ) ; } else { m . addNotice ( notice ) ; } } } if ( getShowMarkedOccurrences ( ) && textArea . getMarkOccurrences ( ) ) { List occurrences = textArea . getMarkedOccurrences ( ) ; for ( Iterator i = occurrences . iterator ( ) ; i . hasNext ( ) ; ) { DocumentRange range = ( DocumentRange ) i . next ( ) ; int line = 0 ; try { line = textArea . getLineOfOffset ( range . getStartOffset ( ) ) ; } catch ( BadLocationException ble ) { continue ; } ParserNotice notice = new MarkedOccurrenceNotice ( range ) ; Integer key = new Integer ( line ) ; Marker m = ( Marker ) markerMap . get ( key ) ; if ( m == null ) { m = new Marker ( notice ) ; m . addMouseListener ( listener ) ; markerMap . put ( key , m ) ; add ( m ) ; } else { if ( ! m . containsMarkedOccurence ( ) ) { m . addNotice ( notice ) ; } } } } revalidate ( ) ; repaint ( ) ; } | Refreshes the markers displayed in this error strip. |
34,349 | public Set < Statement > findTransitiveProperty ( Resource subj , URI prop , Value obj , Resource ... contxts ) throws InferenceEngineException { if ( transitivePropertySet . contains ( prop ) ) { Set < Statement > sts = new HashSet ( ) ; boolean goUp = subj == null ; chainTransitiveProperty ( subj , prop , obj , ( goUp ) ? ( obj ) : ( subj ) , sts , goUp , contxts ) ; return sts ; } else return null ; } | TODO: This chaining can be slow at query execution. the other option is to perform this in the query itself, but that will be constrained to how many levels we decide to go |
34,350 | public boolean isPluginEnabled ( Plugin plugin ) { if ( ( plugin != null ) && ( plugins . contains ( plugin ) ) ) { return plugin . isEnabled ( ) ; } else { return false ; } } | Checks if the given plugin is enabled or not |
34,351 | public String toString ( ) { StringBuilder result = new StringBuilder ( ) ; result . append ( "role name: " + roleName ) ; if ( roleValue != null ) { result . append ( "; value: " ) ; for ( Iterator < ObjectName > objNameIter = roleValue . iterator ( ) ; objNameIter . hasNext ( ) ; ) { ObjectName currObjName = objNameIter . next ( ) ; result . append ( currObjName . toString ( ) ) ; if ( objNameIter . hasNext ( ) ) { result . append ( ", " ) ; } } } result . append ( "; problem type: " + problemType ) ; return result . toString ( ) ; } | Return a string describing this object. |
34,352 | public LocalVariable visibleVariableByName ( String name ) throws AbsentInformationException { validateStackFrame ( ) ; createVisibleVariables ( ) ; return visibleVariables . get ( name ) ; } | Return a particular variable in the frame. Need not be synchronized since it cannot be provably stale. |
34,353 | public boolean hasKeyPurposeId ( KeyPurposeId keyPurposeId ) { return ( usageTable . get ( keyPurposeId ) != null ) ; } | Return true if this ExtendedKeyUsage object contains the passed in keyPurposeId. |
34,354 | public void toByteArray ( byte [ ] toBuf , int offset ) { int toLen = ( toBuf . length > count ) ? count : toBuf . length ; System . arraycopy ( buf , offset , toBuf , offset , toLen - offset ) ; } | Copy the buffered data to the given array. |
34,355 | public OrderedThreadPoolExecutor ( int corePoolSize , int maximumPoolSize ) { this ( corePoolSize , maximumPoolSize , DEFAULT_KEEP_ALIVE , TimeUnit . SECONDS , Executors . defaultThreadFactory ( ) , null ) ; } | Creates a default ThreadPool, with default values : - keepAlive set to 30 seconds - A default ThreadFactory - All events are accepted |
34,356 | public void replace ( DBNote note , int position ) { itemList . set ( position , note ) ; notifyItemChanged ( position ) ; } | Replaces a note with an updated version |
34,357 | @ Override public T next ( ) { if ( ! eol && uriList . isEmpty ( ) ) { fetch ( ) ; } URI next = uriList . poll ( ) ; if ( next == null ) { eol = true ; throw new NoSuchElementException ( "no more " + field ) ; } return create ( session , next ) ; } | Returns the next object of the result. |
34,358 | static Class < ? > loadClass ( String name ) { for ( ClassLoader loader : loaders ( ) ) { try { return loader . loadClass ( name ) ; } catch ( ClassNotFoundException ex ) { continue ; } } return null ; } | Utility method to load a class from one of the located classloaders. Please note that this method is used in tests using reflection. Do not remove. |
34,359 | @ Override default CompletableFuture < Long > sumLong ( final ToLongFunction < ? super T > fn ) { return CompletableFuture . supplyAsync ( null , getExec ( ) ) ; } | Perform an asynchronous sum operation |
34,360 | public SortClause ( String item , ORDER order ) { this . item = item ; this . order = order ; } | Creates a SortClause based on item and order |
34,361 | public XMPSchemaRegistryImpl ( ) { try { registerStandardNamespaces ( ) ; registerStandardAliases ( ) ; } catch ( XMPException e ) { throw new RuntimeException ( "The XMPSchemaRegistry cannot be initialized!" ) ; } } | Performs the initialisation of the registry with the default namespaces, aliases and global options. |
34,362 | public static void removeLogFilter ( LogFilter filter ) { if ( filter == null || filters == null || filters . isEmpty ( ) ) { return ; } if ( filters . contains ( filter ) ) { filters . remove ( filter ) ; } } | remove the log filter |
34,363 | private void closeWall ( String wallId ) { RetroCallback retroCallback ; retroCallback = new RetroCallback ( this ) ; retroCallback . setRequestId ( HttpConstants . ApiResponseCodes . CLOSE_WALL ) ; Bundle args = new Bundle ( ) ; args . putString ( AppConstants . Keys . WALL_ID , wallId ) ; retroCallback . setExtras ( args ) ; retroCallbackList . add ( retroCallback ) ; CloseWallRequestModel closeWallRequestModel = new CloseWallRequestModel ( ) ; closeWallRequestModel . setIs_solved ( "1" ) ; mYeloApi . closeWall ( wallId , closeWallRequestModel , retroCallback ) ; } | api call for closing the wall |
34,364 | public boolean isCumulative ( ) { return cumulative ; } | Gets the cumulative mode. |
34,365 | @ Override public boolean addAll ( int index , Collection < ? extends E > collection ) { int s = size ; if ( index > s || index < 0 ) { throwIndexOutOfBoundsException ( index , s ) ; } Object [ ] newPart = collection . toArray ( ) ; int newPartSize = newPart . length ; if ( newPartSize == 0 ) { return false ; } Object [ ] a = array ; int newSize = s + newPartSize ; if ( newSize <= a . length ) { System . arraycopy ( a , index , a , index + newPartSize , s - index ) ; } else { int newCapacity = newCapacity ( newSize - 1 ) ; Object [ ] newArray = new Object [ newCapacity ] ; System . arraycopy ( a , 0 , newArray , 0 , index ) ; System . arraycopy ( a , index , newArray , index + newPartSize , s - index ) ; array = a = newArray ; } System . arraycopy ( newPart , 0 , a , index , newPartSize ) ; size = newSize ; modCount ++ ; return true ; } | Inserts the objects in the specified collection at the specified location in this List. The objects are added in the order they are returned from the collection's iterator. |
34,366 | public final void onDead ( final Killer killer ) { onDead ( killer , true ) ; } | This method is called when the entity has been killed ( hp==0 ). |
34,367 | public static Throwable extractRootCause ( Throwable t ) { Throwable result = t ; while ( result . getCause ( ) != null ) { result = result . getCause ( ) ; } return result ; } | Extracts the root cause of the exception, no matter how nested it is |
34,368 | public RegexFileFilter ( String pattern , IOCase caseSensitivity ) { if ( pattern == null ) { throw new IllegalArgumentException ( "Pattern is missing" ) ; } int flags = 0 ; if ( caseSensitivity != null && ! caseSensitivity . isCaseSensitive ( ) ) { flags = Pattern . CASE_INSENSITIVE ; } this . pattern = Pattern . compile ( pattern , flags ) ; } | Construct a new regular expression filter with the specified flags case sensitivity. |
34,369 | @ Override public Connection connect ( String url , Properties info ) throws SQLException { try { if ( info == null ) { info = new Properties ( ) ; } if ( ! acceptsURL ( url ) ) { return null ; } if ( url . equals ( DEFAULT_URL ) ) { return DEFAULT_CONNECTION . get ( ) ; } Connection c = DbUpgrade . connectOrUpgrade ( url , info ) ; if ( c != null ) { return c ; } return new JdbcConnection ( url , info ) ; } catch ( Exception e ) { throw DbException . toSQLException ( e ) ; } } | Open a database connection. This method should not be called by an application. Instead, the method DriverManager.getConnection should be used. |
34,370 | private CIMInstance isRegisteredProfileValid ( Iterator < CIMInstance > profileinstances ) { CIMInstance profileInstance = null ; while ( profileinstances . hasNext ( ) ) { profileInstance = profileinstances . next ( ) ; String registeredName = getCIMPropertyValue ( profileInstance , REGISTEREDNAME ) ; String registeredVersion = getCIMPropertyValue ( profileInstance , REGISTEREDVERSION ) ; String registeredOrganization = getCIMPropertyValue ( profileInstance , REGISTEREDORGANIZATION ) ; if ( registeredName . contains ( ARRAY ) && registeredOrganization . equalsIgnoreCase ( ELEVEN ) ) { if ( highestVersion . isEmpty ( ) ) { highestVersionRegProfile = profileInstance ; highestVersion = registeredVersion ; } else if ( compareVersions ( registeredVersion , highestVersion ) > 0 ) { highestVersionRegProfile = profileInstance ; highestVersion = registeredVersion ; } } } return highestVersionRegProfile ; } | is Registered Profile Valid. |
34,371 | public byte [ ] generate160BitHashId ( ) throws CryptoException { try { DERBitString publicKeyBitString = encodePublicKeyAsBitString ( publicKey ) ; return DigestUtil . getMessageDigest ( publicKeyBitString . getBytes ( ) , DigestType . SHA1 ) ; } catch ( IOException ex ) { throw new CryptoException ( res . getString ( "NoGenerateKeyIdentifier.exception.message" ) , ex ) ; } } | Generate 160 bit hash key identifier. |
34,372 | public long next ( long fromTime ) { if ( getCurrentCount ( ) == 0 || fromTime == 0 || fromTime == startDate . getTime ( ) ) { return first ( ) ; } if ( Debug . verboseOn ( ) ) { Debug . logVerbose ( "Date List Size: " + ( rDateList == null ? 0 : rDateList . size ( ) ) , module ) ; Debug . logVerbose ( "Rule List Size: " + ( rRulesList == null ? 0 : rRulesList . size ( ) ) , module ) ; } if ( rDateList == null && rRulesList == null ) { return 0 ; } long nextRuleTime = fromTime ; boolean hasNext = true ; Iterator < RecurrenceRule > rulesIterator = getRecurrenceRuleIterator ( ) ; while ( rulesIterator . hasNext ( ) ) { RecurrenceRule rule = rulesIterator . next ( ) ; while ( hasNext ) { nextRuleTime = getNextTime ( rule , nextRuleTime ) ; if ( nextRuleTime == 0 || isValid ( nextRuleTime ) ) { hasNext = false ; } } } return nextRuleTime ; } | Returns the next recurrence from the specified time. |
34,373 | public static String arrayToCommaDelimitedString ( Object [ ] arr ) { return arrayToDelimitedString ( arr , "," ) ; } | Convenience method to return a String array as a CSV String. E.g. useful for toString() implementations. |
34,374 | public static String buildSelectorFromElementsAndAttribute ( Collection < String > elementNameList , @ Nullable String attributeName , boolean notEmptyAttribute ) { StringBuilder selector = new StringBuilder ( ) ; boolean isFirstElement = true ; for ( String elementName : elementNameList ) { if ( ! isFirstElement ) { selector . append ( SPACE ) ; selector . append ( COMMA ) ; selector . append ( SPACE ) ; } selector . append ( elementName ) ; if ( StringUtils . isNotBlank ( attributeName ) ) { selector . append ( OPEN_BRACKET ) ; selector . append ( attributeName ) ; selector . append ( CLOSE_BRACKET ) ; if ( notEmptyAttribute ) { selector . append ( NOT_PREFIX ) ; selector . append ( OPEN_BRACKET ) ; selector . append ( attributeName ) ; selector . append ( NOT_EMPTY_REGEXP ) ; selector . append ( CLOSE_BRACKET ) ; selector . append ( CLOSE_PARENTHESE ) ; } } isFirstElement = false ; } return selector . toString ( ) ; } | Build a JQuery selector to retrieve elements that contain a given attribute. The notEmptyAttribute attribute determines whether this attribute can be empty or not |
34,375 | private static String translateOSNameToFolderName ( String osName ) { if ( osName . contains ( "Windows" ) ) { return "Windows" ; } else if ( osName . contains ( "Mac" ) ) { return "Mac" ; } else if ( osName . contains ( "Linux" ) ) { return "Linux" ; } else if ( osName . contains ( "AIX" ) ) { return "AIX" ; } else { return osName . replaceAll ( "\\W" , "" ) ; } } | Translates the OS name to folder name. |
34,376 | public void testGetFormat ( ) { byte [ ] key = new byte [ ] { 1 , 2 , 3 , 4 , 5 } ; String algorithm = "Algorithm" ; SecretKeySpec ks = new SecretKeySpec ( key , algorithm ) ; assertTrue ( "The returned value is not \"RAW\"." , ks . getFormat ( ) == "RAW" ) ; } | getFormat() method testing. Tests that returned value is "RAW". |
34,377 | Collection < MobSimVehicleRoute > createPlans ( ) { List < MobSimVehicleRoute > vehicleRoutes = new ArrayList < MobSimVehicleRoute > ( ) ; for ( CarrierAgent carrierAgent : carrierAgents ) { List < MobSimVehicleRoute > plansForCarrier = carrierAgent . createFreightDriverPlans ( ) ; vehicleRoutes . addAll ( plansForCarrier ) ; } return vehicleRoutes ; } | Returns the entire set of selected carrier plans. |
34,378 | private static JFreeChart createChart ( ) { Number [ ] [ ] data = new Integer [ ] [ ] { { new Integer ( - 3 ) , new Integer ( - 2 ) } , { new Integer ( - 1 ) , new Integer ( 1 ) } , { new Integer ( 2 ) , new Integer ( 3 ) } } ; CategoryDataset dataset = DatasetUtilities . createCategoryDataset ( "S" , "C" , data ) ; return ChartFactory . createStackedAreaChart ( "Stacked Area Chart" , "Domain" , "Range" , dataset , PlotOrientation . HORIZONTAL , true , true , true ) ; } | Create a stacked bar chart with sample data in the range -3 to +3. |
34,379 | void add ( IndicatorResult result ) { indicatorResults . add ( result ) ; } | Adds the results for a single indicator. The name of the indicator should be unique. |
34,380 | public static byte [ ] compress ( byte [ ] data ) throws IOException { Deflater deflater = new Deflater ( 9 , Boolean . TRUE ) ; deflater . setInput ( data ) ; ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( data . length ) ; deflater . finish ( ) ; byte [ ] buffer = new byte [ 1024 ] ; while ( ! deflater . finished ( ) ) { int count = deflater . deflate ( buffer ) ; outputStream . write ( buffer , 0 , count ) ; } outputStream . close ( ) ; byte [ ] output = outputStream . toByteArray ( ) ; deflater . end ( ) ; return output ; } | Compress given bytes with zip deflate. |
34,381 | public boolean containsValue ( Object value ) { return contains ( value ) ; } | Returns true if this Cache maps one or more keys to this value. <p> Note that this method is identical in functionality to contains (which predates the Map interface). |
34,382 | public static Map < URI , Integer > filterVolumeMap ( Map < URI , Integer > volumeMap , Set < URI > includedVolumes ) { Map < URI , Integer > result = new HashMap < URI , Integer > ( ) ; if ( includedVolumes == null ) { return result ; } for ( URI includedVolume : includedVolumes ) { result . put ( includedVolume , volumeMap . get ( includedVolume ) ) ; } return result ; } | Filter the volumeMap to only contain the desired includedVolumes. |
34,383 | public synchronized boolean addAll ( int index , Collection < ? extends E > c ) { modCount ++ ; if ( index < 0 || index > elementCount ) throw new ArrayIndexOutOfBoundsException ( index ) ; Object [ ] a = c . toArray ( ) ; int numNew = a . length ; ensureCapacityHelper ( elementCount + numNew ) ; int numMoved = elementCount - index ; if ( numMoved > 0 ) System . arraycopy ( elementData , index , elementData , index + numNew , numMoved ) ; System . arraycopy ( a , 0 , elementData , index , numNew ) ; elementCount += numNew ; return numNew != 0 ; } | Inserts all of the elements in the specified Collection into this Vector at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the Vector in the order that they are returned by the specified Collection's iterator. |
34,384 | @ Override protected void keyTyped ( char par1 , int par2 ) { } | Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). |
34,385 | public static Method findMethod ( Object instance , String name , Class < ? > ... parameterTypes ) throws NoSuchMethodException { for ( Class < ? > clazz = instance . getClass ( ) ; clazz != null ; clazz = clazz . getSuperclass ( ) ) { try { Method method = clazz . getDeclaredMethod ( name , parameterTypes ) ; if ( ! method . isAccessible ( ) ) { method . setAccessible ( true ) ; } return method ; } catch ( NoSuchMethodException e ) { } } throw new NoSuchMethodException ( "Method " + name + " with parameters " + Arrays . asList ( parameterTypes ) + " not found in " + instance . getClass ( ) ) ; } | Locates a given method anywhere in the class inheritance hierarchy. |
34,386 | String readLiteral ( String source , int ofs , String token ) { return readSubstring ( source , ofs , ofs + token . length ( ) ) ; } | Read an unparsable text string. |
34,387 | public static boolean appendStringToFile ( EvoSuiteFile file , String value ) { if ( file == null || value == null ) { return false ; } return appendDataToFile ( file , value . getBytes ( ) ) ; } | Append a string to the given file. If the file does not exist, it will be created. |
34,388 | private Matcher reset ( CharSequence input , int start , int end ) { if ( input == null ) { throw new IllegalArgumentException ( "input == null" ) ; } if ( start < 0 || end < 0 || start > input . length ( ) || end > input . length ( ) || start > end ) { throw new IndexOutOfBoundsException ( ) ; } this . input = input . toString ( ) ; this . regionStart = start ; this . regionEnd = end ; resetForInput ( ) ; matchFound = false ; appendPos = 0 ; return this ; } | Resets the Matcher. A new input sequence and a new region can be specified. Results of a previous find get lost. The next attempt to find an occurrence of the Pattern in the string will start at the beginning of the region. This is the internal version of reset() to which the several public versions delegate. |
34,389 | public void makeAliasColName ( StringBuilder colNameBuffer , StringBuilder fieldTypeBuffer , ModelViewEntity modelViewEntity , ModelReader modelReader ) { if ( UtilValidate . isEmpty ( entityAlias ) && UtilValidate . isEmpty ( field ) && UtilValidate . isNotEmpty ( value ) ) { colNameBuffer . append ( value ) ; } else { ModelEntity modelEntity = modelViewEntity . getAliasedEntity ( entityAlias , modelReader ) ; ModelField modelField = modelViewEntity . getAliasedField ( modelEntity , field , modelReader ) ; String colName = entityAlias + "." + modelField . getColName ( ) ; if ( UtilValidate . isNotEmpty ( defaultValue ) ) { colName = "COALESCE(" + colName + "," + defaultValue + ")" ; } if ( UtilValidate . isNotEmpty ( function ) ) { String prefix = functionPrefixMap . get ( function ) ; if ( prefix == null ) { Debug . logWarning ( "[" + modelViewEntity . getEntityName ( ) + "]: Specified alias function [" + function + "] not valid; must be: min, max, sum, avg, count or count-distinct; using a column name with no function function" , module ) ; } else { colName = prefix + colName + ")" ; } } colNameBuffer . append ( colName ) ; if ( fieldTypeBuffer . length ( ) == 0 ) { fieldTypeBuffer . append ( modelField . getType ( ) ) ; } } } | Make the alias as follows: function(coalesce(entityAlias.field, defaultValue)) |
34,390 | @ Override public synchronized void addDataSourceListener ( DataSourceListener dsl ) { m_dataListeners . addElement ( dsl ) ; } | Add a data source listener |
34,391 | public boolean equals ( final Object obj ) { return this == obj || obj instanceof ArtifactCoordinates && equals ( ( ArtifactCoordinates ) obj ) ; } | Determine whether this coordinates object equals the target object. |
34,392 | public static String readString ( DataInput di , int charsToRead ) throws IOException { final byte [ ] buf = new byte [ charsToRead ] ; di . readFully ( buf ) ; return new String ( buf ) ; } | Read a string of a specified number of ASCII bytes |
34,393 | private String antProjectToArtifactName ( String origModule ) { String module = origModule ; if ( ! origModule . startsWith ( "solr-" ) ) { module = "lucene-" + module ; } return module ; } | Convert Ant project names to artifact names: prepend "lucene-" to Lucene project names |
34,394 | @ RequestMapping ( value = ApiUrl . CITIZEN_PASSWORD_RECOVER , method = RequestMethod . POST ) public ResponseEntity < String > passwordRecover ( HttpServletRequest request ) { ApiResponse res = ApiResponse . newInstance ( ) ; try { String identity = request . getParameter ( "identity" ) ; String redirectURL = request . getParameter ( "redirectURL" ) ; String token = request . getParameter ( "token" ) ; String newPassword , confirmPassword ; if ( StringUtils . isEmpty ( identity ) ) { return res . error ( getMessage ( "msg.invalid.request" ) ) ; } if ( ! StringUtils . isEmpty ( token ) ) { newPassword = request . getParameter ( "newPassword" ) ; confirmPassword = request . getParameter ( "confirmPassword" ) ; if ( StringUtils . isEmpty ( newPassword ) ) { return res . error ( getMessage ( "msg.invalid.request" ) ) ; } else if ( ! newPassword . equals ( confirmPassword ) ) { return res . error ( getMessage ( "msg.pwd.not.match" ) ) ; } else if ( identityRecoveryService . validateAndResetPassword ( token , newPassword ) ) { return res . success ( "" , getMessage ( "msg.pwd.reset.success" ) ) ; } else { return res . error ( getMessage ( "msg.pwd.otp.invalid" ) ) ; } } if ( identity . matches ( "\\d+" ) ) { if ( ! identity . matches ( "\\d{10}" ) ) { return res . error ( getMessage ( "msg.invalid.mobileno" ) ) ; } } else if ( ! identity . matches ( "^[A-Za-z0-9+_.-]+@(.+)$" ) ) { return res . error ( getMessage ( "msg.invalid.mail" ) ) ; } Citizen citizen = citizenService . getCitizenByUserName ( identity ) ; if ( citizen == null ) { return res . error ( getMessage ( "user.not.found" ) ) ; } if ( identityRecoveryService . generateAndSendUserPasswordRecovery ( identity , redirectURL + "/egi/login/password/reset?token=" , true ) ) { return res . success ( "" , "OTP for recovering password has been sent to your mobile" + ( StringUtils . isEmpty ( citizen . getEmailId ( ) ) ? "" : " and mail" ) ) ; } return res . error ( "Password send failed" ) ; } catch ( Exception e ) { LOGGER . error ( "EGOV-API ERROR " , e ) ; return res . error ( getMessage ( "server.error" ) ) ; } } | This will send an email/sms to citizen with link. User can use that link and reset their password. |
34,395 | private boolean doAcquireSharedNanos ( long arg , long nanosTimeout ) throws InterruptedException { if ( nanosTimeout <= 0L ) return false ; final long deadline = System . nanoTime ( ) + nanosTimeout ; final Node node = addWaiter ( Node . SHARED ) ; boolean failed = true ; try { for ( ; ; ) { final Node p = node . predecessor ( ) ; if ( p == head ) { long r = tryAcquireShared ( arg ) ; if ( r >= 0 ) { setHeadAndPropagate ( node , r ) ; p . next = null ; failed = false ; return true ; } } nanosTimeout = deadline - System . nanoTime ( ) ; if ( nanosTimeout <= 0L ) return false ; if ( shouldParkAfterFailedAcquire ( p , node ) && nanosTimeout > spinForTimeoutThreshold ) LockSupport . parkNanos ( this , nanosTimeout ) ; if ( Thread . interrupted ( ) ) throw new InterruptedException ( ) ; } } finally { if ( failed ) cancelAcquire ( node ) ; } } | Acquires in shared timed mode. |
34,396 | private static BitmapSampled cropBitmap ( Context context , Uri loadedImageUri , float [ ] points , int degreesRotated , boolean fixAspectRatio , int aspectRatioX , int aspectRatioY , int sampleMulti , Rect rect , int width , int height ) { Bitmap result = null ; int sampleSize ; try { BitmapFactory . Options options = new BitmapFactory . Options ( ) ; options . inSampleSize = sampleSize = sampleMulti * calculateInSampleSizeByReqestedSize ( rect . width ( ) , rect . height ( ) , width , height ) ; Bitmap fullBitmap = decodeImage ( context . getContentResolver ( ) , loadedImageUri , options ) ; if ( fullBitmap != null ) { try { float [ ] points2 = new float [ points . length ] ; System . arraycopy ( points , 0 , points2 , 0 , points . length ) ; for ( int i = 0 ; i < points2 . length ; i ++ ) { points2 [ i ] = points2 [ i ] / options . inSampleSize ; } result = cropBitmap ( fullBitmap , points2 , degreesRotated , fixAspectRatio , aspectRatioX , aspectRatioY ) ; } finally { if ( result != fullBitmap ) { fullBitmap . recycle ( ) ; } } } } catch ( OutOfMemoryError e ) { if ( result != null ) { result . recycle ( ) ; } throw e ; } catch ( Exception e ) { throw new RuntimeException ( "Failed to load sampled bitmap: " + loadedImageUri + "\r\n" + e . getMessage ( ) , e ) ; } return new BitmapSampled ( result , sampleSize ) ; } | Crop bitmap by fully loading the original and then cropping it, fallback in case cropping region failed. |
34,397 | private boolean isWeekly ( ) { return WEEKLY . equalsIgnoreCase ( this . executionWindowType ) ; } | Determines if the window is a weekly window. |
34,398 | protected void writeDate ( Date date , CharBuf buffer ) { SimpleDateFormat formatter = new SimpleDateFormat ( dateFormat , dateLocale ) ; formatter . setTimeZone ( timezone ) ; buffer . addQuoted ( formatter . format ( date ) ) ; } | Serializes date and writes it into specified buffer. |
34,399 | private void done ( SubmitInfo info ) { info . done ( ) ; if ( ioSpace != null ) { ioSpace . release ( ) ; } } | Called from the native layer |