signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class SimpleTemplateManager { protected String evaluate ( String templateText , Object pmb ) { } }
final Node node = analyze ( filterTemplateText ( templateText , pmb ) ) ; final CommandContext ctx = prepareContext ( pmb ) ; node . accept ( ctx ) ; return ctx . getSql ( ) ;
public class Bigram { /** * 含有语境的二元模型分值算法 * 计算多种分词结果的分值 * 利用获得的二元模型分值重新计算分词结果的分值 * 补偿细粒度切分获得分值而粗粒度切分未获得分值的情况 * @ param sentences 多种分词结果 * @ return 分词结果及其对应的分值 */ public static Map < List < Word > , Float > bigram ( List < Word > ... sentences ) { } }
Map < List < Word > , Float > map = new HashMap < > ( ) ; Map < String , Float > bigramScores = new HashMap < > ( ) ; // 两个连续的bigram补偿粗粒度分值 // 如 : 美国 , 加州 , 大学 , 如果美国 , 加州和加州 , 大学有分值 // 则美国加州大学也会获得分值 Map < String , Float > twoBigramScores = new HashMap < > ( ) ; // 1 、 计算多种分词结果的分值 for ( List < Word > sentence : sentences ) { if ( map . get ( sentence ) != null ) { continue ; } float score = 0 ; // 计算其中一种分词结果的分值 if ( sentence . size ( ) > 1 ) { String last = "" ; for ( int i = 0 ; i < sentence . size ( ) - 1 ; i ++ ) { String first = sentence . get ( i ) . getText ( ) ; String second = sentence . get ( i + 1 ) . getText ( ) ; float bigramScore = getScore ( first , second ) ; if ( bigramScore > 0 ) { if ( last . endsWith ( first ) ) { twoBigramScores . put ( last + second , bigramScores . get ( last ) + bigramScore ) ; last = "" ; } last = first + second ; bigramScores . put ( last , bigramScore ) ; score += bigramScore ; } } } map . put ( sentence , score ) ; } // 2 、 利用获得的二元模型分值重新计算分词结果的分值 // 补偿细粒度切分获得分值而粗粒度切分未获得分值的情况 // 计算多种分词结果的分值 if ( bigramScores . size ( ) > 0 || twoBigramScores . size ( ) > 0 ) { for ( List < Word > sentence : map . keySet ( ) ) { // 计算其中一种分词结果的分值 for ( Word word : sentence ) { Float bigramScore = bigramScores . get ( word . getText ( ) ) ; Float twoBigramScore = twoBigramScores . get ( word . getText ( ) ) ; Float [ ] array = { bigramScore , twoBigramScore } ; for ( Float score : array ) { if ( score != null && score > 0 ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( word . getText ( ) + " 获得分值:" + score ) ; } float value = map . get ( sentence ) ; value += score ; map . put ( sentence , value ) ; } } } } } return map ;
public class BindTypeSubProcessor { /** * Generate classes . * @ throws IOException Signals that an I / O exception has occurred . */ private void generateClasses ( ) throws IOException { } }
for ( BindEntity entity : model . getEntities ( ) ) { final BindEntity item = entity ; BindTypeBuilder . generate ( filer , item ) ; }
public class LogNormalDistributionTypeImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eSet ( int featureID , Object newValue ) { } }
switch ( featureID ) { case BpsimPackage . LOG_NORMAL_DISTRIBUTION_TYPE__MEAN : setMean ( ( Double ) newValue ) ; return ; case BpsimPackage . LOG_NORMAL_DISTRIBUTION_TYPE__STANDARD_DEVIATION : setStandardDeviation ( ( Double ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ;
public class TargetHttpsProxyClient { /** * Replaces SslCertificates for TargetHttpsProxy . * < p > Sample code : * < pre > < code > * try ( TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient . create ( ) ) { * ProjectTargetHttpsProxyName targetHttpsProxy = ProjectTargetHttpsProxyName . of ( " [ PROJECT ] " , " [ TARGET _ HTTPS _ PROXY ] " ) ; * TargetHttpsProxiesSetSslCertificatesRequest targetHttpsProxiesSetSslCertificatesRequestResource = TargetHttpsProxiesSetSslCertificatesRequest . newBuilder ( ) . build ( ) ; * Operation response = targetHttpsProxyClient . setSslCertificatesTargetHttpsProxy ( targetHttpsProxy . toString ( ) , targetHttpsProxiesSetSslCertificatesRequestResource ) ; * < / code > < / pre > * @ param targetHttpsProxy Name of the TargetHttpsProxy resource to set an SslCertificates * resource for . * @ param targetHttpsProxiesSetSslCertificatesRequestResource * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final Operation setSslCertificatesTargetHttpsProxy ( String targetHttpsProxy , TargetHttpsProxiesSetSslCertificatesRequest targetHttpsProxiesSetSslCertificatesRequestResource ) { } }
SetSslCertificatesTargetHttpsProxyHttpRequest request = SetSslCertificatesTargetHttpsProxyHttpRequest . newBuilder ( ) . setTargetHttpsProxy ( targetHttpsProxy ) . setTargetHttpsProxiesSetSslCertificatesRequestResource ( targetHttpsProxiesSetSslCertificatesRequestResource ) . build ( ) ; return setSslCertificatesTargetHttpsProxy ( request ) ;
public class ObjectSerializableCodec { /** * Encodes the object to bytes . * @ param obj the object * @ return bytes * @ throws RemoteRuntimeException */ @ Override public byte [ ] encode ( final T obj ) { } }
try ( final ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; final ObjectOutputStream out = new ObjectOutputStream ( bos ) ) { out . writeObject ( obj ) ; return bos . toByteArray ( ) ; } catch ( final IOException ex ) { throw new RemoteRuntimeException ( ex ) ; }
public class Parameters { /** * Gets a parameter ' s value . * @ param name The parameter name . * @ return The parameter value . */ public Object getValue ( @ NonNull String name ) { } }
if ( name == null ) { throw new IllegalArgumentException ( "name cannot be null." ) ; } return map . get ( name ) ;
public class CmsSourceSearchForm { /** * Initializes the form with the given settings . < p > * @ param settings the settings */ public void initFormValues ( CmsSearchReplaceSettings settings ) { } }
m_siteSelect . setValue ( settings . getSiteRoot ( ) ) ; m_ignoreSubSites . setValue ( new Boolean ( settings . ignoreSubSites ( ) ) ) ; m_searchType . setValue ( settings . getType ( ) ) ; if ( ! settings . getPaths ( ) . isEmpty ( ) ) { m_searchRoot . setValue ( settings . getPaths ( ) . get ( 0 ) ) ; } if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( settings . getTypes ( ) ) ) { try { I_CmsResourceType type = OpenCms . getResourceManager ( ) . getResourceType ( settings . getTypes ( ) ) ; m_resourceType . setValue ( type ) ; } catch ( CmsLoaderException e ) { // nothing to do , skip setting the type } } m_searchPattern . setValue ( settings . getSearchpattern ( ) ) ; m_ignoreSubSites . setValue ( new Boolean ( settings . ignoreSubSites ( ) ) ) ; if ( settings . getType ( ) . isContentValuesOnly ( ) ) { if ( settings . getLocale ( ) != null ) { m_locale . setValue ( settings . getLocale ( ) ) ; } m_xPath . setValue ( settings . getXpath ( ) ) ; } if ( settings . getType ( ) . isSolrSearch ( ) ) { m_solrQuery . setValue ( settings . getQuery ( ) ) ; m_searchIndex . setValue ( settings . getSource ( ) ) ; } if ( settings . getType ( ) . isPropertySearch ( ) ) { m_property . select ( settings . getProperty ( ) ) ; } if ( settings . getType ( ) . equals ( SearchType . resourcetype ) ) { try { CmsObject cms = OpenCms . initCmsObject ( A_CmsUI . getCmsObject ( ) ) ; cms . getRequestContext ( ) . setSiteRoot ( "" ) ; m_resourceSearch . setValue ( cms . readResource ( new CmsUUID ( settings . getSearchpattern ( ) . substring ( settings . getSearchpattern ( ) . indexOf ( "<uuid>" ) + 6 , settings . getSearchpattern ( ) . indexOf ( "</uuid>" ) ) ) ) . getRootPath ( ) ) ; } catch ( CmsException e ) { LOG . error ( "Unable to read resource" , e ) ; } }
public class DocumentAbstract { /** * region > id ( programmatic , for comparison ) */ @ Programmatic public String getId ( ) { } }
Object objectId = JDOHelper . getObjectId ( this ) ; if ( objectId == null ) { return "" ; } String objectIdStr = objectId . toString ( ) ; final String id = objectIdStr . split ( "\\[OID\\]" ) [ 0 ] ; return id ;
public class Rollbar { /** * Remove any person data that might be set . */ public void clearPersonData ( ) { } }
this . rollbar . configure ( new ConfigProvider ( ) { @ Override public Config provide ( ConfigBuilder builder ) { return builder . person ( null ) . build ( ) ; } } ) ;
public class Variables { /** * Set a variable in the top variables layer to given " collection " of the vertex frames . Can ' t be reassigned - * throws on attempt to reassign . */ public void setVariable ( String name , Iterable < ? extends WindupVertexFrame > frames ) { } }
Map < String , Iterable < ? extends WindupVertexFrame > > frame = peek ( ) ; if ( ! Iteration . DEFAULT_VARIABLE_LIST_STRING . equals ( name ) && findVariable ( name ) != null ) { throw new IllegalArgumentException ( "Variable \"" + name + "\" has already been assigned and cannot be reassigned" ) ; } frame . put ( name , frames ) ;
public class Signatures { /** * Returns a JVMS 4.3.3 method descriptor . */ public static String descriptor ( Type type , Types types ) { } }
SigGen sig = new SigGen ( types ) ; sig . assembleSig ( types . erasure ( type ) ) ; return sig . toString ( ) ;
public class TrieNode { /** * Godparent trie node . * @ return the trie node */ public TrieNode godparent ( ) { } }
if ( 0 == getDepth ( ) ) return null ; TrieNode root = trie . root ( ) ; if ( 1 == getDepth ( ) ) return root ; if ( null != trie . godparentIndex && trie . godparentIndex . length > index ) { int godparentIndex = trie . godparentIndex [ this . index ] ; if ( godparentIndex >= 0 ) { return newNode ( godparentIndex ) ; } } TrieNode parent = this . getParent ( ) ; TrieNode godparent ; if ( null == parent ) { godparent = root ; } else { TrieNode greatgodparent = parent . godparent ( ) ; if ( null == greatgodparent ) { godparent = root ; } else { godparent = greatgodparent . getChild ( getChar ( ) ) . map ( x -> ( TrieNode ) x ) . orElseGet ( ( ) -> root ) ; } // assert ( getString ( ) . isEmpty ( ) | | getString ( ) . substring ( 1 ) . equals ( godparent . getString ( ) ) ) ; } if ( null != godparent && null != trie . godparentIndex && trie . godparentIndex . length > index ) { trie . godparentIndex [ this . index ] = godparent . index ; } return godparent ;
public class FlowRunner { /** * Recursively propagate status to parent flow . Alert on first error of the flow in new AZ * dispatching design . * @ param base the base flow * @ param status the status to be propagated */ private void propagateStatusAndAlert ( final ExecutableFlowBase base , final Status status ) { } }
if ( ! Status . isStatusFinished ( base . getStatus ( ) ) && base . getStatus ( ) != Status . KILLING ) { this . logger . info ( "Setting " + base . getNestedId ( ) + " to " + status ) ; boolean shouldAlert = false ; if ( base . getStatus ( ) != status ) { base . setStatus ( status ) ; shouldAlert = true ; } if ( base . getParentFlow ( ) != null ) { propagateStatusAndAlert ( base . getParentFlow ( ) , status ) ; } else if ( this . azkabanProps . getBoolean ( ConfigurationKeys . AZKABAN_POLL_MODEL , false ) ) { // Alert on the root flow if the first error is encountered . // Todo jamiesjc : Add a new FLOW _ STATUS _ CHANGED event type and alert on that event . if ( shouldAlert && base . getStatus ( ) == Status . FAILED_FINISHING ) { ExecutionControllerUtils . alertUserOnFirstError ( ( ExecutableFlow ) base , this . alerterHolder ) ; } } }
public class ManagedBackupShortTermRetentionPoliciesInner { /** * Updates a managed database ' s short term retention policy . * @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal . * @ param managedInstanceName The name of the managed instance . * @ param databaseName The name of the database . * @ param retentionDays The backup retention period in days . This is how many days Point - in - Time Restore will be supported . * @ 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 < ManagedBackupShortTermRetentionPolicyInner > updateAsync ( String resourceGroupName , String managedInstanceName , String databaseName , Integer retentionDays , final ServiceCallback < ManagedBackupShortTermRetentionPolicyInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( updateWithServiceResponseAsync ( resourceGroupName , managedInstanceName , databaseName , retentionDays ) , serviceCallback ) ;
public class OffsetDateTime { /** * Gets the value of the specified field from this date - time as an { @ code int } . * This queries this date - time for the value of the specified field . * The returned value will always be within the valid range of values for the field . * If it is not possible to return the value , because the field is not supported * or for some other reason , an exception is thrown . * If the field is a { @ link ChronoField } then the query is implemented here . * The { @ link # isSupported ( TemporalField ) supported fields } will return valid * values based on this date - time , except { @ code NANO _ OF _ DAY } , { @ code MICRO _ OF _ DAY } , * { @ code EPOCH _ DAY } , { @ code PROLEPTIC _ MONTH } and { @ code INSTANT _ SECONDS } which are too * large to fit in an { @ code int } and throw a { @ code DateTimeException } . * All other { @ code ChronoField } instances will throw an { @ code UnsupportedTemporalTypeException } . * If the field is not a { @ code ChronoField } , then the result of this method * is obtained by invoking { @ code TemporalField . getFrom ( TemporalAccessor ) } * passing { @ code this } as the argument . Whether the value can be obtained , * and what the value represents , is determined by the field . * @ param field the field to get , not null * @ return the value for the field * @ throws DateTimeException if a value for the field cannot be obtained or * the value is outside the range of valid values for the field * @ throws UnsupportedTemporalTypeException if the field is not supported or * the range of values exceeds an { @ code int } * @ throws ArithmeticException if numeric overflow occurs */ @ Override public int get ( TemporalField field ) { } }
if ( field instanceof ChronoField ) { switch ( ( ChronoField ) field ) { case INSTANT_SECONDS : throw new UnsupportedTemporalTypeException ( "Invalid field 'InstantSeconds' for get() method, use getLong() instead" ) ; case OFFSET_SECONDS : return getOffset ( ) . getTotalSeconds ( ) ; } return dateTime . get ( field ) ; } return Temporal . super . get ( field ) ;
public class Webb { /** * Set the value for a named header which is valid for all requests created by this instance . * < br > * The value takes precedence over { @ link Webb # setGlobalHeader ( String , Object ) } but can be overwritten by * { @ link com . goebl . david . Request # header ( String , Object ) } . * < br > * For the supported types for values see { @ link Request # header ( String , Object ) } . * @ param name name of the header ( regarding HTTP it is not case - sensitive , but here case is important ) . * @ param value value of the header . If < code > null < / code > the header value is cleared ( effectively not set ) . * When setting the value to null , a value from global headers can shine through . * @ see # setGlobalHeader ( String , Object ) * @ see com . goebl . david . Request # header ( String , Object ) */ public void setDefaultHeader ( String name , Object value ) { } }
if ( defaultHeaders == null ) { defaultHeaders = new HashMap < String , Object > ( ) ; } if ( value == null ) { defaultHeaders . remove ( name ) ; } else { defaultHeaders . put ( name , value ) ; }
public class AccountHeaderBuilder { /** * helper method to build and set the drawer selection list */ protected void buildDrawerSelectionList ( ) { } }
int selectedPosition = - 1 ; int position = 0 ; ArrayList < IDrawerItem > profileDrawerItems = new ArrayList < > ( ) ; if ( mProfiles != null ) { for ( IProfile profile : mProfiles ) { if ( profile == mCurrentProfile ) { if ( mCurrentHiddenInList ) { continue ; } else { selectedPosition = mDrawer . mDrawerBuilder . getItemAdapter ( ) . getGlobalPosition ( position ) ; } } if ( profile instanceof IDrawerItem ) { ( ( IDrawerItem ) profile ) . withSetSelected ( false ) ; profileDrawerItems . add ( ( IDrawerItem ) profile ) ; } position = position + 1 ; } } mDrawer . switchDrawerContent ( onDrawerItemClickListener , onDrawerItemLongClickListener , profileDrawerItems , selectedPosition ) ;
public class Op { /** * Creates an array with the specified elements and an < i > operation expression < / i > on it . * @ param elements the elements of the array being created * @ return an operator , ready for chaining */ public static < T > Level0ArrayOperator < Float [ ] , Float > onArrayFor ( final Float ... elements ) { } }
return onArrayOf ( Types . FLOAT , VarArgsUtil . asRequiredObjectArray ( elements ) ) ;
public class JsJmsMessageImpl { /** * getJMSXGroupSeq * Return the value of the JMSXGroupSeq property if it exists . * We can return it as object , as that is all JMS API wants . Actually it only * really cares whether it exists , but we ' ll return Object rather than * changing the callng code unnecessarily . * Javadoc description supplied by JsJmsMessage interface . */ @ Override public Object getJMSXGroupSeq ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getJMSXGroupSeq" ) ; Object result = null ; if ( mayHaveMappedJmsSystemProperties ( ) ) { result = getObjectProperty ( SIProperties . JMSXGroupSeq ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getJMSXGroupSeq" , result ) ; return result ;
public class FunctionLibFactory { /** * Geerbte Methode von org . xml . sax . ContentHandler , wird bei durchparsen des XML , beim Auftreten * eines Start - Tag aufgerufen . * @ see org . xml . sax . ContentHandler # startElement ( String , String , String , Attributes ) */ @ Override public void startElement ( String uri , String name , String qName , Attributes atts ) { } }
// Start Function inside = qName ; this . attributes = atts ; if ( qName . equals ( "function" ) ) startFunction ( ) ; else if ( qName . equals ( "argument" ) ) startArg ( ) ; else if ( qName . equals ( "return" ) ) startReturn ( ) ; else if ( qName . equals ( "bundle" ) ) startBundle ( ) ;
public class CoverageDataCore { /** * Get the unsigned pixel values . The values saved as " unsigned shorts " in * the short array is returned as an integer which stores the positive 16 * bit value * @ param pixelValues * pixel values as " unsigned shorts " * @ return unsigned 16 bit pixel values as an integer array */ public int [ ] getUnsignedPixelValues ( short [ ] pixelValues ) { } }
int [ ] unsignedValues = new int [ pixelValues . length ] ; for ( int i = 0 ; i < pixelValues . length ; i ++ ) { unsignedValues [ i ] = getUnsignedPixelValue ( pixelValues [ i ] ) ; } return unsignedValues ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcRelAssociatesMaterial ( ) { } }
if ( ifcRelAssociatesMaterialEClass == null ) { ifcRelAssociatesMaterialEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 454 ) ; } return ifcRelAssociatesMaterialEClass ;
public class OracleDatabase { /** * { @ inheritDoc } */ @ Override protected boolean check4NullValues ( final Connection _con , final String _tableName , final String _columnName ) throws SQLException { } }
boolean ret = true ; final StringBuilder cmd = new StringBuilder ( ) ; cmd . append ( "select count(*) from " ) . append ( getTableQuote ( ) ) . append ( _tableName ) . append ( getTableQuote ( ) ) . append ( " where " ) . append ( getColumnQuote ( ) ) . append ( _columnName ) . append ( getColumnQuote ( ) ) . append ( " is null" ) ; OracleDatabase . LOG . debug ( " ..SQL> {}" , cmd ) ; final Statement stmt = _con . createStatement ( ) ; ResultSet rs = null ; try { rs = stmt . executeQuery ( cmd . toString ( ) ) ; rs . next ( ) ; ret = rs . getInt ( 1 ) > 0 ; } finally { if ( rs != null ) { rs . close ( ) ; } stmt . close ( ) ; } return ret ;
public class KiteConnect { /** * Retrieve an individual sip . * @ param sipId is the id of a particular sip . * @ return MFSIP object which contains all the details of the sip . * @ throws KiteException is thrown for all Kite trade related errors . * @ throws IOException is thrown when there is connection related error . */ public MFSIP getMFSIP ( String sipId ) throws KiteException , IOException , JSONException { } }
JSONObject response = new KiteRequestHandler ( proxy ) . getRequest ( routes . get ( "mutualfunds.sip" ) . replace ( ":sip_id" , sipId ) , apiKey , accessToken ) ; return gson . fromJson ( response . get ( "data" ) . toString ( ) , MFSIP . class ) ;
public class XMLEmitter { /** * Text node . * @ param sText * The contained text * @ param bEscape * If < code > true < / code > the text should be XML masked ( the default ) , * < code > false < / code > if not . The < code > false < / code > case is especially * interesting for HTML inline JS and CSS code . */ public void onText ( @ Nullable final String sText , final boolean bEscape ) { } }
if ( bEscape ) _appendMasked ( EXMLCharMode . TEXT , sText ) ; else _append ( sText ) ;
public class TextComponent { /** * Creates a text component by applying configuration from { @ code consumer } . * @ param consumer the builder configurator * @ return the text component */ public static TextComponent make ( final @ NonNull Consumer < Builder > consumer ) { } }
final Builder builder = builder ( ) ; consumer . accept ( builder ) ; return builder . build ( ) ;
public class CmsRenameImages { /** * Performs the rename images operation . < p > * @ return true , if the resources were successfully renamed , otherwise false * @ throws CmsException if renaming is not successful */ protected boolean performDialogOperation ( ) throws CmsException { } }
// display " please wait " screen before renaming the images if ( ! DIALOG_WAIT . equals ( getParamAction ( ) ) ) { // return false , this will trigger the " please wait " screen return false ; } // lock the image gallery folder checkLock ( getParamResource ( ) ) ; // get all image resources of the folder int imageId = OpenCms . getResourceManager ( ) . getResourceType ( CmsResourceTypeImage . getStaticTypeName ( ) ) . getTypeId ( ) ; CmsResourceFilter filter = CmsResourceFilter . IGNORE_EXPIRATION . addRequireType ( imageId ) ; List < CmsResource > images = getCms ( ) . readResources ( getParamResource ( ) , filter , false ) ; // determine start count int count = 1 ; try { count = Integer . parseInt ( getParamStartcount ( ) ) ; } catch ( Exception e ) { // ignore this exception } // create number printer instance PrintfFormat numberFormat = new PrintfFormat ( "%0." + getParamPlaces ( ) + "d" ) ; // create image galler folder name String folder = getParamResource ( ) ; if ( ! folder . endsWith ( "/" ) ) { folder += "/" ; } Iterator < CmsResource > i = images . iterator ( ) ; // loop over all image resource to change while ( i . hasNext ( ) ) { CmsResource res = i . next ( ) ; String oldName = CmsResource . getName ( res . getRootPath ( ) ) ; CmsProperty titleProperty = getCms ( ) . readPropertyObject ( res , CmsPropertyDefinition . PROPERTY_TITLE , false ) ; String oldTitle = titleProperty . getValue ( ) ; // store image name suffix int lastDot = oldName . lastIndexOf ( '.' ) ; String suffix = "" ; String oldNameWithoutSuffix = oldName ; if ( lastDot > - 1 ) { suffix = oldName . substring ( lastDot ) ; oldNameWithoutSuffix = oldName . substring ( 0 , lastDot ) ; } // determine new image name String newName = "" ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( getParamPrefix ( ) ) && ! "null" . equals ( getParamPrefix ( ) ) ) { newName += getParamPrefix ( ) ; } // create image number String imageNumber = numberFormat . sprintf ( count ) ; newName += imageNumber + suffix ; if ( ! newName . equals ( oldName ) ) { // only rename resources which have a new resource name if ( getCms ( ) . existsResource ( folder + newName , CmsResourceFilter . ALL ) ) { // target resource exists , interrupt & show error throw new CmsException ( Messages . get ( ) . container ( Messages . ERR_MOVE_FAILED_TARGET_EXISTS_2 , getCms ( ) . getSitePath ( res ) , folder + newName ) ) ; } // determine the new title property value if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( oldTitle ) ) { if ( oldTitle . equals ( oldNameWithoutSuffix ) ) { if ( Boolean . valueOf ( getParamRemovetitle ( ) ) . booleanValue ( ) ) { // remove the title property value if ( oldTitle . equals ( titleProperty . getStructureValue ( ) ) ) { titleProperty . setStructureValue ( CmsProperty . DELETE_VALUE ) ; } if ( oldTitle . equals ( titleProperty . getResourceValue ( ) ) ) { titleProperty . setResourceValue ( CmsProperty . DELETE_VALUE ) ; } } else { // set the title property to the new resource name if ( oldTitle . equals ( titleProperty . getStructureValue ( ) ) ) { titleProperty . setStructureValue ( getParamPrefix ( ) + imageNumber ) ; } else if ( oldTitle . equals ( titleProperty . getResourceValue ( ) ) ) { titleProperty . setResourceValue ( getParamPrefix ( ) + imageNumber ) ; } } // write changed title property getCms ( ) . writePropertyObject ( getCms ( ) . getSitePath ( res ) , titleProperty ) ; } } // now rename the resource getCms ( ) . renameResource ( folder + oldName , folder + newName ) ; } // increase image counter count ++ ; } return true ;
public class SQLParser { /** * Parse ECHOERROR statement for sqlcmd . * The result will be " " if the user just typed ECHOERROR . * @ param statement statement to parse * @ return Argument text or NULL if statement wasn ' t recognized */ public static String parseEchoErrorStatement ( String statement ) { } }
Matcher matcher = EchoErrorToken . matcher ( statement ) ; if ( matcher . matches ( ) ) { String commandWordTerminator = matcher . group ( 1 ) ; if ( OneWhitespace . matcher ( commandWordTerminator ) . matches ( ) ) { return matcher . group ( 2 ) ; } return "" ; } return null ;
public class DocumentElement { /** * getter for y - gets * @ generated * @ return value of the feature */ public float getY ( ) { } }
if ( DocumentElement_Type . featOkTst && ( ( DocumentElement_Type ) jcasType ) . casFeat_y == null ) jcasType . jcas . throwFeatMissing ( "y" , "ch.epfl.bbp.uima.types.DocumentElement" ) ; return jcasType . ll_cas . ll_getFloatValue ( addr , ( ( DocumentElement_Type ) jcasType ) . casFeatCode_y ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link String } { @ code > } } */ @ XmlElementDecl ( namespace = "http://www.drugbank.ca" , name = "gene-symbol" , scope = SnpAdverseDrugReactionType . class ) public JAXBElement < String > createSnpAdverseDrugReactionTypeGeneSymbol ( String value ) { } }
return new JAXBElement < String > ( _SnpAdverseDrugReactionTypeGeneSymbol_QNAME , String . class , SnpAdverseDrugReactionType . class , value ) ;
public class ShardedRedisCounter { /** * { @ inheritDoc } */ @ Override protected DataPoint [ ] getAllInRange ( long timestampStartMs , long timestampEndMs ) { } }
SortedSet < DataPoint > result = new TreeSet < DataPoint > ( new Comparator < DataPoint > ( ) { @ Override public int compare ( DataPoint block1 , DataPoint block2 ) { return Longs . compare ( block1 . timestamp ( ) , block2 . timestamp ( ) ) ; } } ) ; long keyStart = toTimeSeriesPoint ( timestampStartMs ) ; long keyEnd = toTimeSeriesPoint ( timestampEndMs ) ; if ( keyEnd == timestampStartMs ) { keyEnd = toTimeSeriesPoint ( timestampEndMs - 1 ) ; } // build list of Redis map & field names List < Long > keys = new ArrayList < Long > ( ) ; List < String > mapNames = new ArrayList < String > ( ) ; List < String > fieldNames = new ArrayList < String > ( ) ; String _name = getName ( ) ; for ( long timestamp = keyStart , _end = keyEnd ; timestamp <= _end ; timestamp += RESOLUTION_MS ) { long bucketOffset = toTimeSeriesPoint ( timestamp ) ; long delta = bucketOffset % ( RESOLUTION_MS * BUCKET_SIZE ) ; long bucketId = bucketOffset - delta ; long [ ] bucket = { bucketId , bucketOffset } ; keys . add ( bucketOffset ) ; String redisKey = _name + ":" + bucket [ 0 ] ; String redisField = String . valueOf ( bucket [ 1 ] ) ; mapNames . add ( redisKey ) ; fieldNames . add ( redisField ) ; } // use pipeline to get all data points at once try ( ShardedJedis jedis = getJedis ( ) ) { ShardedJedisPipeline p = jedis . pipelined ( ) ; for ( int i = 0 , n = mapNames . size ( ) ; i < n ; i ++ ) { String mapName = mapNames . get ( i ) ; String fieldName = fieldNames . get ( i ) ; p . hget ( mapName , fieldName ) ; } List < ? > _pointValues = p . syncAndReturnAll ( ) ; for ( int i = 0 , n = keys . size ( ) ; i < n ; i ++ ) { Long _key = keys . get ( i ) ; Long _value = null ; try { _value = Long . parseLong ( _pointValues . get ( i ) . toString ( ) ) ; } catch ( Exception e ) { _value = null ; } DataPoint dp = _value != null ? new DataPoint ( Type . SUM , _key . longValue ( ) , _value . longValue ( ) , RESOLUTION_MS ) : new DataPoint ( Type . NONE , _key . longValue ( ) , 0 , RESOLUTION_MS ) ; result . add ( dp ) ; } } return result . toArray ( DataPoint . EMPTY_ARR ) ;
public class Statistics { /** * A utility method that calculates the difference of the time * between the given < code > startInMillis < / code > and { @ link System # currentTimeMillis ( ) } * and registers the difference via { @ link # register ( long ) } for the probe of the given { @ link StatsType } . * @ param statsType the specific execution type that is measured . * @ param startInMillis the time in millis that shall be subtracted from { @ link System # currentTimeMillis ( ) } . */ public void registerSince ( @ Nonnull final StatsType statsType , final long startInMillis ) { } }
register ( statsType , System . currentTimeMillis ( ) - startInMillis ) ;
public class Interval { /** * Returns a JSON representation of this interval to send to the server . * Used by the SDK internally . * @ return a JSON representation of this interval */ public ObjectNode toJson ( ) { } }
ObjectMapper mapper = new ObjectMapper ( ) ; ObjectNode node = mapper . createObjectNode ( ) ; ObjectNode unitIntervalNode = mapper . createObjectNode ( ) ; node . put ( intervalUnit . getUnitNodeName ( ) , unitIntervalNode ) ; unitIntervalNode . put ( "interval" , buildIntervalNode ( ) ) ; unitIntervalNode . put ( "aggregationType" , intervalUnit . name ( ) ) ; return node ;
public class JerseyEmoResource { /** * Returns an EmoClientException with a thin wrapper around the Jersey exception response . */ private EmoClientException asEmoClientException ( UniformInterfaceException e ) throws EmoClientException { } }
throw new EmoClientException ( e . getMessage ( ) , e , toEmoResponse ( e . getResponse ( ) ) ) ;
public class SftpFileAttributes { /** * Determine whether these attributes refer to a character device . * @ return boolean */ public boolean isCharacter ( ) { } }
if ( permissions != null && ( permissions . longValue ( ) & SftpFileAttributes . S_IFCHR ) == SftpFileAttributes . S_IFCHR ) { return true ; } return false ;
public class EnumCharacteristic { /** * { @ inheritDoc } */ @ Override protected Integer convert ( JsonValue jsonValue ) { } }
if ( jsonValue instanceof JsonNumber ) { return ( ( JsonNumber ) jsonValue ) . intValue ( ) ; } else if ( jsonValue == JsonObject . TRUE ) { return 1 ; // For at least one enum type ( locks ) , homekit will send a true instead of 1 } else if ( jsonValue == JsonObject . FALSE ) { return 0 ; } else { throw new IndexOutOfBoundsException ( "Cannot convert " + jsonValue . getClass ( ) + " to int" ) ; }
public class DeleteTagsForDomainRequest { /** * A list of tag keys to delete . * @ param tagsToDelete * A list of tag keys to delete . */ public void setTagsToDelete ( java . util . Collection < String > tagsToDelete ) { } }
if ( tagsToDelete == null ) { this . tagsToDelete = null ; return ; } this . tagsToDelete = new com . amazonaws . internal . SdkInternalList < String > ( tagsToDelete ) ;
public class ForkJoinTask { /** * Returns a new { @ code ForkJoinTask } that performs the { @ code call } * method of the given { @ code Callable } as its action , and returns * its result upon { @ link # join } , translating any checked exceptions * encountered into { @ code RuntimeException } . * @ param callable the callable action * @ return the task */ public static < T > ForkJoinTask < T > adapt ( Callable < ? extends T > callable ) { } }
return new AdaptedCallable < T > ( callable ) ;
public class SarlCompiler { /** * Append the inline version for the given call . * < p > This function supports the specific semantic of the inline expression that is defined into the SARL specification . * @ param inlineAnnotation the inline annotation . * @ param calledFeature the called feature . * @ param receiver the receiver of the call : { @ code getActualReceiver ( call ) } . * @ param arguments the call ' s argument : { @ code getActualArguments ( call ) } . * @ param context the context for finding types . * @ param appendable the receiver . */ @ SuppressWarnings ( { } }
"checkstyle:cyclomaticcomplexity" , "checkstyle:npathcomplexity" , "checkstyle:nestedifdepth" } ) private void appendInlineFeatureCallForCastedExpression ( JvmAnnotationReference inlineAnnotation , JvmIdentifiableElement calledFeature , XExpression receiver , List < XExpression > arguments , EObject context , ITreeAppendable appendable ) { // Overridden for fixing the @ Inline behavior String formatString = null ; final List < JvmTypeReference > importedTypes = Lists . newArrayListWithCapacity ( 2 ) ; for ( final JvmAnnotationValue annotationValue : inlineAnnotation . getValues ( ) ) { final String valueName = annotationValue . getValueName ( ) ; if ( Strings . isEmpty ( valueName ) ) { // Special case : the annotation value as no associated operation . // If it appends , we could assumes that the operation is " value ( ) " if ( ! Strings . isEmpty ( formatString ) ) { throw new IllegalStateException ( ) ; } formatString = getAnnotationStringValue ( annotationValue ) ; } else if ( INLINE_VALUE_NAME . equals ( valueName ) ) { if ( ! Strings . isEmpty ( formatString ) ) { throw new IllegalStateException ( ) ; } formatString = getAnnotationStringValue ( annotationValue ) ; } else if ( INLINE_IMPORTED_NAME . equals ( valueName ) ) { importedTypes . addAll ( getAnnotationTypeValue ( annotationValue ) ) ; } } if ( formatString == null ) { throw new IllegalStateException ( ) ; } int numberVariadicParameter = 0 ; final int numberFormalParameters ; JvmFormalParameter formalVariadicParameter = null ; if ( calledFeature instanceof JvmExecutable ) { final JvmExecutable jvmexec = ( JvmExecutable ) calledFeature ; numberFormalParameters = jvmexec . getParameters ( ) . size ( ) ; if ( numberFormalParameters > 0 ) { formalVariadicParameter = jvmexec . getParameters ( ) . get ( numberFormalParameters - 1 ) ; if ( jvmexec . isVarArgs ( ) ) { numberVariadicParameter = 1 ; } } } else { numberFormalParameters = arguments . size ( ) ; } final Matcher matcher = INLINE_VARIABLE_PATTERN . matcher ( formatString ) ; int prevEnd = 0 ; while ( matcher . find ( ) ) { final int start = matcher . start ( ) ; if ( start != prevEnd ) { appendable . append ( formatString . substring ( prevEnd , start ) ) ; } final String indexOrDollar = matcher . group ( 1 ) ; if ( INLINE_VARIABLE_PREFIX . equals ( indexOrDollar ) ) { appendable . append ( INLINE_VARIABLE_PREFIX ) ; } else { final int index = Integer . parseInt ( indexOrDollar ) - 1 ; // Treat the $ 0 parameter in the inline expression if ( index < 0 ) { boolean hasReceiver = true ; if ( receiver != null ) { internalToJavaExpression ( receiver , appendable ) ; if ( receiver instanceof XAbstractFeatureCall ) { if ( ( ( XAbstractFeatureCall ) receiver ) . getFeature ( ) instanceof JvmType ) { final String referenceName = getReferenceName ( receiver , appendable ) ; if ( referenceName != null && referenceName . length ( ) == 0 ) { hasReceiver = false ; } } } } else { hasReceiver = false ; } if ( hasReceiver ) { appendable . append ( "." ) ; // $ NON - NLS - 1 $ } } else { final int numberImports = importedTypes . size ( ) ; final int numberFormalParametersImports = numberFormalParameters + numberImports ; if ( numberVariadicParameter != 0 && index < arguments . size ( ) && index == ( numberFormalParameters - 1 ) ) { XExpression argument = arguments . get ( index ) ; appendArgument ( argument , appendable , index > 0 ) ; for ( int i = index + 1 ; i < arguments . size ( ) ; ++ i ) { appendable . append ( ", " ) ; // $ NON - NLS - 1 $ argument = arguments . get ( i ) ; appendArgument ( argument , appendable , true ) ; } } else if ( index > numberFormalParametersImports ) { throw new IllegalStateException ( ) ; } else if ( index >= numberFormalParameters && index < numberFormalParametersImports ) { serialize ( importedTypes . get ( index - numberFormalParameters ) , context , appendable ) ; } else if ( index == numberFormalParametersImports ) { throw new IllegalStateException ( ) ; } else if ( index < arguments . size ( ) ) { final XExpression argument = arguments . get ( index ) ; appendArgument ( argument , appendable , index > 0 ) ; } else if ( formalVariadicParameter != null ) { appendNullValue ( formalVariadicParameter . getParameterType ( ) , calledFeature , appendable ) ; } else { throw new IllegalStateException ( ) ; } } } prevEnd = matcher . end ( ) ; } if ( prevEnd != formatString . length ( ) ) { appendable . append ( formatString . substring ( prevEnd ) ) ; }
public class IoUtil { /** * Create a copy of an zip file without its empty directories . * @ param inputFile * @ param outputFile * @ throws IOException */ public static void copyZipWithoutEmptyDirectories ( final File inputFile , final File outputFile ) throws IOException { } }
final byte [ ] buf = new byte [ 0x2000 ] ; final ZipFile inputZip = new ZipFile ( inputFile ) ; final ZipOutputStream outputStream = new ZipOutputStream ( new FileOutputStream ( outputFile ) ) ; try { // read a the entries of the input zip file and sort them final Enumeration < ? extends ZipEntry > e = inputZip . entries ( ) ; final ArrayList < ZipEntry > sortedList = new ArrayList < ZipEntry > ( ) ; while ( e . hasMoreElements ( ) ) { final ZipEntry entry = e . nextElement ( ) ; sortedList . add ( entry ) ; } Collections . sort ( sortedList , new Comparator < ZipEntry > ( ) { public int compare ( ZipEntry o1 , ZipEntry o2 ) { String n1 = o1 . getName ( ) , n2 = o2 . getName ( ) ; if ( metaOverride ( n1 , n2 ) ) { return - 1 ; } if ( metaOverride ( n2 , n1 ) ) { return 1 ; } return n1 . compareTo ( n2 ) ; } // make sure that META - INF / MANIFEST . MF is always the first entry after META - INF / private boolean metaOverride ( String n1 , String n2 ) { return ( n1 . startsWith ( "META-INF/" ) && ! n2 . startsWith ( "META-INF/" ) ) || ( n1 . equals ( "META-INF/MANIFEST.MF" ) && ! n2 . equals ( n1 ) && ! n2 . equals ( "META-INF/" ) ) || ( n1 . equals ( "META-INF/" ) && ! n2 . equals ( n1 ) ) ; } } ) ; // treat them again and write them in output , wenn they not are empty directories for ( int i = sortedList . size ( ) - 1 ; i >= 0 ; i -- ) { final ZipEntry inputEntry = sortedList . get ( i ) ; final String name = inputEntry . getName ( ) ; final boolean isEmptyDirectory ; if ( inputEntry . isDirectory ( ) ) { if ( i == sortedList . size ( ) - 1 ) { // no item afterwards ; it was an empty directory isEmptyDirectory = true ; } else { final String nextName = sortedList . get ( i + 1 ) . getName ( ) ; isEmptyDirectory = ! nextName . startsWith ( name ) ; } } else { isEmptyDirectory = false ; } if ( isEmptyDirectory ) { sortedList . remove ( i ) ; } } // finally write entries in normal order for ( int i = 0 ; i < sortedList . size ( ) ; i ++ ) { final ZipEntry inputEntry = sortedList . get ( i ) ; final ZipEntry outputEntry = new ZipEntry ( inputEntry ) ; outputStream . putNextEntry ( outputEntry ) ; ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; final InputStream is = inputZip . getInputStream ( inputEntry ) ; IoUtil . pipe ( is , baos , buf ) ; is . close ( ) ; outputStream . write ( baos . toByteArray ( ) ) ; } } finally { outputStream . close ( ) ; inputZip . close ( ) ; }
public class DataRequirement { /** * @ return { @ link # mustSupport } ( Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation . This does not mean that a value is required for this element , only that the consuming system must understand the element and be able to provide values for it if they are available . * The value of mustSupport SHALL be a FHIRPath resolveable on the type of the DataRequirement . The path SHALL consist only of identifiers , constant indexers , and . resolve ( ) ( see the [ Simple FHIRPath Profile ] ( fhirpath . html # simple ) for full details ) . ) */ public StringType addMustSupportElement ( ) { } }
StringType t = new StringType ( ) ; if ( this . mustSupport == null ) this . mustSupport = new ArrayList < StringType > ( ) ; this . mustSupport . add ( t ) ; return t ;
public class PoolBase { /** * Obtain connection from data source . * @ return a Connection connection */ private Connection newConnection ( ) throws Exception { } }
final long start = currentTime ( ) ; Connection connection = null ; try { String username = config . getUsername ( ) ; String password = config . getPassword ( ) ; connection = ( username == null ) ? dataSource . getConnection ( ) : dataSource . getConnection ( username , password ) ; setupConnection ( connection ) ; lastConnectionFailure . set ( null ) ; return connection ; } catch ( Exception e ) { if ( connection != null ) { quietlyCloseConnection ( connection , "(Failed to create/setup connection)" ) ; } else if ( getLastConnectionFailure ( ) == null ) { logger . debug ( "{} - Failed to create/setup connection: {}" , poolName , e . getMessage ( ) ) ; } lastConnectionFailure . set ( e ) ; throw e ; } finally { // tracker will be null during failFast check if ( metricsTracker != null ) { metricsTracker . recordConnectionCreated ( elapsedMillis ( start ) ) ; } }
public class Main { /** * Java function to calculate the number of lowercase letters in the provided string . * Examples : * count _ lowercase _ letters ( " abc " ) - > 3 * count _ lowercase _ letters ( " string " ) - > 6 * count _ lowercase _ letters ( " Python " ) - > 5 * @ param inputString The string in which lowercase letters need to be counted . * @ return The count of lowercase letters in the input string . */ public static int countLowercaseLetters ( String inputString ) { } }
int lowercaseCounter = 0 ; for ( int i = 0 ; i < inputString . length ( ) ; i ++ ) { if ( 'a' <= inputString . charAt ( i ) && inputString . charAt ( i ) <= 'z' ) { lowercaseCounter ++ ; } } return lowercaseCounter ;
public class ServiceConfigUtil { /** * Copy of { @ link com . google . protobuf . util . Durations # normalizedDuration } . */ @ SuppressWarnings ( "NarrowingCompoundAssignment" ) private static long normalizedDuration ( long seconds , int nanos ) { } }
if ( nanos <= - NANOS_PER_SECOND || nanos >= NANOS_PER_SECOND ) { seconds = checkedAdd ( seconds , nanos / NANOS_PER_SECOND ) ; nanos %= NANOS_PER_SECOND ; } if ( seconds > 0 && nanos < 0 ) { nanos += NANOS_PER_SECOND ; // no overflow since nanos is negative ( and we ' re adding ) seconds -- ; // no overflow since seconds is positive ( and we ' re decrementing ) } if ( seconds < 0 && nanos > 0 ) { nanos -= NANOS_PER_SECOND ; // no overflow since nanos is positive ( and we ' re subtracting ) seconds ++ ; // no overflow since seconds is negative ( and we ' re incrementing ) } if ( ! durationIsValid ( seconds , nanos ) ) { throw new IllegalArgumentException ( String . format ( "Duration is not valid. See proto definition for valid values. " + "Seconds (%s) must be in range [-315,576,000,000, +315,576,000,000]. " + "Nanos (%s) must be in range [-999,999,999, +999,999,999]. " + "Nanos must have the same sign as seconds" , seconds , nanos ) ) ; } return saturatedAdd ( TimeUnit . SECONDS . toNanos ( seconds ) , nanos ) ;
public class JobQueuesManager { /** * This is used to move a job from the waiting queue to the running queue . */ private void makeJobRunning ( JobInProgress job , JobSchedulingInfo oldInfo , QueueInfo qi ) { } }
// Removing of the job from job list is responsibility of the // initialization poller . // Add the job to the running queue qi . addRunningJob ( job ) ;
public class Node { /** * / * copyFileTo implementation with streams */ public long copyFileToImpl ( OutputStream dest , long skip ) throws FileNotFoundException , CopyFileToException { } }
long result ; try ( InputStream src = newInputStream ( ) ) { if ( skip ( src , skip ) ) { return 0 ; } result = getWorld ( ) . getBuffer ( ) . copy ( src , dest ) ; } catch ( FileNotFoundException e ) { throw e ; } catch ( IOException e ) { throw new CopyFileToException ( this , e ) ; } return result ;
public class CustomizableDNSResolver { /** * { @ inheritDoc } */ @ Override public InetAddress [ ] resolve ( final String host ) throws UnknownHostException { } }
InetAddress [ ] resolvedAddresses = dnsMap . get ( host ) ; if ( LOG . isInfoEnabled ( ) ) { LOG . info ( "Resolving {} to {}" , host , Arrays . deepToString ( resolvedAddresses ) ) ; } if ( resolvedAddresses == null ) { resolvedAddresses = super . resolve ( host ) ; } return resolvedAddresses ;
public class RandomUtil { /** * [ min , max ] * @ param min * @ param max * @ return */ public static int random ( int min , int max ) { } }
if ( min < 0 || max < 0 ) { throw new RuntimeException ( "illegal argment, min and max must great then zero." ) ; } if ( min > max ) { int t = max ; max = min ; min = t ; } else if ( min == max ) { return min ; } Random random = new Random ( ) ; return random . nextInt ( max ) % ( max - min + 1 ) + min ;
public class DefaultRouteContext { /** * Execute all routes that are flagged to run as finally . */ @ Override public void runFinallyRoutes ( ) { } }
while ( iterator . hasNext ( ) ) { Route route = iterator . next ( ) . getRoute ( ) ; if ( route . isRunAsFinally ( ) ) { try { handleRoute ( route ) ; } catch ( Exception e ) { log . error ( "Unexpected error in Finally Route" , e ) ; } } else if ( log . isDebugEnabled ( ) ) { if ( StringUtils . isNullOrEmpty ( route . getName ( ) ) ) { log . debug ( "context.next() not called, skipping handler for {} '{}'" , route . getRequestMethod ( ) , route . getUriPattern ( ) ) ; } else { log . debug ( "context.next() not called, skipping '{}' for {} '{}'" , route . getName ( ) , route . getRequestMethod ( ) , route . getUriPattern ( ) ) ; } } }
public class NettyTCPClient { /** * Method that is used to create the connection or { @ link Channel } to * communicated with the remote jetserver . * @ param pipelineFactory * The factory used to create a pipeline of decoders and encoders * for each { @ link Channel } that it creates on connection . * @ param loginEvent * The event contains the { @ link ChannelBuffer } to be transmitted * to jetserver for logging in . Values inside this buffer include * username , password , connection key , < b > optional < / b > local * address of the UDP channel used by this session . * @ param timeout * The amount of time to wait for this connection be created * successfully . * @ param unit * The unit of timeout SECONDS , MILLISECONDS etc . Default is 5 * seconds . * @ return Returns the Netty { @ link Channel } which is the connection to the * remote jetserver . * @ throws InterruptedException */ public Channel connect ( final ChannelPipelineFactory pipelineFactory , final Event loginEvent , int timeout , TimeUnit unit ) throws InterruptedException { } }
ChannelFuture future ; synchronized ( bootstrap ) { bootstrap . setPipelineFactory ( pipelineFactory ) ; future = bootstrap . connect ( serverAddress ) ; future . addListener ( new ChannelFutureListener ( ) { @ Override public void operationComplete ( ChannelFuture future ) throws Exception { if ( future . isSuccess ( ) ) { future . getChannel ( ) . write ( loginEvent ) ; } else { throw new RuntimeException ( future . getCause ( ) . getMessage ( ) ) ; } } } ) ; } return future . getChannel ( ) ;
public class BoxFolder { /** * Returns an iterable containing the items in this folder and specifies which child fields to retrieve from the * API . * @ param fields the fields to retrieve . * @ return an iterable containing the items in this folder . */ public Iterable < BoxItem . Info > getChildren ( final String ... fields ) { } }
return new Iterable < BoxItem . Info > ( ) { @ Override public Iterator < BoxItem . Info > iterator ( ) { String queryString = new QueryStringBuilder ( ) . appendParam ( "fields" , fields ) . toString ( ) ; URL url = GET_ITEMS_URL . buildWithQuery ( getAPI ( ) . getBaseURL ( ) , queryString , getID ( ) ) ; return new BoxItemIterator ( getAPI ( ) , url ) ; } } ;
public class SREsPreferencePage { /** * Sets the SREs to be displayed in this block . * @ param sres SREs to be displayed */ protected void setSREs ( ISREInstall [ ] sres ) { } }
this . sreArray . clear ( ) ; for ( final ISREInstall sre : sres ) { this . sreArray . add ( sre ) ; } this . sresList . setInput ( this . sreArray ) ; refreshSREListUI ( ) ; updateUI ( ) ;
public class Step { /** * Checks mandatory text field . * @ param pageElement * Is concerned element * @ return true or false * @ throws FailureException * if the scenario encounters a functional error */ protected boolean checkMandatoryTextField ( PageElement pageElement ) throws FailureException { } }
WebElement inputText = null ; try { inputText = Context . waitUntil ( ExpectedConditions . presenceOfElementLocated ( Utilities . getLocator ( pageElement ) ) ) ; } catch ( final Exception e ) { new Result . Failure < > ( pageElement , Messages . getMessage ( Messages . FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT ) , true , pageElement . getPage ( ) . getCallBack ( ) ) ; } return ! ( inputText == null || "" . equals ( inputText . getAttribute ( VALUE ) . trim ( ) ) ) ;
public class GeometryExpression { /** * Exports this geometric object to a specific Well - known Text Representation of Geometry . * @ return text representation */ public StringExpression asText ( ) { } }
if ( text == null ) { text = Expressions . stringOperation ( SpatialOps . AS_TEXT , mixin ) ; } return text ;
public class InboundEnvelopeDecoder { /** * Copies min ( from . readableBytes ( ) , to . remaining ( ) bytes from Nettys ByteBuf to the Java NIO ByteBuffer . */ private void copy ( ByteBuf src , ByteBuffer dst ) { } }
// This branch is necessary , because an Exception is thrown if the // destination buffer has more remaining ( writable ) bytes than // currently readable from the Netty ByteBuf source . if ( src . isReadable ( ) ) { if ( src . readableBytes ( ) < dst . remaining ( ) ) { int oldLimit = dst . limit ( ) ; dst . limit ( dst . position ( ) + src . readableBytes ( ) ) ; src . readBytes ( dst ) ; dst . limit ( oldLimit ) ; } else { src . readBytes ( dst ) ; } }
public class CmsForm { /** * Adds a form field to the form . < p > * @ param fieldGroup the form field group key * @ param formField the form field which should be added */ public void addField ( String fieldGroup , final I_CmsFormField formField ) { } }
initializeFormFieldWidget ( formField ) ; m_fields . put ( formField . getId ( ) , formField ) ; String modelId = formField . getModelId ( ) ; m_fieldsByModelId . put ( modelId , formField ) ; formField . getLayoutData ( ) . put ( "group" , fieldGroup ) ; m_fieldsByGroup . put ( fieldGroup , formField ) ; // m _ widget . addField ( formField ) ;
public class CssIdentifierEscapeUtil { /** * Perform an escape operation , based on char [ ] , according to the specified level and type . */ static void escape ( final char [ ] text , final int offset , final int len , final Writer writer , final CssIdentifierEscapeType escapeType , final CssIdentifierEscapeLevel escapeLevel ) throws IOException { } }
if ( text == null || text . length == 0 ) { return ; } final int level = escapeLevel . getEscapeLevel ( ) ; final boolean useBackslashEscapes = escapeType . getUseBackslashEscapes ( ) ; final boolean useCompactHexa = escapeType . getUseCompactHexa ( ) ; final int max = ( offset + len ) ; int readOffset = offset ; for ( int i = offset ; i < max ; i ++ ) { final int codepoint = Character . codePointAt ( text , i ) ; /* * Shortcut : most characters will be ASCII / Alphanumeric , and we won ' t need to do anything at * all for them */ if ( codepoint <= ( ESCAPE_LEVELS_LEN - 2 ) && level < ESCAPE_LEVELS [ codepoint ] && ( i > offset || codepoint < '0' || codepoint > '9' ) ) { // Note how we check whether the first char is a decimal number , in which case we have to escape it continue ; } /* * Hyphen check : only escape when it ' s the first char and it ' s followed by ' - ' or a digit . */ if ( codepoint == '-' && level < 3 ) { if ( i > offset || i + 1 >= max ) { continue ; } final char c1 = text [ i + 1 ] ; if ( c1 != '-' && ( c1 < '0' || c1 > '9' ) ) { continue ; } } /* * Underscore check : only escape when it ' s the first char . */ if ( codepoint == '_' && level < 3 && i > offset ) { continue ; } /* * Shortcut : we might not want to escape non - ASCII chars at all either . */ if ( codepoint > ( ESCAPE_LEVELS_LEN - 2 ) && level < ESCAPE_LEVELS [ ESCAPE_LEVELS_LEN - 1 ] ) { if ( Character . charCount ( codepoint ) > 1 ) { // This is to compensate that we are actually escaping two char [ ] positions with a single codepoint . i ++ ; } continue ; } /* * At this point we know for sure we will need some kind of escape , so we * can write all the contents pending up to this point . */ if ( i - readOffset > 0 ) { writer . write ( text , readOffset , ( i - readOffset ) ) ; } if ( Character . charCount ( codepoint ) > 1 ) { // This is to compensate that we are actually reading two char [ ] positions with a single codepoint . i ++ ; } readOffset = i + 1 ; /* * Perform the real escape , attending the different combinations of BACKSLASH and HEXA escapes */ if ( useBackslashEscapes && codepoint < BACKSLASH_CHARS_LEN ) { // We will try to use a BACKSLASH ESCAPE final char escape = BACKSLASH_CHARS [ codepoint ] ; if ( escape != BACKSLASH_CHARS_NO_ESCAPE ) { // Escape found ! just write it and go for the next char writer . write ( ESCAPE_PREFIX ) ; writer . write ( escape ) ; continue ; } } /* * No escape was possible , so we need hexa escape ( compact or 6 - digit ) . */ final char next = ( ( i + 1 < max ) ? text [ i + 1 ] : ( char ) 0x0 ) ; if ( useCompactHexa ) { writer . write ( ESCAPE_PREFIX ) ; writer . write ( toCompactHexa ( codepoint , next , level ) ) ; continue ; } writer . write ( ESCAPE_PREFIX ) ; writer . write ( toSixDigitHexa ( codepoint , next , level ) ) ; } /* * Final cleaning : append the remaining unescaped text to the string builder and return . */ if ( max - readOffset > 0 ) { writer . write ( text , readOffset , ( max - readOffset ) ) ; }
public class BritishCutoverDate { /** * Obtains a { @ code BritishCutoverDate } representing a date in the British Cutover calendar * system from the proleptic - year , month - of - year and day - of - month fields . * This returns a { @ code BritishCutoverDate } with the specified fields . * Dates in the middle of the cutover gap , such as the 10th September 1752, * will not throw an exception . Instead , the date will be treated as a Julian date * and converted to an ISO date , with the day of month shifted by 11 days . * Invalid dates , such as September 31st will throw an exception . * @ param prolepticYear the British Cutover proleptic - year * @ param month the British Cutover month - of - year , from 1 to 12 * @ param dayOfMonth the British Cutover day - of - month , from 1 to 31 * @ return the date in British Cutover calendar system , not null * @ throws DateTimeException if the value of any field is out of range , * or if the day - of - month is invalid for the month - year */ public static BritishCutoverDate of ( int prolepticYear , int month , int dayOfMonth ) { } }
return BritishCutoverDate . create ( prolepticYear , month , dayOfMonth ) ;
public class UpdateManager { /** * Updates a plugin id to given version or to latest version if { @ code version = = null } . * @ param id the id of plugin to update * @ param version the version to update to , on SemVer format , or null for latest * @ return true if update successful * @ exception PluginException in case the given version is not available , plugin id not already installed etc */ public boolean updatePlugin ( String id , String version ) throws PluginException { } }
if ( pluginManager . getPlugin ( id ) == null ) { throw new PluginException ( "Plugin {} cannot be updated since it is not installed" , id ) ; } PluginInfo pluginInfo = getPluginsMap ( ) . get ( id ) ; if ( pluginInfo == null ) { throw new PluginException ( "Plugin {} does not exist in any repository" , id ) ; } if ( ! hasPluginUpdate ( id ) ) { log . warn ( "Plugin {} does not have an update available which is compatible with system version" , id , systemVersion ) ; return false ; } // Download to temp folder Path downloaded = downloadPlugin ( id , version ) ; if ( ! pluginManager . deletePlugin ( id ) ) { return false ; } Path pluginsRoot = pluginManager . getPluginsRoot ( ) ; Path file = pluginsRoot . resolve ( downloaded . getFileName ( ) ) ; try { Files . move ( downloaded , file ) ; } catch ( IOException e ) { throw new PluginException ( "Failed to write plugin file {} to plugin folder" , file ) ; } String newPluginId = pluginManager . loadPlugin ( file ) ; PluginState state = pluginManager . startPlugin ( newPluginId ) ; return PluginState . STARTED . equals ( state ) ;
public class FileUtil { /** * 获得相对子路径 * 栗子 : * < pre > * dirPath : d : / aaa / bbb filePath : d : / aaa / bbb / ccc = 》 ccc * dirPath : d : / Aaa / bbb filePath : d : / aaa / bbb / ccc . txt = 》 ccc . txt * < / pre > * @ param rootDir 绝对父路径 * @ param file 文件 * @ return 相对子路径 */ public static String subPath ( String rootDir , File file ) { } }
try { return subPath ( rootDir , file . getCanonicalPath ( ) ) ; } catch ( IOException e ) { throw new IORuntimeException ( e ) ; }
public class druidGLexer { /** * $ ANTLR start " DATE _ HOUR _ MIN _ SEC _ SUB " */ public final void mDATE_HOUR_MIN_SEC_SUB ( ) throws RecognitionException { } }
try { int _type = DATE_HOUR_MIN_SEC_SUB ; int _channel = DEFAULT_TOKEN_CHANNEL ; // druidG . g : 692:2 : ( DATE _ HOUR _ MIN _ SEC ' . ' NUM NUM NUM ) // druidG . g : 692:5 : DATE _ HOUR _ MIN _ SEC ' . ' NUM NUM NUM { mDATE_HOUR_MIN_SEC ( ) ; match ( '.' ) ; mNUM ( ) ; mNUM ( ) ; mNUM ( ) ; } state . type = _type ; state . channel = _channel ; } finally { // do for sure before leaving }
public class JsonConvert { /** * 返回非null的值是由String 、 ArrayList 、 HashMap任意组合的对象 */ public < V > V convertFrom ( final String text ) { } }
if ( text == null ) return null ; return ( V ) convertFrom ( Utility . charArray ( text ) ) ;
public class RMItoIDL { /** * Returns a String with the ' mangling ' required for idl names that * contain special characters , including ' _ ' , ' $ ' , and all characters * not in Latin - 1 . < p > * From the CORBA spec : For Java identifiers that contain illegal OMG * IDL identifier characters such as ' $ ' or Unicode characters outside * of ISO Latin 1 , any such illegal characters are replaced by " U " * followed by the 4 hexadecimal characters ( in upper case ) representing * the Unicode value . So , the Java name a $ b is mapped to aU0024b and * x \ u03bCy is mapped to xU03BCy . < p > * For Java names that have leading underscores , the leading underscore * is replaced with " J _ " . So _ fred is mapped to J _ fred . < p > * @ param idlName idlName to be converted */ private static String convertSpecialCharacters ( StringBuilder idlName ) { } }
for ( int i = 0 ; i < idlName . length ( ) ; ++ i ) { char c = idlName . charAt ( i ) ; if ( c == '$' || c > 255 ) { idlName . replace ( i , i + 1 , "U" ) ; String hex = Integer . toHexString ( c ) . toUpperCase ( ) ; int numHex = hex . length ( ) ; int numZero = 4 - numHex ; while ( numZero > 0 ) { idlName . insert ( ++ i , '0' ) ; -- numZero ; } idlName . insert ( i + 1 , hex ) ; i += numHex ; } } if ( idlName . charAt ( 0 ) == '_' ) { idlName . insert ( 0 , 'J' ) ; } return idlName . toString ( ) ;
public class CrawlExample { /** * Run this method to start the crawl . * @ throws IOException * when the output folder cannot be created or emptied . */ public static void main ( String [ ] args ) throws IOException { } }
CrawljaxConfigurationBuilder builder = CrawljaxConfiguration . builderFor ( URL ) ; builder . crawlRules ( ) . setFormFillMode ( FormFillMode . RANDOM ) ; // click these elements builder . crawlRules ( ) . clickDefaultElements ( ) ; /* builder . crawlRules ( ) . click ( " A " ) ; builder . crawlRules ( ) . click ( " button " ) ; */ builder . crawlRules ( ) . crawlHiddenAnchors ( true ) ; builder . crawlRules ( ) . crawlFrames ( false ) ; builder . setUnlimitedCrawlDepth ( ) ; builder . setUnlimitedRuntime ( ) ; builder . setUnlimitedStates ( ) ; // builder . setMaximumStates ( 10 ) ; // builder . setMaximumDepth ( 3 ) ; builder . crawlRules ( ) . clickElementsInRandomOrder ( false ) ; // Set timeouts builder . crawlRules ( ) . waitAfterReloadUrl ( WAIT_TIME_AFTER_RELOAD , TimeUnit . MILLISECONDS ) ; builder . crawlRules ( ) . waitAfterEvent ( WAIT_TIME_AFTER_EVENT , TimeUnit . MILLISECONDS ) ; builder . setBrowserConfig ( new BrowserConfiguration ( BrowserType . PHANTOMJS , 1 ) ) ; // CrawlOverview builder . addPlugin ( new CrawlOverview ( ) ) ; CrawljaxRunner crawljax = new CrawljaxRunner ( builder . build ( ) ) ; crawljax . call ( ) ;
public class Constraint { /** * Generates the column definitions for a table . */ private static void getColumnList ( Table t , int [ ] col , int len , StringBuffer a ) { } }
a . append ( '(' ) ; for ( int i = 0 ; i < len ; i ++ ) { a . append ( t . getColumn ( col [ i ] ) . getName ( ) . statementName ) ; if ( i < len - 1 ) { a . append ( ',' ) ; } } a . append ( ')' ) ;
public class BitmapBuilder { /** * Builds a list from the given bit map . * The list will contain values of 0 or 1s * @ param list * @ return */ public static int [ ] mapToList ( int [ ] bitMap ) { } }
int [ ] list = new int [ ( int ) ( bitMap . length * WORD_LENGTH ) ] ; Arrays . fill ( list , 0 ) ; int j = - 1 ; for ( int i = 0 ; i < list . length ; i ++ ) { if ( i % WORD_LENGTH == 0 ) { j ++ ; } list [ i ] = ( bitMap [ j ] & ( 1 << ( ( WORD_LENGTH - 1 ) - ( i % WORD_LENGTH ) ) ) ) == 0 ? 0 : 1 ; } return list ;
public class ApiOvh { /** * helper * @ return * @ throws IOException */ public List < String > listDomHosting ( ) throws IOException { } }
ArrayList < String > doms = new ArrayList < String > ( ) ; HashSet < String > d = new HashSet < String > ( this . domain . GET ( null ) ) ; for ( String s : this . hostingweb . GET ( ) ) if ( d . contains ( s ) ) doms . add ( s ) ; return doms ;
public class MapKeyLoaderUtil { /** * Returns the role for the map key loader based on the passed parameters . * The partition owner of the map name partition is the sender . * The first replica of the map name partition is the sender backup . * Other partition owners are receivers and other partition replicas do * not have a role . * @ param isPartitionOwner if this is the partition owner * @ param isMapNamePartition if this is the partition containing the map name * @ param isMapNamePartitionFirstReplica if this is the first replica for the partition * containing the map name * @ return the map key loader role */ static MapKeyLoader . Role assignRole ( boolean isPartitionOwner , boolean isMapNamePartition , boolean isMapNamePartitionFirstReplica ) { } }
if ( isMapNamePartition ) { if ( isPartitionOwner ) { // map - name partition owner is the SENDER return MapKeyLoader . Role . SENDER ; } else { if ( isMapNamePartitionFirstReplica ) { // first replica of the map - name partition is the SENDER _ BACKUP return MapKeyLoader . Role . SENDER_BACKUP ; } else { // other replicas of the map - name partition do not have a role return MapKeyLoader . Role . NONE ; } } } else { // ordinary partition owners are RECEIVERs , otherwise no role return isPartitionOwner ? MapKeyLoader . Role . RECEIVER : MapKeyLoader . Role . NONE ; }
public class Converters { /** * Registers the { @ link Instant } converter . * @ param builder The GSON builder to register the converter with . * @ return A reference to { @ code builder } . */ public static GsonBuilder registerInstant ( GsonBuilder builder ) { } }
if ( builder == null ) { throw new NullPointerException ( "builder cannot be null" ) ; } builder . registerTypeAdapter ( INSTANT_TYPE , new InstantConverter ( ) ) ; return builder ;
public class MapDictionary { /** * @ see java . util . Map # keySet ( ) */ @ Override public Set < K > keySet ( ) { } }
final Set < K > localSet = this . localMap . keySet ( ) ; if ( isReadyOnly ( ) ) return Collections . unmodifiableSet ( localSet ) ; return localSet ;
public class WTree { /** * Check if custom nodes that are expanded need their child nodes added from the model . */ protected void checkExpandedCustomNodes ( ) { } }
TreeItemIdNode custom = getCustomTree ( ) ; if ( custom == null ) { return ; } // Get the expanded rows Set < String > expanded = getExpandedRows ( ) ; // Process Top Level for ( TreeItemIdNode node : custom . getChildren ( ) ) { processCheckExpandedCustomNodes ( node , expanded ) ; }
public class CPDefinitionLocalServiceUtil { /** * Creates a new cp definition with the primary key . Does not add the cp definition to the database . * @ param CPDefinitionId the primary key for the new cp definition * @ return the new cp definition */ public static com . liferay . commerce . product . model . CPDefinition createCPDefinition ( long CPDefinitionId ) { } }
return getService ( ) . createCPDefinition ( CPDefinitionId ) ;
public class StatementServiceImp { /** * / * ( non - Javadoc ) * @ see com . popbill . api . StatementService # update ( java . lang . String , java . number . Integer , java . lang . String , com . popbill . api . statement . Statement ) */ @ Override public Response update ( String CorpNum , int ItemCode , String MgtKey , Statement statement ) throws PopbillException { } }
if ( MgtKey == null || MgtKey . isEmpty ( ) ) throw new PopbillException ( - 99999999 , "관리번호가 입력되지 않았습니다." ) ; return update ( CorpNum , ItemCode , MgtKey , statement , null ) ;
public class AbstractMemberProducer { /** * Gets the receiver of the product . The two creational contexts need to be separated because the receiver only serves the product * creation ( it is not a dependent instance of the created instance ) . * @ param productCreationalContext the creational context of the produced instance * @ param receiverCreationalContext the creational context of the receiver * @ return The receiver */ protected Object getReceiver ( CreationalContext < ? > productCreationalContext , CreationalContext < ? > receiverCreationalContext ) { } }
// This is a bit dangerous , as it means that producer methods can end up // executing on partially constructed instances . Also , it ' s not required // by the spec . . . if ( getAnnotated ( ) . isStatic ( ) ) { return null ; } else { if ( productCreationalContext instanceof WeldCreationalContext < ? > ) { WeldCreationalContext < ? > creationalContextImpl = ( WeldCreationalContext < ? > ) productCreationalContext ; final Object incompleteInstance = creationalContextImpl . getIncompleteInstance ( getDeclaringBean ( ) ) ; if ( incompleteInstance != null ) { BeanLogger . LOG . circularCall ( getAnnotated ( ) , getDeclaringBean ( ) ) ; return incompleteInstance ; } } return getBeanManager ( ) . getReference ( getDeclaringBean ( ) , null , receiverCreationalContext , true ) ; }
public class AWSLambdaClient { /** * Creates an < a href = " https : / / docs . aws . amazon . com / lambda / latest / dg / configuration - layers . html " > AWS Lambda layer < / a > * from a ZIP archive . Each time you call < code > PublishLayerVersion < / code > with the same version name , a new version * is created . * Add layers to your function with < a > CreateFunction < / a > or < a > UpdateFunctionConfiguration < / a > . * @ param publishLayerVersionRequest * @ return Result of the PublishLayerVersion operation returned by the service . * @ throws ServiceException * The AWS Lambda service encountered an internal error . * @ throws ResourceNotFoundException * The resource ( for example , a Lambda function or access policy statement ) specified in the request does * not exist . * @ throws TooManyRequestsException * Request throughput limit exceeded . * @ throws InvalidParameterValueException * One of the parameters in the request is invalid . For example , if you provided an IAM role for AWS Lambda * to assume in the < code > CreateFunction < / code > or the < code > UpdateFunctionConfiguration < / code > API , that * AWS Lambda is unable to assume you will get this exception . * @ throws CodeStorageExceededException * You have exceeded your maximum total code size per account . < a * href = " https : / / docs . aws . amazon . com / lambda / latest / dg / limits . html " > Learn more < / a > * @ sample AWSLambda . PublishLayerVersion * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / lambda - 2015-03-31 / PublishLayerVersion " target = " _ top " > AWS API * Documentation < / a > */ @ Override public PublishLayerVersionResult publishLayerVersion ( PublishLayerVersionRequest request ) { } }
request = beforeClientExecution ( request ) ; return executePublishLayerVersion ( request ) ;
public class CleverTapAPI { /** * Push */ private String getCachedFCMToken ( ) { } }
SharedPreferences prefs = getPreferences ( ) ; return ( prefs == null ) ? null : getStringFromPrefs ( Constants . FCM_PROPERTY_REG_ID , null ) ;
public class TypeUtils { /** * Sets one { @ link io . sundr . codegen . model . TypeDef } as an interface of an other . * @ param base The base type . * @ param superClass The super type . * @ return The updated type definition . */ public static TypeDef typeImplements ( TypeDef base , ClassRef ... superClass ) { } }
return new TypeDefBuilder ( base ) . withImplementsList ( superClass ) . build ( ) ;
public class ApiOvhOrder { /** * Create order * REST : POST / order / cdn / webstorage / { serviceName } / traffic * @ param bandwidth [ required ] Traffic in TB that will be added to the cdn . webstorage service * @ param serviceName [ required ] The internal name of your CDN Static offer */ public OvhOrder cdn_webstorage_serviceName_traffic_POST ( String serviceName , OvhOrderTrafficEnum bandwidth ) throws IOException { } }
String qPath = "/order/cdn/webstorage/{serviceName}/traffic" ; StringBuilder sb = path ( qPath , serviceName ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "bandwidth" , bandwidth ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhOrder . class ) ;
public class FileHandlerResult { /** * Returns the instance by it ' s name or throws an exception otherwise . * @ param name * Unique name or NULL . * @ return Enumeration instance or NULL ( if argument name was NULL ) . */ public static FileHandlerResult fromName ( final String name ) { } }
if ( name == null ) { return null ; } for ( final FileHandlerResult result : INSTANCES ) { if ( result . name . equals ( name ) ) { return result ; } } throw new IllegalArgumentException ( "Unknown name: " + name ) ;
public class SQLTool { /** * region select */ public SQLTool select ( String tableName , Collection < String > columns ) { } }
this . type = SQLType . QUERY ; updateTableName ( tableName ) ; for ( String column : columns ) { this . selectSqlCondition . appendSql ( column ) ; } return this ;
public class Vector { /** * Gets the magnitude of the vector squared . * @ return the magnitude */ public double lengthSquared ( ) { } }
return NumberConversions . square ( x ) + NumberConversions . square ( y ) + NumberConversions . square ( z ) ;
public class PoolManager { /** * This method during server shut down will cleanup * and destroy connection nicely . * @ throws ResourceException * @ concurrency concurrent */ public void serverShutDown ( ) throws ResourceException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( this , tc , "serverShutDown" ) ; } connectionPoolShutDown = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "Shutting down pool manager connections in free pool " ) ; Tr . debug ( this , tc , this . toString ( ) ) ; } // Remove parked connection if it exists if ( ( gConfigProps . isSmartHandleSupport ( ) == false ) ) { freePool [ 0 ] . removeParkedConnection ( ) ; } // Reset fatalErrorNotificationTime and remove all free connections for ( int j = 0 ; j < gConfigProps . getMaxFreePoolHashSize ( ) ; ++ j ) { synchronized ( freePool [ j ] . freeConnectionLockObject ) { /* * If a connection gets away , by setting fatalErrorNotificationTime will * guaranty when the connection is returned to the free pool , it will be */ freePool [ j ] . incrementFatalErrorValue ( j ) ; /* * Destroy as many connections as we can in the free pool */ if ( freePool [ j ] . mcWrapperList . size ( ) > 0 ) { try { // added a try \ catch block freePool [ j ] . cleanupAndDestroyAllFreeConnections ( ) ; } catch ( Exception ex ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Exception during destroy of freepool connection: " , new Object [ ] { freePool [ j ] , ex } ) ; } } } // end free lock } // end for j /* * we can not process inuse connection by default during server shutdown . This * was a change in behavior from 6.0.2 and earlier . By trying to destroy * connection that could be * used by an application on a different thread , we can encounter unnecessary * delays or exceptions that will create pmrs . * If this code is needed by some customers , they will be able to enable destroying inuse * connection by using a system value enableInuseConnectionDestroy = true . This is not * recommenced , since this should not be needed . All applications and services should be * stopped before we get this code . If a connection is still inuse by the time we * enter this server shutdown code , its very likely the connection is in error and will * need to manually be recovered or the service was not stopped first . It should always be * understood that manual recovery of XA resource may be needed if connection failure * occurs or a process is stopped unexpectedly * This may not make sence , but please do not add any inuse connection code unless it can be * enabled . In future release , we may what to add this system value to a gui connection pool * property . This is the way we should have added this . : - ) * One other note , if a connection starts to move from the freepool to the inuse pool while * we are destroying managed connections , some interesting things may occur . : - ) : - ) . It is * like we are going to cause the problem fixed . */ if ( enableInuseConnectionDestroy ) { /* * Adding the allow connection request = false in an attempt to stop new connection * requests from occurring . The error will be misleading , but we will have the * stack of the application or service attempting to use a new connections during * server shutdown . It should be ok to reuse this var since this should not happen * very much . */ allowConnectionRequests = false ; // Managed connections currently in use should be destroyed in order to give the // resource adapter a chance to end the transaction branch . Check for in - use connections // in both the sharable and unsharable pools . if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Destroying sharable, in-use connections" ) ; for ( int i = 0 ; i < maxSharedBuckets ; ++ i ) { synchronized ( sharedPool [ i ] . sharedLockObject ) { if ( sharedPool [ i ] . getMCWrapperListSize ( ) > 0 ) { MCWrapper [ ] mcw = sharedPool [ i ] . getMCWrapperList ( ) ; for ( int j = 0 ; j < sharedPool [ i ] . getMCWrapperListSize ( ) ; ++ j ) { try { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "Destroying inuse managed connection " + mcw [ j ] ) ; } ManagedConnection mc = mcw [ j ] . getManagedConnectionWithoutStateCheck ( ) ; if ( mc != null ) mc . destroy ( ) ; } catch ( ResourceException resX ) { // No FFDC needed ; we expect some resource adapters will throw errors here . if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "error during destroy of sharable, in-use connection: " , new Object [ ] { mcw [ j ] , resX } ) ; } } // end loop through the list of connections in the bucket } } // end synchronize on shared pool bucket } // end loop through shared pool buckets if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Destroying unsharable, in-use connections" ) ; MCWrapper [ ] mcw = getUnSharedPoolConnections ( ) ; for ( int j = 0 ; j < mcw . length ; ++ j ) { try { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "Destroying inuse managed connection " + mcw [ j ] ) ; } ManagedConnection mc = mcw [ j ] . getManagedConnectionWithoutStateCheck ( ) ; if ( mc != null ) mc . destroy ( ) ; } catch ( ResourceException resX ) { // No FFDC needed ; we expect some resource adapters will throw errors here . if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "error during destroy of unsharable in-use connection: " , new Object [ ] { mcw [ j ] , resX } ) ; } } // end loop through unsharable , in - use connections } // Ensure that the reap thread has terminated for this pool manager // If we don ' t force closure here , dynamic config changes may cause // duplicate reaper threads for the same resource synchronized ( amLockObject ) { if ( am != null && ! am . isDone ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Alarm for pool manager has not completed yet. Cancelling now." ) ; am . cancel ( false ) ; if ( am . isDone ( ) ) alarmThreadCounter . decrementAndGet ( ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "serverShutDown" ) ; }
public class IPUtil { /** * 从IPv4String转换为InetAddress . * IpString如果确定ipv4 , 使用本方法减少字符分析消耗 . * 先字符串传换为byte [ ] 再调getByAddress ( byte [ ] ) , 避免了调用getByName ( ip ) 可能引起的DNS访问 . */ public static Inet4Address fromIpv4String ( String address ) { } }
byte [ ] bytes = ip4StringToBytes ( address ) ; if ( bytes == null ) { return null ; } else { try { return ( Inet4Address ) Inet4Address . getByAddress ( bytes ) ; } catch ( UnknownHostException e ) { throw new AssertionError ( e ) ; } }
public class Archive { private void collectFiles ( File dir , String dirName ) { } }
if ( ! dirName . equals ( "" ) && ! dirName . endsWith ( "/" ) ) { dirName = dirName + "/" ; } File files [ ] = dir . listFiles ( ) ; assert files != null ; for ( int i = 0 ; i < files . length ; i ++ ) { // issue 256 : ignore ' . DS _ Store ' , ' . _ DS _ Store ' , ' Thumbs . db ' and ' ehthumbs . db ' files if ( files [ i ] . isFile ( ) && ! files [ i ] . getName ( ) . equals ( ".DS_Store" ) && ! files [ i ] . getName ( ) . equals ( "._DS_Store" ) && ! files [ i ] . getName ( ) . equals ( "Thumbs.db" ) && ! files [ i ] . getName ( ) . equals ( "ehthumbs.db" ) ) { names . add ( dirName + files [ i ] . getName ( ) ) ; paths . add ( files [ i ] . getAbsolutePath ( ) ) ; // issue 256 : ignore . git / and . svn / folders } else if ( files [ i ] . isDirectory ( ) && ! files [ i ] . getName ( ) . equals ( ".svn" ) && ! files [ i ] . getName ( ) . equals ( ".git" ) ) { collectFiles ( files [ i ] , dirName + files [ i ] . getName ( ) + "/" ) ; } }
public class Logging { /** * Adds a logging target to the specified logger ( i . e . device ) . * @ param logger A lo4j logger to which the target will be added * @ param ttype The target type * @ param tname The target name */ public void add_logging_target ( Logger logger , String ttype , String tname ) throws DevFailed { } }
add_logging_target ( logger , ttype + LOGGING_SEPARATOR + tname ) ;
public class LayerDrawable { /** * Looks for a layer with the given ID and returns its { @ link Drawable } . * If multiple layers are found for the given ID , returns the { @ link Drawable } for the matching * layer at the highest index . * @ param id The layer ID to search for . * @ return The { @ link Drawable } for the highest - indexed layer that has the given ID , or null if * not found . */ public Drawable findDrawableByLayerId ( int id ) { } }
final ChildDrawable [ ] layers = mLayerState . mChildren ; for ( int i = mLayerState . mNum - 1 ; i >= 0 ; i -- ) { if ( layers [ i ] . mId == id ) { return layers [ i ] . mDrawable ; } } return null ;
public class OperationMenu { /** * Show the OperationMenu based on the selected node . * @ param node The selected node . * @ param x The x position of the selection . * @ param y The y position of the selection . */ public void show ( ManagementModelNode node , int x , int y ) { } }
removeAll ( ) ; addExploreOption ( node ) ; String addressPath = node . addressPath ( ) ; try { ModelNode opNames = executor . doCommand ( addressPath + ":read-operation-names" ) ; if ( opNames . get ( "outcome" ) . asString ( ) . equals ( "failed" ) ) return ; for ( ModelNode name : opNames . get ( "result" ) . asList ( ) ) { String strName = name . asString ( ) ; // filter operations if ( node . isGeneric ( ) && ! genericOpList . contains ( strName ) ) continue ; if ( node . isLeaf ( ) && ! leafOpList . contains ( strName ) ) continue ; if ( ! node . isGeneric ( ) && ! node . isLeaf ( ) && strName . equals ( "add" ) ) continue ; ModelNode opDescription = getResourceDescription ( addressPath , strName ) ; add ( new OperationAction ( node , strName , opDescription ) ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } super . show ( invoker , x , y ) ;
public class CmsResourceTypesTable { /** * Opens the edit dialog . < p > * @ param typeName type to be edited . */ void openEditDialog ( String typeName ) { } }
try { Window window = CmsBasicDialog . prepareWindow ( DialogWidth . max ) ; window . setContent ( new CmsEditResourceTypeDialog ( window , m_app , OpenCms . getResourceManager ( ) . getResourceType ( typeName ) ) ) ; window . setCaption ( CmsVaadinUtils . getMessageText ( Messages . GUI_RESOURCETYPE_EDIT_WINDOW_CAPTION_0 ) ) ; A_CmsUI . get ( ) . addWindow ( window ) ; } catch ( CmsLoaderException e ) { LOG . error ( "Unable to read resource type by name" , e ) ; }
public class TemplateItemInfo { /** * create a database node representing a template item information * @ param graphDatabase * neo4j database to create the node in * @ param itemInfo * template item information to be represented by the node * @ return neo4j node representing the template item information passed */ protected static org . neo4j . graphdb . Node createTemplateItemNode ( final AbstractGraphDatabase graphDatabase , final TemplateItemInfo itemInfo ) { } }
final org . neo4j . graphdb . Node itemNode = graphDatabase . createNode ( ) ; itemNode . setProperty ( TemplateXMLFields . ITEM_NAME , itemInfo . getName ( ) ) ; return itemNode ;
public class WorldGame { /** * Save world to the specified file . * @ param media The output media . * @ throws LionEngineException If error on saving to file . */ public final void saveToFile ( Media media ) { } }
try ( FileWriting writing = new FileWriting ( media ) ) { saving ( writing ) ; } catch ( final IOException exception ) { throw new LionEngineException ( exception , media , "Error on saving to file !" ) ; }
public class QueueData { /** * This method will add a data slice to the list of slices for this message . * @ param bufferContainingSlice * @ param last */ public synchronized void addSlice ( CommsByteBuffer bufferContainingSlice , boolean last ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "addSlice" , new Object [ ] { bufferContainingSlice , last } ) ; slices . add ( bufferContainingSlice . getDataSlice ( ) ) ; // If this is the last slice , calculate the message length if ( last ) { for ( DataSlice slice : slices ) { messageLength += slice . getLength ( ) ; } complete = true ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Message now consists of " + slices . size ( ) + " slices" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "addSlice" ) ;
public class DemoActivity { /** * Shows a Snackbar on the bottom of the layout * @ param message the text to show . */ @ SuppressWarnings ( "ConstantConditions" ) private void showResult ( String message ) { } }
Snackbar . make ( rootLayout , message , Snackbar . LENGTH_LONG ) . show ( ) ;
public class SubqueryPlanner { /** * Exists is modeled as : * < pre > * - Project ( $ 0 > 0) * - Aggregation ( COUNT ( * ) ) * - Limit ( 1) * - - subquery * < / pre > */ private PlanBuilder appendExistSubqueryApplyNode ( PlanBuilder subPlan , ExistsPredicate existsPredicate , boolean correlationAllowed ) { } }
if ( subPlan . canTranslate ( existsPredicate ) ) { // given subquery is already appended return subPlan ; } PlanBuilder subqueryPlan = createPlanBuilder ( existsPredicate . getSubquery ( ) ) ; PlanNode subqueryPlanRoot = subqueryPlan . getRoot ( ) ; if ( isAggregationWithEmptyGroupBy ( subqueryPlanRoot ) ) { subPlan . getTranslations ( ) . put ( existsPredicate , BooleanLiteral . TRUE_LITERAL ) ; return subPlan ; } // add an explicit projection that removes all columns PlanNode subqueryNode = new ProjectNode ( idAllocator . getNextId ( ) , subqueryPlan . getRoot ( ) , Assignments . of ( ) ) ; Symbol exists = symbolAllocator . newSymbol ( "exists" , BOOLEAN ) ; subPlan . getTranslations ( ) . put ( existsPredicate , exists ) ; ExistsPredicate rewrittenExistsPredicate = new ExistsPredicate ( BooleanLiteral . TRUE_LITERAL ) ; return appendApplyNode ( subPlan , existsPredicate . getSubquery ( ) , subqueryNode , Assignments . of ( exists , rewrittenExistsPredicate ) , correlationAllowed ) ;
public class CloudWatchEncryptionMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CloudWatchEncryption cloudWatchEncryption , ProtocolMarshaller protocolMarshaller ) { } }
if ( cloudWatchEncryption == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( cloudWatchEncryption . getCloudWatchEncryptionMode ( ) , CLOUDWATCHENCRYPTIONMODE_BINDING ) ; protocolMarshaller . marshall ( cloudWatchEncryption . getKmsKeyArn ( ) , KMSKEYARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class JCellCheckBox { /** * Creates new JCellButton */ public void init ( String text ) { } }
this . setOpaque ( true ) ; this . setHorizontalTextPosition ( JToggleButton . LEFT ) ; this . setAlignmentX ( JComponent . CENTER_ALIGNMENT ) ;
public class HttpUtils { /** * a fixed size of 35 */ public static byte [ ] computeMultipartBoundary ( ) { } }
ThreadLocalRandom random = ThreadLocalRandom . current ( ) ; byte [ ] bytes = new byte [ 35 ] ; for ( int i = 0 ; i < bytes . length ; i ++ ) { bytes [ i ] = MULTIPART_CHARS [ random . nextInt ( MULTIPART_CHARS . length ) ] ; } return bytes ;
public class SEDProcessor { /** * Returns the index of the next delimiter in the given sed script . The * character at { @ code indexOfPreviousDelimiter } is taken as delimiter . The * method handles escaped delimiters and returns - 1 if no further delimiter * is found . * @ param script * the script to analyze * @ param indexOfPreviousDelimiter * the index of the previous delimiter * @ return the index of the next delimiter after * { @ code indexOfPreviousDelimiter } , or - 1 if no further delimiter * exists of if { @ code indexOfNextDelimiter < 0} */ private static int indexOfNextDelimiter ( String script , int indexOfPreviousDelimiter ) { } }
if ( indexOfPreviousDelimiter < 0 || script . length ( ) <= indexOfPreviousDelimiter ) { return - 1 ; } final char delim = script . charAt ( indexOfPreviousDelimiter ) ; if ( delim == '\\' ) { throw new IllegalArgumentException ( "invalid delimiter '\\' in sed script: " + script ) ; } int index = indexOfPreviousDelimiter ; do { index = script . indexOf ( delim , index + 1 ) ; } while ( index >= 0 && isEscaped ( script , index ) ) ; return index ;
public class OptionHandler { /** * Get string representing usage for this option , of the form " name metaval " or " name = metaval , * e . g . " - - foo VALUE " or " - - foo = VALUE " * @ param rb ResourceBundle to get localized version of meta string * @ param properties * Affects the formatting behaviours . */ public final String getNameAndMeta ( ResourceBundle rb , ParserProperties properties ) { } }
String str = option . isArgument ( ) ? "" : option . toString ( ) ; String meta = getMetaVariable ( rb ) ; if ( meta != null ) { if ( str . length ( ) > 0 ) { str += properties . getOptionValueDelimiter ( ) ; } str += meta ; } return str ;
public class SM2Engine { /** * 加密 * @ param in 数据 * @ param inOff 位置 * @ param inLen 长度 * @ return 密文 */ private byte [ ] encrypt ( byte [ ] in , int inOff , int inLen ) { } }
// 加密数据 byte [ ] c2 = new byte [ inLen ] ; System . arraycopy ( in , inOff , c2 , 0 , c2 . length ) ; final ECMultiplier multiplier = createBasePointMultiplier ( ) ; byte [ ] c1 ; ECPoint kPB ; BigInteger k ; do { k = nextK ( ) ; // 产生随机数计算出曲线点C1 c1 = multiplier . multiply ( ecParams . getG ( ) , k ) . normalize ( ) . getEncoded ( false ) ; kPB = ( ( ECPublicKeyParameters ) ecKey ) . getQ ( ) . multiply ( k ) . normalize ( ) ; kdf ( kPB , c2 ) ; } while ( notEncrypted ( c2 , in , inOff ) ) ; // 杂凑值 , 效验数据 byte [ ] c3 = new byte [ digest . getDigestSize ( ) ] ; addFieldElement ( kPB . getAffineXCoord ( ) ) ; this . digest . update ( in , inOff , inLen ) ; addFieldElement ( kPB . getAffineYCoord ( ) ) ; this . digest . doFinal ( c3 , 0 ) ; // 按照对应模式输出结果 switch ( mode ) { case C1C3C2 : return Arrays . concatenate ( c1 , c3 , c2 ) ; default : return Arrays . concatenate ( c1 , c2 , c3 ) ; }