idx
int64 0
34.9k
| question
stringlengths 12
26.4k
| target
stringlengths 15
2.3k
|
---|---|---|
1,000 | public static void showError ( final String messageText ) { JOptionPane . showMessageDialog ( null , messageText , translate ( "genericErrorMessageTitle" ) , JOptionPane . ERROR_MESSAGE ) ; } | Shows an error message box to the user. Returns only after being confirmed by the user. |
1,001 | @ NonNull public List < TrayItem > queryProviderSafe ( @ NonNull final Uri uri ) { try { return queryProvider ( uri ) ; } catch ( TrayException e ) { return new ArrayList < > ( ) ; } } | sends a query for TrayItems to the provider, doesn't throw when the database access couldn't be established |
1,002 | @ Override public void countExample ( Example example ) { int label = classNameMap . get ( example . getNominalValue ( labelAttribute ) ) ; int plabel = classNameMap . get ( example . getNominalValue ( predictedLabelAttribute ) ) ; double weight = 1.0d ; if ( weightAttribute != null ) { weight = example . getValue ( weightAttribute ) ; } counter [ label ] [ plabel ] += weight ; } | Increases the prediction value in the matrix. |
1,003 | void acc_expand ( ) { int len = digits . length ; int oldOnes [ ] = digits ; digits = new int [ len + 1 ] ; System . arraycopy ( oldOnes , 0 , digits , 1 , len ) ; } | Expand by one and release past (internal) memory. This works internally without affecting the outer type pointer. |
1,004 | protected double updateDistance ( double currDist , double diff ) { double result ; result = currDist ; diff = Math . abs ( diff ) ; if ( diff > result ) result = diff ; return result ; } | Updates the current distance calculated so far with the new difference between two attributes. The difference between the attributes was calculated with the difference(int,double,double) method. |
1,005 | public String goBack ( ) { if ( pointer > 0 ) { pointer -- ; } if ( messages . size ( ) > 0 ) { return messages . get ( pointer ) ; } return null ; } | Go back in history |
1,006 | private Number consumeTokenNumber ( char c ) throws JsonParserException { int start = index - 1 ; int end = index ; boolean isDouble = false ; while ( isDigitCharacter ( peekChar ( ) ) ) { char next = ( char ) advanceChar ( ) ; isDouble = next == '.' || next == 'e' || next == 'E' || isDouble ; end ++ ; } String number = string . substring ( start , end ) ; try { if ( isDouble ) { if ( number . charAt ( 0 ) == '0' ) { if ( number . charAt ( 1 ) == '.' ) { if ( number . length ( ) == 2 ) throw createParseException ( null , "Malformed number: " + number , true ) ; } else if ( number . charAt ( 1 ) != 'e' && number . charAt ( 1 ) != 'E' ) throw createParseException ( null , "Malformed number: " + number , true ) ; } if ( number . charAt ( 0 ) == '-' ) { if ( number . charAt ( 1 ) == '0' ) { if ( number . charAt ( 2 ) == '.' ) { if ( number . length ( ) == 3 ) throw createParseException ( null , "Malformed number: " + number , true ) ; } else if ( number . charAt ( 2 ) != 'e' && number . charAt ( 2 ) != 'E' ) throw createParseException ( null , "Malformed number: " + number , true ) ; } else if ( number . charAt ( 1 ) == '.' ) { throw createParseException ( null , "Malformed number: " + number , true ) ; } } return Double . parseDouble ( number ) ; } if ( number . charAt ( 0 ) == '0' ) { if ( number . length ( ) == 1 ) return 0 ; throw createParseException ( null , "Malformed number: " + number , true ) ; } if ( number . length ( ) > 1 && number . charAt ( 0 ) == '-' && number . charAt ( 1 ) == '0' ) { if ( number . length ( ) == 2 ) return - 0.0 ; throw createParseException ( null , "Malformed number: " + number , true ) ; } int length = number . charAt ( 0 ) == '-' ? number . length ( ) - 1 : number . length ( ) ; if ( length < 10 ) return Integer . parseInt ( number ) ; if ( length < 19 ) return Long . parseLong ( number ) ; return new BigInteger ( number ) ; } catch ( NumberFormatException e ) { throw createParseException ( e , "Malformed number: " + number , true ) ; } } | Steps through to the end of the current number token (a non-digit token). |
1,007 | public void tableSwitch ( final int [ ] keys , final TableSwitchGenerator generator , final boolean useTable ) { for ( int i = 1 ; i < keys . length ; ++ i ) { if ( keys [ i ] < keys [ i - 1 ] ) { throw new IllegalArgumentException ( "keys must be sorted ascending" ) ; } } Label def = newLabel ( ) ; Label end = newLabel ( ) ; if ( keys . length > 0 ) { int len = keys . length ; int min = keys [ 0 ] ; int max = keys [ len - 1 ] ; int range = max - min + 1 ; if ( useTable ) { Label [ ] labels = new Label [ range ] ; Arrays . fill ( labels , def ) ; for ( int i = 0 ; i < len ; ++ i ) { labels [ keys [ i ] - min ] = newLabel ( ) ; } mv . visitTableSwitchInsn ( min , max , def , labels ) ; for ( int i = 0 ; i < range ; ++ i ) { Label label = labels [ i ] ; if ( label != def ) { mark ( label ) ; generator . generateCase ( i + min , end ) ; } } } else { Label [ ] labels = new Label [ len ] ; for ( int i = 0 ; i < len ; ++ i ) { labels [ i ] = newLabel ( ) ; } mv . visitLookupSwitchInsn ( def , keys , labels ) ; for ( int i = 0 ; i < len ; ++ i ) { mark ( labels [ i ] ) ; generator . generateCase ( keys [ i ] , end ) ; } } } mark ( def ) ; generator . generateDefault ( ) ; mark ( end ) ; } | Generates the instructions for a switch statement. |
1,008 | private synchronized void addNodejsInstalls ( IConfigurationElement [ ] cf , List < IEmbeddedNodejs > list ) { for ( IConfigurationElement ce : cf ) { try { list . add ( new NodejsInstall ( ce ) ) ; Trace . trace ( Trace . EXTENSION_POINT , " Loaded nodeJSInstall: " + ce . getAttribute ( "id" ) ) ; } catch ( Throwable t ) { Trace . trace ( Trace . SEVERE , " Could not load nodeJSInstall: " + ce . getAttribute ( "id" ) , t ) ; } } } | Load the Nodejs installs. |
1,009 | public static List < File > sampleFiles ( File folder , int number , FileFilter filter ) { List < File > result = null ; if ( ! folder . exists ( ) || ! folder . isDirectory ( ) || ! folder . canRead ( ) ) { LOG . error ( "Could not read from " + folder . getAbsolutePath ( ) ) ; return null ; } File [ ] fileList = folder . listFiles ( filter ) ; if ( fileList . length > 0 ) { result = new ArrayList < File > ( ) ; if ( fileList . length < number ) { LOG . warn ( "Although " + number + " files were requested, only " + fileList . length + " are available" ) ; } int [ ] permutation = RandomPermutation . getRandomPermutation ( fileList . length ) ; int index = 0 ; while ( result . size ( ) < number && index < permutation . length ) { result . add ( fileList [ permutation [ index ++ ] - 1 ] ) ; } LOG . info ( "File sampling complete, " + result . size ( ) + " returned." ) ; return result ; } else { LOG . warn ( "The folder contains no relevant files. A null object is returned!" ) ; return null ; } } | The method samples from a filtered file list. |
1,010 | public Instance placeMovieClip ( Symbol symbol , Transform matrix2 , AlphaTransform cxform , String name , Actions [ ] clipActions ) { Transform matrix = matrix2 ; int depth = timeline . getAvailableDepth ( ) ; Instance inst = new Instance ( symbol , depth ) ; timeline . setAvailableDepth ( depth + 1 ) ; if ( matrix == null ) { matrix = new Transform ( ) ; } Placement placement = new Placement ( inst , matrix , cxform , name , - 1 , - 1 , frameNumber , false , false , clipActions ) ; placements . add ( placement ) ; return inst ; } | Place a Movie Clip at the next available depth with the given properties. |
1,011 | public void message ( Map headers , String body ) { transmit ( Command . MESSAGE , headers , body ) ; } | Called by the server; sends a message to this client. |
1,012 | protected LightIcon addLight ( ) { LightIcon l = new LightIcon ( this ) ; IconAdder editor = getIconEditor ( "Light" ) ; l . setOffIcon ( editor . getIcon ( "LightStateOff" ) ) ; l . setOnIcon ( editor . getIcon ( "LightStateOn" ) ) ; l . setInconsistentIcon ( editor . getIcon ( "BeanStateInconsistent" ) ) ; l . setUnknownIcon ( editor . getIcon ( "BeanStateUnknown" ) ) ; l . setLight ( ( Light ) editor . getTableSelection ( ) ) ; l . setDisplayLevel ( LIGHTS ) ; setNextLocation ( l ) ; putItem ( l ) ; return l ; } | Add a Light indicator to the target |
1,013 | public static boolean checkIfInitiatorsForRP ( DbClient dbClient , StringSet initiatorList ) { if ( dbClient == null || initiatorList == null ) { return false ; } List < Initiator > initiators = new ArrayList < Initiator > ( ) ; for ( String initiatorId : initiatorList ) { Initiator initiator = dbClient . queryObject ( Initiator . class , URI . create ( initiatorId ) ) ; if ( initiator != null ) { initiators . add ( initiator ) ; } } return checkIfInitiatorsForRP ( initiators ) ; } | Checks to see if the initiators passed in are for RecoverPoint. Convenience method to load the actual Initiators from the StringSet first before calling checkIfInitiatorsForRP(List<Initiator> initiatorList). |
1,014 | @ Deprecated public static File createTempDirectory ( String prefix ) throws IOException { return createTempDirectory ( null , prefix ) ; } | Create temporary directory and use 'java.io.tmpdir' as parent. |
1,015 | public void removeChangingListener ( OnWheelChangedListener listener ) { changingListeners . remove ( listener ) ; } | Removes wheel changing listener |
1,016 | public int timePassed ( ) { final long time = AnimationUtils . currentAnimationTimeMillis ( ) ; final long startTime = Math . min ( mScrollerX . mStartTime , mScrollerY . mStartTime ) ; return ( int ) ( time - startTime ) ; } | Returns the time elapsed since the beginning of the scrolling. |
1,017 | private void createCache ( ) throws Exception { if ( this . distributedSystem == null ) { this . distributedSystem = InternalDistributedSystem . getConnectedInstance ( ) ; } this . cache = CacheFactory . create ( this . distributedSystem ) ; } | create the cache to be used by this migration server |
1,018 | public abstract boolean doInit ( boolean ignoreCancel ) throws Throwable ; | Initialize the model checker |
1,019 | public static void apply ( Collection coll , Function func ) { for ( Iterator i = coll . iterator ( ) ; i . hasNext ( ) ; ) { func . execute ( i . next ( ) ) ; } } | Executes a function on each item in a Collection but does not accumulate the result |
1,020 | public static boolean checkConnection ( Connection conn ) { String sql = "select now()" ; Statement stmt = null ; ResultSet rs = null ; try { stmt = conn . createStatement ( ) ; stmt . setQueryTimeout ( 180 ) ; rs = stmt . executeQuery ( sql ) ; if ( rs != null && rs . next ( ) ) return true ; return false ; } catch ( Exception ex ) { } finally { close ( rs ) ; close ( stmt ) ; } return false ; } | Check if the given jdbc connection is still good |
1,021 | protected static DynamicField [ ] dynamicFieldListToSortedArray ( List < DynamicField > dynamicFieldList ) { DynamicField [ ] dFields = dynamicFieldList . toArray ( new DynamicField [ dynamicFieldList . size ( ) ] ) ; Arrays . sort ( dFields ) ; log . trace ( "Dynamic Field Ordering:" + Arrays . toString ( dFields ) ) ; return dFields ; } | Sort the dynamic fields and stuff them in a normal array for faster access. |
1,022 | protected void triggerPreferredLeaderElection ( ZkUtils zkUtils , List < PartitionInfo > partitionInfoList ) { scala . collection . mutable . HashSet < TopicAndPartition > scalaPartitionInfoSet = new scala . collection . mutable . HashSet < > ( ) ; for ( PartitionInfo javaPartitionInfo : partitionInfoList ) { scalaPartitionInfoSet . add ( new TopicAndPartition ( _topic , javaPartitionInfo . partition ( ) ) ) ; } PreferredReplicaLeaderElectionCommand . writePreferredReplicaElectionData ( zkUtils , scalaPartitionInfoSet ) ; } | This runs the preferred replica election for all partitions. |
1,023 | public DataViewComponent ( MasterView masterView , MasterViewConfiguration masterAreaConfiguration ) { initComponents ( ) ; createMasterView ( masterView ) ; configureMasterView ( masterAreaConfiguration ) ; } | Creates new instance of DataViewComponent. |
1,024 | public void remove ( T graphic ) { synchronized ( mLock ) { mGraphics . remove ( graphic ) ; } postInvalidate ( ) ; } | Removes a graphic from the overlay. |
1,025 | public boolean deleteEntry ( int index ) { System . arraycopy ( entries , index + 1 , entries , index , numEntries - index - 1 ) ; entries [ -- numEntries ] = null ; return true ; } | Deletes the entry at the specified index and shifts all entries after the index to left. |
1,026 | public void removeItem ( int position ) { mDatas . remove ( position ) ; notifyDataSetChanged ( ) ; } | remove data for position |
1,027 | public void resolveUrls ( ) { try { pool = Executors . newFixedThreadPool ( numThreads ) ; BufferedReader buffRead = new BufferedReader ( new FileReader ( new File ( urlsFile ) ) ) ; String urlStr = null ; while ( ( urlStr = buffRead . readLine ( ) ) != null ) { LOG . info ( "Starting: " + urlStr ) ; pool . execute ( new ResolverThread ( urlStr ) ) ; } buffRead . close ( ) ; pool . awaitTermination ( 60 , TimeUnit . SECONDS ) ; } catch ( Exception e ) { pool . shutdownNow ( ) ; LOG . info ( StringUtils . stringifyException ( e ) ) ; } pool . shutdown ( ) ; LOG . info ( "Total: " + numTotal . get ( ) + ", Resovled: " + numResolved . get ( ) + ", Errored: " + numErrored . get ( ) + ", Average Time: " + totalTime . get ( ) / numTotal . get ( ) ) ; } | Creates a thread pool for resolving urls. Reads in the url file on the local filesystem. For each url it attempts to resolve it keeping a total account of the number resolved, errored, and the amount of time. |
1,028 | public void addTextBox ( Sprite sprite , double x , double y , int textLength ) { int sx = convertWorldXToScaledScreen ( x ) ; int sy = convertWorldYToScaledScreen ( y ) ; sy -= sprite . getHeight ( ) ; sx = keepSpriteOnMapX ( sprite , sx ) ; sy = keepSpriteOnMapY ( sprite , sy ) ; boolean found = true ; int tries = 0 ; while ( found ) { found = false ; synchronized ( texts ) { for ( final RemovableSprite item : texts ) { if ( ( item . getX ( ) == sx ) && ( item . getY ( ) == sy ) ) { found = true ; sy += SIZE_UNIT_PIXELS / 2 ; sy = keepSpriteOnMapY ( sprite , sy ) ; break ; } } } tries ++ ; if ( tries > 20 ) { break ; } } texts . add ( new RemovableSprite ( sprite , sx , sy , Math . max ( RemovableSprite . STANDARD_PERSISTENCE_TIME , textLength * RemovableSprite . STANDARD_PERSISTENCE_TIME / 50 ) ) ) ; } | Adds a text bubble at a give position. |
1,029 | public void dispose ( ) { m_debugPerspectiveModel . removeListener ( m_debugListener ) ; synchronizeDebugger ( m_debugPerspectiveModel . getCurrentSelectedDebugger ( ) , null ) ; } | Clears up allocated resources. |
1,030 | public String dump ( Object data ) { List < Object > list = new ArrayList < Object > ( 1 ) ; list . add ( data ) ; return dumpAll ( list . iterator ( ) ) ; } | Serialize a Java object into a YAML String. |
1,031 | private void decrementAccessCount ( ) { if ( accessCount . get ( ) > 0 ) { accessCount . decrementAndGet ( ) ; } } | This method will decrement the access count for a column by 1 whenever a column usage is complete |
1,032 | public TileDirectory ( ) { tilename = "" ; this . tileID = - 1 ; westlon = eastlon = northlat = southlat = Float . NaN ; } | Construct an untiled TileDirectory. Since this object does not have valid boundaries, it is an error to call inRegion on it |
1,033 | protected ASN1Sequence ( ASN1Encodable [ ] array ) { for ( int i = 0 ; i != array . length ; i ++ ) { seq . addElement ( array [ i ] ) ; } } | create a sequence containing a vector of objects. |
1,034 | public boolean isLetterOrDigitAhead ( ) { int pos = currentPosition ; while ( pos < maxPosition ) { if ( Character . isLetterOrDigit ( str . charAt ( pos ) ) ) return true ; pos ++ ; } return false ; } | Tells if there is a digit or a letter character ahead. |
1,035 | public static String addTTDir ( final String fontPath , String failed ) { checkFontTablesInitialised ( ) ; final File currentDir = new File ( fontPath ) ; if ( ( currentDir . exists ( ) ) && ( currentDir . isDirectory ( ) ) ) { final String [ ] files = currentDir . list ( ) ; if ( files != null ) { for ( final String currentFont : files ) { addFontFile ( currentFont , fontPath ) ; } } } else { if ( failed == null ) { failed = fontPath ; } else { failed = failed + ',' + fontPath ; } } return failed ; } | add a truetype font directory and contents to substitution |
1,036 | public static String toHex ( String arg ) { return String . format ( "%04X" , new BigInteger ( 1 , arg . getBytes ( ) ) ) ; } | Create queries with mid for type i.e. mid -> type |
1,037 | public static String addToCartBulkRequirements ( HttpServletRequest request , HttpServletResponse response ) { ShoppingCart cart = getCartObject ( request ) ; Delegator delegator = ( Delegator ) request . getAttribute ( "delegator" ) ; LocalDispatcher dispatcher = ( LocalDispatcher ) request . getAttribute ( "dispatcher" ) ; ShoppingCartHelper cartHelper = new ShoppingCartHelper ( delegator , dispatcher , cart ) ; String controlDirective ; Map < String , Object > result ; Map < String , Object > paramMap = UtilHttp . getParameterMap ( request ) ; String catalogId = CatalogWorker . getCurrentCatalogId ( request ) ; result = cartHelper . addToCartBulkRequirements ( catalogId , paramMap ) ; controlDirective = processResult ( result , request ) ; if ( controlDirective . equals ( ERROR ) ) { return "error" ; } else { return "success" ; } } | Adds a set of requirements to the cart |
1,038 | public static void saveAsGnuStepASCII ( NSDictionary root , File out ) throws IOException { File parent = out . getParentFile ( ) ; if ( ! parent . exists ( ) && ! parent . mkdirs ( ) ) { throw new IOException ( "The output directory does not exist and could not be created." ) ; } OutputStreamWriter w = new OutputStreamWriter ( new FileOutputStream ( out ) , "ASCII" ) ; w . write ( root . toGnuStepASCIIPropertyList ( ) ) ; w . close ( ) ; } | Saves a property list with the given object as root into a ASCII file. |
1,039 | private void fitToBounds ( boolean center , ScaleAndTranslate scaleAndTranslate ) { if ( panLimit == PAN_LIMIT_OUTSIDE && isImageReady ( ) ) { center = false ; } PointF vTranslate = scaleAndTranslate . translate ; float scale = limitedScale ( scaleAndTranslate . scale ) ; float scaleWidth = scale * sWidth ( ) ; float scaleHeight = scale * sHeight ( ) ; if ( panLimit == PAN_LIMIT_CENTER && isImageReady ( ) ) { vTranslate . x = Math . max ( vTranslate . x , getWidth ( ) / 2 - scaleWidth ) ; vTranslate . y = Math . max ( vTranslate . y , getHeight ( ) / 2 - scaleHeight ) ; } else if ( center ) { vTranslate . x = Math . max ( vTranslate . x , getWidth ( ) - scaleWidth ) ; vTranslate . y = Math . max ( vTranslate . y , getHeight ( ) - scaleHeight ) ; } else { vTranslate . x = Math . max ( vTranslate . x , - scaleWidth ) ; vTranslate . y = Math . max ( vTranslate . y , - scaleHeight ) ; } float maxTx ; float maxTy ; if ( panLimit == PAN_LIMIT_CENTER && isImageReady ( ) ) { maxTx = Math . max ( 0 , getWidth ( ) / 2 ) ; maxTy = Math . max ( 0 , getHeight ( ) / 2 ) ; } else if ( center ) { maxTx = Math . max ( 0 , ( getWidth ( ) - scaleWidth ) / 2 ) ; maxTy = Math . max ( 0 , ( getHeight ( ) - scaleHeight ) / 2 ) ; } else { maxTx = Math . max ( 0 , getWidth ( ) ) ; maxTy = Math . max ( 0 , getHeight ( ) ) ; } vTranslate . x = Math . min ( vTranslate . x , maxTx ) ; vTranslate . y = Math . min ( vTranslate . y , maxTy ) ; scaleAndTranslate . scale = scale ; } | Adjusts hypothetical future scale and translate values to keep scale within the allowed range and the image on screen. Minimum scale is set so one dimension fills the view and the image is centered on the other dimension. Used to calculate what the target of an animation should be. |
1,040 | protected RewrittenOutboundUrl processEncodeURL ( HttpServletResponse hsResponse , HttpServletRequest hsRequest , boolean encodeUrlHasBeenRun , String outboundUrl ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "processing outbound url for " + outboundUrl ) ; } if ( outboundUrl == null ) { return new RewrittenOutboundUrl ( null , true ) ; } boolean finalEncodeOutboundUrl = true ; String finalToUrl = outboundUrl ; final List outboundRules = conf . getOutboundRules ( ) ; try { for ( int i = 0 ; i < outboundRules . size ( ) ; i ++ ) { final OutboundRule outboundRule = ( OutboundRule ) outboundRules . get ( i ) ; if ( ! encodeUrlHasBeenRun && outboundRule . isEncodeFirst ( ) ) { continue ; } if ( encodeUrlHasBeenRun && ! outboundRule . isEncodeFirst ( ) ) { continue ; } final RewrittenOutboundUrl rewrittenUrl = outboundRule . execute ( finalToUrl , hsRequest , hsResponse ) ; if ( rewrittenUrl != null ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "\"" + outboundRule . getDisplayName ( ) + "\" matched" ) ; } finalToUrl = rewrittenUrl . getTarget ( ) ; finalEncodeOutboundUrl = rewrittenUrl . isEncode ( ) ; if ( outboundRule . isLast ( ) ) { log . debug ( "rule is last" ) ; break ; } } } } catch ( InvocationTargetException e ) { try { handleInvocationTargetException ( hsRequest , hsResponse , e ) ; } catch ( ServletException e1 ) { log . error ( e1 ) ; } catch ( IOException e1 ) { log . error ( e1 ) ; } } return new RewrittenOutboundUrl ( finalToUrl , finalEncodeOutboundUrl ) ; } | Handles rewriting urls in jsp's etc, i.e. response.encodeURL() is overriden in the response wrapper. |
1,041 | @ Override public Iterator < ShoppingCartItem > iterator ( ) { return cartLines . iterator ( ) ; } | Returns an iterator of cart items. |
1,042 | public static String escapeXml ( String buffer ) { int start = 0 ; int length = buffer . length ( ) ; char [ ] arrayBuffer = buffer . toCharArray ( ) ; StringBuffer escapedBuffer = null ; for ( int i = 0 ; i < length ; i ++ ) { char c = arrayBuffer [ i ] ; if ( c <= HIGHEST_SPECIAL ) { char [ ] escaped = specialCharactersRepresentation [ c ] ; if ( escaped != null ) { if ( start == 0 ) { escapedBuffer = new StringBuffer ( length + 5 ) ; } if ( start < i ) { escapedBuffer . append ( arrayBuffer , start , i - start ) ; } start = i + 1 ; escapedBuffer . append ( escaped ) ; } } } if ( start == 0 ) { return buffer ; } if ( start < length ) { escapedBuffer . append ( arrayBuffer , start , length - start ) ; } return escapedBuffer . toString ( ) ; } | Performs the following substring replacements (to facilitate output to XML/HTML pages): & -> & < -> < > -> > " -> " ' -> ' See also OutSupport.writeEscapedXml(). |
1,043 | private static short CallStaticShortMethodV ( JNIEnvironment env , int classJREF , int methodID , Address argAddress ) throws Exception { if ( traceJNI ) VM . sysWrite ( "JNI called: CallStaticShortMethodV \n" ) ; RuntimeEntrypoints . checkJNICountDownToGC ( ) ; try { Object returnObj = JNIHelpers . invokeWithVarArg ( methodID , argAddress , TypeReference . Short ) ; return Reflection . unwrapShort ( returnObj ) ; } catch ( Throwable unexpected ) { if ( traceJNI ) unexpected . printStackTrace ( System . err ) ; env . recordException ( unexpected ) ; return 0 ; } } | CallStaticShortMethodV: invoke a static method that returns a short value |
1,044 | private static String removeBrackets ( String subQuery ) { if ( subQuery . indexOf ( '(' ) == 0 && subQuery . lastIndexOf ( ')' ) == subQuery . length ( ) - 1 ) { return subQuery . substring ( 1 , subQuery . length ( ) - 1 ) ; } return subQuery ; } | Removes the first and the last bracket from the sub-query. |
1,045 | public static String [ ] stringArrayFromString ( String string , char delimiter ) { List < String > result = new ArrayList < String > ( 10 ) ; if ( StringUtils . isNotBlank ( string ) ) { RaptorStringTokenizer tok = new RaptorStringTokenizer ( string , String . valueOf ( delimiter ) , false ) ; while ( tok . hasMoreTokens ( ) ) { String token = tok . nextToken ( ) ; result . add ( token ) ; } } return result . toArray ( new String [ 0 ] ) ; } | Returns a String[] of strings from a string that is formatted in what toString(String[]) returns. |
1,046 | public float textWidth ( String str ) { if ( textFont == null ) { defaultFontOrDeath ( "textWidth" ) ; } int length = str . length ( ) ; if ( length > textWidthBuffer . length ) { textWidthBuffer = new char [ length + 10 ] ; } str . getChars ( 0 , length , textWidthBuffer , 0 ) ; float wide = 0 ; int index = 0 ; int start = 0 ; while ( index < length ) { if ( textWidthBuffer [ index ] == '\n' ) { wide = Math . max ( wide , textWidthImpl ( textWidthBuffer , start , index ) ) ; start = index + 1 ; } index ++ ; } if ( start < length ) { wide = Math . max ( wide , textWidthImpl ( textWidthBuffer , start , index ) ) ; } return wide ; } | Return the width of a line of text. If the text has multiple lines, this returns the length of the longest line. |
1,047 | public static void appendEscapedSQLString ( StringBuilder sb , String sqlString ) { sb . append ( '\'' ) ; if ( sqlString . indexOf ( '\'' ) != - 1 ) { int length = sqlString . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { char c = sqlString . charAt ( i ) ; if ( c == '\'' ) { sb . append ( '\'' ) ; } sb . append ( c ) ; } } else { sb . append ( sqlString ) ; } sb . append ( '\'' ) ; } | Appends an SQL string to the given StringBuilder, including the opening and closing single quotes. Any single quotes internal to sqlString will be escaped. This method is deprecated because we want to encourage everyone to use the "?" binding form. However, when implementing a ContentProvider, one may want to add WHERE clauses that were not provided by the caller. Since "?" is a positional form, using it in this case could break the caller because the indexes would be shifted to accomodate the ContentProvider's internal bindings. In that case, it may be necessary to construct a WHERE clause manually. This method is useful for those cases. |
1,048 | protected void initClassDefaults ( UIDefaults table ) { super . initClassDefaults ( table ) ; final String windowsPackageName = "com.sun.java.swing.plaf.windows." ; Object [ ] uiDefaults = { "ButtonUI" , windowsPackageName + "WindowsButtonUI" , "CheckBoxUI" , windowsPackageName + "WindowsCheckBoxUI" , "CheckBoxMenuItemUI" , windowsPackageName + "WindowsCheckBoxMenuItemUI" , "LabelUI" , windowsPackageName + "WindowsLabelUI" , "RadioButtonUI" , windowsPackageName + "WindowsRadioButtonUI" , "RadioButtonMenuItemUI" , windowsPackageName + "WindowsRadioButtonMenuItemUI" , "ToggleButtonUI" , windowsPackageName + "WindowsToggleButtonUI" , "ProgressBarUI" , windowsPackageName + "WindowsProgressBarUI" , "SliderUI" , windowsPackageName + "WindowsSliderUI" , "SeparatorUI" , windowsPackageName + "WindowsSeparatorUI" , "SplitPaneUI" , windowsPackageName + "WindowsSplitPaneUI" , "SpinnerUI" , windowsPackageName + "WindowsSpinnerUI" , "TabbedPaneUI" , windowsPackageName + "WindowsTabbedPaneUI" , "TextAreaUI" , windowsPackageName + "WindowsTextAreaUI" , "TextFieldUI" , windowsPackageName + "WindowsTextFieldUI" , "PasswordFieldUI" , windowsPackageName + "WindowsPasswordFieldUI" , "TextPaneUI" , windowsPackageName + "WindowsTextPaneUI" , "EditorPaneUI" , windowsPackageName + "WindowsEditorPaneUI" , "TreeUI" , windowsPackageName + "WindowsTreeUI" , "ToolBarUI" , windowsPackageName + "WindowsToolBarUI" , "ToolBarSeparatorUI" , windowsPackageName + "WindowsToolBarSeparatorUI" , "ComboBoxUI" , windowsPackageName + "WindowsComboBoxUI" , "TableHeaderUI" , windowsPackageName + "WindowsTableHeaderUI" , "InternalFrameUI" , windowsPackageName + "WindowsInternalFrameUI" , "DesktopPaneUI" , windowsPackageName + "WindowsDesktopPaneUI" , "DesktopIconUI" , windowsPackageName + "WindowsDesktopIconUI" , "FileChooserUI" , windowsPackageName + "WindowsFileChooserUI" , "MenuUI" , windowsPackageName + "WindowsMenuUI" , "MenuItemUI" , windowsPackageName + "WindowsMenuItemUI" , "MenuBarUI" , windowsPackageName + "WindowsMenuBarUI" , "PopupMenuUI" , windowsPackageName + "WindowsPopupMenuUI" , "PopupMenuSeparatorUI" , windowsPackageName + "WindowsPopupMenuSeparatorUI" , "ScrollBarUI" , windowsPackageName + "WindowsScrollBarUI" , "RootPaneUI" , windowsPackageName + "WindowsRootPaneUI" } ; table . putDefaults ( uiDefaults ) ; } | Initialize the uiClassID to BasicComponentUI mapping. The JComponent classes define their own uiClassID constants (see AbstractComponent.getUIClassID). This table must map those constants to a BasicComponentUI class of the appropriate type. |
1,049 | public NamedThreadFactory ( String namePrefix ) { this . _namePrefix = namePrefix ; _delegate = Executors . defaultThreadFactory ( ) ; } | Constructs the thread factory. |
1,050 | private void writeHeaderLine ( List < ExtensionProperty > propertyList , int totalColumns , ArchiveFile af , Writer writer ) throws IOException { String [ ] headers = new String [ totalColumns ] ; headers [ ID_COLUMN_INDEX ] = ID_COLUMN_NAME ; int c = 1 ; for ( ExtensionProperty property : propertyList ) { headers [ c ] = property . simpleName ( ) ; c ++ ; } String headerLine = tabRow ( headers ) ; af . setIgnoreHeaderLines ( 1 ) ; writer . write ( headerLine ) ; } | Write the header column line to file. |
1,051 | private List < Usericon > parseChatIcons ( String json , String stream ) { try { JSONParser parser = new JSONParser ( ) ; JSONObject root = ( JSONObject ) parser . parse ( json ) ; List < Usericon > iconsNew = new ArrayList < > ( ) ; addUsericon ( iconsNew , Usericon . Type . MOD , null , getChatIconUrl ( root , "mod" , "image" ) ) ; addUsericon ( iconsNew , Usericon . Type . SUB , stream , getChatIconUrl ( root , "subscriber" , "image" ) ) ; addUsericon ( iconsNew , Usericon . Type . TURBO , null , getChatIconUrl ( root , "turbo" , "image" ) ) ; addUsericon ( iconsNew , Usericon . Type . BROADCASTER , null , getChatIconUrl ( root , "broadcaster" , "image" ) ) ; addUsericon ( iconsNew , Usericon . Type . STAFF , null , getChatIconUrl ( root , "staff" , "image" ) ) ; addUsericon ( iconsNew , Usericon . Type . ADMIN , null , getChatIconUrl ( root , "admin" , "image" ) ) ; addUsericon ( iconsNew , Usericon . Type . GLOBAL_MOD , null , getChatIconUrl ( root , "global_mod" , "image" ) ) ; return iconsNew ; } catch ( ParseException ex ) { LOGGER . warning ( "Error parsing chat icons: " + ex . getLocalizedMessage ( ) ) ; return null ; } } | Parses the icons info returned from the TwitchAPI into a ChatIcons object containing the URLs. |
1,052 | public float distance ( vec3 b ) { float x = this . m [ 0 ] - b . m [ 0 ] ; float y = this . m [ 1 ] - b . m [ 1 ] ; float z = this . m [ 2 ] - b . m [ 2 ] ; float result = ( float ) Math . sqrt ( x * x + y * y + z * z ) ; return result ; } | \brief distance( this, b ) |
1,053 | @ Deprecated public Spider ( ExtensionSpider extension , SpiderParam spiderParam , ConnectionParam connectionParam , Model model , Context scanContext ) { this ( "?" , extension , spiderParam , connectionParam , model , scanContext ) ; } | Instantiates a new spider. |
1,054 | private static boolean evaluateOptionsRules ( List reqOptions , List regOptions ) { if ( reqOptions == null || regOptions == null || ( reqOptions . size ( ) == 0 ) ) { return true ; } Iterator i = reqOptions . iterator ( ) ; while ( i . hasNext ( ) ) { String option = ( String ) i . next ( ) ; if ( regOptions . contains ( option ) ) { return true ; } } return false ; } | Performs options matching for queries. The match succeeds if either list is null or if there is any intersection between the lists. |
1,055 | public void overrideButton ( String button , boolean override ) { LOG . i ( "App" , "WARNING: Volume Button Default Behavior will be overridden. The volume event will be fired!" ) ; if ( button . equals ( "volumeup" ) ) { webView . setButtonPlumbedToJs ( KeyEvent . KEYCODE_VOLUME_UP , override ) ; } else if ( button . equals ( "volumedown" ) ) { webView . setButtonPlumbedToJs ( KeyEvent . KEYCODE_VOLUME_DOWN , override ) ; } else if ( button . equals ( "menubutton" ) ) { webView . setButtonPlumbedToJs ( KeyEvent . KEYCODE_MENU , override ) ; } } | Override the default behavior of the Android volume buttons. If overridden, when the volume button is pressed, the "volume[up|down]button" JavaScript event will be fired. |
1,056 | public static Boolean removeIconFromCache ( Context context , AppInfo appInfo ) { File file = new File ( context . getCacheDir ( ) , appInfo . getAPK ( ) ) ; return file . delete ( ) ; } | Delelete an app icon from cache folder |
1,057 | private static int determineConsecutiveTextCount ( CharSequence msg , int startpos ) { int len = msg . length ( ) ; int idx = startpos ; while ( idx < len ) { char ch = msg . charAt ( idx ) ; int numericCount = 0 ; while ( numericCount < 13 && isDigit ( ch ) && idx < len ) { numericCount ++ ; idx ++ ; if ( idx < len ) { ch = msg . charAt ( idx ) ; } } if ( numericCount >= 13 ) { return idx - startpos - numericCount ; } if ( numericCount > 0 ) { continue ; } ch = msg . charAt ( idx ) ; if ( ! isText ( ch ) ) { break ; } idx ++ ; } return idx - startpos ; } | Determines the number of consecutive characters that are encodable using text compaction. |
1,058 | public void addPropertyChangeListener ( String propertyName , PropertyChangeListener in_pcl ) { beanContextChildSupport . addPropertyChangeListener ( propertyName , in_pcl ) ; } | Method for BeanContextChild interface. |
1,059 | public static void doWithFields ( Class < ? > clazz , FieldCallback fc , FieldFilter ff ) { Class < ? > targetClass = clazz ; do { Field [ ] fields = targetClass . getDeclaredFields ( ) ; for ( Field field : fields ) { if ( ff != null && ! ff . matches ( field ) ) { continue ; } try { fc . doWith ( field ) ; } catch ( IllegalAccessException ex ) { throw new IllegalStateException ( "Not allowed to access field '" + field . getName ( ) + "': " + ex ) ; } } targetClass = targetClass . getSuperclass ( ) ; } while ( targetClass != null && targetClass != Object . class ) ; } | Invoke the given callback on all fields in the target class, going up the class hierarchy to get all declared fields. |
1,060 | private PropertyDescriptor [ ] propertyDescriptors ( Class c ) throws SQLException { BeanInfo beanInfo ; try { beanInfo = Introspector . getBeanInfo ( c ) ; } catch ( IntrospectionException e ) { throw new SQLException ( "Bean introspection failed: " + e . getMessage ( ) ) ; } return beanInfo . getPropertyDescriptors ( ) ; } | Returns a PropertyDescriptor[] for the given Class. |
1,061 | @ Override public List < AppEntry > loadInBackground ( ) { List < ApplicationInfo > apps = mPm . getInstalledApplications ( PackageManager . GET_UNINSTALLED_PACKAGES | PackageManager . GET_DISABLED_COMPONENTS ) ; if ( apps == null ) { apps = new ArrayList < > ( ) ; } final Context context = getContext ( ) ; List < AppEntry > entries = new ArrayList < > ( apps . size ( ) ) ; for ( int i = 0 ; i < apps . size ( ) ; i ++ ) { AppEntry entry = new AppEntry ( this , apps . get ( i ) ) ; entry . loadLabel ( context ) ; entries . add ( entry ) ; } Collections . sort ( entries , ALPHA_COMPARATOR ) ; return entries ; } | This is where the bulk of our work is done. This function is called in a background thread and should generate a new set of data to be published by the loader. |
1,062 | public static long parseDuration ( String durationStr ) { long duration = - 1 ; String [ ] componentArr = durationStr . split ( ":" ) ; switch ( componentArr . length ) { case 1 : duration = parseDurationFromSeconds ( durationStr ) ; break ; case 2 : case 3 : durationStr = ensureSegmentedDuration ( durationStr ) ; duration = parseDurationFromString ( durationStr ) ; break ; default : break ; } return duration ; } | Parses a duration string into milliseconds |
1,063 | public boolean exists ( ) { return file . exists ( ) ; } | Tells if the file exists. |
1,064 | private void startDownloadRepeat ( final String hostname , final int port , final String uri ) { mRepeatDownload = true ; mSpeedTestSocket . startDownload ( hostname , port , uri ) ; } | Start download for download repeat. |
1,065 | public void init ( boolean forEncryption , CipherParameters param ) { core . init ( forEncryption , param ) ; if ( param instanceof ParametersWithRandom ) { ParametersWithRandom rParam = ( ParametersWithRandom ) param ; key = ( RSAKeyParameters ) rParam . getParameters ( ) ; random = rParam . getRandom ( ) ; } else { key = ( RSAKeyParameters ) param ; random = new SecureRandom ( ) ; } } | initialise the RSA engine. |
1,066 | public void exec ( final String service , final String action , final String callbackId , final String rawArgs ) { CordovaPlugin plugin = getPlugin ( service ) ; if ( plugin == null ) { Log . d ( TAG , "exec() call to unknown plugin: " + service ) ; PluginResult cr = new PluginResult ( PluginResult . Status . CLASS_NOT_FOUND_EXCEPTION ) ; app . sendPluginResult ( cr , callbackId ) ; return ; } CallbackContext callbackContext = new CallbackContext ( callbackId , app ) ; try { long pluginStartTime = System . currentTimeMillis ( ) ; boolean wasValidAction = plugin . execute ( action , rawArgs , callbackContext ) ; long duration = System . currentTimeMillis ( ) - pluginStartTime ; if ( duration > SLOW_EXEC_WARNING_THRESHOLD ) { Log . w ( TAG , "THREAD WARNING: exec() call to " + service + "." + action + " blocked the main thread for " + duration + "ms. Plugin should use CordovaInterface.getThreadPool()." ) ; } if ( ! wasValidAction ) { PluginResult cr = new PluginResult ( PluginResult . Status . INVALID_ACTION ) ; callbackContext . sendPluginResult ( cr ) ; } } catch ( JSONException e ) { PluginResult cr = new PluginResult ( PluginResult . Status . JSON_EXCEPTION ) ; callbackContext . sendPluginResult ( cr ) ; } catch ( Exception e ) { Log . e ( TAG , "Uncaught exception from plugin" , e ) ; callbackContext . error ( e . getMessage ( ) ) ; } } | Receives a request for execution and fulfills it by finding the appropriate Java class and calling it's execute method. PluginManager.exec can be used either synchronously or async. In either case, a JSON encoded string is returned that will indicate if any errors have occurred when trying to find or execute the class denoted by the clazz argument. |
1,067 | protected void resetXML11 ( ) throws XNIException { int count = fXML11Components . size ( ) ; for ( int i = 0 ; i < count ; i ++ ) { XMLComponent c = ( XMLComponent ) fXML11Components . get ( i ) ; c . reset ( this ) ; } } | reset all components before parsing and namespace context |
1,068 | public boolean restoreAccessibilityFocus ( CalendarDay day ) { if ( ( day . year != mYear ) || ( day . month != mMonth ) || ( day . day > mNumCells ) ) { return false ; } mTouchHelper . setFocusedVirtualView ( day . day ) ; return true ; } | Attempts to restore accessibility focus to the specified date. |
1,069 | protected void drawDescription ( Canvas c ) { if ( ! mDescription . equals ( "" ) ) { if ( mDescriptionPosition == null ) { c . drawText ( mDescription , getWidth ( ) - mViewPortHandler . offsetRight ( ) - 10 , getHeight ( ) - mViewPortHandler . offsetBottom ( ) - 10 , mDescPaint ) ; } else { c . drawText ( mDescription , mDescriptionPosition . x , mDescriptionPosition . y , mDescPaint ) ; } } } | draws the description text in the bottom right corner of the chart |
1,070 | public void addDropTarget ( DropTarget target ) { mDropTargets . add ( target ) ; } | Add a DropTarget to the list of potential places to receive drop events. |
1,071 | public void pushStream ( char [ ] inStream , int inFileid , String name , String inBaseDir , String inEncoding ) { includeStack . push ( new IncludeState ( cursor , line , col , fileid , fileName , baseDir , encoding , stream ) ) ; cursor = 0 ; line = 1 ; col = 1 ; fileid = inFileid ; fileName = name ; baseDir = inBaseDir ; encoding = inEncoding ; stream = inStream ; } | Sets this mark's state to a new stream. It will store the current stream in it's includeStack. |
1,072 | protected void stopOutputTest ( ) { if ( testRunning && outTest ) { outTimer . stop ( ) ; statusText1 . setText ( "Output Test stopped after " + Integer . toString ( numIterations ) + " Cycles" ) ; statusText1 . setVisible ( true ) ; statusText2 . setText ( " " ) ; statusText2 . setVisible ( true ) ; } } | Local Method to stop an Output Test |
1,073 | public Criteria or ( ) { Criteria criteria = createCriteriaInternal ( ) ; oredCriteria . add ( criteria ) ; return criteria ; } | This method was generated by MyBatis Generator. This method corresponds to the database table attachment |
1,074 | public Builder ( ) { this . created = new Date ( System . currentTimeMillis ( ) ) ; this . lastModified = this . created ; } | Constructs a new builder with the created and last modified time set to the current time |
1,075 | @ Override public TableDto create ( @ Nonnull QualifiedName name ) { TableDto result = null ; log . info ( "Get the table {}" , name ) ; Optional < TableDto > oTable = tableService . get ( name , false ) ; if ( oTable . isPresent ( ) ) { TableDto table = oTable . get ( ) ; String viewName = createViewName ( name ) ; QualifiedName targetName = QualifiedName . ofTable ( name . getCatalogName ( ) , VIEW_DB_NAME , viewName ) ; log . info ( "Check if the view table {} exists." , targetName ) ; Optional < TableDto > oViewTable = Optional . empty ( ) ; try { oViewTable = tableService . get ( targetName , false ) ; } catch ( NotFoundException ignored ) { } if ( ! oViewTable . isPresent ( ) ) { log . info ( "Creating view {}." , targetName ) ; result = tableService . copy ( table , targetName ) ; } else { result = oViewTable . get ( ) ; } } else { throw new TableNotFoundException ( new SchemaTableName ( name . getDatabaseName ( ) , name . getTableName ( ) ) ) ; } return result ; } | Creates the materialized view using the schema of the give table Assumes that the "franklinviews" database name already exists in the given catalog. |
1,076 | public int intHeader ( final String name , final int defaultValue ) throws HttpRequestException { closeOutputQuietly ( ) ; return connection . getHeaderFieldInt ( name , defaultValue ) ; } | Get an integer header value from the response falling back to the given default value if the header is missing or if parsing fails |
1,077 | protected LinkedList < Diff > diff_bisect ( String text1 , String text2 , long deadline ) { int text1_length = text1 . length ( ) ; int text2_length = text2 . length ( ) ; int max_d = ( text1_length + text2_length + 1 ) / 2 ; int v_offset = max_d ; int v_length = 2 * max_d ; int [ ] v1 = new int [ v_length ] ; int [ ] v2 = new int [ v_length ] ; for ( int x = 0 ; x < v_length ; x ++ ) { v1 [ x ] = - 1 ; v2 [ x ] = - 1 ; } v1 [ v_offset + 1 ] = 0 ; v2 [ v_offset + 1 ] = 0 ; int delta = text1_length - text2_length ; boolean front = ( delta % 2 != 0 ) ; int k1start = 0 ; int k1end = 0 ; int k2start = 0 ; int k2end = 0 ; for ( int d = 0 ; d < max_d ; d ++ ) { if ( System . currentTimeMillis ( ) > deadline ) { break ; } for ( int k1 = - d + k1start ; k1 <= d - k1end ; k1 += 2 ) { int k1_offset = v_offset + k1 ; int x1 ; if ( k1 == - d || ( k1 != d && v1 [ k1_offset - 1 ] < v1 [ k1_offset + 1 ] ) ) { x1 = v1 [ k1_offset + 1 ] ; } else { x1 = v1 [ k1_offset - 1 ] + 1 ; } int y1 = x1 - k1 ; while ( x1 < text1_length && y1 < text2_length && text1 . charAt ( x1 ) == text2 . charAt ( y1 ) ) { x1 ++ ; y1 ++ ; } v1 [ k1_offset ] = x1 ; if ( x1 > text1_length ) { k1end += 2 ; } else if ( y1 > text2_length ) { k1start += 2 ; } else if ( front ) { int k2_offset = v_offset + delta - k1 ; if ( k2_offset >= 0 && k2_offset < v_length && v2 [ k2_offset ] != - 1 ) { int x2 = text1_length - v2 [ k2_offset ] ; if ( x1 >= x2 ) { return diff_bisectSplit ( text1 , text2 , x1 , y1 , deadline ) ; } } } } for ( int k2 = - d + k2start ; k2 <= d - k2end ; k2 += 2 ) { int k2_offset = v_offset + k2 ; int x2 ; if ( k2 == - d || ( k2 != d && v2 [ k2_offset - 1 ] < v2 [ k2_offset + 1 ] ) ) { x2 = v2 [ k2_offset + 1 ] ; } else { x2 = v2 [ k2_offset - 1 ] + 1 ; } int y2 = x2 - k2 ; while ( x2 < text1_length && y2 < text2_length && text1 . charAt ( text1_length - x2 - 1 ) == text2 . charAt ( text2_length - y2 - 1 ) ) { x2 ++ ; y2 ++ ; } v2 [ k2_offset ] = x2 ; if ( x2 > text1_length ) { k2end += 2 ; } else if ( y2 > text2_length ) { k2start += 2 ; } else if ( ! front ) { int k1_offset = v_offset + delta - k2 ; if ( k1_offset >= 0 && k1_offset < v_length && v1 [ k1_offset ] != - 1 ) { int x1 = v1 [ k1_offset ] ; int y1 = v_offset + x1 - k1_offset ; x2 = text1_length - x2 ; if ( x1 >= x2 ) { return diff_bisectSplit ( text1 , text2 , x1 , y1 , deadline ) ; } } } } } LinkedList < Diff > diffs = new LinkedList < Diff > ( ) ; diffs . add ( new Diff ( Operation . DELETE , text1 ) ) ; diffs . add ( new Diff ( Operation . INSERT , text2 ) ) ; return diffs ; } | Find the 'middle snake' of a diff, split the problem in two and return the recursively constructed diff. See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations. |
1,078 | public String buildJvmVendor ( ) { return properties . getProperty ( "build.jvm.vendor" ) ; } | Returns the vendor for the JVM used to generate this build. |
1,079 | public static void valueToDocument ( Value value , String rootNodeName , Document document ) { Element root = document . createElement ( rootNodeName ) ; document . appendChild ( root ) ; _valueToDocument ( value , root , document ) ; } | Transforms a jolie.Value object to an XML Document instance. |
1,080 | public void stopLogging ( ) { active = false ; } | method to for asynchronous termination of sampling loops |
1,081 | private void mergeForceCollapse ( ) { while ( stackSize > 1 ) { int n = stackSize - 2 ; if ( n > 0 && runLen [ n - 1 ] < runLen [ n + 1 ] ) n -- ; mergeAt ( n ) ; } } | Merges all runs on the stack until only one remains. This method is called once, to complete the sort. |
1,082 | @ Override public int hashCode ( ) { return oid . hashCode ( ) ; } | Returns the hash code for this object class. It will be calculated as the hash code of the numeric OID. |
1,083 | private void showAbout ( ) { if ( about == null ) { about = new CommonAboutDialog ( frame ) ; } about . setVisible ( true ) ; } | Called when the user selects the "Help->About" menu item. |
1,084 | public List < LinearConstraint > normalizeConstraints ( Collection < LinearConstraint > originalConstraints ) { List < LinearConstraint > normalized = new ArrayList < LinearConstraint > ( originalConstraints . size ( ) ) ; for ( LinearConstraint constraint : originalConstraints ) { normalized . add ( normalize ( constraint ) ) ; } return normalized ; } | Get new versions of the constraints which have positive right hand sides. |
1,085 | public OsLib ( ) { } | Create and OsLib instance. |
1,086 | protected void tearDown ( ) { objArray = null ; objArray2 = null ; hm = null ; } | Tears down the fixture, for example, close a network connection. This method is called after a test is executed. |
1,087 | @ Override protected void initRequest ( ) { super . initRequest ( ) ; _state = _state . toActive ( ) ; HttpBufferStore bufferStore = getHttpBufferStore ( ) ; _method . clear ( ) ; _methodString = null ; _protocol . clear ( ) ; _uriLength = 0 ; if ( bufferStore == null ) { _uri = getSmallUriBuffer ( ) ; _headerBuffer = getSmallHeaderBuffer ( ) ; _headerKeys = getSmallHeaderKeys ( ) ; _headerValues = getSmallHeaderValues ( ) ; } _uriHost . clear ( ) ; _host = null ; _keepalive = KeepaliveState . INIT ; _headerSize = 0 ; _headerLength = 0 ; _inOffset = 0 ; _isChunkedIn = false ; _isFirst = true ; } | Clear the request variables in preparation for a new request. |
1,088 | @ Override public void removeDataSourceListener ( DataSourceListener dsl ) { m_dataListeners . remove ( dsl ) ; } | Remove a data souce listener |
1,089 | public static void doWithFields ( Class < ? > clazz , FieldCallback fc ) throws IllegalArgumentException { doWithFields ( clazz , fc , null ) ; } | Invoke the given callback on all fields in the target class, going up the class hierarchy to get all declared fields. |
1,090 | public static DistributionConfigImpl produce ( Properties props , boolean isConnected ) { if ( props != null ) { Object o = props . get ( DS_CONFIG_NAME ) ; if ( o instanceof DistributionConfigImpl ) { return ( DistributionConfigImpl ) o ; } } return new DistributionConfigImpl ( props , false , isConnected ) ; } | Produce a DistributionConfigImpl for the given properties and return it. |
1,091 | public Shape createPoint ( Point2D point ) { Rectangle2D . Double pointMarker = new Rectangle2D . Double ( 0.0 , 0.0 , size , size ) ; pointMarker . x = ( double ) ( point . getX ( ) - ( size / 2 ) ) ; pointMarker . y = ( double ) ( point . getY ( ) - ( size / 2 ) ) ; return pointMarker ; } | Creates a shape representing a point. |
1,092 | private void repaintChildren ( final Rectangle r ) { final Rectangle content = getContentSize ( ) ; for ( final LWComponentPeer < ? , ? > child : getChildren ( ) ) { final Rectangle childBounds = child . getBounds ( ) ; Rectangle toPaint = r . intersection ( childBounds ) ; toPaint = toPaint . intersection ( content ) ; toPaint . translate ( - childBounds . x , - childBounds . y ) ; child . repaintPeer ( toPaint ) ; } } | Paints all the child peers in the straight z-order, so the bottom-most ones are painted first. |
1,093 | private long calculateMillisFor ( MPPOrderNode node , long commonBase ) { final BigDecimal qty = node . getQtyToDeliver ( ) ; long totalDuration = + node . getQueuingTime ( ) + node . getSetupTimeRequired ( ) + node . getMovingTime ( ) + node . getWaitingTime ( ) ; final BigDecimal workingTime = routingService . estimateWorkingTime ( node , qty ) ; totalDuration += workingTime . doubleValue ( ) ; return ( long ) ( totalDuration * commonBase * 1000 ) ; } | Calculate how many millis take to complete given qty on given node(operation). |
1,094 | protected void add ( String type , String info ) { String seperator = SEPERATOR ; if ( start ( type ) ) { text = new StringBuilder ( ) ; text . append ( timestamp ( ) ) ; text . append ( type ) ; text . append ( ": " ) ; seperator = "" ; } text . append ( seperator ) ; text . append ( info ) ; length ++ ; if ( length >= MAX_LENGTH ) { close ( ) ; } } | Prints something in compact mode, meaning that nick events of the same type appear in the same line, for as long as possible. This is mainly used for a compact way of printing joins/parts/mod/unmod. |
1,095 | public String wrap ( String path ) { return uriPrefix + path ; } | Appends scheme to incoming path |
1,096 | public void resizeCapacity ( int newCapacity ) { if ( newCapacity == capacity_ ) return ; totalQuads_ = Math . min ( totalQuads_ , newCapacity ) ; capacity_ = newCapacity ; ByteBuffer tbb = ByteBuffer . allocateDirect ( ccQuad2 . size * newCapacity * 4 ) ; tbb . order ( ByteOrder . nativeOrder ( ) ) ; FloatBuffer tmpTexCoords = tbb . asFloatBuffer ( ) ; tmpTexCoords . put ( textureCoordinates ) ; textureCoordinates = tmpTexCoords ; textureCoordinates . position ( 0 ) ; ByteBuffer vbb = ByteBuffer . allocateDirect ( ccQuad3 . size * newCapacity * 4 ) ; vbb . order ( ByteOrder . nativeOrder ( ) ) ; FloatBuffer tmpVertexCoords = vbb . asFloatBuffer ( ) ; tmpVertexCoords . put ( vertexCoordinates ) ; vertexCoordinates = tmpVertexCoords ; vertexCoordinates . position ( 0 ) ; ByteBuffer isb = ByteBuffer . allocateDirect ( 6 * newCapacity * 2 ) ; isb . order ( ByteOrder . nativeOrder ( ) ) ; ShortBuffer tmpIndices = isb . asShortBuffer ( ) ; tmpIndices . put ( indices ) ; indices = tmpIndices ; indices . position ( 0 ) ; initIndices ( ) ; if ( withColorArray_ ) { ByteBuffer cbb = ByteBuffer . allocateDirect ( 4 * ccColor4B . size * newCapacity * 4 ) ; cbb . order ( ByteOrder . nativeOrder ( ) ) ; FloatBuffer tmpColors = cbb . asFloatBuffer ( ) ; tmpColors . put ( colors ) ; colors = tmpColors ; colors . position ( 0 ) ; } } | resize the capacity of the Texture Atlas. The new capacity can be lower or higher than the current one It returns YES if the resize was successful. If it fails to resize the capacity it will return NO with a new capacity of 0. |
1,097 | public String convertStatement ( String oraStatement ) { Convert . logMigrationScript ( oraStatement , null , null ) ; return oraStatement ; } | Convert an individual Oracle Style statements to target database statement syntax. |
1,098 | public void annotationAdded ( Annotation annotation ) { addedAnnotations . add ( annotation ) ; } | Adds the given annotation to the set of annotations that are reported as being added from the model. If this event is considered a world change, it is no longer so after this method has successfully finished. |
1,099 | private void computeSnaps ( Collection segStrings , Collection snapPts ) { for ( Iterator i0 = segStrings . iterator ( ) ; i0 . hasNext ( ) ; ) { NodedSegmentString ss = ( NodedSegmentString ) i0 . next ( ) ; computeSnaps ( ss , snapPts ) ; } } | Computes nodes introduced as a result of snapping segments to snap points (hot pixels) |
Subsets and Splits