signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class CarrierRefresher { /** * Returns true if polling is allowed , false if we are below the configured floor poll interval . */ private boolean allowedToPoll ( final String bucket ) { } }
Long bucketLastPollTimestamp = lastPollTimestamps . get ( bucket ) ; return bucketLastPollTimestamp == null || ( ( System . nanoTime ( ) - bucketLastPollTimestamp ) >= pollFloorNs ) ;
public class ApiOvhIpLoadbalancing { /** * Get this object properties * REST : GET / ipLoadbalancing / { serviceName } / http / farm / { farmId } / server / { serverId } * @ param serviceName [ required ] The internal name of your IP load balancing * @ param farmId [ required ] Id of your farm * @ param serverId [ required ] Id of your server */ public OvhBackendHTTPServer serviceName_http_farm_farmId_server_serverId_GET ( String serviceName , Long farmId , Long serverId ) throws IOException { } }
String qPath = "/ipLoadbalancing/{serviceName}/http/farm/{farmId}/server/{serverId}" ; StringBuilder sb = path ( qPath , serviceName , farmId , serverId ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhBackendHTTPServer . class ) ;
public class JDBCCallableStatement { /** * # ifdef JAVA6 */ public synchronized void setCharacterStream ( String parameterName , java . io . Reader reader , long length ) throws SQLException { } }
if ( length > Integer . MAX_VALUE ) { String msg = "Maximum character input length exceeded: " + length ; // NOI18N throw Util . sqlException ( ErrorCode . JDBC_INPUTSTREAM_ERROR , msg ) ; } setCharacterStream ( parameterName , reader , ( int ) length ) ;
public class Marker { /** * return a provided Marker with the given color . * @ param provided * desired color * @ return Marker * @ throws NullPointerException * when provided is null */ public static Marker createProvided ( Provided provided ) { } }
requireNonNull ( provided ) ; return new Marker ( Marker . class . getResource ( "/markers/" + provided . getFilename ( ) ) , provided . getOffsetX ( ) , provided . getOffsetY ( ) ) ;
public class RegisteredResources { /** * Reorder resources based on commitPriority in asccending order for prepare phase . */ protected void sortPreparePriorityResources ( ) { } }
if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "sortPreparePriorityResources" , _resourceObjects . toArray ( ) ) ; Collections . sort ( _resourceObjects , prepareComparator ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "sortPreparePriorityResources" , _resourceObjects . toArray ( ) ) ; return ;
public class ImagePathTag { /** * ( non - Javadoc ) * @ see javax . servlet . jsp . tagext . TagSupport # doStartTag ( ) */ @ Override public int doEndTag ( ) throws JspException { } }
try { String imgSrc = getImgSrcToRender ( ) ; if ( null == var ) { try { pageContext . getOut ( ) . print ( imgSrc ) ; } catch ( IOException e ) { throw new JspException ( e ) ; } } else { pageContext . setAttribute ( var , imgSrc ) ; } return super . doEndTag ( ) ; } finally { // Reset the Thread local for the Jawr context ThreadLocalJawrContext . reset ( ) ; }
public class TaxinvoiceServiceImp { /** * / * ( non - Javadoc ) * @ see com . popbill . api . TaxinvoiceService # getLogs ( java . lang . String , com . popbill . api . taxinvoice . MgtKeyType , java . lang . String ) */ @ Override public TaxinvoiceLog [ ] getLogs ( String CorpNum , MgtKeyType KeyType , String MgtKey ) throws PopbillException { } }
if ( KeyType == null ) throw new PopbillException ( - 99999999 , "관리번호형태가 입력되지 않았습니다." ) ; if ( MgtKey == null || MgtKey . isEmpty ( ) ) throw new PopbillException ( - 99999999 , "관리번호가 입력되지 않았습니다." ) ; return httpget ( "/Taxinvoice/" + KeyType . name ( ) + "/" + MgtKey + "/Logs" , CorpNum , null , TaxinvoiceLog [ ] . class ) ;
public class NestedClassWriterImpl { /** * { @ inheritDoc } */ @ Override protected Content getDeprecatedLink ( Element member ) { } }
return writer . getQualifiedClassLink ( LinkInfoImpl . Kind . MEMBER , member ) ;
public class PvmExecutionImpl { /** * Checks if the given execution is on a dispatchable state . * That means if the current activity is not a leaf in the activity tree OR * it is a leaf but not a scope OR it is a leaf , a scope * and the execution is in state DEFAULT , which means not in state * Starting , Execute or Ending . For this states it is * prohibited to trigger conditional events , otherwise unexpected behavior can appear . * @ return true if the execution is on a dispatchable state , false otherwise */ private boolean isOnDispatchableState ( PvmExecutionImpl targetScope ) { } }
ActivityImpl targetActivity = targetScope . getActivity ( ) ; return // if not leaf , activity id is null - > dispatchable targetScope . getActivityId ( ) == null || // if leaf and not scope - > dispatchable ! targetActivity . isScope ( ) || // if leaf , scope and state in default - > dispatchable ( targetScope . isInState ( ActivityInstanceState . DEFAULT ) ) ;
public class InlineMenuRow { /** * Returns row as List & lt ; InlineKeyboardButtons & gt ; * @ return list of keyboard buttons * @ see InlineMenuButton # toKeyboardButton ( ) */ public List < InlineKeyboardButton > toButtons ( ) { } }
return buttons . stream ( ) . map ( InlineMenuButton :: toKeyboardButton ) . collect ( Collectors . toList ( ) ) ;
public class AnycastOutputHandler { /** * Cleans up the non - persistent state . No methods on the ControlHandler interface should be called after this is called . */ public void close ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "close" ) ; Enumeration streams = null ; synchronized ( this ) { synchronized ( streamTable ) { closed = true ; closeBrowserSessionsInternal ( ) ; streams = streamTable . elements ( ) ; } } // since already set closed to true , no more AOStreams will be created and added to the streamTable , // even if there is an // asynchronous stream creation in progress ( the itemStream will be created , but no AOStream will // be added to the streamTable ) . while ( streams . hasMoreElements ( ) ) { StreamInfo sinfo = ( StreamInfo ) streams . nextElement ( ) ; if ( sinfo . stream != null ) { sinfo . stream . close ( ) ; } } synchronized ( streamTable ) { streamTable . clear ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "close" ) ;
public class CATImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . CAT__CAT_DATA : setCATData ( CAT_DATA_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ;
public class auditnslogpolicy_binding { /** * Use this API to fetch auditnslogpolicy _ binding resource of given name . */ public static auditnslogpolicy_binding get ( nitro_service service , String name ) throws Exception { } }
auditnslogpolicy_binding obj = new auditnslogpolicy_binding ( ) ; obj . set_name ( name ) ; auditnslogpolicy_binding response = ( auditnslogpolicy_binding ) obj . get_resource ( service ) ; return response ;
public class DatabaseAccountsInner { /** * Lists the connection strings for the specified Azure Cosmos DB database account . * @ param resourceGroupName Name of an Azure resource group . * @ param accountName Cosmos DB database account name . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the DatabaseAccountListConnectionStringsResultInner object */ public Observable < ServiceResponse < DatabaseAccountListConnectionStringsResultInner > > listConnectionStringsWithServiceResponseAsync ( String resourceGroupName , String accountName ) { } }
if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( accountName == null ) { throw new IllegalArgumentException ( "Parameter accountName is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } return service . listConnectionStrings ( this . client . subscriptionId ( ) , resourceGroupName , accountName , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < DatabaseAccountListConnectionStringsResultInner > > > ( ) { @ Override public Observable < ServiceResponse < DatabaseAccountListConnectionStringsResultInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < DatabaseAccountListConnectionStringsResultInner > clientResponse = listConnectionStringsDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class LexerEngine { /** * Skip all input tokens . * @ param tokenTypes to be skipped token types */ public void skipAll ( final TokenType ... tokenTypes ) { } }
Set < TokenType > tokenTypeSet = Sets . newHashSet ( tokenTypes ) ; while ( tokenTypeSet . contains ( lexer . getCurrentToken ( ) . getType ( ) ) ) { lexer . nextToken ( ) ; }
public class GetDisksRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetDisksRequest getDisksRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getDisksRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getDisksRequest . getPageToken ( ) , PAGETOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class X509CertPath { /** * Parse a PKIPATH format CertPath from an InputStream . Return an * unmodifiable List of the certificates . * @ param is the < code > InputStream < / code > to read the data from * @ return an unmodifiable List of the certificates * @ exception CertificateException if an exception occurs */ private static List < X509Certificate > parsePKIPATH ( InputStream is ) throws CertificateException { } }
List < X509Certificate > certList = null ; CertificateFactory certFac = null ; if ( is == null ) { throw new CertificateException ( "input stream is null" ) ; } try { DerInputStream dis = new DerInputStream ( readAllBytes ( is ) ) ; DerValue [ ] seq = dis . getSequence ( 3 ) ; if ( seq . length == 0 ) { return Collections . < X509Certificate > emptyList ( ) ; } certFac = CertificateFactory . getInstance ( "X.509" ) ; certList = new ArrayList < X509Certificate > ( seq . length ) ; // append certs in reverse order ( target to trust anchor ) for ( int i = seq . length - 1 ; i >= 0 ; i -- ) { certList . add ( ( X509Certificate ) certFac . generateCertificate ( new ByteArrayInputStream ( seq [ i ] . toByteArray ( ) ) ) ) ; } return Collections . unmodifiableList ( certList ) ; } catch ( IOException ioe ) { throw new CertificateException ( "IOException parsing PkiPath data: " + ioe , ioe ) ; }
public class Scopes { /** * Matches the given < code > Scopes < / code > argument against this < code > Scopes < / code > object , * more weakly than { @ link # match ( Scopes ) } . * < br / > * If this < code > Scopes < / code > is the { @ link # NONE } scope , always returns false . < br / > * If this < code > Scopes < / code > is the { @ link # ANY } scope , always returns true . < br / > * If the given < code > Scopes < / code > is the { @ link # NONE } scope , always returns true . < br / > * If the given < code > Scopes < / code > is the { @ link # ANY } scope , always returns false . < br / > * @ param other the < code > Scopes < / code > to match * @ return true if at least one of the scopes specified by the given < code > Scopes < / code > argument * is also a scope of this < code > Scopes < / code > object . * @ see # match ( Scopes ) */ public boolean weakMatch ( Scopes other ) { } }
if ( isNoneScope ( ) ) return false ; if ( isAnyScope ( ) ) return true ; if ( other == null || other . isNoneScope ( ) ) return true ; if ( other . isAnyScope ( ) ) return false ; return ! Collections . disjoint ( scopes , other . scopes ) ;
public class LegacyDfuImpl { /** * Checks whether the response received is valid and returns the status code . * @ param response the response received from the DFU device . * @ param request the expected Op Code . * @ return The status code . * @ throws UnknownResponseException if response was not valid . */ private int getStatusCode ( @ Nullable final byte [ ] response , final int request ) throws UnknownResponseException { } }
if ( response == null || response . length != 3 || response [ 0 ] != OP_CODE_RESPONSE_CODE_KEY || response [ 1 ] != request || response [ 2 ] < 1 || response [ 2 ] > 6 ) throw new UnknownResponseException ( "Invalid response received" , response , OP_CODE_RESPONSE_CODE_KEY , request ) ; return response [ 2 ] ;
public class PropertiesEscape { /** * Perform a ( configurable ) Java Properties Value < strong > escape < / strong > operation on a < tt > String < / tt > input , * writing results to a < tt > Writer < / tt > . * This method will perform an escape operation according to the specified * { @ link org . unbescape . properties . PropertiesValueEscapeLevel } argument value . * All other < tt > String < / tt > / < tt > Writer < / tt > - based < tt > escapePropertiesValue * ( . . . ) < / tt > methods call this one with * preconfigured < tt > level < / tt > values . * This method is < strong > thread - safe < / strong > . * @ param text the < tt > String < / tt > to be escaped . * @ param writer the < tt > java . io . Writer < / tt > to which the escaped result will be written . Nothing will * be written at all to this writer if input is < tt > null < / tt > . * @ param level the escape level to be applied , see { @ link org . unbescape . properties . PropertiesValueEscapeLevel } . * @ throws IOException if an input / output exception occurs * @ since 1.1.2 */ public static void escapePropertiesValue ( final String text , final Writer writer , final PropertiesValueEscapeLevel level ) throws IOException { } }
if ( writer == null ) { throw new IllegalArgumentException ( "Argument 'writer' cannot be null" ) ; } if ( level == null ) { throw new IllegalArgumentException ( "The 'level' argument cannot be null" ) ; } PropertiesValueEscapeUtil . escape ( new InternalStringReader ( text ) , writer , level ) ;
public class ByteArraySerializer { /** * ( non - Javadoc ) * @ see Serializer # deserialize ( byte [ ] , * java . lang . reflect . Type ) */ @ SuppressWarnings ( "unchecked" ) @ Override public final < T > T deserialize ( byte [ ] content , Type type ) throws SerializerException { } }
if ( byte [ ] . class . equals ( type ) ) { return ( T ) content ; } throw new SerializerException ( "Unable to deserialize to type '" + type + "'" ) ;
public class TempByteHolder { /** * Simple minimum for 3 ints */ private static int min ( int a , int b , int c ) { } }
int r = a ; if ( r > b ) r = b ; if ( r > c ) r = c ; return r ;
public class FloatMatrix { /** * Repeat this matrix < code > rowRepeats < / code > times in row direction and < code > colRepeats < / code > times in column direction . * @ param rowRepeats * @ param colRepeats * @ return a new matrix * @ see IntMatrix # repmat ( int , int ) */ @ Override public FloatMatrix repmat ( final int rowRepeats , final int colRepeats ) { } }
N . checkArgument ( rowRepeats > 0 && colRepeats > 0 , "rowRepeats=%s and colRepeats=%s must be bigger than 0" , rowRepeats , colRepeats ) ; final float [ ] [ ] c = new float [ rows * rowRepeats ] [ cols * colRepeats ] ; for ( int i = 0 ; i < rows ; i ++ ) { for ( int j = 0 ; j < colRepeats ; j ++ ) { N . copy ( a [ i ] , 0 , c [ i ] , j * cols , cols ) ; } } for ( int i = 1 ; i < rowRepeats ; i ++ ) { for ( int j = 0 ; j < rows ; j ++ ) { N . copy ( c [ j ] , 0 , c [ i * rows + j ] , 0 , c [ j ] . length ) ; } } return new FloatMatrix ( c ) ;
public class DimensionReductionUtils { /** * This method will calculate the importance of principal components for PCA / GLRM methods . * @ param std _ deviation : array of singular values * @ param totVar : sum of squared singular values * @ param vars : array of singular values squared * @ param prop _ var : var [ i ] / totVar for each i * @ param cum _ var : cumulative sum of var [ i ] / totVar from index 0 to index i . */ public static void generateIPC ( double [ ] std_deviation , double totVar , double [ ] vars , double [ ] prop_var , double [ ] cum_var ) { } }
int arrayLen = std_deviation . length ; if ( totVar > 0 ) { for ( int i = 0 ; i < arrayLen ; i ++ ) { vars [ i ] = std_deviation [ i ] * std_deviation [ i ] ; prop_var [ i ] = vars [ i ] / totVar ; cum_var [ i ] = i == 0 ? prop_var [ 0 ] : cum_var [ i - 1 ] + prop_var [ i ] ; } } double lastCum = cum_var [ arrayLen - 1 ] ; if ( lastCum > 1 ) { // GLRM sometimes screw up the matrix estimation pretty bad double multF = 1 / lastCum ; ArrayUtils . mult ( prop_var , multF ) ; ArrayUtils . mult ( cum_var , multF ) ; ArrayUtils . mult ( vars , multF ) ; ArrayUtils . mult ( std_deviation , sqrt ( multF ) ) ; }
public class GeneralPurposeFFT_F32_2D { /** * Computes 2D inverse DFT of complex data leaving the result in * < code > a < / code > . The data is stored in 1D array in row - major order . * Complex number is stored as two float values in sequence : the real and * imaginary part , i . e . the input array must be of size rows * 2 * columns . The * physical layout of the input data has to be as follows : < br > * < pre > * a [ k1*2 * columns + 2 * k2 ] = Re [ k1 ] [ k2 ] , * a [ k1*2 * columns + 2 * k2 + 1 ] = Im [ k1 ] [ k2 ] , 0 & lt ; = k1 & lt ; rows , 0 & lt ; = k2 & lt ; columns , * < / pre > * @ param a * data to transform * @ param scale * if true then scaling is performed */ public void complexInverse ( final float [ ] a , final boolean scale ) { } }
// handle special case if ( rows == 1 || columns == 1 ) { if ( rows > 1 ) fftRows . complexInverse ( a , scale ) ; else fftColumns . complexInverse ( a , scale ) ; return ; } if ( isPowerOfTwo ) { int oldn2 = columns ; columns = 2 * columns ; for ( int r = 0 ; r < rows ; r ++ ) { fftColumns . complexInverse ( a , r * columns , scale ) ; } cdft2d_sub ( 1 , a , scale ) ; columns = oldn2 ; } else { final int rowspan = 2 * columns ; for ( int r = 0 ; r < rows ; r ++ ) { fftColumns . complexInverse ( a , r * rowspan , scale ) ; } for ( int c = 0 ; c < columns ; c ++ ) { int idx1 = 2 * c ; for ( int r = 0 ; r < rows ; r ++ ) { int idx2 = 2 * r ; int idx3 = r * rowspan + idx1 ; temp [ idx2 ] = a [ idx3 ] ; temp [ idx2 + 1 ] = a [ idx3 + 1 ] ; } fftRows . complexInverse ( temp , scale ) ; for ( int r = 0 ; r < rows ; r ++ ) { int idx2 = 2 * r ; int idx3 = r * rowspan + idx1 ; a [ idx3 ] = temp [ idx2 ] ; a [ idx3 + 1 ] = temp [ idx2 + 1 ] ; } } }
public class DocBookBuildUtilities { /** * Get any ids that are referenced by a " link " or " xref " * XML attribute within the node . Any ids that are found * are added to the passes linkIds set . * @ param node The DOM XML node to check for links . * @ param linkIds The set of current found link ids . */ public static void getTopicLinkIds ( final Node node , final Set < String > linkIds ) { } }
// If the node is null then there isn ' t anything to find , so just return . if ( node == null ) { return ; } if ( node . getNodeName ( ) . equals ( "xref" ) || node . getNodeName ( ) . equals ( "link" ) ) { final NamedNodeMap attributes = node . getAttributes ( ) ; if ( attributes != null ) { final Node idAttribute = attributes . getNamedItem ( "linkend" ) ; if ( idAttribute != null ) { final String idAttributeValue = idAttribute . getNodeValue ( ) ; linkIds . add ( idAttributeValue ) ; } } } final NodeList elements = node . getChildNodes ( ) ; for ( int i = 0 ; i < elements . getLength ( ) ; ++ i ) { getTopicLinkIds ( elements . item ( i ) , linkIds ) ; }
public class MainActivity { /** * Install package . */ private void installPackage ( ) { } }
AndPermission . with ( this ) . install ( ) . file ( new File ( Environment . getExternalStorageDirectory ( ) , "android.apk" ) ) . rationale ( new InstallRationale ( ) ) . onGranted ( new Action < File > ( ) { @ Override public void onAction ( File data ) { // Installing . toast ( R . string . successfully ) ; } } ) . onDenied ( new Action < File > ( ) { @ Override public void onAction ( File data ) { // The user refused to install . toast ( R . string . failure ) ; } } ) . start ( ) ;
public class ProfileController { /** * Handle form post for revoking chosen approvals */ @ RequestMapping ( value = "/profile" , method = RequestMethod . POST ) public String post ( @ RequestParam ( required = false ) Collection < String > checkedScopes , @ RequestParam ( required = false ) String update , @ RequestParam ( required = false ) String delete , @ RequestParam ( required = false ) String clientId ) { } }
String userId = getCurrentUserId ( ) ; if ( null != update ) { Map < String , List < DescribedApproval > > approvalsByClientId = getCurrentApprovalsForUser ( userId ) ; List < DescribedApproval > allApprovals = new ArrayList < > ( ) ; for ( List < DescribedApproval > clientApprovals : approvalsByClientId . values ( ) ) { allApprovals . addAll ( clientApprovals ) ; } if ( hasText ( clientId ) ) { allApprovals . removeIf ( da -> ! clientId . equals ( da . getClientId ( ) ) ) ; } for ( Approval approval : allApprovals ) { String namespacedScope = approval . getClientId ( ) + "-" + approval . getScope ( ) ; if ( checkedScopes != null && checkedScopes . contains ( namespacedScope ) ) { approval . setStatus ( Approval . ApprovalStatus . APPROVED ) ; } else { approval . setStatus ( Approval . ApprovalStatus . DENIED ) ; } } updateApprovals ( allApprovals ) ; } else if ( null != delete ) { deleteApprovalsForClient ( userId , clientId ) ; } return "redirect:profile" ;
public class AbstractHTTPDestination { /** * Propogate in the message a TLSSessionInfo instance representative * of the TLS - specific information in the HTTP request . * @ param request the Jetty request * @ param message the Message */ private static void propogateSecureSession ( HttpServletRequest request , Message message ) { } }
final String cipherSuite = ( String ) request . getAttribute ( SSL_CIPHER_SUITE_ATTRIBUTE ) ; if ( cipherSuite != null ) { final java . security . cert . Certificate [ ] certs = ( java . security . cert . Certificate [ ] ) request . getAttribute ( SSL_PEER_CERT_CHAIN_ATTRIBUTE ) ; message . put ( TLSSessionInfo . class , new TLSSessionInfo ( cipherSuite , null , certs ) ) ; }
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link EnvelopeType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link EnvelopeType } { @ code > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "verticalExtent" ) public JAXBElement < EnvelopeType > createVerticalExtent ( EnvelopeType value ) { } }
return new JAXBElement < EnvelopeType > ( _VerticalExtent_QNAME , EnvelopeType . class , null , value ) ;
public class WildCardURL { /** * Gets whether a string matches a wildcard pattern . The following would be considered to be matches : * < code > * pattern somepattern < / code > * < code > pattern * patternsome < / code > * < code > * pattern * somepatternsome < / code > * @ param pattern The pattern to check , wildcards must be at either the start , end or both , but not in the middle . * @ param stringToMatch The string to check * @ return < code > True < / code > if the wildcard matches the pattern , otherwise < code > false < / code > */ private boolean wildcardMatches ( String pattern , String stringToMatch ) { } }
boolean match = false ; int length = pattern . length ( ) ; if ( pattern . charAt ( 0 ) == '*' ) { if ( length == 1 ) { match = true ; } else if ( pattern . charAt ( length - 1 ) == '*' && length > 2 && stringToMatch . contains ( pattern . substring ( 1 , length - 3 ) . toLowerCase ( ) ) ) { match = true ; // * match * } else if ( length > 1 && stringToMatch . endsWith ( pattern . substring ( 1 ) . toLowerCase ( ) ) ) { match = true ; // * match } } else if ( pattern . charAt ( length - 1 ) == '*' && stringToMatch . startsWith ( pattern . substring ( 0 , length - 2 ) . toLowerCase ( ) ) ) { match = true ; // match * } else if ( pattern . equalsIgnoreCase ( stringToMatch ) ) { // match match = true ; } return match ;
public class TextParameterDataSegment { /** * { @ inheritDoc } */ public final int deserialize ( final ByteBuffer src , final int len ) { } }
if ( len == 0 ) { return 0 ; } clear ( ) ; resizeBuffer ( len , false ) ; return length ;
public class FixedBucketsHistogram { /** * Encode the serialized form generated by toBytes ( ) in Base64 , used as the JSON serialization format . * @ return Base64 serialization */ @ JsonValue public String toBase64 ( ) { } }
byte [ ] asBytes = toBytes ( ) ; return StringUtils . fromUtf8 ( StringUtils . encodeBase64 ( asBytes ) ) ;
public class BuildWithDetails { /** * Update < code > displayName < / code > and the < code > description < / code > of a * build . * @ param displayName The new displayName which should be set . * @ param description The description which should be set . * @ throws IOException in case of errors . */ public BuildWithDetails updateDisplayNameAndDescription ( String displayName , String description ) throws IOException { } }
return updateDisplayNameAndDescription ( displayName , description , false ) ;
public class TKEYRecord { /** * Converts rdata to a String */ String rrToString ( ) { } }
StringBuffer sb = new StringBuffer ( ) ; sb . append ( alg ) ; sb . append ( " " ) ; if ( Options . check ( "multiline" ) ) sb . append ( "(\n\t" ) ; sb . append ( FormattedTime . format ( timeInception ) ) ; sb . append ( " " ) ; sb . append ( FormattedTime . format ( timeExpire ) ) ; sb . append ( " " ) ; sb . append ( modeString ( ) ) ; sb . append ( " " ) ; sb . append ( Rcode . TSIGstring ( error ) ) ; if ( Options . check ( "multiline" ) ) { sb . append ( "\n" ) ; if ( key != null ) { sb . append ( base64 . formatString ( key , 64 , "\t" , false ) ) ; sb . append ( "\n" ) ; } if ( other != null ) sb . append ( base64 . formatString ( other , 64 , "\t" , false ) ) ; sb . append ( " )" ) ; } else { sb . append ( " " ) ; if ( key != null ) { sb . append ( base64 . toString ( key ) ) ; sb . append ( " " ) ; } if ( other != null ) sb . append ( base64 . toString ( other ) ) ; } return sb . toString ( ) ;
public class HandlerEvaluator { /** * Writes a handler entry using the given writer . * @ param writer * the writer used to output the results * @ param uiOwner * the name of the class evaluated here that owns the template * @ param handlerVarName * the name of the handler variable * @ param handlerType * the handler we want to create * @ param eventType * the event associated with the handler * @ param boundMethod * the method bound in the handler */ protected void writeHandler ( IndentedWriter writer , String uiOwner , String handlerVarName , JClassType handlerType , JClassType eventType , String boundMethod ) throws UnableToCompleteException { } }
// Retrieves the single method ( usually ' onSomething ' ) related to all // handlers . Ex : onClick in ClickHandler , onBlur in BlurHandler . . . JMethod [ ] methods = handlerType . getMethods ( ) ; if ( methods . length != 1 ) { logger . die ( "'%s' has more than one method defined." , handlerType . getName ( ) ) ; } // Checks if the method has an Event as parameter . Ex : ClickEvent in // onClick , BlurEvent in onBlur . . . JParameter [ ] parameters = methods [ 0 ] . getParameters ( ) ; if ( parameters . length != 1 || parameters [ 0 ] . getType ( ) != eventType ) { logger . die ( "Method '%s' needs '%s' as parameter" , methods [ 0 ] . getName ( ) , eventType . getName ( ) ) ; } writer . newline ( ) ; writer . write ( "final %1$s %2$s = new %1$s() {" , handlerType . getParameterizedQualifiedSourceName ( ) , handlerVarName ) ; writer . indent ( ) ; writer . write ( "public void %1$s(%2$s event) {" , methods [ 0 ] . getName ( ) , eventType . getParameterizedQualifiedSourceName ( ) ) ; writer . indent ( ) ; writer . write ( "%1$s.%2$s(event);" , uiOwner , boundMethod ) ; writer . outdent ( ) ; writer . write ( "}" ) ; writer . outdent ( ) ; writer . write ( "};" ) ;
public class PriorityQueue { /** * Inserts item x at position k , maintaining heap invariant by demoting x down the tree repeatedly until it is less than or * equal to its children or is a leaf . * @ param k the position to fill * @ param x the item to insert */ @ SuppressWarnings ( "unchecked" ) private void siftDown ( int k , E x ) { } }
int half = size >>> 1 ; // loop while a non - leaf while ( k < half ) { int child = ( k << 1 ) + 1 ; // assume left child is least E c = ( E ) queue [ child ] ; int right = child + 1 ; if ( right < size && c . compareTo ( ( E ) queue [ right ] ) > 0 ) c = ( E ) queue [ child = right ] ; if ( x . compareTo ( c ) <= 0 ) break ; queue [ k ] = c ; k = child ; } queue [ k ] = x ;
public class AsperaTransferManager { /** * List all files within the folder to exclude all subdirectories & modify the transfer spec to * pass onto Aspera SDK * @ param directory * @ param transferSpecs */ public void excludeSubdirectories ( File directory , TransferSpecs transferSpecs ) { } }
if ( directory == null || ! directory . exists ( ) || ! directory . isDirectory ( ) ) { throw new IllegalArgumentException ( "Must provide a directory to upload" ) ; } List < File > files = new LinkedList < File > ( ) ; listFiles ( directory , files ) ; for ( TransferSpec transferSpec : transferSpecs . transfer_specs ) { Vector < NodePath > paths = new Vector < NodePath > ( ) ; for ( File f : files ) { NodePath path = new NodePath ( ) ; path . setDestination ( f . getName ( ) ) ; path . setSource ( f . getAbsolutePath ( ) ) ; paths . add ( path ) ; } transferSpec . setPaths ( paths ) ; }
public class PublicanPODocBookBuilder { /** * Builds the POT / PO files for a topic . * @ param buildData Information and data structures for the build . * @ param specTopic The spec topic to create the POT / PO files for . * @ param filePathAndName The path and filename for the topic relative to the locale directory . * @ throws BuildProcessingException */ protected void buildPOTopic ( final POBuildData buildData , final SpecTopic specTopic , final String filePathAndName ) throws BuildProcessingException { } }
if ( specTopic != null ) { final Map < String , TranslationDetails > translations = new LinkedHashMap < String , TranslationDetails > ( ) ; addStringsForTopic ( buildData , specTopic , translations ) ; createPOFile ( buildData , filePathAndName , translations ) ; }
public class ArbitrateCommmunicationClient { /** * 指定对应的Node节点 , 进行event调用 */ public Object call ( Long nid , final Event event ) { } }
return delegate . call ( convertToAddress ( nid ) , event ) ;
public class Grep { /** * singleton */ public int run ( String [ ] args ) throws Exception { } }
if ( args . length < 3 ) { System . out . println ( "Grep <inDir> <outDir> <regex> [<group>]" ) ; ToolRunner . printGenericCommandUsage ( System . out ) ; return - 1 ; } Path tempDir = new Path ( "grep-temp-" + Integer . toString ( new Random ( ) . nextInt ( Integer . MAX_VALUE ) ) ) ; JobConf grepJob = new JobConf ( getConf ( ) , Grep . class ) ; try { grepJob . setJobName ( "grep-search" ) ; FileInputFormat . setInputPaths ( grepJob , args [ 0 ] ) ; grepJob . setMapperClass ( RegexMapper . class ) ; grepJob . set ( "mapred.mapper.regex" , args [ 2 ] ) ; if ( args . length == 4 ) grepJob . set ( "mapred.mapper.regex.group" , args [ 3 ] ) ; grepJob . setCombinerClass ( LongSumReducer . class ) ; grepJob . setReducerClass ( LongSumReducer . class ) ; FileOutputFormat . setOutputPath ( grepJob , tempDir ) ; grepJob . setOutputFormat ( SequenceFileOutputFormat . class ) ; grepJob . setOutputKeyClass ( Text . class ) ; grepJob . setOutputValueClass ( LongWritable . class ) ; JobClient . runJob ( grepJob ) ; JobConf sortJob = new JobConf ( Grep . class ) ; sortJob . setJobName ( "grep-sort" ) ; FileInputFormat . setInputPaths ( sortJob , tempDir ) ; sortJob . setInputFormat ( SequenceFileInputFormat . class ) ; sortJob . setMapperClass ( InverseMapper . class ) ; sortJob . setNumReduceTasks ( 1 ) ; // write a single file FileOutputFormat . setOutputPath ( sortJob , new Path ( args [ 1 ] ) ) ; sortJob . setOutputKeyComparatorClass // sort by decreasing freq ( LongWritable . DecreasingComparator . class ) ; JobClient . runJob ( sortJob ) ; } finally { FileSystem . get ( grepJob ) . delete ( tempDir , true ) ; } return 0 ;
public class CPDefinitionOptionValueRelLocalServiceBaseImpl { /** * Returns the cp definition option value rel matching the UUID and group . * @ param uuid the cp definition option value rel ' s UUID * @ param groupId the primary key of the group * @ return the matching cp definition option value rel * @ throws PortalException if a matching cp definition option value rel could not be found */ @ Override public CPDefinitionOptionValueRel getCPDefinitionOptionValueRelByUuidAndGroupId ( String uuid , long groupId ) throws PortalException { } }
return cpDefinitionOptionValueRelPersistence . findByUUID_G ( uuid , groupId ) ;
public class Math { /** * Raise each element of an array to a scalar power . * @ param x array * @ param n scalar exponent * @ return x < sup > n < / sup > */ public static double [ ] pow ( double [ ] x , double n ) { } }
double [ ] array = new double [ x . length ] ; for ( int i = 0 ; i < x . length ; i ++ ) { array [ i ] = Math . pow ( x [ i ] , n ) ; } return array ;
public class SimpleGenerator { /** * Returns the next generated entity . * @ return the next generated entity . * @ throws java . util . NoSuchElementException if the iteration has no more elements . */ @ Override public Object next ( ) { } }
quantity -- ; try { return generatedClass . newInstance ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; }
public class NearestVertexOfIntersection { /** * Execute the snap operation . * @ param coordinate The original location . * @ param distance The maximum distance allowed for snapping . * @ return The new location . If no snapping target was found , this may return the original location . */ public Coordinate snap ( Coordinate coordinate , double distance ) { } }
// Some initialization : calculatedDistance = distance ; hasSnapped = false ; Coordinate snappingPoint = coordinate ; // Go over all geometries and consider only the intersecting ones : for ( Geometry geometry : geometries ) { if ( MathService . isWithin ( geometry , coordinate ) ) { NearestVertexSnapAlgorithm nearestVertex = new NearestVertexSnapAlgorithm ( ) ; nearestVertex . setGeometries ( new Geometry [ ] { geometry } ) ; Coordinate temp = nearestVertex . snap ( coordinate , calculatedDistance ) ; if ( nearestVertex . hasSnapped ( ) ) { hasSnapped = true ; calculatedDistance = nearestVertex . getCalculatedDistance ( ) ; snappingPoint = temp ; } } } return snappingPoint ;
public class CDKMCS { /** * This makes atom map of matching atoms out of atom map of matching bonds as produced by the get ( Subgraph | Ismorphism ) Map methods . * @ param list The list produced by the getMap method . * @ param sourceGraph first molecule . Must not be an IQueryAtomContainer . * @ param targetGraph second molecule . May be an IQueryAtomContainer . * @ return The mapping found projected on sourceGraph . This is atom List of CDKRMap objects containing Ids of matching atoms . */ public static List < CDKRMap > makeAtomsMapOfBondsMap ( List < CDKRMap > list , IAtomContainer sourceGraph , IAtomContainer targetGraph ) { } }
if ( list == null ) { return ( list ) ; } List < CDKRMap > result = new ArrayList < CDKRMap > ( ) ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { IBond bond1 = sourceGraph . getBond ( list . get ( i ) . getId1 ( ) ) ; IBond bond2 = targetGraph . getBond ( list . get ( i ) . getId2 ( ) ) ; IAtom [ ] atom1 = BondManipulator . getAtomArray ( bond1 ) ; IAtom [ ] atom2 = BondManipulator . getAtomArray ( bond2 ) ; for ( int j = 0 ; j < 2 ; j ++ ) { List < IBond > bondsConnectedToAtom1j = sourceGraph . getConnectedBondsList ( atom1 [ j ] ) ; for ( int k = 0 ; k < bondsConnectedToAtom1j . size ( ) ; k ++ ) { if ( ! bondsConnectedToAtom1j . get ( k ) . equals ( bond1 ) ) { IBond testBond = bondsConnectedToAtom1j . get ( k ) ; for ( int m = 0 ; m < list . size ( ) ; m ++ ) { IBond testBond2 ; if ( ( list . get ( m ) ) . getId1 ( ) == sourceGraph . indexOf ( testBond ) ) { testBond2 = targetGraph . getBond ( ( list . get ( m ) ) . getId2 ( ) ) ; for ( int n = 0 ; n < 2 ; n ++ ) { List < IBond > bondsToTest = targetGraph . getConnectedBondsList ( atom2 [ n ] ) ; if ( bondsToTest . contains ( testBond2 ) ) { CDKRMap map ; if ( j == n ) { map = new CDKRMap ( sourceGraph . indexOf ( atom1 [ 0 ] ) , targetGraph . indexOf ( atom2 [ 0 ] ) ) ; } else { map = new CDKRMap ( sourceGraph . indexOf ( atom1 [ 1 ] ) , targetGraph . indexOf ( atom2 [ 0 ] ) ) ; } if ( ! result . contains ( map ) ) { result . add ( map ) ; } CDKRMap map2 ; if ( j == n ) { map2 = new CDKRMap ( sourceGraph . indexOf ( atom1 [ 1 ] ) , targetGraph . indexOf ( atom2 [ 1 ] ) ) ; } else { map2 = new CDKRMap ( sourceGraph . indexOf ( atom1 [ 0 ] ) , targetGraph . indexOf ( atom2 [ 1 ] ) ) ; } if ( ! result . contains ( map2 ) ) { result . add ( map2 ) ; } } } } } } } } } return result ;
public class ExponentialBackOff { /** * Returns a random value from the interval [ randomizationFactor * currentInterval , * randomizationFactor * currentInterval ] . */ static int getRandomValueFromInterval ( double randomizationFactor , double random , int currentIntervalMillis ) { } }
double delta = randomizationFactor * currentIntervalMillis ; double minInterval = currentIntervalMillis - delta ; double maxInterval = currentIntervalMillis + delta ; // Get a random value from the range [ minInterval , maxInterval ] . // The formula used below has a + 1 because if the minInterval is 1 and the maxInterval is 3 then // we want a 33 % chance for selecting either 1 , 2 or 3. int randomValue = ( int ) ( minInterval + ( random * ( maxInterval - minInterval + 1 ) ) ) ; return randomValue ;
public class CollectionUtils { /** * Shuffles the elements in the { @ link List } . This method guarantees a random , uniform shuffling of the elements * in the { @ link List } with an operational efficiency of O ( n ) . * @ param < T > Class type of the elements in the { @ link List } . * @ param list { @ link List } of elements to shuffle . * @ return the { @ link List } of elements shuffled . * @ see java . util . Collections # swap ( List , int , int ) * @ see # isNotEmpty ( Iterable ) * @ see java . util . List */ @ NullSafe public static < T > List < T > shuffle ( List < T > list ) { } }
if ( isNotEmpty ( list ) ) { Random random = new Random ( System . currentTimeMillis ( ) ) ; for ( int index = 0 , sizeMinusOne = nullSafeSize ( list ) - 1 ; index < sizeMinusOne ; index ++ ) { int randomIndex = ( random . nextInt ( sizeMinusOne - index ) + 1 ) ; Collections . swap ( list , index , index + randomIndex ) ; } } return list ;
public class AstUtil { /** * Return true only if the MethodCallExpression represents a method call for the specified method name * @ param methodCall - the AST MethodCallExpression * @ param methodNamePattern - the expected name of the method being called * @ param numArguments - The number of expected arguments * @ return true only if the method call name matches */ public static boolean isMethodNamed ( MethodCallExpression methodCall , String methodNamePattern , Integer numArguments ) { } }
Expression method = methodCall . getMethod ( ) ; // ! important : performance enhancement boolean IS_NAME_MATCH = false ; if ( method instanceof ConstantExpression ) { if ( ( ( ConstantExpression ) method ) . getValue ( ) instanceof String ) { IS_NAME_MATCH = ( ( String ) ( ( ConstantExpression ) method ) . getValue ( ) ) . matches ( methodNamePattern ) ; } } if ( IS_NAME_MATCH && numArguments != null ) { return AstUtil . getMethodArguments ( methodCall ) . size ( ) == numArguments ; } return IS_NAME_MATCH ;
public class ResourceMethodContentAnalyzer { /** * Analyzes the method ( including own project methods ) . * @ param methodResult The method result */ void analyze ( final MethodResult methodResult ) { } }
lock . lock ( ) ; try { buildPackagePrefix ( methodResult . getParentResource ( ) . getOriginalClass ( ) ) ; final List < Instruction > visitedInstructions = interpretRelevantInstructions ( methodResult . getInstructions ( ) ) ; // find project defined methods in invoke occurrences final Set < ProjectMethod > projectMethods = findProjectMethods ( visitedInstructions ) ; // add project methods to global method pool projectMethods . forEach ( MethodPool . getInstance ( ) :: addProjectMethod ) ; Element returnedElement = new MethodSimulator ( ) . simulate ( visitedInstructions ) ; final String returnType = methodResult . getOriginalMethodSignature ( ) . getReturnType ( ) ; // void resource methods are interpreted later ; stop analyzing on error if ( Types . PRIMITIVE_VOID . equals ( returnType ) ) { return ; } if ( returnedElement == null ) { // happens for abstract methods or if there is no return return ; } final Set < Object > possibleObjects = returnedElement . getPossibleValues ( ) . stream ( ) . filter ( o -> ! ( o instanceof HttpResponse ) ) . collect ( Collectors . toSet ( ) ) ; // for non - Response methods add a default if there are non - Response objects or none objects at all if ( ! Types . RESPONSE . equals ( returnType ) ) { final HttpResponse defaultResponse = new HttpResponse ( ) ; if ( Types . OBJECT . equals ( returnType ) ) defaultResponse . getEntityTypes ( ) . addAll ( returnedElement . getTypes ( ) ) ; else defaultResponse . getEntityTypes ( ) . add ( returnType ) ; possibleObjects . stream ( ) . filter ( o -> o instanceof JsonValue ) . map ( o -> ( JsonValue ) o ) . forEach ( defaultResponse . getInlineEntities ( ) :: add ) ; defaultResponse . getContentTypes ( ) . addAll ( methodResult . getResponseMediaTypes ( ) ) ; methodResult . getResponses ( ) . add ( defaultResponse ) ; } // add Response results as well returnedElement . getPossibleValues ( ) . stream ( ) . filter ( o -> o instanceof HttpResponse ) . map ( o -> ( HttpResponse ) o ) . forEach ( methodResult . getResponses ( ) :: add ) ; } finally { lock . unlock ( ) ; }
public class MinimizeEnergyPrune { /** * Look for two corners which point to the same point and removes one of them from the corner list */ void removeDuplicates ( GrowQueue_I32 corners ) { } }
// remove duplicates for ( int i = 0 ; i < corners . size ( ) ; i ++ ) { Point2D_I32 a = contour . get ( corners . get ( i ) ) ; // start from the top so that removing a corner doesn ' t mess with the for loop for ( int j = corners . size ( ) - 1 ; j > i ; j -- ) { Point2D_I32 b = contour . get ( corners . get ( j ) ) ; if ( a . x == b . x && a . y == b . y ) { // this is still ok if j = = 0 because it wrapped around . ' i ' will now be > size corners . remove ( j ) ; } } }
public class RESTMBeanServerConnection { /** * { @ inheritDoc } */ @ Override public ObjectInstance createMBean ( String className , ObjectName name ) throws ReflectionException , InstanceAlreadyExistsException , MBeanRegistrationException , MBeanException , NotCompliantMBeanException , IOException { } }
try { return createMBean ( className , name , null , null , null , false , false ) ; } catch ( InstanceNotFoundException inf ) { throw new IOException ( inf ) ; // Should never happen }
public class AbstractClient { /** * { @ inheritDoc } */ @ Override public Client language ( String language ) { } }
state . getRequestHeaders ( ) . putSingle ( HttpHeaders . CONTENT_LANGUAGE , language ) ; return this ;
public class JsonObject { /** * Returns true if this object has no mapping for { @ code name } or if it has * a mapping whose value is { @ link JsonNull } . */ public boolean isNull ( String name ) { } }
JsonElement value = nameValuePairs . get ( name ) ; return value . isNull ( ) ;
public class JobHistoryFileParserHadoop2 { /** * gets the int values as ints or longs some keys in 2.0 are now int , they were longs in 1.0 this * will maintain compatiblity between 1.0 and 2.0 by casting those ints to long * keeping this function package level visible ( unit testing ) * @ throws IllegalArgumentException if new key is encountered */ byte [ ] getValue ( String key , int value ) { } }
byte [ ] valueBytes = null ; Class < ? > clazz = JobHistoryKeys . KEY_TYPES . get ( JobHistoryKeys . valueOf ( key ) ) ; if ( clazz == null ) { throw new IllegalArgumentException ( " unknown key " + key + " encountered while parsing " + this . jobKey ) ; } if ( Long . class . equals ( clazz ) ) { valueBytes = ( value != 0L ) ? Bytes . toBytes ( new Long ( value ) ) : Constants . ZERO_LONG_BYTES ; } else { valueBytes = ( value != 0 ) ? Bytes . toBytes ( value ) : Constants . ZERO_INT_BYTES ; } return valueBytes ;
public class CustomerAccountUrl { /** * Get Resource Url for ChangePassword * @ param accountId Unique identifier of the customer account . * @ param unlockAccount Specifies whether to unlock the specified customer account . * @ param userId Unique identifier of the user whose tenant scopes you want to retrieve . * @ return String Resource Url */ public static MozuUrl changePasswordUrl ( Integer accountId , Boolean unlockAccount , String userId ) { } }
UrlFormatter formatter = new UrlFormatter ( "/api/commerce/customer/accounts/{accountId}/Change-Password?unlockAccount={unlockAccount}&userId={userId}" ) ; formatter . formatUrl ( "accountId" , accountId ) ; formatter . formatUrl ( "unlockAccount" , unlockAccount ) ; formatter . formatUrl ( "userId" , userId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ;
public class MultiTable { /** * Delete this record ( Always called from the record class ) . * Always override this method . * @ exception DBException File exception . */ public void remove ( ) throws DBException { } }
this . syncCurrentToBase ( ) ; boolean [ ] rgbListenerState = this . getRecord ( ) . setEnableListeners ( false ) ; this . getRecord ( ) . handleRecordChange ( DBConstants . DELETE_TYPE ) ; // Fake the call for the grid table this . getRecord ( ) . setEnableListeners ( rgbListenerState ) ; super . remove ( ) ; this . syncCurrentToBase ( ) ; rgbListenerState = this . getRecord ( ) . setEnableListeners ( false ) ; this . getRecord ( ) . handleRecordChange ( DBConstants . AFTER_DELETE_TYPE ) ; // Fake the call for the grid table this . getRecord ( ) . setEnableListeners ( rgbListenerState ) ;
public class HttpNeo4jSequenceGenerator { /** * Adds a node for each generator of type { @ link IdSourceType # SEQUENCE } . Table - based generators are created lazily * at runtime . * @ param sequences the generators to process */ private Statements createSequencesStatements ( Iterable < Sequence > sequences ) { } }
Statements statements = new Statements ( ) ; for ( Sequence sequence : sequences ) { addSequence ( statements , sequence ) ; } return statements ;
public class RestoreManagerImpl { /** * / * ( non - Javadoc ) * @ see org . duracloud . snapshot . bridge . service . RestorationManager # getStatus ( java . lang . String ) */ @ Override public Restoration get ( String restorationId ) throws RestorationNotFoundException { } }
Restoration restoration = this . restoreRepo . findByRestorationId ( restorationId ) ; if ( restoration == null ) { log . debug ( "Restoration returned null for {}. Throwing exception..." , restorationId ) ; throw new RestorationNotFoundException ( restorationId ) ; } log . debug ( "got restoration {}" , restoration ) ; return restoration ;
public class UserClient { /** * Add friends to username * @ param username Necessary * @ param users username to be add * @ return No content * @ throws APIConnectionException connect exception * @ throws APIRequestException request exception */ public ResponseWrapper addFriends ( String username , String ... users ) throws APIConnectionException , APIRequestException { } }
StringUtils . checkUsername ( username ) ; Preconditions . checkArgument ( null != users && users . length > 0 , "friend list should not be empty" ) ; JsonArray array = new JsonArray ( ) ; for ( String user : users ) { array . add ( new JsonPrimitive ( user ) ) ; } return _httpClient . sendPost ( _baseUrl + userPath + "/" + username + "/friends" , array . toString ( ) ) ;
public class OcelotServices { /** * Unsubscribe to topic * @ param topic * @ param session * @ return */ @ JsTopic @ WsDataService public Integer unsubscribe ( @ JsTopicName ( prefix = Constants . Topic . SUBSCRIBERS ) String topic , Session session ) { } }
return topicManager . unregisterTopicSession ( topic , session ) ;
public class Compiler { /** * Checks whether the compilation has been canceled and reports the given work increment to the compiler progress . */ protected void reportWorked ( int workIncrement , int currentUnitIndex ) { } }
if ( this . progress != null ) { if ( this . progress . isCanceled ( ) ) { // Only AbortCompilation can stop the compiler cleanly . // We check cancellation again following the call to compile . throw new AbortCompilation ( true , null ) ; } this . progress . worked ( workIncrement , ( this . totalUnits * this . remainingIterations ) - currentUnitIndex - 1 ) ; }
public class VimGenerator2 { /** * Generate the preamble of the Vim style . * @ param it the receiver of the generated elements . */ protected void generatePreamble ( IStyleAppendable it ) { } }
clearHilights ( ) ; final String nm = getLanguageSimpleName ( ) . toLowerCase ( ) ; final String cmd = Strings . toFirstUpper ( getLanguageSimpleName ( ) . toLowerCase ( ) ) + "HiLink" ; // $ NON - NLS - 1 $ appendComment ( it , "Quit when a syntax file was already loaded" ) ; // $ NON - NLS - 1 $ appendCmd ( it , false , "if !exists(\"main_syntax\")" ) . increaseIndentation ( ) . newLine ( ) ; // $ NON - NLS - 1 $ appendCmd ( it , false , "if exists(\"b:current_syntax\")" ) . increaseIndentation ( ) . newLine ( ) ; // $ NON - NLS - 1 $ appendCmd ( it , false , "finish" ) . decreaseIndentation ( ) . newLine ( ) ; // $ NON - NLS - 1 $ appendCmd ( it , "endif" ) ; // $ NON - NLS - 1 $ appendComment ( it , "we define it here so that included files can test for it" ) ; // $ NON - NLS - 1 $ appendCmd ( it , "let main_syntax='" + nm + "'" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $ appendCmd ( it , false , "syn region " + nm + "Fold start=\"{\" end=\"}\" transparent fold" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $ it . decreaseIndentation ( ) . newLine ( ) ; appendCmd ( it , "endif" ) ; // $ NON - NLS - 1 $ it . newLine ( ) ; appendCmd ( it , "let s:cpo_save = &cpo" ) ; // $ NON - NLS - 1 $ appendCmd ( it , "set cpo&vim" ) ; // $ NON - NLS - 1 $ it . newLine ( ) ; appendComment ( it , "don't use standard HiLink, it will not work with included syntax files" ) ; // $ NON - NLS - 1 $ appendCmd ( it , false , "if version < 508" ) . increaseIndentation ( ) . newLine ( ) ; // $ NON - NLS - 1 $ appendCmd ( it , false , "command! -nargs=+ " + cmd + " hi link <args>" ) . decreaseIndentation ( ) . newLine ( ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $ appendCmd ( it , false , "else" ) . increaseIndentation ( ) . newLine ( ) ; // $ NON - NLS - 1 $ appendCmd ( it , false , "command! -nargs=+ " + cmd + " hi def link <args>" ) . decreaseIndentation ( ) . newLine ( ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $ appendCmd ( it , "endif" ) ; // $ NON - NLS - 1 $ it . newLine ( ) ; appendComment ( it , "some characters that cannot be in a SARL program (outside a string)" ) ; // $ NON - NLS - 1 $ appendMatch ( it , nm + "Error" , "[\\\\`]" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $ it . newLine ( ) ;
public class AbstractTreeWriter { /** * Add each level of the class tree . For each sub - class or * sub - interface indents the next level information . * Recurses itself to add sub - classes info . * @ param parent the superclass or superinterface of the sset * @ param collection a collection of the sub - classes at this level * @ param isEnum true if we are generating a tree for enums * @ param contentTree the content tree to which the level information will be added */ protected void addLevelInfo ( TypeElement parent , Collection < TypeElement > collection , boolean isEnum , Content contentTree ) { } }
if ( ! collection . isEmpty ( ) ) { Content ul = new HtmlTree ( HtmlTag . UL ) ; for ( TypeElement local : collection ) { HtmlTree li = new HtmlTree ( HtmlTag . LI ) ; li . addStyle ( HtmlStyle . circle ) ; addPartialInfo ( local , li ) ; addExtendsImplements ( parent , local , li ) ; addLevelInfo ( local , classtree . directSubClasses ( local , isEnum ) , isEnum , li ) ; // Recurse ul . addContent ( li ) ; } contentTree . addContent ( ul ) ; }
public class DependencyFinder { /** * Parses the named class from the given archive and * returns all target locations the named class references . */ public Set < Location > parse ( Archive archive , String name ) { } }
try { return parse ( archive , CLASS_FINDER , name ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; }
public class LifeExpectancyProcessor { /** * Helper method that finds the first value of a time - valued property ( if * any ) , and extracts an integer year . It checks if the value has sufficient * precision to extract an exact year . * @ param document * the document to extract the data from * @ param propertyId * the string id of the property to look for * @ return the year , or Interger . MIN _ VALUE if none was found */ private int getYearIfAny ( StatementDocument document , String propertyId ) { } }
TimeValue date = document . findStatementTimeValue ( propertyId ) ; if ( date != null && date . getPrecision ( ) >= TimeValue . PREC_YEAR ) { return ( int ) date . getYear ( ) ; } else { return Integer . MIN_VALUE ; }
public class FanInGraph { /** * Srikant & Sachin */ @ Deprecated public Collection < MaterialRevision > computeRevisionsForReporting ( CaseInsensitiveString pipelineName , PipelineTimeline pipelineTimeline ) { } }
Pair < List < RootFanInNode > , List < DependencyFanInNode > > scmAndDepMaterialsChildren = getScmAndDepMaterialsChildren ( ) ; List < RootFanInNode > scmChildren = scmAndDepMaterialsChildren . first ( ) ; List < DependencyFanInNode > depChildren = scmAndDepMaterialsChildren . last ( ) ; if ( depChildren . isEmpty ( ) ) { // No fanin required all are SCMs return null ; } FanInGraphContext context = buildContext ( pipelineTimeline ) ; root . initialize ( context ) ; initChildren ( depChildren , pipelineName , context ) ; iterateAndMakeAllUniqueScmRevisionsForChildrenSame ( depChildren , pipelineName , context ) ; List < MaterialRevision > finalRevisionsForScmChildren = createFinalRevisionsForScmChildren ( root . latestPipelineTimelineEntry ( context ) , scmChildren , depChildren ) ; List < MaterialRevision > finalRevisionsForDepChildren = createFinalRevisionsForDepChildren ( depChildren ) ; return CollectionUtils . union ( finalRevisionsForScmChildren , finalRevisionsForDepChildren ) ;
public class BookKeeperLogFactory { /** * region Initialization */ private BookKeeper startBookKeeperClient ( ) throws Exception { } }
// These two are in Seconds , not Millis . int writeTimeout = ( int ) Math . ceil ( this . config . getBkWriteTimeoutMillis ( ) / 1000.0 ) ; int readTimeout = ( int ) Math . ceil ( this . config . getBkReadTimeoutMillis ( ) / 1000.0 ) ; ClientConfiguration config = new ClientConfiguration ( ) . setClientTcpNoDelay ( true ) . setAddEntryTimeout ( writeTimeout ) . setReadEntryTimeout ( readTimeout ) . setGetBookieInfoTimeout ( readTimeout ) . setClientConnectTimeoutMillis ( ( int ) this . config . getZkConnectionTimeout ( ) . toMillis ( ) ) . setZkTimeout ( ( int ) this . config . getZkConnectionTimeout ( ) . toMillis ( ) ) ; if ( this . config . isTLSEnabled ( ) ) { config = ( ClientConfiguration ) config . setTLSProvider ( "OpenSSL" ) ; config = config . setTLSTrustStore ( this . config . getTlsTrustStore ( ) ) ; config . setTLSTrustStorePasswordPath ( this . config . getTlsTrustStorePasswordPath ( ) ) ; } String metadataServiceUri = "zk://" + this . config . getZkAddress ( ) ; if ( this . config . getBkLedgerPath ( ) . isEmpty ( ) ) { metadataServiceUri += "/" + this . namespace + "/bookkeeper/ledgers" ; } else { metadataServiceUri += this . config . getBkLedgerPath ( ) ; } config . setMetadataServiceUri ( metadataServiceUri ) ; return new BookKeeper ( config ) ;
public class ReactorRateLimiterAspectExt { /** * handle the Spring web flux ( Flux / Mono ) return types AOP based into reactor rate limiter * See { @ link RateLimiter } for details . * @ param proceedingJoinPoint Spring AOP proceedingJoinPoint * @ param rateLimiter the configured rateLimiter * @ param methodName the method name * @ return the result object * @ throws Throwable exception in case of faulty flow */ @ SuppressWarnings ( "unchecked" ) @ Override public Object handle ( ProceedingJoinPoint proceedingJoinPoint , RateLimiter rateLimiter , String methodName ) throws Throwable { } }
Object returnValue = proceedingJoinPoint . proceed ( ) ; if ( Flux . class . isAssignableFrom ( returnValue . getClass ( ) ) ) { Flux < ? > fluxReturnValue = ( Flux < ? > ) returnValue ; return fluxReturnValue . transform ( RateLimiterOperator . of ( rateLimiter , Schedulers . immediate ( ) ) ) ; } else if ( Mono . class . isAssignableFrom ( returnValue . getClass ( ) ) ) { Mono < ? > monoReturnValue = ( Mono < ? > ) returnValue ; return monoReturnValue . transform ( RateLimiterOperator . of ( rateLimiter , Schedulers . immediate ( ) ) ) ; } else { logger . error ( "Unsupported type for Reactor rateLimiter {}" , returnValue . getClass ( ) . getTypeName ( ) ) ; throw new IllegalArgumentException ( "Not Supported type for the rateLimiter in Reactor :" + returnValue . getClass ( ) . getName ( ) ) ; }
public class OrderAwarePluginRegistry { /** * Creates a new { @ link OrderAwarePluginRegistry } with the given plugins . * @ param plugins * @ return * @ since 2.0 */ public static < S , T extends Plugin < S > > OrderAwarePluginRegistry < T , S > of ( List < ? extends T > plugins , Comparator < ? super T > comparator ) { } }
Assert . notNull ( plugins , "Plugins must not be null!" ) ; Assert . notNull ( comparator , "Comparator must not be null!" ) ; return new OrderAwarePluginRegistry < > ( plugins , comparator ) ;
public class HTMLRenderingUtils { /** * Renders a < code > SimpleHTMLTag < / code > as HTML * @ param tag Single tag * @ return HTML */ public static String render ( SimpleHTMLTag tag ) { } }
List < SimpleHTMLTag > tags = new ArrayList < > ( ) ; tags . add ( tag ) ; HTMLRenderer renderer = new HTMLRenderer ( tags ) ; return renderer . render ( ) ;
public class XMLChar { /** * Returns true if the encoding name is a valid Java encoding . * This method does not verify that there is a decoder available * for this encoding , only that the characters are valid for an * Java encoding name . * @ param javaEncoding The Java encoding name . */ public static boolean isValidJavaEncoding ( String javaEncoding ) { } }
if ( javaEncoding != null ) { int length = javaEncoding . length ( ) ; if ( length > 0 ) { for ( int i = 1 ; i < length ; i ++ ) { char c = javaEncoding . charAt ( i ) ; if ( ( c < 'A' || c > 'Z' ) && ( c < 'a' || c > 'z' ) && ( c < '0' || c > '9' ) && c != '.' && c != '_' && c != '-' ) { return false ; } } return true ; } } return false ;
public class AmazonConnectClient { /** * Updates the phone configuration settings in the < code > UserPhoneConfig < / code > object for the specified user . * @ param updateUserPhoneConfigRequest * @ return Result of the UpdateUserPhoneConfig operation returned by the service . * @ throws InvalidRequestException * The request is not valid . * @ throws InvalidParameterException * One or more of the parameters provided to the operation are not valid . * @ throws ResourceNotFoundException * The specified resource was not found . * @ throws ThrottlingException * The throttling limit has been exceeded . * @ throws InternalServiceException * Request processing failed due to an error or failure with the service . * @ sample AmazonConnect . UpdateUserPhoneConfig * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / connect - 2017-08-08 / UpdateUserPhoneConfig " target = " _ top " > AWS * API Documentation < / a > */ @ Override public UpdateUserPhoneConfigResult updateUserPhoneConfig ( UpdateUserPhoneConfigRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeUpdateUserPhoneConfig ( request ) ;
public class CmsScrollPanelImpl { /** * Hide the native scrollbars . We call this after attaching to ensure that we * inherit the direction ( rtl or ltr ) . */ private void hideNativeScrollbars ( ) { } }
m_nativeScrollbarWidth = AbstractNativeScrollbar . getNativeScrollbarWidth ( ) ; getScrollableElement ( ) . getStyle ( ) . setMarginRight ( - ( m_nativeScrollbarWidth + 10 ) , Unit . PX ) ;
public class KeyUtil { /** * 读取X . 509 Certification文件 < br > * Certification为证书文件 < br > * see : http : / / snowolf . iteye . com / blog / 391931 * @ param in { @ link InputStream } 如果想从文件读取 . cer文件 , 使用 { @ link FileUtil # getInputStream ( java . io . File ) } 读取 * @ param password 密码 * @ param alias 别名 * @ return { @ link KeyStore } * @ since 4.4.1 */ public static Certificate readX509Certificate ( InputStream in , char [ ] password , String alias ) { } }
return readCertificate ( X509 , in , password , alias ) ;
public class LabeledStatement { /** * Sets label list , setting the parent of each label * in the list . Replaces any existing labels . * @ throws IllegalArgumentException } if labels is { @ code null } */ public void setLabels ( List < Label > labels ) { } }
assertNotNull ( labels ) ; if ( this . labels != null ) this . labels . clear ( ) ; for ( Label l : labels ) { addLabel ( l ) ; }
public class Integrator { /** * Merge plugin configuration files . */ private void mergePlugins ( ) { } }
final Element root = pluginsDoc . createElement ( ELEM_PLUGINS ) ; pluginsDoc . appendChild ( root ) ; if ( ! descSet . isEmpty ( ) ) { final URI b = new File ( ditaDir , CONFIG_DIR + File . separator + "plugins.xml" ) . toURI ( ) ; for ( final File descFile : descSet ) { logger . debug ( "Read plug-in configuration " + descFile . getPath ( ) ) ; final Element plugin = parseDesc ( descFile ) ; if ( plugin != null ) { final URI base = getRelativePath ( b , descFile . toURI ( ) ) ; plugin . setAttributeNS ( XML_NS_URI , XML_NS_PREFIX + ":base" , base . toString ( ) ) ; root . appendChild ( pluginsDoc . importNode ( plugin , true ) ) ; } } }
public class SparseVector { /** * end constructor */ public Node [ ] toArray ( ) { } }
// logger . info ( " count " + count ) ; Node [ ] array = new Node [ count ] ; int i = 0 ; // System . out . print ( " node : " ) ; Iterator it = iterator ( ) ; while ( it . hasNext ( ) ) { Entry e = ( Entry ) it . next ( ) ; // System . out . print ( " " + e . getIndex ( ) ) ; array [ i ] = new Node ( ) ; array [ i ] . index = e . getIndex ( ) ; array [ i ] . value = e . getValue ( ) ; i ++ ; } // System . out . print ( " \ n " ) ; return array ;
public class RGroupQuery { /** * Maps the distribution of an R - group to all possible substitute combinations . * This is best illustrated by an example . < br > * Say R2 occurs twice in the root , and has condition > 0 . So a valid * output configuration can have either one or two substitutes . * The distributions will have been calculated to be the following * solutions : [ 0,1 ] , [ 1,0 ] , [ 1,1 ] < br > * To start with [ 1,1 ] , assume two possible substitutes have been * defined for R2 , namely * C = O and * C - N . Then the distribution [ 1,1] * should lead to four mappings : < br > * [ * C = O , * C = O ] , [ * C - N , * C - N ] , [ * C = O , * C - N ] , [ * C - N , * C = O ] . < br > * These mappings are generated in this function , as well as the other valid mappings * for [ 0,1 ] and [ 1,0 ] : < br > * [ * C = O , null ] , [ * C - N , null ] , [ null , * C = O ] , [ null , * C - N ] . < br > * So the example would have this function produce eight mappings ( result list size = = 8 ) . * @ param rgpList * @ param listOffset * @ param distribution * @ param mapping * @ param result */ private void mapSubstitutes ( RGroupList rgpList , int listOffset , Integer [ ] distribution , RGroup [ ] mapping , List < List < RGroup > > result ) { } }
if ( listOffset == distribution . length ) { List < RGroup > mapped = new ArrayList < RGroup > ( ) ; for ( RGroup rgrp : mapping ) mapped . add ( rgrp ) ; result . add ( mapped ) ; } else { if ( distribution [ listOffset ] == 0 ) { mapping [ listOffset ] = null ; mapSubstitutes ( rgpList , listOffset + 1 , distribution , mapping , result ) ; } else { for ( RGroup rgrp : rgpList . getRGroups ( ) ) { mapping [ listOffset ] = rgrp ; mapSubstitutes ( rgpList , listOffset + 1 , distribution , mapping , result ) ; } } }
public class ApiOvhDedicatedCloud { /** * Change option user access properties * REST : POST / dedicatedCloud / { serviceName } / vmEncryption / kms / { kmsId } / changeProperties * @ param sslThumbprint [ required ] SSL thumbprint of the remote service , e . g . A7:61:68 : . . . : 61:91:2F * @ param description [ required ] Description of your option access network * @ param serviceName [ required ] Domain of the service * @ param kmsId [ required ] Id of the VM Encryption KMS */ public OvhTask serviceName_vmEncryption_kms_kmsId_changeProperties_POST ( String serviceName , Long kmsId , String description , String sslThumbprint ) throws IOException { } }
String qPath = "/dedicatedCloud/{serviceName}/vmEncryption/kms/{kmsId}/changeProperties" ; StringBuilder sb = path ( qPath , serviceName , kmsId ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "description" , description ) ; addBody ( o , "sslThumbprint" , sslThumbprint ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhTask . class ) ;
public class RebootManager { /** * Composes the given reboot message with the minutes and either the custom or standard details * about the pending reboot . */ protected String getRebootMessage ( String key , int minutes ) { } }
String msg = getCustomRebootMessage ( ) ; if ( StringUtil . isBlank ( msg ) ) { msg = "m.reboot_msg_standard" ; } return MessageBundle . compose ( key , MessageBundle . taint ( "" + minutes ) , msg ) ;
public class CommerceTaxFixedRateLocalServiceWrapper { /** * Returns the commerce tax fixed rate with the primary key . * @ param commerceTaxFixedRateId the primary key of the commerce tax fixed rate * @ return the commerce tax fixed rate * @ throws PortalException if a commerce tax fixed rate with the primary key could not be found */ @ Override public com . liferay . commerce . tax . engine . fixed . model . CommerceTaxFixedRate getCommerceTaxFixedRate ( long commerceTaxFixedRateId ) throws com . liferay . portal . kernel . exception . PortalException { } }
return _commerceTaxFixedRateLocalService . getCommerceTaxFixedRate ( commerceTaxFixedRateId ) ;
public class TreeRule { /** * Parses a string into a rule type enumerator * @ param type The string to parse * @ return The type enumerator * @ throws IllegalArgumentException if the type was empty or invalid */ public static TreeRuleType stringToType ( final String type ) { } }
if ( type == null || type . isEmpty ( ) ) { throw new IllegalArgumentException ( "Rule type was empty" ) ; } else if ( type . toLowerCase ( ) . equals ( "metric" ) ) { return TreeRuleType . METRIC ; } else if ( type . toLowerCase ( ) . equals ( "metric_custom" ) ) { return TreeRuleType . METRIC_CUSTOM ; } else if ( type . toLowerCase ( ) . equals ( "tagk" ) ) { return TreeRuleType . TAGK ; } else if ( type . toLowerCase ( ) . equals ( "tagk_custom" ) ) { return TreeRuleType . TAGK_CUSTOM ; } else if ( type . toLowerCase ( ) . equals ( "tagv_custom" ) ) { return TreeRuleType . TAGV_CUSTOM ; } else { throw new IllegalArgumentException ( "Unrecognized rule type" ) ; }
public class DataCenterFilter { /** * { @ inheritDoc } */ @ Override public DataCenterFilter and ( DataCenterFilter otherFilter ) { } }
notNull ( otherFilter , "Other filter must be not a null" ) ; return new DataCenterFilter ( getPredicate ( ) . and ( otherFilter . getPredicate ( ) ) ) ;
public class TcpIpNetworkingService { /** * Returns the respective endpoint manager based on the qualifier . * Under unified endpoint environments , this will return the respective view of the { @ link TcpIpUnifiedEndpointManager } * eg . { @ link MemberViewUnifiedEndpointManager } or { @ link ClientViewUnifiedEndpointManager } which report connections based * on the qualifier , but they register / create connection directly on the Unified manager . * @ param qualifier * @ return */ public EndpointManager < TcpIpConnection > getEndpointManager ( EndpointQualifier qualifier ) { } }
EndpointManager < TcpIpConnection > mgr = endpointManagers . get ( qualifier ) ; if ( mgr == null ) { logger . finest ( "An endpoint manager for qualifier " + qualifier + " was never registered." ) ; } return mgr ;
public class UnicodeFormatter { /** * 转换 & # 123 ; 这种编码为正常字符 * 有些手机会将中文转换成 & # 123 ; 这种编码 , 这个函数主要用来转换成正常字符 . * @ param str 待转换字符 * @ return String */ public static String decodeNetUnicodeString ( String str ) { } }
if ( Strings . isNullOrEmpty ( str ) ) return str ; Matcher m = NET_UNICODE_PATTERN . matcher ( str ) ; StringBuffer sb = new StringBuffer ( ) ; while ( m . find ( ) ) { String mcStr = m . group ( 1 ) ; int charValue = toInt ( mcStr , - 1 ) ; String s = charValue > 0 ? String . valueOf ( charValue ) : "" ; m . appendReplacement ( sb , Matcher . quoteReplacement ( s ) ) ; } m . appendTail ( sb ) ; return sb . toString ( ) ;
public class AbstractVectorModel { /** * 获取与向量最相似的词语 * @ param vector 向量 * @ param size topN个 * @ return 键值对列表 , 键是相似词语 , 值是相似度 , 按相似度降序排列 */ public List < Map . Entry < K , Float > > nearest ( Vector vector , int size ) { } }
MaxHeap < Map . Entry < K , Float > > maxHeap = new MaxHeap < Map . Entry < K , Float > > ( size , new Comparator < Map . Entry < K , Float > > ( ) { @ Override public int compare ( Map . Entry < K , Float > o1 , Map . Entry < K , Float > o2 ) { return o1 . getValue ( ) . compareTo ( o2 . getValue ( ) ) ; } } ) ; for ( Map . Entry < K , Vector > entry : storage . entrySet ( ) ) { maxHeap . add ( new AbstractMap . SimpleEntry < K , Float > ( entry . getKey ( ) , entry . getValue ( ) . cosineForUnitVector ( vector ) ) ) ; } return maxHeap . toList ( ) ;
public class SrvDatabase { /** * < p > Convert org . beigesoft . orm . model . ColumnsValues * to android . content . ContentValues . < / p > * @ param pColumnsVals Columns Values * @ param pIns if insert , update otherwise * @ return ContentValues */ public final ContentValues convertToContentValues ( final ColumnsValues pColumnsVals , final boolean pIns ) { } }
ContentValues contentValues = new ContentValues ( ) ; ColumnsValues cv = filterCv ( pColumnsVals , pIns ) ; for ( Map . Entry < String , Integer > entry : cv . getIntegersMap ( ) . entrySet ( ) ) { contentValues . put ( entry . getKey ( ) . toUpperCase ( ) , entry . getValue ( ) ) ; } for ( Map . Entry < String , Long > entry : cv . getLongsMap ( ) . entrySet ( ) ) { contentValues . put ( entry . getKey ( ) . toUpperCase ( ) , entry . getValue ( ) ) ; } for ( Map . Entry < String , Float > entry : cv . getFloatsMap ( ) . entrySet ( ) ) { contentValues . put ( entry . getKey ( ) . toUpperCase ( ) , entry . getValue ( ) ) ; } for ( Map . Entry < String , Double > entry : cv . getDoublesMap ( ) . entrySet ( ) ) { contentValues . put ( entry . getKey ( ) . toUpperCase ( ) , entry . getValue ( ) ) ; } for ( Map . Entry < String , String > entry : cv . getStringsMap ( ) . entrySet ( ) ) { contentValues . put ( entry . getKey ( ) . toUpperCase ( ) , entry . getValue ( ) ) ; } return contentValues ;
public class UUID { /** * 从一个 UU64 恢复回一个 UUID 对象 * @ param uu64 64进制表示的 UUID , 内容为 [ \ \ - 0-9a - zA - Z _ ] * @ return UUID 对象 */ public static java . util . UUID fromUU64 ( String uu64 ) { } }
String uu16 = UU16FromUU64 ( uu64 ) ; return java . util . UUID . fromString ( UU ( uu16 ) ) ;
public class RichTextUtil { /** * Rewrites all children / sub - tree of the given parent element . * For rewrite operations the given rewrite content handler is called . * @ param parent Parent element * @ param rewriteContentHandler Rewrite content handler */ public static void rewriteContent ( @ NotNull Element parent , @ NotNull RewriteContentHandler rewriteContentHandler ) { } }
// iterate through content list and build new content list List < Content > originalContent = parent . getContent ( ) ; List < Content > newContent = new ArrayList < Content > ( ) ; for ( Content contentElement : originalContent ) { // handle element if ( contentElement instanceof Element ) { Element element = ( Element ) contentElement ; // check if rewrite is needed for element List < Content > rewriteContent = rewriteContentHandler . rewriteElement ( element ) ; if ( rewriteContent != null ) { // element was removed if ( rewriteContent . isEmpty ( ) ) { // do not add to newContent } // element is the same - rewrite child elements else if ( rewriteContent . size ( ) == 1 && rewriteContent . get ( 0 ) == element ) { // NOPMD rewriteContent ( element , rewriteContentHandler ) ; newContent . add ( element ) ; } // element was replaced with other content - rewrite and add instead else { for ( Content newContentItem : rewriteContent ) { if ( newContentItem instanceof Element ) { Element newElement = ( Element ) newContentItem ; rewriteContent ( newElement , rewriteContentHandler ) ; } newContent . add ( newContentItem . clone ( ) ) ; } } } // nothing to rewrite - do nothing , but rewrite child element else { rewriteContent ( element , rewriteContentHandler ) ; newContent . add ( element ) ; } } // handle text node else if ( contentElement instanceof Text ) { Text text = ( Text ) contentElement ; // check if rewrite is needed for text node List < Content > rewriteContent = rewriteContentHandler . rewriteText ( text ) ; if ( rewriteContent != null ) { // element was removed if ( rewriteContent . isEmpty ( ) ) { // do not add to newContent } // element is the same - ignore else if ( rewriteContent . size ( ) == 1 && rewriteContent . get ( 0 ) == text ) { // NOPMD // add original element newContent . add ( text ) ; } // element was replaced with other content - add instead else { for ( Content newContentItem : rewriteContent ) { newContent . add ( newContentItem . clone ( ) ) ; } } } // nothing to rewrite - do nothing , but add original text element else { newContent . add ( text ) ; } } // unknown element - just add to new content else { newContent . add ( contentElement ) ; } } // replace original content with new content parent . removeContent ( ) ; parent . addContent ( newContent ) ;
public class CmsJspTagContainer { /** * Resets the tag instance and standard context state . < p > */ private void resetState ( ) { } }
// clear all members so the tag object may be reused m_type = null ; m_name = null ; m_param = null ; m_maxElements = null ; m_tag = null ; m_tagClass = null ; m_detailView = false ; m_detailOnly = false ; m_width = null ; m_editableBy = null ; m_bodyContent = null ; m_hasModelGroupAncestor = false ; // reset the current element CmsJspStandardContextBean cmsContext = CmsJspStandardContextBean . getInstance ( pageContext . getRequest ( ) ) ; cmsContext . setElement ( m_parentElement ) ; cmsContext . setContainer ( m_parentContainer ) ; m_parentElement = null ; m_parentContainer = null ;
public class TaxinvoiceServiceImp { /** * ( non - Javadoc ) * @ see com . popbill . api . TaxinvoiceService # getMailURL ( java . lang . String , com . popbill . api . taxinvoice . MgtKeyType , java . lang . String ) */ @ Override public String getMailURL ( String CorpNum , MgtKeyType KeyType , String MgtKey ) throws PopbillException { } }
if ( KeyType == null ) throw new PopbillException ( - 99999999 , "관리번호형태가 입력되지 않았습니다." ) ; if ( MgtKey == null || MgtKey . isEmpty ( ) ) throw new PopbillException ( - 99999999 , "관리번호가 입력되지 않았습니다." ) ; return getMailURL ( CorpNum , KeyType , MgtKey , null ) ;
public class PrimitiveCastExtensions { /** * Decodes a { @ code CharSequence } into a { @ code AtomicDouble } . * < p > In opposite to the functions of { @ link Double } , this function is * null - safe and does not generate a { @ link NumberFormatException } . * If the given string cannot by parsed , { @ code 0 } is replied . * < p > See { @ link # doubleValue ( CharSequence ) } for details on the accepted formats * for the input string of characters . * @ param value a value of { @ code CharSequence } type . * @ return the equivalent value to { @ code value } of { @ code AtomicDouble } type . * @ since 0.9 * @ see # doubleValue ( CharSequence ) */ @ Pure @ Inline ( value = "new $2($3.doubleValue($1))" , imported = { } }
AtomicDouble . class , PrimitiveCastExtensions . class } ) public static AtomicDouble toAtomicDouble ( CharSequence value ) { return new AtomicDouble ( doubleValue ( value ) ) ;
public class JobScheduleOperations { /** * Adds a job schedule to the Batch account . * @ param jobSchedule The job schedule to be added . * @ param additionalBehaviors A collection of { @ link BatchClientBehavior } instances that are applied to the Batch service request . * @ throws BatchErrorException Exception thrown when an error response is received from the Batch service . * @ throws IOException Exception thrown when there is an error in serialization / deserialization of data sent to / received from the Batch service . */ public void createJobSchedule ( JobScheduleAddParameter jobSchedule , Iterable < BatchClientBehavior > additionalBehaviors ) throws BatchErrorException , IOException { } }
JobScheduleAddOptions options = new JobScheduleAddOptions ( ) ; BehaviorManager bhMgr = new BehaviorManager ( this . customBehaviors ( ) , additionalBehaviors ) ; bhMgr . applyRequestBehaviors ( options ) ; this . parentBatchClient . protocolLayer ( ) . jobSchedules ( ) . add ( jobSchedule , options ) ;
public class StringContext { /** * Finds the index of the first occurrence of the given search string in * the source string , or - 1 if not found . * @ param str the source string * @ param search the string to search for * @ return the start index of the found string or - 1 if not found */ public int findFirst ( String str , String search ) { } }
return ( str == null || search == null ) ? - 1 : str . indexOf ( search ) ;
public class ListSigningPlatformsResult { /** * A list of all platforms that match the request parameters . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setPlatforms ( java . util . Collection ) } or { @ link # withPlatforms ( java . util . Collection ) } if you want to * override the existing values . * @ param platforms * A list of all platforms that match the request parameters . * @ return Returns a reference to this object so that method calls can be chained together . */ public ListSigningPlatformsResult withPlatforms ( SigningPlatform ... platforms ) { } }
if ( this . platforms == null ) { setPlatforms ( new java . util . ArrayList < SigningPlatform > ( platforms . length ) ) ; } for ( SigningPlatform ele : platforms ) { this . platforms . add ( ele ) ; } return this ;
public class EvaluationMarshaller { /** * Marshall the given parameter object . */ public void marshall ( Evaluation evaluation , ProtocolMarshaller protocolMarshaller ) { } }
if ( evaluation == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( evaluation . getEvaluationId ( ) , EVALUATIONID_BINDING ) ; protocolMarshaller . marshall ( evaluation . getMLModelId ( ) , MLMODELID_BINDING ) ; protocolMarshaller . marshall ( evaluation . getEvaluationDataSourceId ( ) , EVALUATIONDATASOURCEID_BINDING ) ; protocolMarshaller . marshall ( evaluation . getInputDataLocationS3 ( ) , INPUTDATALOCATIONS3_BINDING ) ; protocolMarshaller . marshall ( evaluation . getCreatedByIamUser ( ) , CREATEDBYIAMUSER_BINDING ) ; protocolMarshaller . marshall ( evaluation . getCreatedAt ( ) , CREATEDAT_BINDING ) ; protocolMarshaller . marshall ( evaluation . getLastUpdatedAt ( ) , LASTUPDATEDAT_BINDING ) ; protocolMarshaller . marshall ( evaluation . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( evaluation . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( evaluation . getPerformanceMetrics ( ) , PERFORMANCEMETRICS_BINDING ) ; protocolMarshaller . marshall ( evaluation . getMessage ( ) , MESSAGE_BINDING ) ; protocolMarshaller . marshall ( evaluation . getComputeTime ( ) , COMPUTETIME_BINDING ) ; protocolMarshaller . marshall ( evaluation . getFinishedAt ( ) , FINISHEDAT_BINDING ) ; protocolMarshaller . marshall ( evaluation . getStartedAt ( ) , STARTEDAT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Javalin { /** * Adds a lambda handler for a Server Sent Event connection on the specified path . */ public Javalin sse ( @ NotNull String path , @ NotNull Consumer < SseClient > client ) { } }
return sse ( path , client , new HashSet < > ( ) ) ;
public class PyCodeBuilder { /** * Add a single PyExpr object to the output variable . */ void addToOutputVar ( PyExpr pyExpr ) { } }
boolean isList = pyExpr instanceof PyListExpr ; if ( isList && ! getOutputVarIsInited ( ) ) { appendLine ( getOutputVarName ( ) , " = " , pyExpr . getText ( ) ) ; } else { initOutputVarIfNecessary ( ) ; String function = isList ? ".extend(" : ".append(" ; appendLine ( getOutputVarName ( ) , function , pyExpr . getText ( ) , ")" ) ; } setOutputVarInited ( ) ;
public class NorthArrowGraphic { /** * Renders a given graphic into a new image , scaled to fit the new size and rotated . */ private static URI createRaster ( final Dimension targetSize , final RasterReference rasterReference , final Double rotation , final Color backgroundColor , final File workingDir ) throws IOException { } }
final File path = File . createTempFile ( "north-arrow-" , ".png" , workingDir ) ; final BufferedImage newImage = new BufferedImage ( targetSize . width , targetSize . height , BufferedImage . TYPE_4BYTE_ABGR ) ; final Graphics2D graphics2d = newImage . createGraphics ( ) ; try { final BufferedImage originalImage = ImageIO . read ( rasterReference . inputStream ) ; if ( originalImage == null ) { LOGGER . warn ( "Unable to load NorthArrow graphic: {}, it is not an image format that can be " + "decoded" , rasterReference . uri ) ; throw new IllegalArgumentException ( ) ; } // set background color graphics2d . setColor ( backgroundColor ) ; graphics2d . fillRect ( 0 , 0 , targetSize . width , targetSize . height ) ; // scale the original image to fit the new size int newWidth ; int newHeight ; if ( originalImage . getWidth ( ) > originalImage . getHeight ( ) ) { newWidth = targetSize . width ; newHeight = Math . min ( targetSize . height , ( int ) Math . ceil ( newWidth / ( originalImage . getWidth ( ) / ( double ) originalImage . getHeight ( ) ) ) ) ; } else { newHeight = targetSize . height ; newWidth = Math . min ( targetSize . width , ( int ) Math . ceil ( newHeight / ( originalImage . getHeight ( ) / ( double ) originalImage . getWidth ( ) ) ) ) ; } // position the original image in the center of the new int deltaX = ( int ) Math . floor ( ( targetSize . width - newWidth ) / 2.0 ) ; int deltaY = ( int ) Math . floor ( ( targetSize . height - newHeight ) / 2.0 ) ; if ( ! FloatingPointUtil . equals ( rotation , 0.0 ) ) { final AffineTransform rotate = AffineTransform . getRotateInstance ( rotation , targetSize . width / 2.0 , targetSize . height / 2.0 ) ; graphics2d . setTransform ( rotate ) ; } graphics2d . setRenderingHint ( RenderingHints . KEY_INTERPOLATION , RenderingHints . VALUE_INTERPOLATION_BICUBIC ) ; graphics2d . drawImage ( originalImage , deltaX , deltaY , newWidth , newHeight , null ) ; ImageUtils . writeImage ( newImage , "png" , path ) ; } finally { graphics2d . dispose ( ) ; } return path . toURI ( ) ;