idx
int64
0
34.9k
question
stringlengths
12
26.4k
target
stringlengths
15
2.15k
300
public static Path createTempFile ( String prefix , String suffix ) throws IOException { Path tempDirPath = Paths . get ( SystemProperties . getTempFilesPath ( ) ) ; return createTempFile ( tempDirPath , prefix , suffix ) ; }
Used to seed all version buckets with the max value of the version field in the index.
301
private synchronized void rebuildJournal ( ) throws IOException { if ( journalWriter != null ) { journalWriter . close ( ) ; } Writer writer = new BufferedWriter ( new FileWriter ( journalFileTmp ) , IO_BUFFER_SIZE ) ; writer . write ( MAGIC ) ; writer . write ( "\n" ) ; writer . write ( VERSION_1 ) ; writer . write ( "\n" ) ; writer . write ( Integer . toString ( appVersion ) ) ; writer . write ( "\n" ) ; writer . write ( Integer . toString ( valueCount ) ) ; writer . write ( "\n" ) ; writer . write ( "\n" ) ; for ( Entry entry : lruEntries . values ( ) ) { if ( entry . currentEditor != null ) { writer . write ( DIRTY + ' ' + entry . key + '\n' ) ; } else { writer . write ( CLEAN + ' ' + entry . key + entry . getLengths ( ) + '\n' ) ; } } writer . close ( ) ; journalFileTmp . renameTo ( journalFile ) ; journalWriter = new BufferedWriter ( new FileWriter ( journalFile , true ) , IO_BUFFER_SIZE ) ; }
Returns the quantile for the given percentage.
302
public static short [ ] initializeSubStateArray ( List < Tree < String > > trainTrees , List < Tree < String > > validationTrees , Numberer tagNumberer , short nSubStates ) { short [ ] nSub = new short [ 2 ] ; nSub [ 0 ] = 1 ; nSub [ 1 ] = nSubStates ; StateSetTreeList trainStateSetTrees = new StateSetTreeList ( trainTrees , nSub , true , tagNumberer ) ; @ SuppressWarnings ( "unused" ) StateSetTreeList validationStateSetTrees = new StateSetTreeList ( validationTrees , nSub , true , tagNumberer ) ; StateSetTreeList . initializeTagNumberer ( trainTrees , tagNumberer ) ; StateSetTreeList . initializeTagNumberer ( validationTrees , tagNumberer ) ; short numStates = ( short ) tagNumberer . total ( ) ; short [ ] nSubStateArray = new short [ numStates ] ; Arrays . fill ( nSubStateArray , nSubStates ) ; nSubStateArray [ 0 ] = 1 ; return nSubStateArray ; }
SCIPIO: Converts a timestamp into a Date
303
public void addPropertyChangeListener ( PropertyChangeListener listener ) { propertyChangeSupport . addPropertyChangeListener ( listener ) ; }
Deletes a consistency group.
304
public PluginDescriptionFile ( final String pluginName , final String pluginVersion , final String mainClass ) { name = pluginName . replace ( ' ' , '_' ) ; version = pluginVersion ; main = mainClass ; }
Converts to object array.
305
public void fill ( Graphics2D g , Shape s ) { Rectangle bounds = s . getBounds ( ) ; int width = bounds . width ; int height = bounds . height ; BufferedImage bimage = Effect . createBufferedImage ( width , height , true ) ; Graphics2D gbi = bimage . createGraphics ( ) ; gbi . setColor ( Color . BLACK ) ; gbi . fill ( s ) ; g . drawImage ( applyEffect ( bimage , null , width , height ) , 0 , 0 , null ) ; }
Create a SSLContext with a KeyManager using the private key and certificate chain from the given KeyStore and a TrustManager using the certificates authorities from the same KeyStore.
306
public void silentClear ( ) { mSelectedWidgets . clear ( ) ; mModifiedWidgets . clear ( ) ; }
Returns an enumeration describing the available options.
307
public static boolean isArray ( Element arrayE ) { String name = arrayE . getTagName ( ) ; if ( name . equals ( "Array" ) || name . equals ( "NUM-ARRAY" ) || name . equals ( "INT-ARRAY" ) || name . equals ( "REAL-ARRAY" ) || name . equals ( "STRING-ARRAY" ) || isSparseArray ( arrayE ) ) { return true ; } return false ; }
Initialize the byte[] from the UTF8 bytes for the provided String.
308
public void addNotificationListener ( ObjectName name , NotificationListener listener , NotificationFilter filter , Object handback ) throws InstanceNotFoundException { mbsInterceptor . addNotificationListener ( cloneObjectName ( name ) , listener , filter , handback ) ; }
Search in the game tree the best move using minimax with alpha beta pruning
309
static long readVarLong ( InputStream in ) throws IOException { long x = in . read ( ) ; if ( x < 0 ) { throw new EOFException ( ) ; } x = ( byte ) x ; if ( x >= 0 ) { return x ; } x &= 0x7f ; for ( int s = 7 ; s < 64 ; s += 7 ) { long b = in . read ( ) ; if ( b < 0 ) { throw new EOFException ( ) ; } b = ( byte ) b ; x |= ( b & 0x7f ) << s ; if ( b >= 0 ) { break ; } } return x ; }
Get last buffered message
310
public void addFillOutsideLine ( FillOutsideLine fill ) { mFillBelowLine . add ( fill ) ; }
update an exit item
311
public static Builder createBuilder ( AbstractManagedObjectDefinition < ? , ? > d , String propertyName ) { return new Builder ( d , propertyName ) ; }
Returns a hash code value for this object.
312
public void filter ( File inputFile , PrintWriter o ) throws IOException { BufferedWriter bw = new BufferedWriter ( o ) ; StringBuffer sb = ( StringBuffer ) fileMap . get ( inputFile . toString ( ) ) ; if ( sb == null ) { sb = loadFile ( inputFile ) ; } filter ( sb , bw ) ; bw . flush ( ) ; }
Converts the given double to a localized String version.
313
public int update ( String sql , StatementVisitor visitor ) throws SQLException { Connection connection = null ; PreparedStatement stmt = null ; try { connection = source . getConnection ( ) ; stmt = connection . prepareStatement ( sql ) ; visitor . visit ( stmt ) ; return stmt . executeUpdate ( ) ; } finally { SQLUtil . closeQuietly ( stmt ) ; SQLUtil . closeQuietly ( connection ) ; } }
Change UI of an accepted card to a Twitter shared card update views accordinly
314
public void stop ( ) { logger . info ( "Cassandra shutting down..." ) ; if ( thriftServer != null ) thriftServer . stop ( ) ; if ( nativeServer != null ) nativeServer . stop ( ) ; if ( FBUtilities . isWindows ( ) ) System . exit ( 0 ) ; if ( jmxServer != null ) { try { jmxServer . stop ( ) ; } catch ( IOException e ) { logger . error ( "Error shutting down local JMX server: " , e ) ; } } }
Prints message to the specified output.
315
private void compileMethod ( HotSpotResolvedJavaMethod method , int counter ) { try { long start = System . currentTimeMillis ( ) ; long allocatedAtStart = MemUseTrackerImpl . getCurrentThreadAllocatedBytes ( ) ; int entryBCI = JVMCICompiler . INVOCATION_ENTRY_BCI ; HotSpotCompilationRequest request = new HotSpotCompilationRequest ( method , entryBCI , 0L ) ; boolean useProfilingInfo = false ; boolean installAsDefault = false ; CompilationTask task = new CompilationTask ( jvmciRuntime , compiler , request , useProfilingInfo , installAsDefault ) ; task . runCompilation ( ) ; HotSpotInstalledCode installedCode = task . getInstalledCode ( ) ; if ( installedCode != null ) { installedCode . invalidate ( ) ; } memoryUsed . getAndAdd ( MemUseTrackerImpl . getCurrentThreadAllocatedBytes ( ) - allocatedAtStart ) ; compileTime . getAndAdd ( System . currentTimeMillis ( ) - start ) ; compiledMethodsCounter . incrementAndGet ( ) ; } catch ( Throwable t ) { println ( "CompileTheWorld (%d) : Error compiling method: %s" , counter , method . format ( "%H.%n(%p):%r" ) ) ; printStackTrace ( t ) ; } }
True if a refresh is needed from the original data source.
316
private static void doCopyDirectory ( File srcDir , File destDir , FileFilter filter , boolean preserveFileDate , List < String > exclusionList ) throws IOException { File [ ] srcFiles = filter == null ? srcDir . listFiles ( ) : srcDir . listFiles ( filter ) ; if ( srcFiles == null ) { throw new IOException ( "Failed to list contents of " + srcDir ) ; } if ( destDir . exists ( ) ) { if ( destDir . isDirectory ( ) == false ) { throw new IOException ( "Destination '" + destDir + "' exists but is not a directory" ) ; } } else { if ( ! destDir . mkdirs ( ) && ! destDir . isDirectory ( ) ) { throw new IOException ( "Destination '" + destDir + "' directory cannot be created" ) ; } } if ( destDir . canWrite ( ) == false ) { throw new IOException ( "Destination '" + destDir + "' cannot be written to" ) ; } for ( File srcFile : srcFiles ) { File dstFile = new File ( destDir , srcFile . getName ( ) ) ; if ( exclusionList == null || ! exclusionList . contains ( srcFile . getCanonicalPath ( ) ) ) { if ( srcFile . isDirectory ( ) ) { doCopyDirectory ( srcFile , dstFile , filter , preserveFileDate , exclusionList ) ; } else { doCopyFile ( srcFile , dstFile , preserveFileDate ) ; } } } if ( preserveFileDate ) { destDir . setLastModified ( srcDir . lastModified ( ) ) ; } }
Parse a numeric value, validating against given min/max constraints.
317
public int processByte ( byte in , byte [ ] out , int outOff ) throws DataLengthException , IllegalStateException { int resultLen = 0 ; if ( bufOff == buf . length ) { resultLen = cipher . processBlock ( buf , 0 , out , outOff ) ; System . arraycopy ( buf , blockSize , buf , 0 , blockSize ) ; bufOff = blockSize ; } buf [ bufOff ++ ] = in ; return resultLen ; }
Returns the server port that accepted the request.
318
public EsriShapeExport ( EsriGraphicList list , DbfTableModel dbf , String pathToFile ) { setGraphicList ( list ) ; setMasterDBF ( dbf ) ; filePath = pathToFile ; DEBUG = logger . isLoggable ( Level . FINE ) ; }
Purges one entry whose wrapped key has been garbage collected.
319
void saveOffsetInExternalStore ( String topic , int partition , long offset ) { try { FileWriter writer = new FileWriter ( storageName ( topic , partition ) , false ) ; BufferedWriter bufferedWriter = new BufferedWriter ( writer ) ; bufferedWriter . write ( offset + "" ) ; bufferedWriter . flush ( ) ; bufferedWriter . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; throw new RuntimeException ( e ) ; } }
Invite additional participants to this group chat inviteParticipants
320
private CentroidClusterModel assinePoints ( CentroidClusterModel model ) { double [ ] values = new double [ attributes . size ( ) ] ; int i = 0 ; for ( Example example : exampleSet ) { double [ ] exampleValues = getAsDoubleArray ( example , attributes , values ) ; double nearestDistance = measure . calculateDistance ( model . getCentroidCoordinates ( 0 ) , exampleValues ) ; int nearestIndex = 0 ; int id = 0 ; for ( Centroid cr : model . getCentroids ( ) ) { double distance = measure . calculateDistance ( cr . getCentroid ( ) , exampleValues ) ; if ( distance < nearestDistance ) { nearestDistance = distance ; nearestIndex = id ; } id ++ ; } centroidAssignments [ i ] = nearestIndex ; i ++ ; } model . setClusterAssignments ( centroidAssignments , exampleSet ) ; return model ; }
We only want the current page that is being shown to be focusable.
321
public static String formatQuantity ( BigDecimal quantity ) { if ( quantity == null ) return "" ; else return quantityDecimalFormat . format ( quantity ) ; }
Get a copy of the elements of the byte array instrument.
322
public void importPKCS8 ( BurpCertificate certificate , String filename ) { setStatus ( "Importing private key..." ) ; FileInputStream fis ; File file = new File ( filename ) ; PrivateKey privateKey ; try { fis = new FileInputStream ( file ) ; DataInputStream dis = new DataInputStream ( fis ) ; byte [ ] keyBytes = new byte [ ( int ) file . length ( ) ] ; dis . readFully ( keyBytes ) ; dis . close ( ) ; PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec ( keyBytes ) ; KeyFactory keyFactory = KeyFactory . getInstance ( "RSA" ) ; privateKey = keyFactory . generatePrivate ( keySpec ) ; certificate . setPrivateKey ( privateKey ) ; setCertificateTree ( ) ; setStatus ( "Private Key imported." ) ; } catch ( IOException | NoSuchAlgorithmException | InvalidKeySpecException e ) { setStatus ( "Error importing private Key. (" + e . getMessage ( ) + ")" ) ; e . printStackTrace ( ) ; } catch ( Exception e ) { setStatus ( "Error (" + e . getMessage ( ) + ")" ) ; } }
Copies workspace files from machine's host to backup storage and remove all files from the source.
323
public Collection < Object > undo ( ) { HashSet < Object > modifiedObjects = null ; boolean done = false ; while ( ( indexOfNextAdd > 0 ) && ! done ) { List < mxUndoableEdit > edits = history . get ( -- indexOfNextAdd ) ; for ( int i = edits . size ( ) - 1 ; i >= 0 ; i -- ) { mxUndoableEdit edit = edits . get ( i ) ; edit . undo ( ) ; modifiedObjects = edit . getAffectedObjects ( ) ; if ( edit . isSignificant ( ) ) { fireEvent ( new mxEventObject ( mxEvent . UNDO , "edit" , edit ) ) ; done = true ; } } } return modifiedObjects ; }
Delete the specified vm.
324
public TeXParser ( String parseString , TeXFormula formula ) { this ( parseString , formula , true ) ; }
Gets hash for folders in XML response to avoid cached responses.
325
public static < T > TreeNode < T > copy ( TreeDef < T > treeDef , T root ) { return copy ( treeDef , root , Function . identity ( ) ) ; }
Deletes the physical file identified by given absolute file path. Returns true if delete succeeds or if file does NOT exist, false otherwise. DownloadManager actually deletes the physical file when remove method is called. So, this method might not be required for removing downloads.
326
protected void drawWithOffset ( float zone , int pointsRight , int pointsLeft , float fixedPoints , Canvas canvas , Paint paint ) { int position = getPositionForZone ( zone ) ; int firstPosition = ( int ) ( position - pointsLeft - fixedPoints ) ; int lastPosition = ( int ) ( position + pointsRight + fixedPoints ) ; if ( lastPosition > pointsNumber - 1 && lastPosition != pointsNumber ) { int offset = lastPosition - pointsNumber - 1 ; float [ ] pointsF = getArrayFloat ( points . subList ( 0 , offset ) ) ; lastPosition = pointsNumber - 1 ; canvas . drawPoints ( pointsF , paint ) ; } if ( firstPosition < 0 ) { int offset = Math . abs ( firstPosition ) ; float [ ] pointsF = getArrayFloat ( points . subList ( ( pointsNumber - 1 ) - offset , pointsNumber - 1 ) ) ; canvas . drawPoints ( pointsF , paint ) ; firstPosition = 0 ; } float [ ] pointsF = getArrayFloat ( points . subList ( firstPosition , lastPosition ) ) ; canvas . drawPoints ( pointsF , paint ) ; }
Grow path stack, if required.
327
static String calculateNthPercentile ( List < String > values , int n ) { String [ ] valuesArr = new String [ values . size ( ) ] ; valuesArr = values . toArray ( valuesArr ) ; Arrays . sort ( valuesArr ) ; int ordinalRank = ( int ) Math . ceil ( n * values . size ( ) / 100.0 ) ; return valuesArr [ ordinalRank - 1 ] ; }
Create a new EWMA with a specific smoothing constant.
328
private void boundsChanged ( ) { if ( runLaterPending ) return ; runLaterPending = true ; Platform . runLater ( null ) ; }
The Text Compaction mode includes all the printable ASCII characters (i.e. values from 32 to 126) and three ASCII control characters: HT or tab (ASCII value 9), LF or line feed (ASCII value 10), and CR or carriage return (ASCII value 13). The Text Compaction mode also includes various latch and shift characters which are used exclusively within the mode. The Text Compaction mode encodes up to 2 characters per codeword. The compaction rules for converting data into PDF417 codewords are defined in 5.4.2.2. The sub-mode switches are defined in 5.4.2.3.
329
public void clear ( ) { synchronized ( lock ) { File [ ] files = cachePath . listFiles ( ) ; if ( files == null ) { return ; } for ( File file : files ) { removeFile ( file ) ; } pendingTasks . clear ( ) ; } }
stop the UDP server, clean up and delete its reference.
330
@ Nullable protected abstract URL resolveTestData ( String name ) ;
Test that we can successfully deserialize our target class for all of the given Quartz versions.
331
public static boolean isFullAccessibleField ( JField field , JClassType clazz ) { return field . isPublic ( ) || hasGetAndSetMethods ( field , clazz ) ; }
Returns true, if at the current time, the event described by the supplied event descriptor could be generated.
332
public byte [ ] convert ( byte [ ] inBuffer , int size ) { byte [ ] result = null ; if ( inBuffer != null ) { DrmConvertedStatus convertedStatus = null ; try { if ( size != inBuffer . length ) { byte [ ] buf = new byte [ size ] ; System . arraycopy ( inBuffer , 0 , buf , 0 , size ) ; convertedStatus = mDrmClient . convertData ( mConvertSessionId , buf ) ; } else { convertedStatus = mDrmClient . convertData ( mConvertSessionId , inBuffer ) ; } if ( convertedStatus != null && convertedStatus . statusCode == DrmConvertedStatus . STATUS_OK && convertedStatus . convertedData != null ) { result = convertedStatus . convertedData ; } } catch ( IllegalArgumentException e ) { Log . w ( TAG , "Buffer with data to convert is illegal. Convertsession: " + mConvertSessionId , e ) ; } catch ( IllegalStateException e ) { Log . w ( TAG , "Could not convert data. Convertsession: " + mConvertSessionId , e ) ; } } else { throw new IllegalArgumentException ( "Parameter inBuffer is null" ) ; } return result ; }
Returns a string representation of the tree state of this, i.e., the concrete state. (The version of toString commented out below returns a representation of the abstract state of this.
333
public void simulateMethod ( SootMethod method , ReferenceVariable thisVar , ReferenceVariable returnVar , ReferenceVariable params [ ] ) { String subSignature = method . getSubSignature ( ) ; if ( subSignature . equals ( "java.lang.Process execInternal(java.lang.String[],java.lang.String[],java.lang.String)" ) ) { java_lang_Runtime_execInternal ( method , thisVar , returnVar , params ) ; return ; } else { defaultMethod ( method , thisVar , returnVar , params ) ; return ; } }
Sets the flag that indicates whether all objects are finalized when the VM is about to exit. Note that all finalization which occurs when the system is exiting is performed after all running threads have been terminated.
334
@ Deprecated private static void makeJSForInlineSubmit ( Appendable writer , Map < String , Object > context , ModelForm modelForm , String hiddenFormName ) throws IOException { List < ModelFormField > rowSubmitFields = modelForm . getMultiSubmitFields ( ) ; if ( rowSubmitFields != null ) { writer . append ( "<script type=\"text/javascript\">\r\n" ) ; writer . append ( "jQuery(document).ready(function() {\r\n" ) ; writer . append ( "\tvar submitForm = $(\"form[name=" + hiddenFormName + "]\");\r\n" ) ; writer . append ( "\tif (submitForm) {\r\n" ) ; for ( ModelFormField rowSubmitField : rowSubmitFields ) { writer . append ( "\t\tvar id = $(\"[id^=" + rowSubmitField . getCurrentContainerId ( context ) + "]\");\r\n" ) ; writer . append ( "\t\t$(id).click(function(e) {\r\n" ) ; writer . append ( "\t\te.preventDefault();\r\n" ) ; makeHiddenFieldsForHiddenForm ( writer ) ; writer . append ( "\t\t\tsubmitForm.submit();\r\n" ) ; writer . append ( "\t\t});\r\n" ) ; } writer . append ( "\t} else {\r\n" ) ; writer . append ( "\t\treturn false;\r\n" ) ; writer . append ( "\t}\r\n" ) ; writer . append ( "});\r\n" ) ; writer . append ( "</script>\r\n" ) ; } }
Read log files one by one and, line by line from the data folder.
335
public void clear ( ) { oredCriteria . clear ( ) ; orderByClause = null ; distinct = false ; }
Compiles the given CUDA file into a PTX file using NVCC, and returns the name of the resulting PTX file
336
private URL createSearchURL ( URL url ) throws MalformedURLException { if ( url == null ) { return url ; } String protocol = url . getProtocol ( ) ; if ( isDirectory ( url ) || protocol . equals ( "jar" ) ) { return url ; } if ( factory == null ) { return new URL ( "jar" , "" , - 1 , url . toString ( ) + "!/" ) ; } return new URL ( "jar" , "" , - 1 , url . toString ( ) + "!/" , factory . createURLStreamHandler ( "jar" ) ) ; }
Adds wheel changing listener
337
public final void trackedAction ( Core controller ) throws InterruptedException { long time = System . currentTimeMillis ( ) ; statistics . useNow ( ) ; action ( controller ) ; time = System . currentTimeMillis ( ) - time ; statistics . updateAverageExecutionTime ( time ) ; }
Flush the engine (committing segments to disk and truncating the translog) and close it.
338
private boolean translateReadyOps ( int ops , int initialOps , SelectionKeyImpl sk ) { int intOps = sk . nioInterestOps ( ) ; int oldOps = sk . nioReadyOps ( ) ; int newOps = initialOps ; if ( ( ops & Net . POLLNVAL ) != 0 ) { return false ; } if ( ( ops & ( Net . POLLERR | Net . POLLHUP ) ) != 0 ) { newOps = intOps ; sk . nioReadyOps ( newOps ) ; return ( newOps & ~ oldOps ) != 0 ; } if ( ( ( ops & Net . POLLIN ) != 0 ) && ( ( intOps & SelectionKey . OP_READ ) != 0 ) ) newOps |= SelectionKey . OP_READ ; if ( ( ( ops & Net . POLLOUT ) != 0 ) && ( ( intOps & SelectionKey . OP_WRITE ) != 0 ) ) newOps |= SelectionKey . OP_WRITE ; sk . nioReadyOps ( newOps ) ; return ( newOps & ~ oldOps ) != 0 ; }
Create a candidate for grouping based on a rectangle
339
public Executor env ( Map < String , String > env ) { this . env = env ; return this ; }
Constructs a new, empty map with the specified initial capacity and load factor.
340
protected void initView ( ) { mMonthTitlePaint = new Paint ( ) ; mMonthTitlePaint . setFakeBoldText ( true ) ; mMonthTitlePaint . setAntiAlias ( true ) ; mMonthTitlePaint . setTextSize ( MONTH_LABEL_TEXT_SIZE ) ; mMonthTitlePaint . setTypeface ( Typeface . create ( mMonthTitleTypeface , Typeface . BOLD ) ) ; mMonthTitlePaint . setColor ( mDayTextColor ) ; mMonthTitlePaint . setTextAlign ( Align . CENTER ) ; mMonthTitlePaint . setStyle ( Style . FILL ) ; mMonthTitleBGPaint = new Paint ( ) ; mMonthTitleBGPaint . setFakeBoldText ( true ) ; mMonthTitleBGPaint . setAntiAlias ( true ) ; mMonthTitleBGPaint . setColor ( mMonthTitleBGColor ) ; mMonthTitleBGPaint . setTextAlign ( Align . CENTER ) ; mMonthTitleBGPaint . setStyle ( Style . FILL ) ; mSelectedCirclePaint = new Paint ( ) ; mSelectedCirclePaint . setFakeBoldText ( true ) ; mSelectedCirclePaint . setAntiAlias ( true ) ; mSelectedCirclePaint . setColor ( mTodayNumberColor ) ; mSelectedCirclePaint . setTextAlign ( Align . CENTER ) ; mSelectedCirclePaint . setStyle ( Style . FILL ) ; mSelectedCirclePaint . setAlpha ( SELECTED_CIRCLE_ALPHA ) ; mMonthDayLabelPaint = new Paint ( ) ; mMonthDayLabelPaint . setAntiAlias ( true ) ; mMonthDayLabelPaint . setTextSize ( MONTH_DAY_LABEL_TEXT_SIZE ) ; mMonthDayLabelPaint . setColor ( mDayTextColor ) ; mMonthDayLabelPaint . setTypeface ( Typeface . create ( mDayOfWeekTypeface , Typeface . NORMAL ) ) ; mMonthDayLabelPaint . setStyle ( Style . FILL ) ; mMonthDayLabelPaint . setTextAlign ( Align . CENTER ) ; mMonthDayLabelPaint . setFakeBoldText ( true ) ; mMonthNumPaint = new Paint ( ) ; mMonthNumPaint . setAntiAlias ( true ) ; mMonthNumPaint . setTextSize ( MINI_DAY_NUMBER_TEXT_SIZE ) ; mMonthNumPaint . setStyle ( Style . FILL ) ; mMonthNumPaint . setTextAlign ( Align . CENTER ) ; mMonthNumPaint . setFakeBoldText ( false ) ; mCircleIndicatorPaint = new Paint ( ) ; mCircleIndicatorPaint . setAntiAlias ( true ) ; mCircleIndicatorPaint . setStyle ( Style . FILL ) ; mCircleIndicatorPaint . setColor ( mDayTextColor ) ; }
Returns a byte array, including preamble, min, max and data extracted from the Combined Buffer.
341
public static KeyPair createECKeyPair ( String name ) throws IOException { try { ECGenParameterSpec ecSpec = new ECGenParameterSpec ( name ) ; KeyPairGenerator keyGen = KeyPairGenerator . getInstance ( "EC" ) ; keyGen . initialize ( ecSpec , new SecureRandom ( ) ) ; return keyGen . generateKeyPair ( ) ; } catch ( NoSuchAlgorithmException | InvalidAlgorithmParameterException ex ) { throw new IOException ( ex ) ; } }
Determines if the supplied value is a valid xsd:gMonth string.
342
public void init ( boolean encrypting , CipherParameters params ) throws IllegalArgumentException { this . encrypting = encrypting ; if ( params instanceof ParametersWithIV ) { ParametersWithIV ivParam = ( ParametersWithIV ) params ; byte [ ] iv = ivParam . getIV ( ) ; if ( iv . length < IV . length ) { System . arraycopy ( iv , 0 , IV , IV . length - iv . length , iv . length ) ; for ( int i = 0 ; i < IV . length - iv . length ; i ++ ) { IV [ i ] = 0 ; } } else { System . arraycopy ( iv , 0 , IV , 0 , IV . length ) ; } reset ( ) ; if ( ivParam . getParameters ( ) != null ) { cipher . init ( true , ivParam . getParameters ( ) ) ; } } else { reset ( ) ; if ( params != null ) { cipher . init ( true , params ) ; } } }
Prepares statement for query.
343
public static Document loadDocument ( InputStream stream ) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; return builder . parse ( stream ) ; }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
344
private int handleSingleNalUnitPacket ( Buffer input , Buffer output ) { byte [ ] bufferData = ( byte [ ] ) input . getData ( ) ; int bufferDataLength = bufferData . length ; byte [ ] data = new byte [ bufferDataLength ] ; System . arraycopy ( bufferData , 0 , data , 0 , bufferDataLength ) ; output . setData ( data ) ; output . setLength ( data . length ) ; output . setOffset ( 0 ) ; output . setTimeStamp ( input . getTimeStamp ( ) ) ; output . setSequenceNumber ( input . getSequenceNumber ( ) ) ; output . setVideoOrientation ( input . getVideoOrientation ( ) ) ; output . setFormat ( input . getFormat ( ) ) ; output . setFlags ( input . getFlags ( ) ) ; return BUFFER_PROCESSED_OK ; }
Tests whether each character in the given string is a letter.
345
public static < T > List < T > asList ( T ... values ) { if ( values == null ) { return new ArrayList < T > ( 0 ) ; } else { return new ArrayList < T > ( Arrays . asList ( values ) ) ; } }
decode the base 64 encoded byte data writing it to the given output stream, whitespace characters will be ignored.
346
void messageReceived ( ByteBuffer buf ) throws IgniteCheckedException , SSLException { if ( buf . limit ( ) > inNetBuf . remaining ( ) ) { inNetBuf = expandBuffer ( inNetBuf , inNetBuf . capacity ( ) + buf . limit ( ) * 2 ) ; appBuf = expandBuffer ( appBuf , inNetBuf . capacity ( ) * 2 ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Expanded buffers [inNetBufCapacity=" + inNetBuf . capacity ( ) + ", appBufCapacity=" + appBuf . capacity ( ) + ", ses=" + ses + ", " ) ; } inNetBuf . put ( buf ) ; if ( ! handshakeFinished ) handshake ( ) ; else unwrapData ( ) ; if ( isInboundDone ( ) ) { int newPosition = buf . position ( ) - inNetBuf . position ( ) ; if ( newPosition >= 0 ) { buf . position ( newPosition ) ; if ( buf . hasRemaining ( ) ) U . warn ( log , "Got unread bytes after receiving close_notify message (will ignore): " + ses ) ; } inNetBuf . clear ( ) ; } }
Create a random instance.
347
public final Object copy ( ) { DynamicIntArray copy = new DynamicIntArray ( m_Objects . length ) ; copy . m_Size = m_Size ; copy . m_CapacityIncrement = m_CapacityIncrement ; copy . m_CapacityMultiplier = m_CapacityMultiplier ; System . arraycopy ( m_Objects , 0 , copy . m_Objects , 0 , m_Size ) ; return copy ; }
Make sure that s does not end with a backslash that would escape any delimiter placed after it.
348
public static int deleteOldSMS ( ) { long olderthan = System . currentTimeMillis ( ) - OLD_SMS_THRESHOLD ; return database . delete ( DatabaseOpenHelper . SMS_TABLE_NAME , "date < " + olderthan , null ) ; }
Get all genomes matching the supplied filters.
349
private void checkClassAndSync ( Class < ? extends IPacket > clazz ) { if ( ! registeredClasses . contains ( clazz ) ) { throw new RuntimeException ( "NetworkHelper got unknown Packet type " + clazz + " to send, critical error" ) ; } while ( isCurrentlySendingSemaphor ) { Thread . yield ( ) ; } isCurrentlySendingSemaphor = true ; }
Make sure to free up additional resources for a running SCWarrant.
350
private void fitImageToView ( ) { Drawable drawable = getDrawable ( ) ; if ( drawable == null || drawable . getIntrinsicWidth ( ) == 0 || drawable . getIntrinsicHeight ( ) == 0 ) { return ; } if ( matrix == null || prevMatrix == null ) { return ; } int drawableWidth = drawable . getIntrinsicWidth ( ) ; int drawableHeight = drawable . getIntrinsicHeight ( ) ; float scaleX = ( float ) viewWidth / drawableWidth ; float scaleY = ( float ) viewHeight / drawableHeight ; switch ( mScaleType ) { case CENTER : scaleX = scaleY = 1 ; break ; case CENTER_CROP : scaleX = scaleY = Math . max ( scaleX , scaleY ) ; break ; case CENTER_INSIDE : scaleX = scaleY = Math . min ( 1 , Math . min ( scaleX , scaleY ) ) ; case FIT_CENTER : scaleX = scaleY = Math . min ( scaleX , scaleY ) ; break ; case FIT_XY : break ; default : throw new UnsupportedOperationException ( "TouchImageView does not support FIT_START or FIT_END" ) ; } float redundantXSpace = viewWidth - ( scaleX * drawableWidth ) ; float redundantYSpace = viewHeight - ( scaleY * drawableHeight ) ; matchViewWidth = viewWidth - redundantXSpace ; matchViewHeight = viewHeight - redundantYSpace ; if ( ! isZoomed ( ) && ! imageRenderedAtLeastOnce ) { matrix . setScale ( scaleX , scaleY ) ; matrix . postTranslate ( redundantXSpace / 2 , redundantYSpace / 2 ) ; normalizedScale = 1 ; } else { if ( prevMatchViewWidth == 0 || prevMatchViewHeight == 0 ) { savePreviousImageValues ( ) ; } prevMatrix . getValues ( m ) ; m [ Matrix . MSCALE_X ] = matchViewWidth / drawableWidth * normalizedScale ; m [ Matrix . MSCALE_Y ] = matchViewHeight / drawableHeight * normalizedScale ; float transX = m [ Matrix . MTRANS_X ] ; float transY = m [ Matrix . MTRANS_Y ] ; float prevActualWidth = prevMatchViewWidth * normalizedScale ; float actualWidth = getImageWidth ( ) ; translateMatrixAfterRotate ( Matrix . MTRANS_X , transX , prevActualWidth , actualWidth , prevViewWidth , viewWidth , drawableWidth ) ; float prevActualHeight = prevMatchViewHeight * normalizedScale ; float actualHeight = getImageHeight ( ) ; translateMatrixAfterRotate ( Matrix . MTRANS_Y , transY , prevActualHeight , actualHeight , prevViewHeight , viewHeight , drawableHeight ) ; matrix . setValues ( m ) ; } fixTrans ( ) ; setImageMatrix ( matrix ) ; }
Utility to create submaps, where given bounds override unbounded(null) ones and/or are checked against bounded ones.
351
private static String encodeMetricFilters ( String metricString , Map < String , String > mapper ) { String finalString = metricString ; int counter = 0 ; int startIndex = 0 ; int endIndex = 0 ; for ( int i = 0 ; i < metricString . length ( ) ; i ++ ) { char currentChar = metricString . charAt ( i ) ; startIndex = ( currentChar == '(' && counter == 0 ) ? i : startIndex ; counter = ( currentChar == '(' ) ? counter + 1 : counter ; if ( currentChar == ')' ) { endIndex = i ; counter = counter - 1 ; } if ( counter == 0 && startIndex != 0 ) { String filterString = metricString . substring ( startIndex , endIndex + 1 ) ; finalString = finalString . replace ( filterString , "-" + startIndex ) ; mapper . put ( "-" + startIndex , filterString ) ; startIndex = 0 ; } } return finalString ; }
Clean the attributes of this element. Attributes with null name (the name was ill-formed) or null value (the attribute was present in the element type but not in this actual element) are removed.
352
private void finalizeAdditions ( boolean addHomeScreenShortcuts ) { finalizeWorkFolder ( ) ; if ( addHomeScreenShortcuts && ! mHomescreenApps . isEmpty ( ) ) { sortList ( mHomescreenApps ) ; mModel . addAndBindAddedWorkspaceItems ( mContext , mHomescreenApps ) ; } }
Presents the input graph to FCI and checks to make sure the output of FCI is equivalent to the given output graph.
353
private void stopCheckingStatus ( ) { executor . shutdownNow ( ) ; executor = Executors . newSingleThreadExecutor ( ) ; future = null ; }
Run a http get request
354
public void updateNotification ( int notificationId ) { try { notificationDAO . open ( ) ; notificationDAO . updateNotification ( notificationId , Notification . Status . DISMISSED ) ; } finally { notificationDAO . close ( ) ; } }
This method concatenates two byte arrays
355
public static Element addChildElementNSValue ( Element element , String childElementName , String childElementValue , Document document , String nameSpaceUrl ) { Element newElement = document . createElementNS ( nameSpaceUrl , childElementName ) ; newElement . appendChild ( document . createTextNode ( childElementValue ) ) ; element . appendChild ( newElement ) ; return element ; }
Reduces the current indent level by two spaces, or crashes if the indent level is zero.
356
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 ) ; } } }
Place angle brackets around a URI or URL.
357
public void addColumnListener ( ColumnListener listener ) { m_listeners . add ( listener ) ; }
Return true if this message has a body.
358
public void loadDataset ( URL url , IRI context , ParserConfig config ) throws RepositoryException { try { Long since = lastModified . get ( url ) ; URLConnection urlCon = url . openConnection ( ) ; if ( since != null ) { urlCon . setIfModifiedSince ( since ) ; } if ( since == null || since < urlCon . getLastModified ( ) ) { load ( url , urlCon , context , config ) ; } } catch ( RDFParseException e ) { throw new RepositoryException ( e ) ; } catch ( IOException e ) { throw new RepositoryException ( e ) ; } }
Add two numbers of the same length. The first one is negative and the second is positive. The first one is greater in absolute value.
359
protected int read ( InputStream inputStream , byte [ ] buffer , char [ ] divider ) throws IOException { int index = 0 ; int dividerIndex = 0 ; do { byte readByte = ( byte ) ( 0x000000FF & inputStream . read ( ) ) ; if ( readByte == - 1 ) { return index ; } if ( readByte == divider [ dividerIndex ] ) { dividerIndex ++ ; } if ( dividerIndex == divider . length ) { index -= dividerIndex - 1 ; for ( int i = index ; i < index + dividerIndex ; i ++ ) { if ( i >= buffer . length ) { break ; } buffer [ i ] = 0 ; } return index ; } buffer [ index ] = readByte ; index ++ ; } while ( index < buffer . length ) ; return index ; }
Resets the actions list.
360
public void testNodeDocumentFragmentNormalize1 ( ) throws Throwable { Document doc ; DocumentFragment docFragment ; String nodeValue ; Text txtNode ; Node retval ; doc = ( Document ) load ( "hc_staff" , builder ) ; docFragment = doc . createDocumentFragment ( ) ; txtNode = doc . createTextNode ( "foo" ) ; retval = docFragment . appendChild ( txtNode ) ; txtNode = doc . createTextNode ( "bar" ) ; retval = docFragment . appendChild ( txtNode ) ; docFragment . normalize ( ) ; txtNode = ( Text ) docFragment . getFirstChild ( ) ; nodeValue = txtNode . getNodeValue ( ) ; assertEquals ( "normalizedNodeValue" , "foobar" , nodeValue ) ; retval = txtNode . getNextSibling ( ) ; assertNull ( "singleChild" , retval ) ; }
start thread and pump. Requires up-to-date tempoCache
361
private void collectTimes ( Tree tree , NodeRef node , Set < NodeRef > excludeNodesBelow , Intervals intervals ) { intervals . addCoalescentEvent ( tree . getNodeHeight ( node ) ) ; for ( int i = 0 ; i < tree . getChildCount ( node ) ; i ++ ) { NodeRef child = tree . getChild ( node , i ) ; boolean include = true ; if ( excludeNodesBelow != null && excludeNodesBelow . contains ( child ) ) { include = false ; } if ( ! include || tree . isExternal ( child ) ) { intervals . addSampleEvent ( tree . getNodeHeight ( child ) ) ; } else { collectTimes ( tree , child , excludeNodesBelow , intervals ) ; } } }
Spawns an item stack in the world.
362
public StringBody ( final String text , final String mimeType , Charset charset ) throws UnsupportedEncodingException { super ( mimeType ) ; if ( text == null ) { throw new IllegalArgumentException ( "Text may not be null" ) ; } if ( charset == null ) { charset = Charset . forName ( HTTP . UTF_8 ) ; } this . content = text . getBytes ( charset . name ( ) ) ; this . charset = charset ; }
This method was generated by MyBatis Generator. This method corresponds to the database table topic
363
public void makeImmutable ( ) { mutable = false ; if ( authnContextClassRef != null ) { authnContextClassRef = Collections . unmodifiableList ( authnContextClassRef ) ; } if ( authnContextDeclRef != null ) { authnContextDeclRef = Collections . unmodifiableList ( authnContextDeclRef ) ; } return ; }
Cancels the builder with the given task id.
364
protected abstract int readSkipData ( int level , IndexInput skipStream ) throws IOException ;
Parse the given string into Date object.
365
SSLSession toSession ( byte [ ] data , String host , int port ) { ByteArrayInputStream bais = new ByteArrayInputStream ( data ) ; DataInputStream dais = new DataInputStream ( bais ) ; try { int type = dais . readInt ( ) ; if ( type != OPEN_SSL ) { log ( new AssertionError ( "Unexpected type ID: " + type ) ) ; return null ; } int length = dais . readInt ( ) ; byte [ ] sessionData = new byte [ length ] ; dais . readFully ( sessionData ) ; int count = dais . readInt ( ) ; X509Certificate [ ] certs = new X509Certificate [ count ] ; for ( int i = 0 ; i < count ; i ++ ) { length = dais . readInt ( ) ; byte [ ] certData = new byte [ length ] ; dais . readFully ( certData ) ; certs [ i ] = OpenSSLX509Certificate . fromX509Der ( certData ) ; } return new OpenSSLSessionImpl ( sessionData , host , port , certs , this ) ; } catch ( IOException e ) { log ( e ) ; return null ; } }
Show a toast and dismiss the last one if still visible.
366
protected TamsMessage pollMessage ( ) { if ( disablePoll ) { return null ; } if ( ! pollQueue . isEmpty ( ) ) { PollMessage pm = pollQueue . peek ( ) ; if ( pm != null ) { tm = pm . getMessage ( ) ; return pm . getMessage ( ) ; } } return null ; }
Prints a boolean to standard output and then terminates the line.
367
public Path bin ( ) { return root . resolve ( "bin" ) ; }
Returns the next available identifier.
368
public static void safeCopy ( final Reader reader , final Writer writer ) throws IOException { try { IOUtils . copy ( reader , writer ) ; } finally { IOUtils . closeQuietly ( reader ) ; IOUtils . closeQuietly ( writer ) ; } }
Scrub any illegal characters out of the variable name
369
public static < T extends Bean > T load ( Bson query , T t ) { String collection = getCollection ( t . getClass ( ) ) ; if ( collection != null ) { try { return load ( query , null , t ) ; } catch ( Exception e ) { if ( log . isErrorEnabled ( ) ) log . error ( e . getMessage ( ) , e ) ; } } return null ; }
Implementation of comparableSwapped interface, sorting by second then first.
370
private PrintElement createImageElement ( MPrintFormatItem item ) { Object obj = m_data . getNode ( new Integer ( item . getAD_Column_ID ( ) ) ) ; if ( obj == null ) return null ; else if ( obj instanceof PrintDataElement ) ; else { log . log ( Level . SEVERE , "Element not PrintDataElement " + obj . getClass ( ) ) ; return null ; } PrintDataElement data = ( PrintDataElement ) obj ; if ( data . isNull ( ) && item . isSuppressNull ( ) ) return null ; String url = data . getValueDisplay ( m_format . getLanguage ( ) ) ; if ( ( url == null || url . length ( ) == 0 ) ) { if ( item . isSuppressNull ( ) ) return null ; else return null ; } ImageElement element = null ; if ( data . getDisplayType ( ) == DisplayType . Image ) { element = ImageElement . get ( data , url ) ; } else { element = ImageElement . get ( url ) ; } return element ; }
Constructs a new instance, based on a date/time and the default time zone.
371
public void resetCharges ( ) { pendingCharges . removeAllElements ( ) ; }
Creates a WS Federation provider.
372
static RepaintManager currentManager ( AppContext appContext ) { RepaintManager rm = ( RepaintManager ) appContext . get ( repaintManagerKey ) ; if ( rm == null ) { rm = new RepaintManager ( BUFFER_STRATEGY_TYPE ) ; appContext . put ( repaintManagerKey , rm ) ; } return rm ; }
Make a deep copy of a matrix
373
public static void paintCheckedBackground ( Component c , Graphics g , int x , int y , int width , int height ) { if ( backgroundImage == null ) { backgroundImage = new BufferedImage ( 64 , 64 , BufferedImage . TYPE_INT_ARGB ) ; Graphics bg = backgroundImage . createGraphics ( ) ; for ( int by = 0 ; by < 64 ; by += 8 ) { for ( int bx = 0 ; bx < 64 ; bx += 8 ) { bg . setColor ( ( ( bx ^ by ) & 8 ) != 0 ? Color . lightGray : Color . white ) ; bg . fillRect ( bx , by , 8 , 8 ) ; } } bg . dispose ( ) ; } if ( backgroundImage != null ) { Shape saveClip = g . getClip ( ) ; Rectangle r = g . getClipBounds ( ) ; if ( r == null ) r = new Rectangle ( c . getSize ( ) ) ; r = r . intersection ( new Rectangle ( x , y , width , height ) ) ; g . setClip ( r ) ; int w = backgroundImage . getWidth ( ) ; int h = backgroundImage . getHeight ( ) ; if ( w != - 1 && h != - 1 ) { int x1 = ( r . x / w ) * w ; int y1 = ( r . y / h ) * h ; int x2 = ( ( r . x + r . width + w - 1 ) / w ) * w ; int y2 = ( ( r . y + r . height + h - 1 ) / h ) * h ; for ( y = y1 ; y < y2 ; y += h ) for ( x = x1 ; x < x2 ; x += w ) g . drawImage ( backgroundImage , x , y , c ) ; } g . setClip ( saveClip ) ; } }
Parses parameters with the given parser.
374
public int decrement ( ) { lock . lock ( ) ; int newValue = -- value ; lock . unlock ( ) ; return newValue ; }
Creates background shape - setups background, stroke and radius.
375
private void addPoint ( Point p ) { Coordinate coord = p . getCoordinate ( ) ; insertPoint ( argIndex , coord , Location . INTERIOR ) ; }
This method opens an output file writes to it, opens the same file as an input stream, reads the contents and verifies the data that was written earlier can be read
376
public boolean isConnectable ( ) { for ( DeviceService service : services . values ( ) ) { if ( service . isConnectable ( ) ) return true ; } return false ; }
Add existing IDs to provided collection.
377
public E take ( ) throws InterruptedException { final ReentrantLock lock = this . lock ; lock . lockInterruptibly ( ) ; try { for ( ; ; ) { E first = q . peek ( ) ; if ( first == null ) available . await ( ) ; else { long delay = first . getDelay ( NANOSECONDS ) ; if ( delay <= 0 ) return q . poll ( ) ; first = null ; if ( leader != null ) available . await ( ) ; else { Thread thisThread = Thread . currentThread ( ) ; leader = thisThread ; try { available . awaitNanos ( delay ) ; } finally { if ( leader == thisThread ) leader = null ; } } } } } finally { if ( leader == null && q . peek ( ) != null ) available . signal ( ) ; lock . unlock ( ) ; } }
Create a new Namespace support object.
378
private static void skipArray ( ByteBuffer buf ) { int length = buf . getShort ( ) & 0xFFFF ; for ( int i = 0 ; i < length ; i ++ ) skipMemberValue ( buf ) ; }
This method looks up the ETag sent in the request from the "If-None-Match" header value and compares it to the given tag. If they match, it will set status code 304 Not Modified on the response. It will set the ETag header on the response in any case. It will wrap the given tag in quotes.
379
public static byte [ ] hash ( byte [ ] input ) { if ( input != null ) { final MessageDigest digest ; try { digest = MessageDigest . getInstance ( "SHA-256" ) ; byte [ ] hashedBytes = input ; digest . update ( hashedBytes , 0 , hashedBytes . length ) ; return hashedBytes ; } catch ( NoSuchAlgorithmException e ) { Log . e ( TAG , "problem hashing \"" + input + "\" " + e . getMessage ( ) , e ) ; } } else { Log . w ( TAG , "hash called with null input byte[]" ) ; } return null ; }
Write stream in text format.
380
private void reopen ( ) { Timeline animation = new Timeline ( new KeyFrame ( Duration . seconds ( 0.1 ) , new KeyValue ( inputs . prefHeightProperty ( ) , inputs . getMaxHeight ( ) ) ) ) ; animation . play ( ) ; }
Computes the distances of all the node from the starting root nodes. If there is more than one root node the minimum distance from each root node is used as the designated distance to a given node. Also keeps track of the predecessors of each node traversed as well as the order of nodes traversed.
381
private byte [ ] copyArray ( byte [ ] buffer , int length ) { byte [ ] result = new byte [ length ] ; System . arraycopy ( buffer , 0 , result , 0 , Math . min ( buffer . length , length ) ) ; return result ; }
Util method to write an attribute without the ns prefix
382
protected void drawPath ( Canvas canvas , List < Float > points , Paint paint , boolean circular ) { Path path = new Path ( ) ; int height = canvas . getHeight ( ) ; int width = canvas . getWidth ( ) ; float [ ] tempDrawPoints ; if ( points . size ( ) < 4 ) { return ; } tempDrawPoints = calculateDrawPoints ( points . get ( 0 ) , points . get ( 1 ) , points . get ( 2 ) , points . get ( 3 ) , height , width ) ; path . moveTo ( tempDrawPoints [ 0 ] , tempDrawPoints [ 1 ] ) ; path . lineTo ( tempDrawPoints [ 2 ] , tempDrawPoints [ 3 ] ) ; int length = points . size ( ) ; for ( int i = 4 ; i < length ; i += 2 ) { if ( ( points . get ( i - 1 ) < 0 && points . get ( i + 1 ) < 0 ) || ( points . get ( i - 1 ) > height && points . get ( i + 1 ) > height ) ) { continue ; } tempDrawPoints = calculateDrawPoints ( points . get ( i - 2 ) , points . get ( i - 1 ) , points . get ( i ) , points . get ( i + 1 ) , height , width ) ; if ( ! circular ) { path . moveTo ( tempDrawPoints [ 0 ] , tempDrawPoints [ 1 ] ) ; } path . lineTo ( tempDrawPoints [ 2 ] , tempDrawPoints [ 3 ] ) ; } if ( circular ) { path . lineTo ( points . get ( 0 ) , points . get ( 1 ) ) ; } canvas . drawPath ( path , paint ) ; }
Checks if panning is enabled.
383
public static Map < String , Object > testSOAPService ( DispatchContext dctx , Map < String , ? > context ) { Delegator delegator = dctx . getDelegator ( ) ; Map < String , Object > response = ServiceUtil . returnSuccess ( ) ; List < GenericValue > testingNodes = new LinkedList < GenericValue > ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { GenericValue testingNode = delegator . makeValue ( "TestingNode" ) ; testingNode . put ( "testingNodeId" , "TESTING_NODE" + i ) ; testingNode . put ( "description" , "Testing Node " + i ) ; testingNode . put ( "createdStamp" , UtilDateTime . nowTimestamp ( ) ) ; testingNodes . add ( testingNode ) ; } response . put ( "testingNodes" , testingNodes ) ; return response ; }
Add the top-left corner drawable.
384
public XmlDom ( InputStream is ) throws SAXException { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder builder ; try { builder = factory . newDocumentBuilder ( ) ; Document doc = builder . parse ( is ) ; this . root = ( Element ) doc . getDocumentElement ( ) ; } catch ( ParserConfigurationException e ) { } catch ( IOException e ) { throw new SAXException ( e ) ; } }
generate an X509 certificate, based on the current issuer and subject using the default provider "BC".
385
public void removeKeyListener ( GlobalKeyListener listener ) { listeners . remove ( listener ) ; }
Returns the MIME type for the given extension.
386
public Set search3 ( String tokenID , String startDN , String filter , int numOfEntries , int timeLimit , boolean sortResults , boolean ascendingOrder , Set excludes ) throws SMSException , SSOException , RemoteException { initialize ( ) ; if ( debug . messageEnabled ( ) ) { debug . message ( "SMSJAXRPCObjectImpl::search dn: " + startDN + " filter: " + filter + " excludes: " + excludes ) ; } Iterator i = SMSEntry . search ( getToken ( tokenID ) , startDN , filter , numOfEntries , timeLimit , sortResults , ascendingOrder , excludes ) ; Set < String > result = new HashSet < String > ( ) ; while ( i . hasNext ( ) ) { SMSDataEntry e = ( SMSDataEntry ) i . next ( ) ; try { result . add ( e . toJSONString ( ) ) ; } catch ( JSONException ex ) { debug . error ( "SMSJAXRPCObjectImpl::problem performing search dn: " + startDN + " filter: " + filter + " excludes: " + excludes , ex ) ; } } return result ; }
Test for CVE 2010-1871 on the Jboss Admin console References: https://bugzilla.redhat.com/show_bug.cgi?id=615956 http://blog.o0o.nu/2010/07/cve-2010-1871-jboss-seam-framework.html http://archives.neohapsis.com/archives/bugtraq/2013-05/0117.html http://www.exploit-db.com/exploits/36653/
387
private Resource generatePreviewResource ( Resource resource , Eml eml , BigDecimal nextVersion ) { Resource copy = new Resource ( ) ; copy . setShortname ( resource . getShortname ( ) ) ; copy . setTitle ( resource . getTitle ( ) ) ; copy . setLastPublished ( resource . getLastPublished ( ) ) ; copy . setStatus ( resource . getStatus ( ) ) ; copy . setOrganisation ( resource . getOrganisation ( ) ) ; copy . setKey ( resource . getKey ( ) ) ; copy . setEmlVersion ( nextVersion ) ; if ( resource . isCitationAutoGenerated ( ) ) { Citation citation = new Citation ( ) ; URI homepage = cfg . getResourceVersionUri ( resource . getShortname ( ) , nextVersion ) ; citation . setCitation ( resource . generateResourceCitation ( nextVersion , homepage ) ) ; eml . setCitation ( citation ) ; } Date releaseDate = new Date ( ) ; copy . setLastPublished ( releaseDate ) ; eml . setPubDate ( releaseDate ) ; copy . setEml ( eml ) ; List < VersionHistory > histories = Lists . newArrayList ( ) ; histories . addAll ( resource . getVersionHistory ( ) ) ; copy . setVersionHistory ( histories ) ; VersionHistory history = new VersionHistory ( nextVersion , releaseDate , PublicationStatus . PUBLIC ) ; User modifiedBy = getCurrentUser ( ) ; if ( modifiedBy != null ) { history . setModifiedBy ( modifiedBy ) ; } if ( resource . getDoi ( ) != null && ( resource . getIdentifierStatus ( ) == IdentifierStatus . PUBLIC_PENDING_PUBLICATION || resource . getIdentifierStatus ( ) == IdentifierStatus . PUBLIC ) ) { copy . setDoi ( resource . getDoi ( ) ) ; copy . setIdentifierStatus ( IdentifierStatus . PUBLIC ) ; history . setDoi ( resource . getDoi ( ) ) ; history . setStatus ( IdentifierStatus . PUBLIC ) ; } copy . addVersionHistory ( history ) ; return copy ; }
Force buffered operations to the filesystem.
388
public boolean removeEntry ( int xIndex , int dataSetIndex ) { if ( dataSetIndex >= mDataSets . size ( ) ) return false ; T dataSet = mDataSets . get ( dataSetIndex ) ; Entry e = dataSet . getEntryForXIndex ( xIndex ) ; if ( e == null || e . getXIndex ( ) != xIndex ) return false ; return removeEntry ( e , dataSetIndex ) ; }
Finds the first match of the specified pattern and returns the specified matched group.
389
void closeStream ( Closeable closeable ) { try { if ( closeable != null ) { closeable . close ( ) ; } } catch ( IOException ex ) { utils . logIssue ( "Could not close exception storage file." , ex ) ; } }
This method was generated by MyBatis Generator. This method corresponds to the database table tag
390
private void emitEnsureCollection ( Method method , String fieldName , StringBuilder builder ) { builder . append ( " protected void " ) ; builder . append ( getEnsureName ( fieldName ) ) ; builder . append ( "() {\n" ) ; builder . append ( " if (" ) ; builder . append ( fieldName ) ; builder . append ( " == null) {\n " ) ; builder . append ( fieldName ) ; builder . append ( " = new " ) ; builder . append ( getImplName ( method . getGenericReturnType ( ) , true ) ) ; builder . append ( "();\n" ) ; builder . append ( " }\n" ) ; builder . append ( " }\n" ) ; }
Returns true if metric units.
391
public void testFromDate ( ) throws Exception { TimeZone . setDefault ( TimeZone . getTimeZone ( "PST" ) ) ; final Calendar date = Calendar . getInstance ( ) ; date . setTime ( new Date ( 123456789012345L ) ) ; Assert . assertEquals ( "5882-03-11T00:30:12.345Z" , CalendarSerializer . serialize ( date ) ) ; final Calendar dateNoMillis = Calendar . getInstance ( ) ; dateNoMillis . setTime ( new Date ( 123456789012000L ) ) ; Assert . assertEquals ( "5882-03-11T00:30:12.000Z" , CalendarSerializer . serialize ( dateNoMillis ) ) ; }
precondition: the current character is a quote or an escape
392
private void readObject ( ObjectInputStream in ) throws IOException , ClassNotFoundException { in . defaultReadObject ( ) ; registrarID = new ServiceID ( in ) ; if ( server == null ) { throw new InvalidObjectException ( "null server" ) ; } }
Send a message to target processes. If the message is an instance of TOMMessage, it is sent to the clients, otherwise it is set to the servers.
393
@ Override public boolean eIsSet ( int featureID ) { switch ( featureID ) { case EipPackage . METADATA__KEY : return KEY_EDEFAULT == null ? key != null : ! KEY_EDEFAULT . equals ( key ) ; case EipPackage . METADATA__VALUES : return values != null && ! values . isEmpty ( ) ; } return super . eIsSet ( featureID ) ; }
Open and initialize a BigdataSailRepository using the supplied config properties. You must specify a journal file in the properties.
394
public void addHandler ( String columnName , SQLDataHandler handler ) { if ( m_overrides == null ) m_overrides = new HashMap ( 3 ) ; m_overrides . put ( columnName , handler ) ; }
Change a specific subset of the buffer's data at the given offset to the given length.
395
@ Override public boolean isModified ( ) { if ( _isDigestModified ) { if ( log . isLoggable ( Level . FINE ) ) log . fine ( _source . getNativePath ( ) + " digest is modified." ) ; return true ; } long sourceLastModified = _source . getLastModified ( ) ; long sourceLength = _source . length ( ) ; if ( ! _requireSource && sourceLastModified == 0 ) { return false ; } else if ( sourceLength != _length ) { if ( log . isLoggable ( Level . FINE ) ) { log . fine ( _source . getNativePath ( ) + " length is modified (" + _length + " -> " + sourceLength + ")" ) ; } return true ; } else if ( sourceLastModified != _lastModified ) { if ( log . isLoggable ( Level . FINE ) ) log . fine ( _source . getNativePath ( ) + " time is modified." ) ; return true ; } else return false ; }
Returns index of subset instance is assigned to. Returns -1 if instance is assigned to more than one subset.
396
public byte [ ] toByteArray ( ) { int totalLen = _pastLen + _currBlockPtr ; if ( totalLen == 0 ) { return NO_BYTES ; } byte [ ] result = new byte [ totalLen ] ; int offset = 0 ; for ( byte [ ] block : _pastBlocks ) { int len = block . length ; System . arraycopy ( block , 0 , result , offset , len ) ; offset += len ; } System . arraycopy ( _currBlock , 0 , result , offset , _currBlockPtr ) ; offset += _currBlockPtr ; if ( offset != totalLen ) { throw new RuntimeException ( "Internal error: total len assumed to be " + totalLen + ", copied " + offset + " bytes" ) ; } if ( ! _pastBlocks . isEmpty ( ) ) { reset ( ) ; } return result ; }
Converts all separators to the Unix separator of forward slash.
397
public CommandEditor ( ActionCommand cmd , EditableResources res , String uiName , List < com . codename1 . ui . Command > commands , Properties projectGeneratorSettings , boolean java5 ) { this . java5 = java5 ; this . projectGeneratorSettings = projectGeneratorSettings ; this . uiName = uiName ; initComponents ( ) ; goToSource . setEnabled ( projectGeneratorSettings != null ) ; com . codename1 . ui . Command [ ] existing = new com . codename1 . ui . Command [ commands . size ( ) + 1 ] ; existing [ 0 ] = null ; for ( int iter = 1 ; iter < existing . length ; iter ++ ) { existing [ iter ] = commands . get ( iter - 1 ) ; } Vector postActions = new Vector ( ) ; postActions . addElement ( "None" ) ; Vector actions = new Vector ( ) ; actions . addElement ( "None" ) ; actions . addElement ( "Minimize" ) ; actions . addElement ( "Exit" ) ; actions . addElement ( "Execute" ) ; actions . addElement ( "Back" ) ; backCommand . setSelected ( cmd . isBackCommand ( ) ) ; String [ ] uiEntries = new String [ res . getUIResourceNames ( ) . length ] ; System . arraycopy ( res . getUIResourceNames ( ) , 0 , uiEntries , 0 , uiEntries . length ) ; Arrays . sort ( uiEntries ) ; for ( String uis : uiEntries ) { if ( ! uiName . equals ( uis ) ) { actions . addElement ( uis ) ; postActions . addElement ( uis ) ; } } action . setModel ( new DefaultComboBoxModel ( actions ) ) ; postAction . setModel ( new DefaultComboBoxModel ( postActions ) ) ; String a = cmd . getAction ( ) ; if ( a != null ) { if ( a . startsWith ( "@" ) ) { a = a . substring ( 1 ) ; asynchronous . setSelected ( true ) ; } else { if ( a . startsWith ( "!" ) ) { a = a . substring ( 1 ) ; String [ ] arr = a . split ( ";" ) ; action . setSelectedItem ( arr [ 0 ] ) ; postAction . setSelectedItem ( arr [ 1 ] ) ; } else { if ( a . startsWith ( "$" ) ) { a = a . substring ( 1 ) ; } } } } action . setSelectedItem ( a ) ; name . setText ( cmd . getCommandName ( ) ) ; id . setModel ( new SpinnerNumberModel ( cmd . getId ( ) , - 10000 , Integer . MAX_VALUE , 1 ) ) ; ResourceEditorView . initImagesComboBox ( icon , res , false , true ) ; icon . setSelectedItem ( cmd . getIcon ( ) ) ; ResourceEditorView . initImagesComboBox ( rollover , res , false , true ) ; rollover . setSelectedItem ( cmd . getRolloverIcon ( ) ) ; ResourceEditorView . initImagesComboBox ( pressed , res , false , true ) ; pressed . setSelectedItem ( cmd . getPressedIcon ( ) ) ; ResourceEditorView . initImagesComboBox ( disabled , res , false , true ) ; disabled . setSelectedItem ( cmd . getDisabledIcon ( ) ) ; }
Scrolls to the given offset in the document.
398
public static < M extends Message > String writeJsonStream ( ImmutableList < M > messages ) { ByteArrayOutputStream resultStream = new ByteArrayOutputStream ( ) ; MessageWriter < M > writer = MessageWriter . create ( Output . forStream ( new PrintStream ( resultStream ) ) ) ; writer . writeAll ( messages ) ; return resultStream . toString ( ) ; }
Create the EMR cluster.
399
public org . smpte_ra . schemas . st2067_2_2016 . ContentMaturityRatingType buildContentMaturityRatingType ( String agency , String rating , org . smpte_ra . schemas . st2067_2_2016 . ContentMaturityRatingType . Audience audience ) throws URISyntaxException { org . smpte_ra . schemas . st2067_2_2016 . ContentMaturityRatingType contentMaturityRatingType = new org . smpte_ra . schemas . st2067_2_2016 . ContentMaturityRatingType ( ) ; if ( ! agency . matches ( "^[a-zA-Z0-9._-]+" ) == true ) { throw new URISyntaxException ( "Invalid URI" , "The ContentMaturityRating agency %s does not follow the syntax of a valid URI (a-z, A-Z, 0-9, ., _, -)" ) ; } contentMaturityRatingType . setAgency ( agency ) ; contentMaturityRatingType . setRating ( rating ) ; contentMaturityRatingType . setAudience ( audience ) ; return contentMaturityRatingType ; }
Returns whether this map is empty.