signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class MDLFormat { /** * { @ inheritDoc } */ @ Override public boolean matches ( int lineNumber , String line ) { } }
if ( lineNumber == 4 && line . length ( ) > 7 && ( ! line . contains ( "2000" ) ) && // MDL Mol V2000 format ( ! line . contains ( "3000" ) ) ) // MDL Mol V3000 format { // possibly a MDL mol file try { String atomCountString = line . substring ( 0 , 3 ) . trim ( ) ; String bondCountString = line . substring ( 3 , 6 ) . trim ( ) ; Integer . valueOf ( atomCountString ) ; Integer . valueOf ( bondCountString ) ; String remainder = line . substring ( 6 ) . trim ( ) ; for ( int i = 0 ; i < remainder . length ( ) ; ++ i ) { char c = remainder . charAt ( i ) ; if ( ! ( Character . isDigit ( c ) || Character . isWhitespace ( c ) ) ) { return false ; } } } catch ( NumberFormatException nfe ) { // Integers not found on fourth line ; therefore not a MDL file return false ; } return true ; } return false ;
public class MainActivity { /** * gets storage state and current cache size */ private void updateStorageInfo ( ) { } }
long cacheSize = updateStoragePrefreneces ( this ) ; // cache management ends here TextView tv = findViewById ( R . id . sdcardstate_value ) ; final String state = Environment . getExternalStorageState ( ) ; boolean mSdCardAvailable = Environment . MEDIA_MOUNTED . equals ( state ) ; tv . setText ( ( mSdCardAvailable ? "Mounted" : "Not Available" ) ) ; if ( ! mSdCardAvailable ) { tv . setTextColor ( Color . RED ) ; tv . setTypeface ( null , Typeface . BOLD ) ; } tv = findViewById ( R . id . version_text ) ; tv . setText ( BuildConfig . VERSION_NAME + " " + BuildConfig . BUILD_TYPE ) ; tv = findViewById ( R . id . mainstorageInfo ) ; tv . setText ( Configuration . getInstance ( ) . getOsmdroidTileCache ( ) . getAbsolutePath ( ) + "\n" + "Cache size: " + Formatter . formatFileSize ( this , cacheSize ) ) ;
public class BaseLogger { /** * Prepares an exception message * @ param id the id of the message * @ param messageTemplate the message template to use * @ param parameters the parameters for the message ( optional ) * @ return the prepared exception message */ protected String exceptionMessage ( String id , String messageTemplate , Object ... parameters ) { } }
String formattedTemplate = formatMessageTemplate ( id , messageTemplate ) ; if ( parameters == null || parameters . length == 0 ) { return formattedTemplate ; } else { return MessageFormatter . arrayFormat ( formattedTemplate , parameters ) . getMessage ( ) ; }
public class OBOOntology { /** * Looks up the name for an ontology ID . * @ param id * The ontology ID . * @ return The name , or null . */ public String getNameForID ( String id ) { } }
if ( ! terms . containsKey ( id ) ) return null ; return terms . get ( id ) . getName ( ) ;
public class NetworkedWorldModel { /** * NetworkedWorld */ @ Override public void disconnect ( ) { } }
network . disconnect ( ) ; for ( final L listener : listeners ) { network . removeListener ( listener ) ; } listeners . clear ( ) ;
public class GroovyScriptEngineImpl { /** * for GroovyClassLoader instance */ private static ClassLoader getParentLoader ( ) { } }
// check whether thread context loader can " see " Groovy Script class ClassLoader ctxtLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; try { Class < ? > c = ctxtLoader . loadClass ( Script . class . getName ( ) ) ; if ( c == Script . class ) { return ctxtLoader ; } } catch ( ClassNotFoundException cnfe ) { /* ignore */ } // exception was thrown or we get wrong class return Script . class . getClassLoader ( ) ;
public class KeyVaultClientBaseImpl { /** * Deletes the certificate contacts for a specified key vault . * Deletes the certificate contacts for a specified key vault certificate . This operation requires the certificates / managecontacts permission . * @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the Contacts object */ public Observable < Contacts > deleteCertificateContactsAsync ( String vaultBaseUrl ) { } }
return deleteCertificateContactsWithServiceResponseAsync ( vaultBaseUrl ) . map ( new Func1 < ServiceResponse < Contacts > , Contacts > ( ) { @ Override public Contacts call ( ServiceResponse < Contacts > response ) { return response . body ( ) ; } } ) ;
public class StocatorPath { /** * Inspect the path and return true if path contains reserved " _ temporary " or * the first entry from " fs . stocator . temp . identifier " if provided * @ param path to inspect * @ return true if path contains temporary identifier */ public boolean isTemporaryPath ( String path ) { } }
for ( String tempPath : tempIdentifiers ) { String [ ] tempPathComponents = tempPath . split ( "/" ) ; if ( tempPathComponents . length > 0 && path != null && path . contains ( tempPathComponents [ 0 ] . replace ( "ID" , "" ) ) ) { return true ; } } return false ;
public class BlockingThreadPoolExecutor { /** * Awaits termination of the threads * @ throws InterruptedException The executor was interrupted */ public void awaitTermination ( ) throws InterruptedException { } }
lock . lock ( ) ; try { while ( ! isDone ) { done . await ( ) ; } } finally { isDone = false ; lock . unlock ( ) ; }
public class HexEncoder { /** * [ TESTING ] . * @ param input octets . * @ return nibbles . */ byte [ ] encodeLikeABoss ( final byte [ ] input ) { } }
if ( input == null ) { throw new NullPointerException ( "input" ) ; } final byte [ ] output = new byte [ input . length << 1 ] ; int index = 0 ; // index in output for ( int i = 0 ; i < input . length ; i ++ ) { String s = Integer . toString ( input [ i ] & 0xFF , 16 ) ; if ( s . length ( ) == 1 ) { s = "0" + s ; } output [ index ++ ] = ( byte ) s . charAt ( 0 ) ; output [ index ++ ] = ( byte ) s . charAt ( 1 ) ; } return output ;
public class ChannelFrameworkImpl { /** * Setter method for the interval of time between chain restart attempts . * @ param value * @ throws NumberFormatException * if the value is not a number or is less than zero */ public void setChainStartRetryInterval ( Object value ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Setting chain start retry interval [" + value + "]" ) ; } try { long num = MetatypeUtils . parseLong ( PROPERTY_CONFIG_ALIAS , PROPERTY_CHAIN_START_RETRY_INTERVAL , value , chainStartRetryInterval ) ; if ( 0L <= num ) { this . chainStartRetryInterval = num ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Value is too low" ) ; } } } catch ( NumberFormatException nfe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Value is not a number" ) ; } }
public class DefaultAsyncJobExecutor { /** * Stops the acquisition thread */ protected void stopJobAcquisitionThread ( ) { } }
if ( asyncJobAcquisitionThread != null ) { try { asyncJobAcquisitionThread . join ( ) ; } catch ( InterruptedException e ) { log . warn ( "Interrupted while waiting for the async job acquisition thread to terminate" , e ) ; } asyncJobAcquisitionThread = null ; }
public class HttpUtil { /** * Performs an HTTP POST on the given URL . * @ param url The URL to connect to . * @ return The HTTP response as Response object . * @ throws URISyntaxException * @ throws UnsupportedEncodingException * @ throws HttpException */ public static Response post ( String url ) throws URISyntaxException , UnsupportedEncodingException , HttpException { } }
return postParams ( new HttpPost ( url ) , new ArrayList < NameValuePair > ( ) , null , null ) ;
public class JtsAdapter { /** * Return true if the values of the two { @ link Coordinate } are equal when their * first and second ordinates are cast as ints . Ignores 3rd ordinate . * @ param a first coordinate to compare * @ param b second coordinate to compare * @ return true if the values of the two { @ link Coordinate } are equal when their * first and second ordinates are cast as ints */ private static boolean equalAsInts2d ( Coordinate a , Coordinate b ) { } }
return ( ( int ) a . getOrdinate ( 0 ) ) == ( ( int ) b . getOrdinate ( 0 ) ) && ( ( int ) a . getOrdinate ( 1 ) ) == ( ( int ) b . getOrdinate ( 1 ) ) ;
public class CovarianceMatrix { /** * Static Constructor from a full relation . * @ param relation Relation to use . * @ return Covariance matrix */ public static CovarianceMatrix make ( Relation < ? extends NumberVector > relation ) { } }
int dim = RelationUtil . dimensionality ( relation ) ; CovarianceMatrix c = new CovarianceMatrix ( dim ) ; double [ ] mean = c . mean ; int count = 0 ; // Compute mean first : for ( DBIDIter iditer = relation . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { NumberVector vec = relation . get ( iditer ) ; for ( int i = 0 ; i < dim ; i ++ ) { mean [ i ] += vec . doubleValue ( i ) ; } count ++ ; } if ( count == 0 ) { return c ; } // Normalize mean for ( int i = 0 ; i < dim ; i ++ ) { mean [ i ] /= count ; } // Compute covariances second // Two - pass approach is numerically okay and fast , when possible . double [ ] tmp = c . nmea ; // Scratch space double [ ] [ ] elems = c . elements ; for ( DBIDIter iditer = relation . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { NumberVector vec = relation . get ( iditer ) ; for ( int i = 0 ; i < dim ; i ++ ) { tmp [ i ] = vec . doubleValue ( i ) - mean [ i ] ; } for ( int i = 0 ; i < dim ; i ++ ) { for ( int j = i ; j < dim ; j ++ ) { elems [ i ] [ j ] += tmp [ i ] * tmp [ j ] ; } } } // Restore symmetry . for ( int i = 0 ; i < dim ; i ++ ) { for ( int j = i + 1 ; j < dim ; j ++ ) { elems [ j ] [ i ] = elems [ i ] [ j ] ; } } c . wsum = count ; return c ;
public class CorsPolicy { /** * Generates immutable HTTP response headers that should be added to a CORS preflight response . * @ return { @ link HttpHeaders } the HTTP response headers to be added . */ public HttpHeaders generatePreflightResponseHeaders ( ) { } }
final HttpHeaders headers = new DefaultHttpHeaders ( ) ; preflightResponseHeaders . forEach ( ( key , value ) -> { final Object val = getValue ( value ) ; if ( val instanceof Iterable ) { headers . addObject ( key , ( Iterable < ? > ) val ) ; } else { headers . addObject ( key , val ) ; } } ) ; return headers . asImmutable ( ) ;
public class UIUtils { /** * Get a Drawable attribute value * @ param ctx * @ param drawableAttrId * @ return */ public static Drawable getDrawableAttr ( Context ctx , @ AttrRes int drawableAttrId ) { } }
int [ ] attrs = new int [ ] { drawableAttrId /* index 0 */ } ; TypedArray ta = ctx . obtainStyledAttributes ( attrs ) ; Drawable drawable = ta . getDrawable ( 0 ) ; ta . recycle ( ) ; return drawable ;
public class CsvReader { /** * Skips the next line of data using the standard end of line characters and * does not do any column delimited parsing . * @ return Whether a line was successfully skipped or not . * @ exception IOException * Thrown if an error occurs while reading data from the * source stream . */ public boolean skipLine ( ) throws IOException { } }
checkClosed ( ) ; // clear public column values for current line columnsCount = 0 ; boolean skippedLine = false ; if ( hasMoreData ) { boolean foundEol = false ; do { if ( dataBuffer . Position == dataBuffer . Count ) { checkDataLength ( ) ; } else { skippedLine = true ; // grab the current letter as a char char currentLetter = dataBuffer . Buffer [ dataBuffer . Position ] ; if ( currentLetter == Letters . CR || currentLetter == Letters . LF ) { foundEol = true ; } // keep track of the last letter because we need // it for several key decisions lastLetter = currentLetter ; if ( ! foundEol ) { dataBuffer . Position ++ ; } } // end else } while ( hasMoreData && ! foundEol ) ; columnBuffer . Position = 0 ; dataBuffer . LineStart = dataBuffer . Position + 1 ; } rawBuffer . Position = 0 ; rawRecord = "" ; return skippedLine ;
public class HelloSignClient { /** * Big kahuna method for editing an embedded template . This method allows * the updating of merge fields and CC roles ( both optional parameters ) . * @ param templateId String ID of the signature request to embed * @ param skipSignerRoles true if the edited template should not allow the * user to modify the template ' s signer roles . Defaults to false . * @ param skipSubjectMessage true if the edited template should not allow * the user to modify the template ' s subject and message . Defaults to * false . * @ param testMode true if this request is a test request . Useful for * editing locked templates . * @ param mergeFields These will overwrite the current merge fields for the * embedded template . To remove all merge fields , pass in an empty Map . * @ param ccRoles These will overwrite the current CC Roles for the embedded * template . To remove all CC roles , pass in null or an empty List . * @ return EmbeddedResponse * @ throws HelloSignException thrown if there ' s a problem processing the * HTTP request or the JSON response . */ public EmbeddedResponse getEmbeddedTemplateEditUrl ( String templateId , boolean skipSignerRoles , boolean skipSubjectMessage , boolean testMode , Map < String , FieldType > mergeFields , List < String > ccRoles ) throws HelloSignException { } }
String url = BASE_URI + EMBEDDED_EDIT_URL_URI + "/" + templateId ; HttpClient client = httpClient . withAuth ( auth ) . withPostField ( EMBEDDED_TEMPLATE_SKIP_SIGNER_ROLES , skipSignerRoles ) . withPostField ( EMBEDDED_TEMPLATE_SKIP_SUBJECT_MESSAGE , skipSubjectMessage ) . withPostField ( AbstractRequest . REQUEST_TEST_MODE , testMode ) ; String mergeFieldsStr = TemplateDraft . serializeMergeFields ( mergeFields ) ; if ( mergeFieldsStr != null ) { client = client . withPostField ( EMBEDDED_TEMPLATE_MERGE_FIELDS , mergeFieldsStr ) ; } if ( ccRoles == null || ccRoles . isEmpty ( ) ) { // Per documentation : https : / / app . hellosign . com / api / reference # get _ embedded _ template _ edit _ url client = client . withPostField ( EMBEDDED_TEMPLATE_CC_ROLES + "[0]" , "" ) ; } else { for ( int i = 0 ; i < ccRoles . size ( ) ; i ++ ) { String cc = ccRoles . get ( i ) ; client = client . withPostField ( EMBEDDED_TEMPLATE_CC_ROLES + "[" + i + "]" , cc ) ; } } return new EmbeddedResponse ( client . post ( url ) . asJson ( ) ) ;
public class CmsXmlSitemapGenerator { /** * Gets the list of pages from the navigation which should be directly added to the XML sitemap . < p > * @ return the list of pages to add to the XML sitemap */ protected List < CmsResource > getNavigationPages ( ) { } }
List < CmsResource > result = new ArrayList < CmsResource > ( ) ; CmsJspNavBuilder navBuilder = new CmsJspNavBuilder ( m_siteGuestCms ) ; try { CmsResource rootDefaultFile = m_siteGuestCms . readDefaultFile ( m_siteGuestCms . getRequestContext ( ) . removeSiteRoot ( m_baseFolderRootPath ) , CmsResourceFilter . DEFAULT ) ; if ( rootDefaultFile != null ) { result . add ( rootDefaultFile ) ; } } catch ( Exception e ) { LOG . info ( e . getLocalizedMessage ( ) , e ) ; } List < CmsJspNavElement > navElements = navBuilder . getSiteNavigation ( m_baseFolderSitePath , CmsJspNavBuilder . Visibility . includeHidden , - 1 ) ; for ( CmsJspNavElement navElement : navElements ) { CmsResource navResource = navElement . getResource ( ) ; if ( navResource . isFolder ( ) ) { try { CmsResource defaultFile = m_guestCms . readDefaultFile ( navResource , CmsResourceFilter . DEFAULT_FILES ) ; if ( defaultFile != null ) { result . add ( defaultFile ) ; } else { LOG . warn ( "Could not get default file for " + navResource . getRootPath ( ) ) ; } } catch ( CmsException e ) { LOG . warn ( "Could not get default file for " + navResource . getRootPath ( ) ) ; } } else { result . add ( navResource ) ; } } return result ;
public class RestGetRequestValidator { /** * Validations specific to GET and GET ALL */ @ Override public boolean parseAndValidateRequest ( ) { } }
if ( ! super . parseAndValidateRequest ( ) ) { return false ; } isGetVersionRequest = hasGetVersionRequestHeader ( ) ; if ( isGetVersionRequest && this . parsedKeys . size ( ) > 1 ) { RestErrorHandler . writeErrorResponse ( messageEvent , HttpResponseStatus . BAD_REQUEST , "Get version request cannot have multiple keys" ) ; return false ; } return true ;
public class DefaultRiskAnalysis { /** * < p > Checks if a transaction is considered " standard " by Bitcoin Core ' s IsStandardTx and AreInputsStandard * functions . < / p > * < p > Note that this method currently only implements a minimum of checks . More to be added later . < / p > */ public static RuleViolation isStandard ( Transaction tx ) { } }
// TODO : Finish this function off . if ( tx . getVersion ( ) > 2 || tx . getVersion ( ) < 1 ) { log . warn ( "TX considered non-standard due to unknown version number {}" , tx . getVersion ( ) ) ; return RuleViolation . VERSION ; } final List < TransactionOutput > outputs = tx . getOutputs ( ) ; for ( int i = 0 ; i < outputs . size ( ) ; i ++ ) { TransactionOutput output = outputs . get ( i ) ; RuleViolation violation = isOutputStandard ( output ) ; if ( violation != RuleViolation . NONE ) { log . warn ( "TX considered non-standard due to output {} violating rule {}" , i , violation ) ; return violation ; } } final List < TransactionInput > inputs = tx . getInputs ( ) ; for ( int i = 0 ; i < inputs . size ( ) ; i ++ ) { TransactionInput input = inputs . get ( i ) ; RuleViolation violation = isInputStandard ( input ) ; if ( violation != RuleViolation . NONE ) { log . warn ( "TX considered non-standard due to input {} violating rule {}" , i , violation ) ; return violation ; } } return RuleViolation . NONE ;
public class LRUCache { /** * 移除最近最少访问 */ protected void removeRencentlyLeastAccess ( Set < Map . Entry < K , ValueEntry > > entries ) { } }
// 最小使用次数 int least = 0 ; // 最久没有被访问 long earliest = 0 ; K toBeRemovedByCount = null ; K toBeRemovedByTime = null ; Iterator < Map . Entry < K , ValueEntry > > it = entries . iterator ( ) ; if ( it . hasNext ( ) ) { Map . Entry < K , ValueEntry > valueEntry = it . next ( ) ; least = valueEntry . getValue ( ) . count . get ( ) ; toBeRemovedByCount = valueEntry . getKey ( ) ; earliest = valueEntry . getValue ( ) . lastAccess . get ( ) ; toBeRemovedByTime = valueEntry . getKey ( ) ; } while ( it . hasNext ( ) ) { Map . Entry < K , ValueEntry > valueEntry = it . next ( ) ; if ( valueEntry . getValue ( ) . count . get ( ) < least ) { least = valueEntry . getValue ( ) . count . get ( ) ; toBeRemovedByCount = valueEntry . getKey ( ) ; } if ( valueEntry . getValue ( ) . lastAccess . get ( ) < earliest ) { earliest = valueEntry . getValue ( ) . count . get ( ) ; toBeRemovedByTime = valueEntry . getKey ( ) ; } } // System . out . println ( " remove : " + toBeRemoved ) ; // 如果最少使用次数大于MINI _ ACCESS , 那么移除访问时间最早的项 ( 也就是最久没有被访问的项 ) if ( least > MINI_ACCESS ) { map . remove ( toBeRemovedByTime ) ; } else { map . remove ( toBeRemovedByCount ) ; }
public class MediaSpec { /** * Obtains the ratio specified by the given media query expression . * @ param e The media query expression specifying a ratio . * @ return The length converted to pixels or { @ code null } when the value cannot be converted to ratio . */ protected Float getExpressionRatio ( MediaExpression e ) { } }
if ( e . size ( ) == 2 ) // the ratio is two integer values { Term < ? > term1 = e . get ( 0 ) ; Term < ? > term2 = e . get ( 1 ) ; if ( term1 instanceof TermInteger && term2 instanceof TermInteger && ( ( ( TermInteger ) term2 ) . getOperator ( ) == Operator . SLASH ) ) return ( ( TermInteger ) term1 ) . getValue ( ) / ( ( TermInteger ) term2 ) . getValue ( ) ; else return null ; } else return null ;
public class AbstractContext { /** * Sets several variables at a time into the context . * @ param variables the variables to be set . */ public void setVariables ( final Map < String , Object > variables ) { } }
if ( variables == null ) { return ; } this . variables . putAll ( variables ) ;
public class FirestoreImpl { /** * Internal getAll ( ) method that accepts an optional transaction id . */ ApiFuture < List < DocumentSnapshot > > getAll ( final DocumentReference [ ] documentReferences , @ Nullable FieldMask fieldMask , @ Nullable ByteString transactionId ) { } }
final SettableApiFuture < List < DocumentSnapshot > > futureList = SettableApiFuture . create ( ) ; final Map < DocumentReference , DocumentSnapshot > resultMap = new HashMap < > ( ) ; ApiStreamObserver < BatchGetDocumentsResponse > responseObserver = new ApiStreamObserver < BatchGetDocumentsResponse > ( ) { int numResponses ; @ Override public void onNext ( BatchGetDocumentsResponse response ) { DocumentReference documentReference ; DocumentSnapshot documentSnapshot ; numResponses ++ ; if ( numResponses == 1 ) { tracer . getCurrentSpan ( ) . addAnnotation ( "Firestore.BatchGet: First response" ) ; } else if ( numResponses % 100 == 0 ) { tracer . getCurrentSpan ( ) . addAnnotation ( "Firestore.BatchGet: Received 100 responses" ) ; } switch ( response . getResultCase ( ) ) { case FOUND : documentReference = new DocumentReference ( FirestoreImpl . this , ResourcePath . create ( response . getFound ( ) . getName ( ) ) ) ; documentSnapshot = DocumentSnapshot . fromDocument ( FirestoreImpl . this , Timestamp . fromProto ( response . getReadTime ( ) ) , response . getFound ( ) ) ; break ; case MISSING : documentReference = new DocumentReference ( FirestoreImpl . this , ResourcePath . create ( response . getMissing ( ) ) ) ; documentSnapshot = DocumentSnapshot . fromMissing ( FirestoreImpl . this , documentReference , Timestamp . fromProto ( response . getReadTime ( ) ) ) ; break ; default : return ; } resultMap . put ( documentReference , documentSnapshot ) ; } @ Override public void onError ( Throwable throwable ) { tracer . getCurrentSpan ( ) . addAnnotation ( "Firestore.BatchGet: Error" ) ; futureList . setException ( throwable ) ; } @ Override public void onCompleted ( ) { tracer . getCurrentSpan ( ) . addAnnotation ( "Firestore.BatchGet: Complete" ) ; List < DocumentSnapshot > documentSnapshots = new ArrayList < > ( ) ; for ( DocumentReference documentReference : documentReferences ) { documentSnapshots . add ( resultMap . get ( documentReference ) ) ; } futureList . set ( documentSnapshots ) ; } } ; BatchGetDocumentsRequest . Builder request = BatchGetDocumentsRequest . newBuilder ( ) ; request . setDatabase ( getDatabaseName ( ) ) ; if ( fieldMask != null ) { request . setMask ( fieldMask . toPb ( ) ) ; } if ( transactionId != null ) { request . setTransaction ( transactionId ) ; } for ( DocumentReference docRef : documentReferences ) { request . addDocuments ( docRef . getName ( ) ) ; } tracer . getCurrentSpan ( ) . addAnnotation ( "Firestore.BatchGet: Start" , ImmutableMap . of ( "numDocuments" , AttributeValue . longAttributeValue ( documentReferences . length ) ) ) ; streamRequest ( request . build ( ) , responseObserver , firestoreClient . batchGetDocumentsCallable ( ) ) ; return futureList ;
public class WikipediaTemplateInfo { /** * For a given page ( pageId ) , this method returns all adjacent revision pairs in which a given template * has been removed or added ( depending on the RevisionPairType ) in the second pair part . * @ param pageId id of the page whose revision history should be inspected * @ param template the template to look for * @ param type the type of template change ( add or remove ) that should be extracted * @ return list of revision pairs containing the desired template changes */ public List < RevisionPair > getRevisionPairs ( int pageId , String template , RevisionPair . RevisionPairType type ) throws WikiApiException { } }
if ( revApi == null ) { revApi = new RevisionApi ( wiki . getDatabaseConfiguration ( ) ) ; } List < RevisionPair > resultList = new LinkedList < RevisionPair > ( ) ; Map < Timestamp , Boolean > tplIndexMap = new HashMap < Timestamp , Boolean > ( ) ; List < Timestamp > revTsList = revApi . getRevisionTimestamps ( pageId ) ; for ( Timestamp ts : revTsList ) { tplIndexMap . put ( ts , revisionContainsTemplateName ( revApi . getRevision ( pageId , ts ) . getRevisionID ( ) , template ) ) ; } SortedSet < Entry < Timestamp , Boolean > > entries = new TreeSet < Entry < Timestamp , Boolean > > ( new Comparator < Entry < Timestamp , Boolean > > ( ) { public int compare ( Entry < Timestamp , Boolean > e1 , Entry < Timestamp , Boolean > e2 ) { return e1 . getKey ( ) . compareTo ( e2 . getKey ( ) ) ; } } ) ; entries . addAll ( tplIndexMap . entrySet ( ) ) ; Entry < Timestamp , Boolean > prev = null ; Entry < Timestamp , Boolean > current = null ; for ( Entry < Timestamp , Boolean > e : entries ) { current = e ; // check pair if ( prev != null && prev . getValue ( ) != current . getValue ( ) ) { // case : template has been deleted since last revision if ( prev . getValue ( ) && ! current . getValue ( ) && type == RevisionPairType . deleteTemplate ) { resultList . add ( new RevisionPair ( revApi . getRevision ( pageId , prev . getKey ( ) ) , revApi . getRevision ( pageId , current . getKey ( ) ) , template , RevisionPairType . deleteTemplate ) ) ; } // case : template has been added since last revision if ( ! prev . getValue ( ) && current . getValue ( ) && type == RevisionPairType . addTemplate ) { resultList . add ( new RevisionPair ( revApi . getRevision ( pageId , prev . getKey ( ) ) , revApi . getRevision ( pageId , current . getKey ( ) ) , template , RevisionPairType . addTemplate ) ) ; } } prev = current ; } return resultList ;
public class SimpleWebServlet { /** * Handle the HTTP GET method by building a simple web page . */ public void doGet ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { } }
String toAddr = request . getParameter ( "to" ) ; String fromAddr = request . getParameter ( "from" ) ; String bye = request . getParameter ( "bye" ) ; URI to = toAddr == null ? null : sipFactory . createAddress ( toAddr ) . getURI ( ) ; URI from = fromAddr == null ? null : sipFactory . createAddress ( fromAddr ) . getURI ( ) ; CallStatusContainer calls = ( CallStatusContainer ) getServletContext ( ) . getAttribute ( "activeCalls" ) ; // Create app session and request SipApplicationSession appSession = ( ( ConvergedHttpSession ) request . getSession ( ) ) . getApplicationSession ( ) ; if ( bye != null ) { if ( bye . equals ( "all" ) ) { Iterator it = ( Iterator ) appSession . getSessions ( "sip" ) ; while ( it . hasNext ( ) ) { SipSession session = ( SipSession ) it . next ( ) ; Call call = ( Call ) session . getAttribute ( "call" ) ; if ( call != null ) call . end ( ) ; calls . removeCall ( call ) ; notifyStatus ( "Received Bye All request" ) ; } } else { // Someone wants to end an established call , send byes and clean up Call call = calls . getCall ( fromAddr , toAddr ) ; call . end ( ) ; calls . removeCall ( call ) ; notifyStatus ( "Received Bye request" ) ; } } else { if ( calls == null ) { calls = new CallStatusContainer ( ) ; getServletContext ( ) . setAttribute ( "activeCalls" , calls ) ; } // Add the call in the active calls Call call = calls . addCall ( fromAddr , toAddr , "FFFF00" ) ; SipServletRequest req = sipFactory . createRequest ( appSession , "INVITE" , from , to ) ; // Set some attribute req . getSession ( ) . setAttribute ( "SecondPartyAddress" , sipFactory . createAddress ( fromAddr ) ) ; req . getSession ( ) . setAttribute ( "call" , call ) ; // This session will be used to send BYE call . addSession ( req . getSession ( ) ) ; logger . info ( "Sending request" + req ) ; // Send the INVITE request req . send ( ) ; notifyStatus ( "Received Call request" ) ; } // Write the output html PrintWriter out ; response . setContentType ( "text/html" ) ; out = response . getWriter ( ) ; out . println ( "success" ) ; out . close ( ) ;
public class AmazonAutoScalingClient { /** * Updates the instance protection settings of the specified instances . * For more information about preventing instances that are part of an Auto Scaling group from terminating on scale * in , see < a * href = " https : / / docs . aws . amazon . com / autoscaling / ec2 / userguide / as - instance - termination . html # instance - protection " * > Instance Protection < / a > in the < i > Amazon EC2 Auto Scaling User Guide < / i > . * @ param setInstanceProtectionRequest * @ return Result of the SetInstanceProtection operation returned by the service . * @ throws LimitExceededException * You have already reached a limit for your Amazon EC2 Auto Scaling resources ( for example , Auto Scaling * groups , launch configurations , or lifecycle hooks ) . For more information , see * < a > DescribeAccountLimits < / a > . * @ throws ResourceContentionException * You already have a pending update to an Amazon EC2 Auto Scaling resource ( for example , an Auto Scaling * group , instance , or load balancer ) . * @ sample AmazonAutoScaling . SetInstanceProtection * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / autoscaling - 2011-01-01 / SetInstanceProtection " * target = " _ top " > AWS API Documentation < / a > */ @ Override public SetInstanceProtectionResult setInstanceProtection ( SetInstanceProtectionRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeSetInstanceProtection ( request ) ;
public class Log4JLogger { /** * Log an error to the Log4j Logger with < code > ERROR < / code > priority . */ public void error ( Object message , Throwable t ) { } }
if ( IS12 ) { getLogger ( ) . log ( FQCN , Level . ERROR , message , t ) ; } else { getLogger ( ) . log ( FQCN , Level . ERROR , message , t ) ; }
public class PoolGetOptions { /** * Set the time the request was issued . Client libraries typically set this to the current system clock time ; set it explicitly if you are calling the REST API directly . * @ param ocpDate the ocpDate value to set * @ return the PoolGetOptions object itself . */ public PoolGetOptions withOcpDate ( DateTime ocpDate ) { } }
if ( ocpDate == null ) { this . ocpDate = null ; } else { this . ocpDate = new DateTimeRfc1123 ( ocpDate ) ; } return this ;
public class ClassFileImporter { /** * Imports the class files of the supplied classes from the classpath / modulepath . * < br > < br > * For information about the impact of the imported classes on the evaluation of rules , * as well as configuration and details , refer to { @ link ClassFileImporter } . */ @ PublicAPI ( usage = ACCESS ) public JavaClasses importClasses ( Collection < Class < ? > > classes ) { } }
Set < Location > locations = new HashSet < > ( ) ; for ( Class < ? > clazz : classes ) { locations . addAll ( Locations . ofClass ( clazz ) ) ; } return importLocations ( locations ) ;
public class CharsetDecoder { /** * Changes this decoder ' s action for unmappable - character errors . * < p > This method invokes the { @ link # implOnUnmappableCharacter * implOnUnmappableCharacter } method , passing the new action . < / p > * @ param newAction The new action ; must not be < tt > null < / tt > * @ return This decoder * @ throws IllegalArgumentException * If the precondition on the parameter does not hold */ public final CharsetDecoder onUnmappableCharacter ( CodingErrorAction newAction ) { } }
if ( newAction == null ) throw new IllegalArgumentException ( "Null action" ) ; unmappableCharacterAction = newAction ; implOnUnmappableCharacter ( newAction ) ; return this ;
public class CmsGroupTable { /** * Initializes the table . < p > * @ param ou name */ protected void init ( String ou ) { } }
m_menu = new CmsContextMenu ( ) ; m_menu . setAsTableContextMenu ( this ) ; m_container = new IndexedContainer ( ) ; for ( TableProperty prop : TableProperty . values ( ) ) { m_container . addContainerProperty ( prop , prop . getType ( ) , prop . getDefault ( ) ) ; setColumnHeader ( prop , prop . getName ( ) ) ; } m_app . addGroupContainerProperties ( m_container ) ; setContainerDataSource ( m_container ) ; setItemIconPropertyId ( TableProperty . Icon ) ; setRowHeaderMode ( RowHeaderMode . ICON_ONLY ) ; setColumnWidth ( null , 40 ) ; setSelectable ( true ) ; setMultiSelect ( true ) ; for ( CmsGroup group : m_groups ) { Item item = m_container . addItem ( group ) ; m_app . fillGroupItem ( item , group , m_indirects ) ; } addItemClickListener ( new ItemClickListener ( ) { private static final long serialVersionUID = 4807195510202231174L ; @ SuppressWarnings ( "unchecked" ) public void itemClick ( ItemClickEvent event ) { changeValueIfNotMultiSelect ( event . getItemId ( ) ) ; if ( event . getButton ( ) . equals ( MouseButton . RIGHT ) || ( event . getPropertyId ( ) == null ) ) { Set < String > groupIds = new HashSet < String > ( ) ; for ( CmsGroup group : ( Set < CmsGroup > ) getValue ( ) ) { groupIds . add ( group . getId ( ) . getStringValue ( ) ) ; } m_menu . setEntries ( getMenuEntries ( ) , groupIds ) ; m_menu . openForTable ( event , event . getItemId ( ) , event . getPropertyId ( ) , CmsGroupTable . this ) ; return ; } if ( event . getButton ( ) . equals ( MouseButton . LEFT ) && event . getPropertyId ( ) . equals ( TableProperty . Name ) ) { updateApp ( ( ( ( Set < CmsGroup > ) getValue ( ) ) . iterator ( ) . next ( ) ) . getId ( ) . getStringValue ( ) ) ; } } } ) ; setCellStyleGenerator ( new CellStyleGenerator ( ) { private static final long serialVersionUID = 1L ; public String getStyle ( Table source , Object itemId , Object propertyId ) { String css = "" ; if ( ( ( Boolean ) source . getItem ( itemId ) . getItemProperty ( TableProperty . INDIRECT ) . getValue ( ) ) . booleanValue ( ) ) { css += " " + OpenCmsTheme . TABLE_CELL_DISABLED + " " + OpenCmsTheme . EXPIRED ; } if ( TableProperty . Name . equals ( propertyId ) ) { css += " " + OpenCmsTheme . HOVER_COLUMN ; } return css ; } } ) ; setVisibleColumns ( TableProperty . Name , TableProperty . Description , TableProperty . OU ) ;
public class AlertConditionCache { /** * Adds the condition list to the conditions for the account . * @ param conditions The conditions to add */ public void add ( Collection < AlertCondition > conditions ) { } }
for ( AlertCondition condition : conditions ) this . conditions . put ( condition . getId ( ) , condition ) ;
public class Calendar { /** * Sets the state of the calendar fields that are < em > not < / em > specified * by < code > fieldMask < / code > to < em > unset < / em > . If < code > fieldMask < / code > * specifies all the calendar fields , then the state of this * < code > Calendar < / code > becomes that all the calendar fields are in sync * with the time value ( millisecond offset from the Epoch ) . * @ param fieldMask the field mask indicating which calendar fields are in * sync with the time value . * @ exception IndexOutOfBoundsException if the specified * < code > field < / code > is out of range * ( < code > field & lt ; 0 | | field & gt ; = FIELD _ COUNT < / code > ) . * @ see # isExternallySet ( int ) * @ see # selectFields ( ) */ final void setFieldsNormalized ( int fieldMask ) { } }
if ( fieldMask != ALL_FIELDS ) { for ( int i = 0 ; i < fields . length ; i ++ ) { if ( ( fieldMask & 1 ) == 0 ) { stamp [ i ] = fields [ i ] = 0 ; // UNSET = = 0 isSet [ i ] = false ; } fieldMask >>= 1 ; } } // Some or all of the fields are in sync with the // milliseconds , but the stamp values are not normalized yet . areFieldsSet = true ; areAllFieldsSet = false ;
public class CmsLink { /** * Updates the uri of this link with a new value . < p > * Also updates the structure of the underlying XML page document this link belongs to . < p > * Note that you can < b > not < / b > update the " internal " or " type " values of the link , * so the new link must be of same type ( A , IMG ) and also remain either an internal or external link . < p > * @ param uri the uri to update this link with < code > scheme : / / authority / path # anchor ? query < / code > */ public void updateLink ( String uri ) { } }
// set the uri m_uri = uri ; // update the components setComponents ( ) ; // update the xml CmsLinkUpdateUtil . updateXml ( this , m_element , true ) ;
public class VRPResourceManager { /** * Sets whether a cluster is managed by a Virtual Datacenter . Setting this to true will prevent users from disabling * DRS for the cluster . * @ param cluster Cluster object * @ param status True if the cluster is managed by a Virtual Datacenter * @ throws InvalidState * @ throws NotFound * @ throws RuntimeFault * @ throws RemoteException */ public void setManagedByVDC ( ClusterComputeResource cluster , boolean status ) throws InvalidState , NotFound , RuntimeFault , RemoteException { } }
getVimService ( ) . setManagedByVDC ( getMOR ( ) , cluster . getMOR ( ) , status ) ;
public class ExecutionPlan { /** * Add a Plugin whose Detectors should be added to the execution plan . */ public void addPlugin ( Plugin plugin ) throws OrderingConstraintException { } }
if ( DEBUG ) { System . out . println ( "Adding plugin " + plugin . getPluginId ( ) + " to execution plan" ) ; } pluginList . add ( plugin ) ; // Add ordering constraints copyTo ( plugin . interPassConstraintIterator ( ) , interPassConstraintList ) ; copyTo ( plugin . intraPassConstraintIterator ( ) , intraPassConstraintList ) ; // Add detector factories for ( DetectorFactory factory : plugin . getDetectorFactories ( ) ) { if ( DEBUG ) { System . out . println ( " Detector factory " + factory . getShortName ( ) ) ; } if ( factoryMap . put ( factory . getFullName ( ) , factory ) != null ) { throw new OrderingConstraintException ( "Detector " + factory . getFullName ( ) + " is defined by more than one plugin" ) ; } }
public class JvmUtils { /** * Formats the specified jvm arguments such that any tokens are replaced with concrete values ; * @ param jvmArguments * @ return The formatted jvm arguments . */ public static String formatJvmArguments ( Optional < String > jvmArguments ) { } }
if ( jvmArguments . isPresent ( ) ) { return PORT_UTILS . replacePortTokens ( jvmArguments . get ( ) ) ; } return StringUtils . EMPTY ;
public class LinearDiscriminantAnalysisFilter { /** * Compute the centroid for each class . * @ param dim Dimensionality * @ param vectorcolumn Vector column * @ param keys Key index * @ param classes Classes * @ return Centroids for each class . */ protected List < Centroid > computeCentroids ( int dim , List < V > vectorcolumn , List < ClassLabel > keys , Map < ClassLabel , IntList > classes ) { } }
final int numc = keys . size ( ) ; List < Centroid > centroids = new ArrayList < > ( numc ) ; for ( int i = 0 ; i < numc ; i ++ ) { Centroid c = new Centroid ( dim ) ; for ( IntIterator it = classes . get ( keys . get ( i ) ) . iterator ( ) ; it . hasNext ( ) ; ) { c . put ( vectorcolumn . get ( it . nextInt ( ) ) ) ; } centroids . add ( c ) ; } return centroids ;
public class WebhookUpdater { /** * Queues the avatar to be updated . * @ param avatar The avatar to set . * @ param fileType The type of the avatar , e . g . " png " or " jpg " . * @ return The current instance in order to chain call methods . */ public WebhookUpdater setAvatar ( InputStream avatar , String fileType ) { } }
delegate . setAvatar ( avatar , fileType ) ; return this ;
public class FactoryOptimization { /** * Creates a dense trust region least - squares optimization using dogleg steps . Solver works on the B = J < sup > T < / sup > J matrix . * @ see UnconLeastSqTrustRegion _ F64 * @ param config Trust region configuration * @ return The new optimization routine */ public static UnconstrainedLeastSquares < DMatrixRMaj > dogleg ( @ Nullable ConfigTrustRegion config , boolean robust ) { } }
if ( config == null ) config = new ConfigTrustRegion ( ) ; LinearSolverDense < DMatrixRMaj > solver ; if ( robust ) solver = LinearSolverFactory_DDRM . leastSquaresQrPivot ( true , false ) ; else solver = LinearSolverFactory_DDRM . chol ( 100 ) ; HessianLeastSquares_DDRM hessian = new HessianLeastSquares_DDRM ( solver ) ; MatrixMath_DDRM math = new MatrixMath_DDRM ( ) ; TrustRegionUpdateDogleg_F64 < DMatrixRMaj > update = new TrustRegionUpdateDogleg_F64 < > ( ) ; UnconLeastSqTrustRegion_F64 < DMatrixRMaj > alg = new UnconLeastSqTrustRegion_F64 < > ( update , hessian , math ) ; alg . configure ( config ) ; return alg ;
public class HttpRosetteAPI { /** * Returns the version of the binding . * @ return version of the binding */ private static String getVersion ( ) { } }
Properties properties = new Properties ( ) ; try ( InputStream ins = HttpRosetteAPI . class . getClassLoader ( ) . getResourceAsStream ( "version.properties" ) ) { properties . load ( ins ) ; } catch ( IOException e ) { // should not happen } return properties . getProperty ( "version" , "undefined" ) ;
public class TreeUtil { /** * Alphabetically sorts children under the specified parent . * @ param parent Parent whose child nodes ( Treenode ) are to be sorted . * @ param recurse If true , sorting is recursed through all children . */ public static void sort ( BaseComponent parent , boolean recurse ) { } }
if ( parent == null || parent . getChildren ( ) . size ( ) < 2 ) { return ; } int i = 1 ; int size = parent . getChildren ( ) . size ( ) ; while ( i < size ) { Treenode item1 = ( Treenode ) parent . getChildren ( ) . get ( i - 1 ) ; Treenode item2 = ( Treenode ) parent . getChildren ( ) . get ( i ) ; if ( compare ( item1 , item2 ) > 0 ) { parent . swapChildren ( i - 1 , i ) ; i = i == 1 ? 2 : i - 1 ; } else { i ++ ; } } if ( recurse ) { for ( BaseComponent child : parent . getChildren ( ) ) { sort ( child , recurse ) ; } }
public class CmsImportVersion7 { /** * Checks whether the content for the resource being imported exists either in the VFS or in the import file . < p > * @ param resource the resource which should be checked * @ return true if the content exists in the VFS or import file */ private boolean hasContentInVfsOrImport ( CmsResource resource ) { } }
if ( m_contentFiles . contains ( resource . getResourceId ( ) ) ) { return true ; } try { List < CmsResource > resources = getCms ( ) . readSiblings ( resource , CmsResourceFilter . ALL ) ; if ( ! resources . isEmpty ( ) ) { return true ; } } catch ( CmsException e ) { LOG . warn ( e . getLocalizedMessage ( ) , e ) ; } return false ;
public class TextCharacter { /** * Returns a copy of this TextCharacter with a specified background color * @ param backgroundColor Background color the copy should have * @ return Copy of the TextCharacter with a different background color */ public TextCharacter withBackgroundColor ( TextColor backgroundColor ) { } }
if ( this . backgroundColor == backgroundColor || this . backgroundColor . equals ( backgroundColor ) ) { return this ; } return new TextCharacter ( character , foregroundColor , backgroundColor , modifiers ) ;
public class TagContextBuilder { /** * Adds a non - propagating tag to this { @ code TagContextBuilder } . * < p > This is equivalent to calling { @ code put ( key , value , * TagMetadata . create ( TagTtl . NO _ PROPAGATION ) ) } . * @ param key the { @ code TagKey } which will be set . * @ param value the { @ code TagValue } to set for the given key . * @ return this * @ since 0.21 */ public final TagContextBuilder putLocal ( TagKey key , TagValue value ) { } }
return put ( key , value , METADATA_NO_PROPAGATION ) ;
public class JobRegistry { /** * Adds the ( sub - ) resource class name to the analysis list with the associated class result . */ public void analyzeResourceClass ( final String className , final ClassResult classResult ) { } }
// TODO check if class has already been analyzed unhandledClasses . add ( Pair . of ( className , classResult ) ) ;
public class HandlerChainInfoBuilder { /** * Get the handlerChainsInfo from @ HandlerChain * @ param serviceClazzName * @ param hcSer * @ param portQName * @ param serviceQName * @ param bindingID * @ return */ public HandlerChainsInfo buildHandlerChainsInfoFromAnnotation ( String serviceClazzName , HandlerChainAnnotationSer hcSer , QName portQName , QName serviceQName , String bindingID ) { } }
HandlerChainsInfo chainsInfo = new HandlerChainsInfo ( ) ; validateAnnotation ( hcSer . getFile ( ) , serviceClazzName ) ; processHandlerChainAnnotation ( chainsInfo , serviceClazzName , hcSer . getFile ( ) , portQName , serviceQName , bindingID ) ; return chainsInfo ;
public class DefaultJobProgressStep { /** * Finish current step . */ public void finishStep ( ) { } }
// Close step if ( this . children != null && ! this . children . isEmpty ( ) ) { this . children . get ( this . children . size ( ) - 1 ) . finish ( ) ; }
public class RpmFileSet { /** * Supports RPM ' s { @ code % ghost } directive , used to flag the specified file as being a ghost file . * By adding this directive to the line containing a file , RPM will know about the ghosted file , but will * not add it to the package . * Permitted values for this directive are : * < ul > * < li > { @ code true } ( equivalent to specifying { @ code % ghost } * < li > { @ code false } ( equivalent to omitting { @ code % ghost } ) * < / ul > * @ see < a href = " http : / / www . rpm . org / max - rpm - snapshot / s1 - rpm - inside - files - list - directives . html " > rpm . com < / a > * @ see # directive * @ param ghost to set */ public void setGhost ( boolean ghost ) { } }
checkRpmFileSetAttributesAllowed ( ) ; if ( ghost ) { directive . set ( Directive . RPMFILE_GHOST ) ; } else { directive . unset ( Directive . RPMFILE_GHOST ) ; }
public class KsiBlockSignerBuilder { /** * Sets the hash algorithm used by { @ link HashTreeBuilder } . * @ deprecated Use { @ link KsiBlockSignerBuilder # setTreeBuilder ( TreeBuilder ) } instead . */ @ Deprecated public KsiBlockSignerBuilder setDefaultHashAlgorithm ( HashAlgorithm algorithm ) { } }
notNull ( algorithm , "Hash algorithm" ) ; algorithm . checkExpiration ( ) ; this . algorithm = algorithm ; return this ;
public class ListDashboardsResult { /** * The list of matching dashboards . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setDashboardEntries ( java . util . Collection ) } or { @ link # withDashboardEntries ( java . util . Collection ) } if you * want to override the existing values . * @ param dashboardEntries * The list of matching dashboards . * @ return Returns a reference to this object so that method calls can be chained together . */ public ListDashboardsResult withDashboardEntries ( DashboardEntry ... dashboardEntries ) { } }
if ( this . dashboardEntries == null ) { setDashboardEntries ( new com . amazonaws . internal . SdkInternalList < DashboardEntry > ( dashboardEntries . length ) ) ; } for ( DashboardEntry ele : dashboardEntries ) { this . dashboardEntries . add ( ele ) ; } return this ;
public class CacheableSessionLockManager { /** * { @ inheritDoc } */ public LockImpl getLock ( NodeImpl node ) throws LockException , RepositoryException { } }
LockData lData = lockManager . getExactNodeOrCloseParentLock ( ( NodeData ) node . getData ( ) ) ; if ( lData == null || ( ! node . getInternalIdentifier ( ) . equals ( lData . getNodeIdentifier ( ) ) && ! lData . isDeep ( ) ) ) { throw new LockException ( "Node not locked: " + node . getData ( ) . getQPath ( ) ) ; } return new CacheLockImpl ( node . getSession ( ) , lData , this ) ;
public class PreferencesHelper { /** * Retrieves object stored as json encoded string . * Gson library should be available in classpath . */ @ Nullable public static < T > T getJson ( @ NonNull SharedPreferences prefs , @ NonNull String key , @ NonNull Type type ) { } }
return GsonHelper . fromJson ( prefs . getString ( key , null ) , type ) ;
public class GroupsApi { /** * Get information about a group . * < br > * This method does not require authentication . * < br > * @ param groupId ( Optional ) The NSID of the group to fetch information for . One of this or the groupPathAlias is required . * @ param groupPathAlias ( Optional ) The path alias of the group . One of this or the groupId parameter is required . * @ param lang ( Optional ) The language of the group name and description to fetch . * If the language is not found , the primary language of the group will be returned . * Valid values are the same as in < a href = " https : / / www . flickr . com / services / feeds / " > feeds . < / a > * @ return information about the group . * @ throws JinxException if required parameters are missing , or if there are any errors . * @ see < a href = " https : / / www . flickr . com / services / api / flickr . groups . getInfo . html " > flickr . groups . getInfo < / a > */ public GroupInfo getInfo ( String groupId , String groupPathAlias , String lang ) throws JinxException { } }
if ( JinxUtils . isNullOrEmpty ( groupId ) ) { JinxUtils . validateParams ( groupPathAlias ) ; } else { JinxUtils . validateParams ( groupId ) ; } Map < String , String > params = new TreeMap < > ( ) ; params . put ( "method" , "flickr.groups.getInfo" ) ; if ( ! JinxUtils . isNullOrEmpty ( groupId ) ) { params . put ( "group_id" , groupId ) ; } else { params . put ( "group_path_alias" , groupPathAlias ) ; } if ( ! JinxUtils . isNullOrEmpty ( lang ) ) { params . put ( "lang" , lang ) ; } return jinx . flickrGet ( params , GroupInfo . class , false ) ;
public class VirtualMachineScaleSetsInner { /** * Gets a list of all VM scale sets under a resource group . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; VirtualMachineScaleSetInner & gt ; object */ public Observable < Page < VirtualMachineScaleSetInner > > listByResourceGroupNextAsync ( final String nextPageLink ) { } }
return listByResourceGroupNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < VirtualMachineScaleSetInner > > , Page < VirtualMachineScaleSetInner > > ( ) { @ Override public Page < VirtualMachineScaleSetInner > call ( ServiceResponse < Page < VirtualMachineScaleSetInner > > response ) { return response . body ( ) ; } } ) ;
public class QrPose3DUtils { /** * Location of each corner in the QR Code ' s reference frame in 3D * @ param version QR Code ' s version * @ return List . Recycled on each call */ public List < Point3D_F64 > getLandmark3D ( int version ) { } }
int N = QrCode . totalModules ( version ) ; set3D ( 0 , 0 , N , point3D . get ( 0 ) ) ; set3D ( 0 , 7 , N , point3D . get ( 1 ) ) ; set3D ( 7 , 7 , N , point3D . get ( 2 ) ) ; set3D ( 7 , 0 , N , point3D . get ( 3 ) ) ; set3D ( 0 , N - 7 , N , point3D . get ( 4 ) ) ; set3D ( 0 , N , N , point3D . get ( 5 ) ) ; set3D ( 7 , N , N , point3D . get ( 6 ) ) ; set3D ( 7 , N - 7 , N , point3D . get ( 7 ) ) ; set3D ( N - 7 , 0 , N , point3D . get ( 8 ) ) ; set3D ( N - 7 , 7 , N , point3D . get ( 9 ) ) ; set3D ( N , 7 , N , point3D . get ( 10 ) ) ; set3D ( N , 0 , N , point3D . get ( 11 ) ) ; return point3D ;
public class ChannelFrameworkImpl { /** * @ see com . ibm . wsspi . channelfw . ChannelFramework # removeChannel ( String ) */ @ Override public synchronized ChannelData removeChannel ( String channelName ) throws ChannelException , ChainException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "removeChannel: " + channelName ) ; } if ( null == channelName ) { throw new InvalidChannelNameException ( "Input channel name is null" ) ; } // Fetch the channel data from the framework . ChannelDataImpl channelData = ( ChannelDataImpl ) channelDataMap . get ( channelName ) ; if ( null == channelData ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { // Due to timing windows ( i . e . multiple channel providers going away ) , there is // a race to stop and / or clean up chains . This is not a notable condition : the chain can only be removed // once . Tr . exit ( tc , "removeChannel: " + channelName , "Channel not found" ) ; } return null ; } // Channel configs can only be removed if they are not in use by the // runtime . if ( 0 != channelData . getNumChildren ( ) ) { throw new ChannelException ( "Can't remove channel config " + channelName + " in runtime. Destroy must happen first. " ) ; } // Remove the chain config from the framework ' s map . this . channelDataMap . remove ( channelName ) ; // iterating chain configs will clear out live chains / channelRunningMap // Remove any chain configurations that refer to this channel . // Get a temp array so we can release the lock needed by removeChain . // This isn ' t a clone , but we should be okay holding the references . Object [ ] chainDataArray = this . chainDataMap . values ( ) . toArray ( ) ; ChainDataImpl chainData = null ; for ( int i = 0 ; i < chainDataArray . length ; i ++ ) { chainData = ( ChainDataImpl ) chainDataArray [ i ] ; if ( chainData . containsChannel ( channelName ) ) { // Found reference to channel config . Remove chain config . // This ripples into the chain groups and cleans them up too . removeChain ( chainData . getName ( ) ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "removeChannel" ) ; } return channelData ;
public class SignalServiceAccountManager { /** * Request a Voice verification code . On success , the server will * make a voice call to this Signal user . * @ throws IOException */ public void requestVoiceVerificationCode ( Locale locale , Optional < String > captchaToken ) throws IOException { } }
this . pushServiceSocket . requestVoiceVerificationCode ( locale , captchaToken ) ;
public class HealthCheckClient { /** * Retrieves the list of HealthCheck resources available to the specified project . * < p > Sample code : * < pre > < code > * try ( HealthCheckClient healthCheckClient = HealthCheckClient . create ( ) ) { * ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ; * for ( HealthCheck element : healthCheckClient . listHealthChecks ( project . toString ( ) ) . iterateAll ( ) ) { * / / doThingsWith ( element ) ; * < / code > < / pre > * @ param project Project ID for this request . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final ListHealthChecksPagedResponse listHealthChecks ( String project ) { } }
ListHealthChecksHttpRequest request = ListHealthChecksHttpRequest . newBuilder ( ) . setProject ( project ) . build ( ) ; return listHealthChecks ( request ) ;
public class SchedulingHelper { /** * ( non - Javadoc ) * @ see java . util . concurrent . Future # cancel ( boolean ) */ @ Override public boolean cancel ( boolean mayInterruptIfRunning ) { } }
if ( m_isDone == true ) { return false ; } m_isDone = true ; if ( m_pendingException != null ) { return false ; } m_cancelResult = m_schedFuture . cancel ( false ) ; if ( ( m_cancelResult != true ) || ( m_defaultFuture != null ) ) { // Push the cancel call to the Default Executor Future if it has progressed that far . try { this . m_coordinationLatch . await ( ) ; } catch ( InterruptedException ie ) { // Try to proceed . } if ( m_defaultFuture != null ) { m_cancelResult = m_defaultFuture . cancel ( mayInterruptIfRunning ) ; } } if ( m_cancelResult == true ) { m_pendingException = new CancellationException ( ) ; m_scheduledExecutorQueue . remove ( this ) ; } // Let get ( ) finish this . m_coordinationLatch . countDown ( ) ; return m_cancelResult ;
public class DelegatingPhaseListener { /** * Determine if the { @ link PhaseListener } should process the given { @ link PhaseEvent } . */ private boolean shouldProcessPhase ( final PhaseListener listener , final PhaseEvent event ) { } }
return ( PhaseId . ANY_PHASE . equals ( listener . getPhaseId ( ) ) || event . getPhaseId ( ) . equals ( listener . getPhaseId ( ) ) ) ;
public class ProviderManager { /** * Adds an extension provider with the specified element name and name space . The provider * will override any providers loaded through the classpath . The provider must be either * a PacketExtensionProvider instance , or a Class object of a Javabean . * @ param elementName the XML element name . * @ param namespace the XML namespace . * @ param provider the extension provider . */ @ SuppressWarnings ( "unchecked" ) public static void addExtensionProvider ( String elementName , String namespace , Object provider ) { } }
validate ( elementName , namespace ) ; // First remove existing providers String key = removeExtensionProvider ( elementName , namespace ) ; if ( provider instanceof ExtensionElementProvider ) { extensionProviders . put ( key , ( ExtensionElementProvider < ExtensionElement > ) provider ) ; } else { throw new IllegalArgumentException ( "Provider must be a PacketExtensionProvider" ) ; }
public class Settings { /** * Effective value as { @ code int } . * @ return the value as { @ code int } . If the property does not have value nor default value , then { @ code 0 } is returned . * @ throws NumberFormatException if value is not empty and is not a parsable integer */ public int getInt ( String key ) { } }
String value = getString ( key ) ; if ( StringUtils . isNotEmpty ( value ) ) { return Integer . parseInt ( value ) ; } return 0 ;
public class NDArrayWritable { /** * Deserialize into a row vector of default type . */ public void readFields ( DataInput in ) throws IOException { } }
DataInputStream dis = new DataInputStream ( new DataInputWrapperStream ( in ) ) ; byte header = dis . readByte ( ) ; if ( header != NDARRAY_SER_VERSION_HEADER && header != NDARRAY_SER_VERSION_HEADER_NULL ) { throw new IllegalStateException ( "Unexpected NDArrayWritable version header - stream corrupt?" ) ; } if ( header == NDARRAY_SER_VERSION_HEADER_NULL ) { array = null ; return ; } array = Nd4j . read ( dis ) ; hash = null ;
public class HomeOfHomes { /** * LIDB859-4 d429866.2 */ public void addHome ( BeanMetaData bmd ) // F743-26072 throws RemoteException { } }
final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "addHome : " + bmd . j2eeName ) ; if ( homesByName . get ( bmd . j2eeName ) != null ) { throw new DuplicateHomeNameException ( bmd . j2eeName . toString ( ) ) ; } homesByName . put ( bmd . j2eeName , bmd . homeRecord ) ; // d366845.3 J2EEName j2eeName = bmd . j2eeName ; String application = j2eeName . getApplication ( ) ; AppLinkData linkData ; // F743-26072 - Use AppLinkData synchronized ( ivAppLinkData ) { linkData = ivAppLinkData . get ( application ) ; if ( linkData == null ) { if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . debug ( tc , "adding application link data for " + application ) ; linkData = new AppLinkData ( ) ; ivAppLinkData . put ( application , linkData ) ; } } updateAppLinkData ( linkData , true , j2eeName , bmd ) ; // For version cable modules , the serialized BeanId will contain the // unversioned ( or base ) name , so a map is created from unversioned to // active to enable properly routing incoming requests . F54184 if ( bmd . _moduleMetaData . isVersionedModule ( ) ) { EJBModuleMetaDataImpl mmd = bmd . _moduleMetaData ; bmd . ivUnversionedJ2eeName = j2eeNameFactory . create ( mmd . ivVersionedAppBaseName , mmd . ivVersionedModuleBaseName , j2eeName . getComponent ( ) ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Versioned Mapping Added : " + bmd . ivUnversionedJ2eeName + " -> " + j2eeName ) ; J2EEName dupBaseName = ivVersionedModuleNames . put ( bmd . ivUnversionedJ2eeName , j2eeName ) ; if ( dupBaseName != null ) // F54184.2 { ivVersionedModuleNames . put ( bmd . ivUnversionedJ2eeName , dupBaseName ) ; throw new DuplicateHomeNameException ( "Base Name : " + bmd . ivUnversionedJ2eeName ) ; } } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "addHome" ) ;
public class TraceImpl { /** * Event tracing . * @ param source The class instance which called this method * @ param sourceClass The type of class which called this method * @ param methodName The method where the event took place * @ param throwable The exception to trace */ public final void event ( Object source , Class sourceClass , String methodName , Throwable throwable ) { } }
internalEvent ( source , sourceClass , methodName , throwable ) ;
public class DefaultContextInteractionsSkill { /** * Replies the Lifecycle skill as fast as possible . * @ return the skill */ protected final Lifecycle getLifecycleSkill ( ) { } }
if ( this . skillBufferLifecycle == null || this . skillBufferLifecycle . get ( ) == null ) { this . skillBufferLifecycle = $getSkill ( Lifecycle . class ) ; } return $castSkill ( Lifecycle . class , this . skillBufferLifecycle ) ;
public class DwgFile { /** * Modify the geometry of the objects contained in the blocks of a DWG file and * add these objects to the DWG object list . */ public void blockManagement ( ) { } }
Vector dwgObjectsWithoutBlocks = new Vector ( ) ; boolean addingToBlock = false ; for ( int i = 0 ; i < dwgObjects . size ( ) ; i ++ ) { try { DwgObject entity = ( DwgObject ) dwgObjects . get ( i ) ; if ( entity instanceof DwgArc && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgEllipse && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgCircle && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgPolyline2D && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgPolyline3D && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgLwPolyline && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgSolid && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgLine && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgPoint && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgMText && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgText && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgAttrib && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgAttdef && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgBlock ) { addingToBlock = true ; } else if ( entity instanceof DwgEndblk ) { addingToBlock = false ; } else if ( entity instanceof DwgBlockHeader ) { addingToBlock = true ; } else if ( entity instanceof DwgInsert && ! addingToBlock ) { /* double [ ] p = ( ( DwgInsert ) entity ) . getInsertionPoint ( ) ; Point2D point = new Point2D . Double ( p [ 0 ] , p [ 1 ] ) ; double [ ] scale = ( ( DwgInsert ) entity ) . getScale ( ) ; double rot = ( ( DwgInsert ) entity ) . getRotation ( ) ; int blockHandle = ( ( DwgInsert ) entity ) . getBlockHeaderHandle ( ) ; manageInsert ( point , scale , rot , blockHandle , i , dwgObjectsWithoutBlocks ) ; */ } else { // System . out . println ( " Detectado dwgObject pendiente de implementar " ) ; } } catch ( StackOverflowError e ) { e . printStackTrace ( ) ; System . out . println ( "Overflowerror at object: " + i ) ; } } dwgObjects = dwgObjectsWithoutBlocks ;
public class TypeRefImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClassifier getClassifier ( ) { } }
if ( classifier != null && classifier . eIsProxy ( ) ) { InternalEObject oldClassifier = ( InternalEObject ) classifier ; classifier = ( EClassifier ) eResolveProxy ( oldClassifier ) ; if ( classifier != oldClassifier ) { if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . RESOLVE , XtextPackage . TYPE_REF__CLASSIFIER , oldClassifier , classifier ) ) ; } } return classifier ;
public class Reflection { /** * Returns a MethodHandle corresponding to the specified constructor . * Warning : The way Oracle JVM implements producing MethodHandle for a constructor involves * creating JNI global weak references . G1 processes such references serially . As a result , * calling this method in a tight loop can create significant GC pressure and significantly * increase application pause time . */ public static MethodHandle constructorMethodHandle ( StandardErrorCode errorCode , Constructor constructor ) { } }
try { return MethodHandles . lookup ( ) . unreflectConstructor ( constructor ) ; } catch ( IllegalAccessException e ) { throw new PrestoException ( errorCode , e ) ; }
public class FieldInfo { /** * Get the names of any classes in the type descriptor or type signature . * @ param classNames * the names of any classes in the type descriptor or type signature . */ @ Override protected void findReferencedClassNames ( final Set < String > classNames ) { } }
final TypeSignature methodSig = getTypeSignature ( ) ; if ( methodSig != null ) { methodSig . findReferencedClassNames ( classNames ) ; } final TypeSignature methodDesc = getTypeDescriptor ( ) ; if ( methodDesc != null ) { methodDesc . findReferencedClassNames ( classNames ) ; } if ( annotationInfo != null ) { for ( final AnnotationInfo ai : annotationInfo ) { ai . findReferencedClassNames ( classNames ) ; } }
public class GGradientToEdgeFeatures { /** * Computes the edge intensity using a Euclidean norm . * @ param derivX Derivative along x - axis . Not modified . * @ param derivY Derivative along y - axis . Not modified . * @ param intensity Edge intensity . */ static public < D extends ImageGray < D > > void intensityE ( D derivX , D derivY , GrayF32 intensity ) { } }
if ( derivX instanceof GrayF32 ) { GradientToEdgeFeatures . intensityE ( ( GrayF32 ) derivX , ( GrayF32 ) derivY , intensity ) ; } else if ( derivX instanceof GrayS16 ) { GradientToEdgeFeatures . intensityE ( ( GrayS16 ) derivX , ( GrayS16 ) derivY , intensity ) ; } else if ( derivX instanceof GrayS32 ) { GradientToEdgeFeatures . intensityE ( ( GrayS32 ) derivX , ( GrayS32 ) derivY , intensity ) ; } else { throw new IllegalArgumentException ( "Unknown input type" ) ; }
public class IOUtil { /** * Finds a resource with a given name using the class loader of the * specified class . Functions identically to * { @ link Class # getResourceAsStream ( java . lang . String ) } , except it throws an * { @ link IllegalArgumentException } if the specified resource name is * < code > null < / code > , and it throws an { @ link IOException } if no resource * with the specified name is found . * @ param name name { @ link String } of the desired resource . Cannot be * < code > null < / code > . * @ param cls the { @ link Class } whose loader to use . * @ return an { @ link InputStream } . * @ throws IOException if no resource with this name is found . */ public static InputStream getResourceAsStream ( String name , Class < ? > cls ) throws IOException { } }
if ( cls == null ) { cls = IOUtil . class ; } if ( name == null ) { throw new IllegalArgumentException ( "resource cannot be null" ) ; } InputStream result = cls . getResourceAsStream ( name ) ; if ( result == null ) { throw new IOException ( "Could not open resource " + name + " using " + cls . getName ( ) + "'s class loader" ) ; } return result ;
public class GetSignedUrlTaskParameters { /** * Parses properties from task parameter string * @ param taskParameters - JSON formatted set of parameters */ public static GetSignedUrlTaskParameters deserialize ( String taskParameters ) { } }
JaxbJsonSerializer < GetSignedUrlTaskParameters > serializer = new JaxbJsonSerializer < > ( GetSignedUrlTaskParameters . class ) ; try { GetSignedUrlTaskParameters params = serializer . deserialize ( taskParameters ) ; // Verify expected parameters if ( null == params . getSpaceId ( ) || params . getSpaceId ( ) . isEmpty ( ) ) { throw new TaskDataException ( "Task parameter 'spaceId' may not be empty" ) ; } else if ( null == params . getContentId ( ) || params . getContentId ( ) . isEmpty ( ) ) { throw new TaskDataException ( "Task parameter 'contentId' may not be empty" ) ; } return params ; } catch ( IOException e ) { throw new TaskDataException ( "Unable to parse task parameters due to: " + e . getMessage ( ) ) ; }
public class ModelsImpl { /** * Get the explicit list of the pattern . any entity . * @ param appId The application ID . * @ param versionId The version ID . * @ param entityId The Pattern . Any entity id . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the List & lt ; ExplicitListItem & gt ; object */ public Observable < ServiceResponse < List < ExplicitListItem > > > getExplicitListWithServiceResponseAsync ( UUID appId , String versionId , UUID entityId ) { } }
if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } if ( appId == null ) { throw new IllegalArgumentException ( "Parameter appId is required and cannot be null." ) ; } if ( versionId == null ) { throw new IllegalArgumentException ( "Parameter versionId is required and cannot be null." ) ; } if ( entityId == null ) { throw new IllegalArgumentException ( "Parameter entityId is required and cannot be null." ) ; } String parameterizedHost = Joiner . on ( ", " ) . join ( "{Endpoint}" , this . client . endpoint ( ) ) ; return service . getExplicitList ( appId , versionId , entityId , this . client . acceptLanguage ( ) , parameterizedHost , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < List < ExplicitListItem > > > > ( ) { @ Override public Observable < ServiceResponse < List < ExplicitListItem > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < List < ExplicitListItem > > clientResponse = getExplicitListDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class CachePanel { /** * Reads the configuration parameters described in the panel from the * ConfigSettings and and sets the contained values . * @ param config * Reference to the ConfigSettings object */ @ Override public void applyConfig ( final ConfigSettings config ) { } }
Object o = config . getConfigParameter ( ConfigurationKeys . LIMIT_TASK_SIZE_REVISIONS ) ; if ( o != null ) { this . articleTaskLimitField . setText ( Long . toString ( ( Long ) o ) ) ; } else { this . articleTaskLimitField . setText ( "" ) ; } o = config . getConfigParameter ( ConfigurationKeys . LIMIT_TASK_SIZE_DIFFS ) ; if ( o != null ) { this . diffTaskLimitField . setText ( Long . toString ( ( Long ) o ) ) ; } else { this . diffTaskLimitField . setText ( "" ) ; } o = config . getConfigParameter ( ConfigurationKeys . LIMIT_SQLSERVER_MAX_ALLOWED_PACKET ) ; if ( o != null ) { this . maxAllowedPacketField . setText ( Long . toString ( ( Long ) o ) ) ; } else { this . maxAllowedPacketField . setText ( "" ) ; }
public class Either { /** * { @ inheritDoc } */ @ Override public final < R2 > Either < L , R > discardR ( Applicative < R2 , Either < L , ? > > appB ) { } }
return Monad . super . discardR ( appB ) . coerce ( ) ;
public class CustomManifest { /** * returns the list of location attribute of which type is file in the given text of Subsystem - Content . * the location may or may not be an absolute path . If there is not a mathing data , returns empty List . */ protected List < String > getFileLocationsFromSubsystemContent ( String subsystemContent ) { } }
String sc = subsystemContent + "," ; List < String > files = new ArrayList < String > ( ) ; boolean isFile = false ; String location = null ; int strLen = sc . length ( ) ; boolean quoted = false ; for ( int i = 0 , pos = 0 ; i < strLen ; i ++ ) { char c = sc . charAt ( i ) ; if ( ! quoted && ( c == ';' || c == ',' ) ) { String str = sc . substring ( pos , i ) ; pos = i + 1 ; if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "element : " + str ) ; } if ( str . contains ( ":=" ) ) { if ( getKey ( str ) . equals ( HDR_ATTR_LOCATION ) ) { location = getValue ( str ) ; } } else if ( str . contains ( "=" ) ) { if ( getKey ( str ) . equals ( HDR_ATTR_TYPE ) && getValue ( str ) . equals ( HDR_ATTR_VALUE_FILE ) ) { isFile = true ; } } if ( c == ',' ) { // the delimiter of each subsystem content . if ( isFile && location != null ) { if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "location : " + location ) ; } files . add ( location ) ; } location = null ; isFile = false ; } } else if ( c == '\"' ) { quoted = ! quoted ; } } return files ;
public class OrRange { /** * ( non - Javadoc ) * @ see net . ossindex . version . impl . IVersionRange # getMaximum ( ) */ @ Override public IVersion getMaximum ( ) { } }
Iterator < IVersionRange > it = ranges . iterator ( ) ; IVersionRange r1 = it . next ( ) ; IVersion max = r1 . getMaximum ( ) ; while ( it . hasNext ( ) ) { IVersionRange r2 = it . next ( ) ; IVersion v2 = r2 . getMinimum ( ) ; int cmp = max . compareTo ( v2 ) ; if ( cmp > 0 ) { return max = v2 ; } } return max ;
public class ServiceCreds { /** * Creates a unique password for the specified node using the supplied shared secret . */ protected static String createAuthToken ( String clientId , String sharedSecret ) { } }
return StringUtil . md5hex ( clientId + sharedSecret ) ;
public class GoogleCloudStorageFileSystem { /** * Equivalent to a recursive listing of { @ code prefix } , except that { @ code prefix } doesn ' t have to * represent an actual object but can just be a partial prefix string . The ' authority ' component * of the { @ code prefix } < b > must < / b > be the complete authority , however ; we can only list prefixes * of < b > objects < / b > , not buckets . * @ param prefix the prefix to use to list all matching objects . */ public List < FileInfo > listAllFileInfoForPrefix ( URI prefix ) throws IOException { } }
logger . atFine ( ) . log ( "listAllFileInfoForPrefixPage(%s)" , prefix ) ; StorageResourceId prefixId = getPrefixId ( prefix ) ; List < GoogleCloudStorageItemInfo > itemInfos = gcs . listObjectInfo ( prefixId . getBucketName ( ) , prefixId . getObjectName ( ) , /* delimiter = */ null ) ; List < FileInfo > fileInfos = FileInfo . fromItemInfos ( pathCodec , itemInfos ) ; fileInfos . sort ( FILE_INFO_PATH_COMPARATOR ) ; return fileInfos ;
public class WikibaseDataFetcher { /** * Fetches the documents for the entities of the given string IDs . The * result is a map from entity IDs to { @ link EntityDocument } objects . It is * possible that a requested ID could not be found : then this key is not set * in the map . * @ param entityIds * list of string IDs ( e . g . , " P31 " , " Q42 " ) of requested entities * @ return map from IDs for which data could be found to the documents that * were retrieved * @ throws MediaWikiApiErrorException * @ throws IOException */ public Map < String , EntityDocument > getEntityDocuments ( List < String > entityIds ) throws MediaWikiApiErrorException , IOException { } }
Map < String , EntityDocument > result = new HashMap < > ( ) ; List < String > newEntityIds = new ArrayList < > ( ) ; newEntityIds . addAll ( entityIds ) ; boolean moreItems = ! newEntityIds . isEmpty ( ) ; while ( moreItems ) { List < String > subListOfEntityIds ; if ( newEntityIds . size ( ) <= maxListSize ) { subListOfEntityIds = newEntityIds ; moreItems = false ; } else { subListOfEntityIds = newEntityIds . subList ( 0 , maxListSize ) ; } WbGetEntitiesActionData properties = new WbGetEntitiesActionData ( ) ; properties . ids = ApiConnection . implodeObjects ( subListOfEntityIds ) ; result . putAll ( getEntityDocumentMap ( entityIds . size ( ) , properties ) ) ; subListOfEntityIds . clear ( ) ; } return result ;
public class MD5Encrypt { /** * 转换字节数组为十进制字符串 * @ param b * 字节数组 * @ return 十进制字符串 */ public static String byteArrayToNumString ( byte [ ] b ) { } }
StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < b . length ; i ++ ) { sb . append ( byteToNumString ( b [ i ] ) ) ; } return new String ( sb ) ;
public class BinaryMap { /** * { @ inheritDoc } * @ param toKey * @ param inclusive * @ return */ @ Override public NavigableMap < K , V > headMap ( K toKey , boolean inclusive ) { } }
Entry < K , V > to = entry ( toKey , null ) ; return new BinaryMap < > ( entrySet . headSet ( to , inclusive ) , comparator ) ;
public class PolicyAssignmentsInner { /** * Deletes a policy assignment by ID . * When providing a scope for the assigment , use ' / subscriptions / { subscription - id } / ' for subscriptions , ' / subscriptions / { subscription - id } / resourceGroups / { resource - group - name } ' for resource groups , and ' / subscriptions / { subscription - id } / resourceGroups / { resource - group - name } / providers / { resource - provider - namespace } / { resource - type } / { resource - name } ' for resources . * @ param policyAssignmentId The ID of the policy assignment to delete . Use the format ' / { scope } / providers / Microsoft . Authorization / policyAssignments / { policy - assignment - name } ' . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < PolicyAssignmentInner > deleteByIdAsync ( String policyAssignmentId , final ServiceCallback < PolicyAssignmentInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( deleteByIdWithServiceResponseAsync ( policyAssignmentId ) , serviceCallback ) ;
public class PropertiesFileConfiguration { /** * Load properties from a classpath property file . * @ param propertiesFile the classpath properties file to read . * @ return a < a href = " http : / / docs . oracle . com / javase / 7 / docs / api / java / util / Properties . html " > Properties < / a > object * containing the properties set in the file . */ private Properties loadProperty ( String propertiesFile ) { } }
Properties prop = new Properties ( ) ; try { InputStream in = getClass ( ) . getResourceAsStream ( propertiesFile ) ; prop . load ( in ) ; in . close ( ) ; } catch ( IOException e ) { throw new IllegalStateException ( "Cannot load property file at " + propertiesFile , e ) ; } return prop ;
public class LabelProcessor { /** * Replace all instances of a label string in a label builder . The check for the label string which should be * replaced is done ignoring the case . * @ param label the label builder in which label string will be replaced * @ param oldLabel the label string which is replaced * @ param newLabel the label string replacement * @ return the updated label builder */ public static Label . Builder replace ( final Label . Builder label , final String oldLabel , final String newLabel ) { } }
for ( final MapFieldEntry . Builder entryBuilder : label . getEntryBuilderList ( ) ) { final List < String > valueList = new ArrayList < > ( entryBuilder . getValueList ( ) ) ; entryBuilder . clearValue ( ) ; for ( String value : valueList ) { if ( StringProcessor . removeWhiteSpaces ( value ) . equalsIgnoreCase ( StringProcessor . removeWhiteSpaces ( oldLabel ) ) ) { entryBuilder . addValue ( newLabel ) ; } else { entryBuilder . addValue ( value ) ; } } } return label ;
public class RestClientUtil { /** * 创建或者更新索引文档 * @ param indexName * @ param indexType * @ param bean * @ return * @ throws ElasticSearchException */ public String addDateMapDocument ( String indexName , String indexType , Map bean ) throws ElasticSearchException { } }
return addDocument ( this . indexNameBuilder . getIndexName ( indexName ) , indexType , bean , null , null , null , ( String ) null ) ;
public class PlotCanvas { /** * Resets the plot . */ public void reset ( ) { } }
base . reset ( ) ; graphics . projection . reset ( ) ; baseGrid . setBase ( base ) ; if ( graphics . projection instanceof Projection3D ) { ( ( Projection3D ) graphics . projection ) . setDefaultView ( ) ; } canvas . repaint ( ) ;
public class Serializer { /** * Serializes the given parameter object to the output stream . * @ param output The { @ link OutputStream } to serialize the parameter into . * @ param param The { @ link Params } to serialize . * @ param < T > The type of the parameter object to serialize . * @ throws IOException on general I / O error . */ public < T extends Params > void serializeParams ( OutputStream output , T param ) throws IOException { } }
// TODO : Add params - specific options . objectMapper . writerFor ( param . getClass ( ) ) . writeValue ( output , param ) ;
public class CopyableFileWatermarkHelper { /** * Get Optional { @ link CopyableFileWatermarkGenerator } from { @ link State } . */ public static Optional < CopyableFileWatermarkGenerator > getCopyableFileWatermarkGenerator ( State state ) throws IOException { } }
try { if ( state . contains ( WATERMARK_CREATOR ) ) { Class < ? > watermarkCreatorClass = Class . forName ( state . getProp ( WATERMARK_CREATOR ) ) ; return Optional . of ( ( CopyableFileWatermarkGenerator ) watermarkCreatorClass . newInstance ( ) ) ; } else { return Optional . absent ( ) ; } } catch ( ClassNotFoundException | InstantiationException | IllegalAccessException e ) { throw new IOException ( "Failed to instantiate watermarkCreator." ) ; }
public class NetworkSettingsPanel { /** * Initialize layout . */ @ Override protected void onInitializeLayout ( ) { } }
final GroupLayout groupLayout = new GroupLayout ( this ) ; groupLayout . setHorizontalGroup ( groupLayout . createParallelGroup ( Alignment . LEADING ) . addGroup ( groupLayout . createSequentialGroup ( ) . addContainerGap ( ) . addGroup ( groupLayout . createParallelGroup ( Alignment . LEADING ) . addComponent ( lpHostOrIpaddress , Alignment . TRAILING , GroupLayout . DEFAULT_SIZE , 501 , Short . MAX_VALUE ) . addComponent ( lpNoProxy , Alignment . TRAILING , GroupLayout . DEFAULT_SIZE , 501 , Short . MAX_VALUE ) . addComponent ( lpUseSystemSettings , GroupLayout . PREFERRED_SIZE , 501 , GroupLayout . PREFERRED_SIZE ) ) . addContainerGap ( ) ) ) ; groupLayout . setVerticalGroup ( groupLayout . createParallelGroup ( Alignment . LEADING ) . addGroup ( groupLayout . createSequentialGroup ( ) . addContainerGap ( ) . addComponent ( lpNoProxy , GroupLayout . PREFERRED_SIZE , 42 , GroupLayout . PREFERRED_SIZE ) . addGap ( 18 ) . addComponent ( lpHostOrIpaddress , GroupLayout . DEFAULT_SIZE , 93 , Short . MAX_VALUE ) . addGap ( 18 ) . addComponent ( lpUseSystemSettings , GroupLayout . PREFERRED_SIZE , 42 , GroupLayout . PREFERRED_SIZE ) . addGap ( 29 ) ) ) ; setLayout ( groupLayout ) ;
public class SshX509RsaSha1PublicKey { /** * Initialize the public key from a blob of binary data . * @ param blob * byte [ ] * @ param start * int * @ param len * int * @ throws SshException * @ todo Implement this com . sshtools . ssh . SshPublicKey method */ public void init ( byte [ ] blob , int start , int len ) throws SshException { } }
ByteArrayReader bar = new ByteArrayReader ( blob , start , len ) ; try { String header = bar . readString ( ) ; if ( ! header . equals ( X509V3_SIGN_RSA_SHA1 ) ) { throw new SshException ( "The encoded key is not X509 RSA" , SshException . INTERNAL_ERROR ) ; } byte [ ] encoded = bar . readBinaryString ( ) ; ByteArrayInputStream is = new ByteArrayInputStream ( encoded ) ; CertificateFactory cf = JCEProvider . getProviderForAlgorithm ( JCEAlgorithms . JCE_X509 ) == null ? CertificateFactory . getInstance ( JCEAlgorithms . JCE_X509 ) : CertificateFactory . getInstance ( JCEAlgorithms . JCE_X509 , JCEProvider . getProviderForAlgorithm ( JCEAlgorithms . JCE_X509 ) ) ; this . cert = ( X509Certificate ) cf . generateCertificate ( is ) ; if ( ! ( cert . getPublicKey ( ) instanceof RSAPublicKey ) ) throw new SshException ( "Certificate public key is not an RSA public key!" , SshException . BAD_API_USAGE ) ; this . pubKey = ( RSAPublicKey ) cert . getPublicKey ( ) ; } catch ( Throwable ex ) { throw new SshException ( ex . getMessage ( ) , SshException . JCE_ERROR , ex ) ; } finally { try { bar . close ( ) ; } catch ( IOException e ) { } }
public class ImgUtil { /** * 将已有Image复制新的一份出来 * @ param img { @ link Image } * @ param imageType { @ link BufferedImage } 中的常量 , 图像类型 , 例如黑白等 * @ return { @ link BufferedImage } * @ see BufferedImage # TYPE _ INT _ RGB * @ see BufferedImage # TYPE _ INT _ ARGB * @ see BufferedImage # TYPE _ INT _ ARGB _ PRE * @ see BufferedImage # TYPE _ INT _ BGR * @ see BufferedImage # TYPE _ 3BYTE _ BGR * @ see BufferedImage # TYPE _ 4BYTE _ ABGR * @ see BufferedImage # TYPE _ 4BYTE _ ABGR _ PRE * @ see BufferedImage # TYPE _ BYTE _ GRAY * @ see BufferedImage # TYPE _ USHORT _ GRAY * @ see BufferedImage # TYPE _ BYTE _ BINARY * @ see BufferedImage # TYPE _ BYTE _ INDEXED * @ see BufferedImage # TYPE _ USHORT _ 565 _ RGB * @ see BufferedImage # TYPE _ USHORT _ 555 _ RGB */ public static BufferedImage copyImage ( Image img , int imageType ) { } }
final BufferedImage bimage = new BufferedImage ( img . getWidth ( null ) , img . getHeight ( null ) , imageType ) ; final Graphics2D bGr = bimage . createGraphics ( ) ; bGr . drawImage ( img , 0 , 0 , null ) ; bGr . dispose ( ) ; return bimage ;
public class ftw_events { /** * Use this API to fetch filtered set of ftw _ events resources . * filter string should be in JSON format . eg : " vm _ state : DOWN , name : [ a - z ] + " */ public static ftw_events [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } }
ftw_events obj = new ftw_events ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; ftw_events [ ] response = ( ftw_events [ ] ) obj . getfiltered ( service , option ) ; return response ;
public class EntityRecognizerMetadata { /** * Entity types from the metadata of an entity recognizer . * @ param entityTypes * Entity types from the metadata of an entity recognizer . */ public void setEntityTypes ( java . util . Collection < EntityRecognizerMetadataEntityTypesListItem > entityTypes ) { } }
if ( entityTypes == null ) { this . entityTypes = null ; return ; } this . entityTypes = new java . util . ArrayList < EntityRecognizerMetadataEntityTypesListItem > ( entityTypes ) ;
public class ListListenersResult { /** * The list of listeners for an accelerator . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setListeners ( java . util . Collection ) } or { @ link # withListeners ( java . util . Collection ) } if you want to * override the existing values . * @ param listeners * The list of listeners for an accelerator . * @ return Returns a reference to this object so that method calls can be chained together . */ public ListListenersResult withListeners ( Listener ... listeners ) { } }
if ( this . listeners == null ) { setListeners ( new java . util . ArrayList < Listener > ( listeners . length ) ) ; } for ( Listener ele : listeners ) { this . listeners . add ( ele ) ; } return this ;