signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Get { /** * Retrieves the provided css attribute of the element . If the element isn ' t
* present , the css attribute doesn ' t exist , or the attributes can ' t be
* accessed , a null value will be returned .
* @ param attribute - the css attribute to be returned
* @ return String : the value of the css attribute */
public String css ( String attribute ) { } } | if ( ! element . is ( ) . present ( ) ) { return null ; } try { WebElement webElement = element . getWebElement ( ) ; return webElement . getCssValue ( attribute ) ; } catch ( NoSuchMethodError | Exception e ) { log . warn ( e ) ; return null ; } |
public class Generics { /** * Build class type variable name and type variable implementation lookup
* @ param theClass the class to build the lookup
* @ return the lookup */
public static Map < String , Class > buildTypeParamImplLookup ( Class theClass ) { } } | Map < String , Class > lookup = new HashMap < > ( ) ; buildTypeParamImplLookup ( theClass , lookup ) ; return lookup ; |
public class PublicanPODocBookBuilder { /** * Creates the actual PO / POT files for a specific file .
* @ param buildData
* @ param filePathAndName The
* @ param translations The mapping of original strings to translation strings , that will be used to build the po / pot files .
* @ throws BuildProcessingException */
protected void createPOFile ( final POBuildData buildData , final String filePathAndName , final Map < String , TranslationDetails > translations ) throws BuildProcessingException { } } | // Don ' t create files where there is nothing to translate
if ( ! translations . isEmpty ( ) ) { final StringBuilder potFile = createBasePOFile ( buildData ) ; final StringBuilder poFile = createBasePOFile ( buildData ) ; for ( final Map . Entry < String , TranslationDetails > entry : translations . entrySet ( ) ) { final String tagName = entry . getValue ( ) == null ? null : entry . getValue ( ) . getTagName ( ) ; addPOTEntry ( tagName , entry . getKey ( ) , potFile ) ; if ( entry . getValue ( ) == null ) { addPOEntry ( tagName , entry . getKey ( ) , null , false , poFile ) ; } else { addPOEntry ( tagName , entry . getKey ( ) , entry . getValue ( ) . getTranslation ( ) , entry . getValue ( ) . isFuzzy ( ) , poFile ) ; } } addPOTToZip ( filePathAndName + ".pot" , potFile . toString ( ) , buildData ) ; if ( ! buildData . getDefaultLocale ( ) . equals ( buildData . getPOBuildLocale ( ) ) ) { addPOToZip ( filePathAndName + ".po" , poFile . toString ( ) , buildData ) ; } } |
public class EqualityMatcher { /** * Implement handlePut . */
void handlePut ( SimpleTest test , Conjunction selector , MatchTarget object , InternTable subExpr ) throws MatchingException { } } | if ( tc . isEntryEnabled ( ) ) tc . entry ( this , cclass , "handlePut" , new Object [ ] { test , selector , object , subExpr } ) ; Object value = test . getValue ( ) ; if ( value == null ) throw new IllegalStateException ( ) ; handleEqualityPut ( value , selector , object , subExpr ) ; if ( tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "handlePut" ) ; |
import java . util . * ; public class TupleToStr { /** * Converts a list of tuples into a single string .
* Examples :
* > > > tuple _ to _ str ( [ ( ' 1 ' , ' 4 ' , ' 6 ' ) , ( ' 5 ' , ' 8 ' ) , ( ' 2 ' , ' 9 ' ) , ( ' 1 ' , ' 10 ' ) ] )
* ' 1 4 6 5 8 2 9 1 10'
* > > > tuple _ to _ str ( [ ( ' 2 ' , ' 3 ' , ' 4 ' ) , ( ' 6 ' , ' 9 ' ) , ( ' 3 ' , ' 2 ' ) , ( ' 2 ' , ' 11 ' ) ] )
* ' 2 3 4 6 9 3 2 2 11'
* > > > tuple _ to _ str ( [ ( ' 14 ' , ' 21 ' , ' 9 ' ) , ( ' 24 ' , ' 19 ' ) , ( ' 12 ' , ' 29 ' ) , ( ' 23 ' , ' 17 ' ) ] )
* ' 14 21 9 24 19 12 29 23 17'
* @ param tuplesList : A list of tuples
* @ return : A string composed of all elements from tuples , space - separated . */
public static String tupleToStr ( List < List < String > > tuplesList ) { } } | String result = "" ; for ( List < String > tuple : tuplesList ) { for ( String element : tuple ) { result += element + " " ; } } return result . trim ( ) ; // Remove the last space |
public class DependentLocalityType { /** * Gets the value of the dependentLocalityName property .
* This accessor method returns a reference to the live list ,
* not a snapshot . Therefore any modification you make to the
* returned list will be present inside the JAXB object .
* This is why there is not a < CODE > set < / CODE > method for the dependentLocalityName property .
* For example , to add a new item , do as follows :
* < pre >
* getDependentLocalityName ( ) . add ( newItem ) ;
* < / pre >
* Objects of the following type ( s ) are allowed in the list
* { @ link DependentLocalityType . DependentLocalityName } */
public List < DependentLocalityType . DependentLocalityName > getDependentLocalityName ( ) { } } | if ( dependentLocalityName == null ) { dependentLocalityName = new ArrayList < DependentLocalityType . DependentLocalityName > ( ) ; } return this . dependentLocalityName ; |
public class lbmonitor { /** * Use this API to add lbmonitor . */
public static base_response add ( nitro_service client , lbmonitor resource ) throws Exception { } } | lbmonitor addresource = new lbmonitor ( ) ; addresource . monitorname = resource . monitorname ; addresource . type = resource . type ; addresource . action = resource . action ; addresource . respcode = resource . respcode ; addresource . httprequest = resource . httprequest ; addresource . rtsprequest = resource . rtsprequest ; addresource . customheaders = resource . customheaders ; addresource . maxforwards = resource . maxforwards ; addresource . sipmethod = resource . sipmethod ; addresource . sipuri = resource . sipuri ; addresource . sipreguri = resource . sipreguri ; addresource . send = resource . send ; addresource . recv = resource . recv ; addresource . query = resource . query ; addresource . querytype = resource . querytype ; addresource . scriptname = resource . scriptname ; addresource . scriptargs = resource . scriptargs ; addresource . dispatcherip = resource . dispatcherip ; addresource . dispatcherport = resource . dispatcherport ; addresource . username = resource . username ; addresource . password = resource . password ; addresource . secondarypassword = resource . secondarypassword ; addresource . logonpointname = resource . logonpointname ; addresource . lasversion = resource . lasversion ; addresource . radkey = resource . radkey ; addresource . radnasid = resource . radnasid ; addresource . radnasip = resource . radnasip ; addresource . radaccounttype = resource . radaccounttype ; addresource . radframedip = resource . radframedip ; addresource . radapn = resource . radapn ; addresource . radmsisdn = resource . radmsisdn ; addresource . radaccountsession = resource . radaccountsession ; addresource . lrtm = resource . lrtm ; addresource . deviation = resource . deviation ; addresource . units1 = resource . units1 ; addresource . interval = resource . interval ; addresource . units3 = resource . units3 ; addresource . resptimeout = resource . resptimeout ; addresource . units4 = resource . units4 ; addresource . resptimeoutthresh = resource . resptimeoutthresh ; addresource . retries = resource . retries ; addresource . failureretries = resource . failureretries ; addresource . alertretries = resource . alertretries ; addresource . successretries = resource . successretries ; addresource . downtime = resource . downtime ; addresource . units2 = resource . units2 ; addresource . destip = resource . destip ; addresource . destport = resource . destport ; addresource . state = resource . state ; addresource . reverse = resource . reverse ; addresource . transparent = resource . transparent ; addresource . iptunnel = resource . iptunnel ; addresource . tos = resource . tos ; addresource . tosid = resource . tosid ; addresource . secure = resource . secure ; addresource . validatecred = resource . validatecred ; addresource . domain = resource . domain ; addresource . ipaddress = resource . ipaddress ; addresource . group = resource . group ; addresource . filename = resource . filename ; addresource . basedn = resource . basedn ; addresource . binddn = resource . binddn ; addresource . filter = resource . filter ; addresource . attribute = resource . attribute ; addresource . database = resource . database ; addresource . sqlquery = resource . sqlquery ; addresource . evalrule = resource . evalrule ; addresource . mssqlprotocolversion = resource . mssqlprotocolversion ; addresource . Snmpoid = resource . Snmpoid ; addresource . snmpcommunity = resource . snmpcommunity ; addresource . snmpthreshold = resource . snmpthreshold ; addresource . snmpversion = resource . snmpversion ; addresource . metrictable = resource . metrictable ; addresource . application = resource . application ; addresource . sitepath = resource . sitepath ; addresource . storename = resource . storename ; addresource . storefrontacctservice = resource . storefrontacctservice ; addresource . hostname = resource . hostname ; addresource . netprofile = resource . netprofile ; addresource . originhost = resource . originhost ; addresource . originrealm = resource . originrealm ; addresource . hostipaddress = resource . hostipaddress ; addresource . vendorid = resource . vendorid ; addresource . productname = resource . productname ; addresource . firmwarerevision = resource . firmwarerevision ; addresource . authapplicationid = resource . authapplicationid ; addresource . acctapplicationid = resource . acctapplicationid ; addresource . inbandsecurityid = resource . inbandsecurityid ; addresource . supportedvendorids = resource . supportedvendorids ; addresource . vendorspecificvendorid = resource . vendorspecificvendorid ; addresource . vendorspecificauthapplicationids = resource . vendorspecificauthapplicationids ; addresource . vendorspecificacctapplicationids = resource . vendorspecificacctapplicationids ; addresource . kcdaccount = resource . kcdaccount ; addresource . storedb = resource . storedb ; return addresource . add_resource ( client ) ; |
public class AlpineResource { /** * Convenience method that returns true if the principal has the specified permission ,
* or false if not .
* @ param permission the permission to check
* @ return true if principal has permission assigned , false if not
* @ since 1.2.0 */
protected boolean hasPermission ( final String permission ) { } } | if ( getPrincipal ( ) == null ) { return false ; } try ( AlpineQueryManager qm = new AlpineQueryManager ( ) ) { boolean hasPermission = false ; if ( getPrincipal ( ) instanceof ApiKey ) { hasPermission = qm . hasPermission ( ( ApiKey ) getPrincipal ( ) , permission ) ; } else if ( getPrincipal ( ) instanceof UserPrincipal ) { hasPermission = qm . hasPermission ( ( UserPrincipal ) getPrincipal ( ) , permission , true ) ; } return hasPermission ; } |
public class OfflineChangePointDetectionAlgorithm { /** * Find the best position to assume a change in mean .
* @ param sums Cumulative sums
* @ param begin Interval begin
* @ param end Interval end
* @ return Best change position */
public static DoubleIntPair bestChangeInMean ( double [ ] sums , int begin , int end ) { } } | final int len = end - begin , last = end - 1 ; final double suml = begin > 0 ? sums [ begin - 1 ] : 0. ; final double sumr = sums [ last ] ; int bestpos = begin ; double bestscore = Double . NEGATIVE_INFINITY ; // Iterate elements k = 2 . . n - 1 in math notation _
for ( int j = begin , km1 = 1 ; j < last ; j ++ , km1 ++ ) { assert ( km1 < len ) ; // FIXME : remove eventually
final double sumj = sums [ j ] ; // Sum _ inclusive _ j ' th element .
// Derive the left mean and right mean from the precomputed aggregates :
final double lmean = ( sumj - suml ) / km1 ; final double rmean = ( sumr - sumj ) / ( len - km1 ) ; // Equation 2.6.17 from the Basseville book
final double dm = lmean - rmean ; final double score = km1 * ( double ) ( len - km1 ) * dm * dm ; if ( score > bestscore ) { bestpos = j + 1 ; bestscore = score ; } } return new DoubleIntPair ( bestscore , bestpos ) ; |
public class RRuleIteratorImpl { /** * calculates and stored the next date in this recurrence . */
private void fetchNext ( ) { } } | if ( pendingUtc != null || done ) { return ; } DateValue dUtc = generateInstance ( ) ; // check the exit condition
if ( dUtc == null || ! condition . apply ( dUtc ) ) { done = true ; return ; } pendingUtc = dUtc ; yearGenerator . workDone ( ) ; |
public class DateFormatSymbols { /** * Loads localized names for day periods in the requested format .
* @ param resourceMap Contains the dayPeriod resource to load */
private String [ ] loadDayPeriodStrings ( Map < String , String > resourceMap ) { } } | String strings [ ] = new String [ DAY_PERIOD_KEYS . length ] ; if ( resourceMap != null ) { for ( int i = 0 ; i < DAY_PERIOD_KEYS . length ; ++ i ) { strings [ i ] = resourceMap . get ( DAY_PERIOD_KEYS [ i ] ) ; // Null if string doesn ' t exist .
} } return strings ; |
public class KickflipApiClient { /** * Login an exiting Kickflip User and make it active .
* @ param username The Kickflip user ' s username
* @ param password The Kickflip user ' s password
* @ param cb This callback will receive a User in { @ link io . kickflip . sdk . api . KickflipCallback # onSuccess ( io . kickflip . sdk . api . json . Response ) }
* or an Exception { @ link io . kickflip . sdk . api . KickflipCallback # onError ( io . kickflip . sdk . exception . KickflipException ) } . */
public void loginUser ( String username , final String password , final KickflipCallback cb ) { } } | GenericData data = new GenericData ( ) ; data . put ( "username" , username ) ; data . put ( "password" , password ) ; post ( GET_USER_PRIVATE , new UrlEncodedContent ( data ) , User . class , new KickflipCallback ( ) { @ Override public void onSuccess ( final Response response ) { if ( VERBOSE ) Log . i ( TAG , "loginUser response: " + response ) ; storeNewUserResponse ( ( User ) response , password ) ; postResponseToCallback ( cb , response ) ; } @ Override public void onError ( final KickflipException error ) { Log . w ( TAG , "loginUser Error: " + error ) ; postExceptionToCallback ( cb , error ) ; } } ) ; |
public class snmpengineid { /** * Use this API to unset the properties of snmpengineid resource .
* Properties that need to be unset are specified in args array . */
public static base_response unset ( nitro_service client , Long ownernode , String args [ ] ) throws Exception { } } | snmpengineid unsetresource = new snmpengineid ( ) ; unsetresource . ownernode = ownernode ; return unsetresource . unset_resource ( client , args ) ; |
public class QueueFile { /** * Reads the eldest element . Returns null if the queue is empty . */
public @ Nullable byte [ ] peek ( ) throws IOException { } } | if ( closed ) throw new IllegalStateException ( "closed" ) ; if ( isEmpty ( ) ) return null ; int length = first . length ; byte [ ] data = new byte [ length ] ; ringRead ( first . position + Element . HEADER_LENGTH , data , 0 , length ) ; return data ; |
public class ArchiveOutputSettingsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ArchiveOutputSettings archiveOutputSettings , ProtocolMarshaller protocolMarshaller ) { } } | if ( archiveOutputSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( archiveOutputSettings . getContainerSettings ( ) , CONTAINERSETTINGS_BINDING ) ; protocolMarshaller . marshall ( archiveOutputSettings . getExtension ( ) , EXTENSION_BINDING ) ; protocolMarshaller . marshall ( archiveOutputSettings . getNameModifier ( ) , NAMEMODIFIER_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class DataSet { /** * Selects an element with maximum value .
* < p > The maximum is computed over the specified fields in lexicographical order .
* < p > < strong > Example 1 < / strong > : Given a data set with elements < code > [ 0 , 1 ] , [ 1 , 0 ] < / code > , the
* results will be :
* < ul >
* < li > < code > maxBy ( 0 ) < / code > : < code > [ 1 , 0 ] < / code > < / li >
* < li > < code > maxBy ( 1 ) < / code > : < code > [ 0 , 1 ] < / code > < / li >
* < / ul >
* < p > < strong > Example 2 < / strong > : Given a data set with elements < code > [ 0 , 0 ] , [ 0 , 1 ] < / code > , the
* results will be :
* < ul >
* < li > < code > maxBy ( 0 , 1 ) < / code > : < code > [ 0 , 1 ] < / code > < / li >
* < / ul >
* < p > If multiple values with maximum value at the specified fields exist , a random one will be
* picked .
* < p > Internally , this operation is implemented as a { @ link ReduceFunction } .
* @ param fields Field positions to compute the maximum over
* @ return A { @ link ReduceOperator } representing the maximum */
@ SuppressWarnings ( { } } | "unchecked" , "rawtypes" } ) public ReduceOperator < T > maxBy ( int ... fields ) { if ( ! getType ( ) . isTupleType ( ) ) { throw new InvalidProgramException ( "DataSet#maxBy(int...) only works on Tuple types." ) ; } return new ReduceOperator < > ( this , new SelectByMaxFunction ( ( TupleTypeInfo ) getType ( ) , fields ) , Utils . getCallLocationName ( ) ) ; |
public class Matchers { /** * Returns a Matcher that matches against nodes that are declared { @ code @ private } . */
public static Matcher isPrivate ( ) { } } | return new Matcher ( ) { @ Override public boolean matches ( Node node , NodeMetadata metadata ) { JSDocInfo jsDoc = NodeUtil . getBestJSDocInfo ( node ) ; if ( jsDoc != null ) { return jsDoc . getVisibility ( ) == Visibility . PRIVATE ; } return false ; } } ; |
public class SubDomainMarshaller { /** * Marshall the given parameter object . */
public void marshall ( SubDomain subDomain , ProtocolMarshaller protocolMarshaller ) { } } | if ( subDomain == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( subDomain . getSubDomainSetting ( ) , SUBDOMAINSETTING_BINDING ) ; protocolMarshaller . marshall ( subDomain . getVerified ( ) , VERIFIED_BINDING ) ; protocolMarshaller . marshall ( subDomain . getDnsRecord ( ) , DNSRECORD_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class StringUtils { /** * Convert first character in given string to upper case . < br >
* If given source string is blank or first character is upper case , return
* it ' s self .
* @ param source string to be tested .
* @ return a new string has been converted or it ' s self . */
public static String firstCharToUpperCase ( final String source ) { } } | if ( isBlank ( source ) || Character . isUpperCase ( source . charAt ( 0 ) ) ) { return source ; } StringBuilder destination = getStringBuild ( ) ; destination . append ( source . substring ( 0 , 1 ) . toUpperCase ( ) ) ; destination . append ( source . substring ( 1 ) ) ; return destination . toString ( ) ; |
public class DistributedTableSerializer { /** * Loads the table data from the path and writes it to the output stream . Returns the set of UUIDs associated with
* the table , just like { @ link # loadAndSerialize ( long , java . io . OutputStream ) } . */
private Set < Long > loadFromNode ( String path , OutputStream out ) throws KeeperException . NoNodeException { } } | try { // Get the cached representation of this table
byte [ ] data = _curator . getData ( ) . forPath ( path ) ; DataInputStream in = new DataInputStream ( new ByteArrayInputStream ( data ) ) ; int uuidCountOrExceptionCode = in . readInt ( ) ; // A negative first integer indicates an exception condition .
if ( uuidCountOrExceptionCode < 0 ) { String exceptionJson = new String ( data , 4 , data . length - 4 , Charsets . UTF_8 ) ; switch ( uuidCountOrExceptionCode ) { case UNKNOWN_TABLE : throw JsonHelper . fromJson ( exceptionJson , UnknownTableException . class ) ; case DROPPED_TABLE : throw JsonHelper . fromJson ( exceptionJson , DroppedTableException . class ) ; } } // Load the UUIDs for this table
Set < Long > uuids = Sets . newHashSet ( ) ; for ( int i = 0 ; i < uuidCountOrExceptionCode ; i ++ ) { uuids . add ( in . readLong ( ) ) ; } // Copy the remaining bytes as the content
ByteStreams . copy ( in , out ) ; return uuids ; } catch ( Throwable t ) { Throwables . propagateIfInstanceOf ( t , KeeperException . NoNodeException . class ) ; throw Throwables . propagate ( t ) ; } |
public class PersistenceValidator { /** * Checks constraints present on embeddable attributes
* @ param embeddedObject
* @ param embeddedColumn
* @ param embeddedFieldName */
private void onValidateEmbeddable ( Object embeddedObject , EmbeddableType embeddedColumn ) { } } | if ( embeddedObject instanceof Collection ) { for ( Object obj : ( Collection ) embeddedObject ) { for ( Object column : embeddedColumn . getAttributes ( ) ) { Attribute columnAttribute = ( Attribute ) column ; Field f = ( Field ) columnAttribute . getJavaMember ( ) ; this . factory . validate ( f , embeddedObject , new AttributeConstraintRule ( ) ) ; } } } else { for ( Object column : embeddedColumn . getAttributes ( ) ) { Attribute columnAttribute = ( Attribute ) column ; Field f = ( Field ) ( ( Field ) columnAttribute . getJavaMember ( ) ) ; this . factory . validate ( f , embeddedObject , new AttributeConstraintRule ( ) ) ; } } |
public class RTMPConnection { /** * { @ inheritDoc } */
@ Override public void close ( ) { } } | if ( closing . compareAndSet ( false , true ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "close: {}" , sessionId ) ; } stopWaitForHandshake ( ) ; stopRoundTripMeasurement ( ) ; // update our state
if ( state != null ) { final byte s = getStateCode ( ) ; switch ( s ) { case RTMP . STATE_DISCONNECTED : if ( log . isDebugEnabled ( ) ) { log . debug ( "Already disconnected" ) ; } return ; default : if ( log . isDebugEnabled ( ) ) { log . debug ( "State: {}" , RTMP . states [ s ] ) ; } setStateCode ( RTMP . STATE_DISCONNECTING ) ; } } Red5 . setConnectionLocal ( this ) ; IStreamService streamService = ( IStreamService ) ScopeUtils . getScopeService ( scope , IStreamService . class , StreamService . class ) ; if ( streamService != null ) { // in the end of call streamService . deleteStream we do streams . remove
for ( Iterator < IClientStream > it = streams . values ( ) . iterator ( ) ; it . hasNext ( ) ; ) { IClientStream stream = it . next ( ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Closing stream: {}" , stream . getStreamId ( ) ) ; } streamService . deleteStream ( this , stream . getStreamId ( ) ) ; } } else { if ( log . isDebugEnabled ( ) ) { log . debug ( "Stream service was not found for scope: {}" , ( scope != null ? scope . getName ( ) : "null or non-existant" ) ) ; } } // close the base connection - disconnect scopes and unregister client
super . close ( ) ; // kill all the collections etc
channels . clear ( ) ; streams . clear ( ) ; pendingCalls . clear ( ) ; deferredResults . clear ( ) ; pendingVideos . clear ( ) ; streamBuffers . clear ( ) ; if ( log . isTraceEnabled ( ) ) { // dump memory stats
log . trace ( "Memory at close - free: {}K total: {}K" , Runtime . getRuntime ( ) . freeMemory ( ) / 1024 , Runtime . getRuntime ( ) . totalMemory ( ) / 1024 ) ; } } else if ( log . isDebugEnabled ( ) ) { log . debug ( "Already closing.." ) ; } |
public class IntegralImageOps { /** * Computes the value of a block inside an integral image and treats pixels outside of the
* image as zero . The block is defined as follows : x0 & lt ; x & le ; x1 and y0 & lt ; y & le ; y1.
* @ param integral Integral image .
* @ param x0 Lower bound of the block . Exclusive .
* @ param y0 Lower bound of the block . Exclusive .
* @ param x1 Upper bound of the block . Inclusive .
* @ param y1 Upper bound of the block . Inclusive .
* @ return Value inside the block . */
public static double block_zero ( GrayF64 integral , int x0 , int y0 , int x1 , int y1 ) { } } | return ImplIntegralImageOps . block_zero ( integral , x0 , y0 , x1 , y1 ) ; |
public class GuiBootstrap { /** * Tells whether or not ZAP is being started for first time . It does so by checking if the license was not yet been
* accepted .
* @ return { @ code true } if it ' s the first time , { @ code false } otherwise .
* @ see Constant # ACCEPTED _ LICENSE */
private static boolean isFirstTime ( ) { } } | Path acceptedLicenseFile = Paths . get ( Constant . getInstance ( ) . ACCEPTED_LICENSE ) ; return Files . notExists ( acceptedLicenseFile ) ; |
public class VdmPluginImages { /** * Creates an image descriptor for the given prefix and name in the JDT UI bundle . The path can contain variables
* like $ NL $ . If no image could be found , < code > useMissingImageDescriptor < / code > decides if either the ' missing
* image descriptor ' is returned or < code > null < / code > . or < code > null < / code > . */
private static ImageDescriptor create ( String prefix , String name , boolean useMissingImageDescriptor ) { } } | IPath path = ICONS_PATH . append ( prefix ) . append ( name ) ; return createImageDescriptor ( VdmUIPlugin . getDefault ( ) . getBundle ( ) , path , useMissingImageDescriptor ) ; |
public class DataListRenderer { /** * Renders items with no strict markup
* @ param context FacesContext instance
* @ param list DataList component
* @ throws IOException */
protected void encodeStrictList ( FacesContext context , DataList list ) throws IOException { } } | ResponseWriter writer = context . getResponseWriter ( ) ; String clientId = list . getClientId ( context ) ; boolean isDefinition = list . isDefinition ( ) ; UIComponent definitionFacet = list . getFacet ( "description" ) ; boolean renderDefinition = isDefinition && definitionFacet != null ; String itemType = list . getItemType ( ) ; String listClass = DataList . LIST_CLASS ; if ( itemType != null && itemType . equals ( "none" ) ) { listClass = listClass + " " + DataList . NO_BULLETS_CLASS ; } String listTag = list . getListTag ( ) ; String listItemTag = isDefinition ? "dt" : "li" ; String varStatus = list . getVarStatus ( ) ; int first = list . getFirst ( ) ; int rows = list . getRows ( ) == 0 ? list . getRowCount ( ) : list . getRows ( ) ; int pageSize = first + rows ; int rowCount = list . getRowCount ( ) ; String rowIndexVar = list . getRowIndexVar ( ) ; Map < String , Object > requestMap = context . getExternalContext ( ) . getRequestMap ( ) ; writer . startElement ( listTag , null ) ; writer . writeAttribute ( "id" , clientId + "_list" , null ) ; writer . writeAttribute ( "class" , listClass , null ) ; if ( list . getItemType ( ) != null ) { writer . writeAttribute ( "type" , list . getItemType ( ) , null ) ; } for ( int i = first ; i < pageSize ; i ++ ) { if ( varStatus != null ) { requestMap . put ( varStatus , new VarStatus ( first , ( pageSize - 1 ) , ( i == 0 ) , ( i == ( rowCount - 1 ) ) , i , ( i % 2 == 0 ) , ( i % 2 == 1 ) , 1 ) ) ; } list . setRowIndex ( i ) ; if ( rowIndexVar != null ) { requestMap . put ( rowIndexVar , i ) ; } if ( list . isRowAvailable ( ) ) { String itemStyleClass = list . getItemStyleClass ( ) ; itemStyleClass = ( itemStyleClass == null ) ? DataList . LIST_ITEM_CLASS : DataList . LIST_ITEM_CLASS + " " + itemStyleClass ; writer . startElement ( listItemTag , null ) ; writer . writeAttribute ( "class" , itemStyleClass , null ) ; renderChildren ( context , list ) ; writer . endElement ( listItemTag ) ; if ( renderDefinition ) { writer . startElement ( "dd" , null ) ; definitionFacet . encodeAll ( context ) ; writer . endElement ( "dd" ) ; } } } // cleanup
list . setRowIndex ( - 1 ) ; if ( rowIndexVar != null ) { requestMap . remove ( rowIndexVar ) ; } if ( varStatus != null ) { requestMap . remove ( varStatus ) ; } writer . endElement ( listTag ) ; |
public class Main { /** * Print a usage message . */
private static void badUsage ( String s ) { } } | System . err . println ( ToolErrorReporter . getMessage ( "msg.jsc.bad.usage" , Main . class . getName ( ) , s ) ) ; |
public class FakedWebserver { /** * faked http request handling . shows usage of OneAgent SDK ' s incoming webrequest API */
private void serve ( HttpRequest request , HttpResponse response ) { } } | String url = request . getUri ( ) ; System . out . println ( "[Server] serve " + url ) ; IncomingWebRequestTracer incomingWebrequestTracer = oneAgentSDK . traceIncomingWebRequest ( webAppInfo , url , request . getMethod ( ) ) ; // add request header , parameter and remote address before start :
for ( Entry < String , List < String > > headerField : request . getHeaders ( ) . entrySet ( ) ) { for ( String value : headerField . getValue ( ) ) { incomingWebrequestTracer . addRequestHeader ( headerField . getKey ( ) , value ) ; } } for ( Entry < String , List < String > > parameter : request . getParameters ( ) . entrySet ( ) ) { for ( String value : parameter . getValue ( ) ) { incomingWebrequestTracer . addParameter ( parameter . getKey ( ) , value ) ; } } incomingWebrequestTracer . setRemoteAddress ( request . getRemoteIpAddress ( ) ) ; incomingWebrequestTracer . start ( ) ; try { response . setContent ( "Hello world!" . getBytes ( ) ) ; response . setStatusCode ( 200 ) ; incomingWebrequestTracer . setStatusCode ( 200 ) ; } catch ( Exception e ) { // we assume , container is sending http 500 in case of exception is thrown while serving an request :
incomingWebrequestTracer . error ( e ) ; e . printStackTrace ( ) ; throw new RuntimeException ( e ) ; } finally { incomingWebrequestTracer . end ( ) ; } |
public class FontUtils { /** * Draw text right justified
* @ param font The font to draw with
* @ param s The string to draw
* @ param x The x location to draw at
* @ param y The y location to draw at
* @ param width The width to fill with the text */
public static void drawRight ( Font font , String s , int x , int y , int width ) { } } | drawString ( font , s , Alignment . RIGHT , x , y , width , Color . white ) ; |
public class GroupApi { /** * Creates a new project group . Available only for users who can create groups .
* < pre > < code > GitLab Endpoint : POST / groups < / code > < / pre >
* @ param name the name of the group to add
* @ param path the path for the group
* @ param description ( optional ) - The group ' s description
* @ param visibility ( optional ) - The group ' s visibility . Can be private , internal , or public .
* @ param lfsEnabled ( optional ) - Enable / disable Large File Storage ( LFS ) for the projects in this group
* @ param requestAccessEnabled ( optional ) - Allow users to request member access
* @ param parentId ( optional ) - The parent group id for creating nested group
* @ return the created Group instance
* @ throws GitLabApiException if any exception occurs */
public Group addGroup ( String name , String path , String description , Visibility visibility , Boolean lfsEnabled , Boolean requestAccessEnabled , Integer parentId ) throws GitLabApiException { } } | Form formData = new GitLabApiForm ( ) . withParam ( "name" , name ) . withParam ( "path" , path ) . withParam ( "description" , description ) . withParam ( "visibility" , visibility ) . withParam ( "lfs_enabled" , lfsEnabled ) . withParam ( "request_access_enabled" , requestAccessEnabled ) . withParam ( "parent_id" , isApiVersion ( ApiVersion . V3 ) ? null : parentId ) ; Response response = post ( Response . Status . CREATED , formData , "groups" ) ; return ( response . readEntity ( Group . class ) ) ; |
public class MsgSettingController { /** * Download api json .
* @ param req the req
* @ param method the method
* @ param url the url
* @ param res the res */
@ GetMapping ( "/setting/download/api/json" ) public void downloadApiJson ( HttpServletRequest req , @ RequestParam ( "method" ) String method , @ RequestParam ( "url" ) String url , HttpServletResponse res ) { } } | this . validationSessionComponent . sessionCheck ( req ) ; url = new String ( Base64 . getDecoder ( ) . decode ( url ) ) ; List < ValidationData > list = this . msgSettingService . getValidationData ( method , url ) ; ValidationFileUtil . sendFileToHttpServiceResponse ( method + url . replaceAll ( "/" , "-" ) + ".json" , list , res ) ; |
public class MSExcelParser { /** * Sanitize headers
* 1 ) Replace empty / null column names by " Col " + column number
* 2 ) Replace duplicate column names by column name + increasing number
* 3 ) Replace column names based on regular expressions with another string ( useful in case your Big Data platform does not support certain characters in the column String )
* @ param headers original headers to sanitize
* @ param regex regex to be searched in each column name ( all occurrences , see String . replaceAll )
* @ param replace String to replace the matched regular expression
* @ return sanitized headers */
public static String [ ] sanitizeHeaders ( String [ ] headers , String regex , String replace ) { } } | String result [ ] = new String [ headers . length ] ; HashMap < String , Integer > headerHashMap = new HashMap < > ( ) ; // for detecting duplicates
for ( int i = 0 ; i < headers . length ; i ++ ) { String currentColumn = headers [ i ] ; // if column name is empty create artificial column name
if ( ( currentColumn == null ) || "" . equals ( currentColumn ) ) { currentColumn = HadoopOfficeReadConfiguration . PREFIX_UNKNOWN_COL + i ; } // apply regex to column name
if ( ( regex != null ) && ( ! "" . equals ( regex ) ) ) { currentColumn = currentColumn . replaceAll ( regex , replace ) ; } // check if column name already exist
Integer existingEntry = headerHashMap . get ( currentColumn ) ; if ( existingEntry == null ) { existingEntry = 1 ; } else { existingEntry += 1 ; currentColumn += existingEntry ; } result [ i ] = currentColumn ; headerHashMap . put ( currentColumn , existingEntry ) ; } return result ; |
public class Route53AutoNamingClient { /** * Gets a list of instances registered with Route53 given a service ID .
* @ param serviceId The service id
* @ return list of serviceInstances usable by MN . */
@ Override public Publisher < List < ServiceInstance > > getInstances ( String serviceId ) { } } | if ( serviceId == null ) { serviceId = getRoute53ClientDiscoveryConfiguration ( ) . getAwsServiceId ( ) ; // we can default to the config file
} ListInstancesRequest instancesRequest = new ListInstancesRequest ( ) . withServiceId ( serviceId ) ; Future < ListInstancesResult > instanceResult = getDiscoveryClient ( ) . listInstancesAsync ( instancesRequest ) ; Flowable < ListInstancesResult > observableInstanceResult = Flowable . fromFuture ( instanceResult ) ; return observableInstanceResult . flatMap ( this :: convertInstancesResulttoServiceInstances ) ; |
public class Date { /** * Sets the month of this date to the specified value . This
* < tt > Date < / tt > object is modified so that it represents a point
* in time within the specified month , with the year , date , hour ,
* minute , and second the same as before , as interpreted in the
* local time zone . If the date was October 31 , for example , and
* the month is set to June , then the new date will be treated as
* if it were on July 1 , because June has only 30 days .
* @ param month the month value between 0-11.
* @ see java . util . Calendar
* @ deprecated As of JDK version 1.1,
* replaced by < code > Calendar . set ( Calendar . MONTH , int month ) < / code > . */
@ Deprecated public void setMonth ( int month ) { } } | int y = 0 ; if ( month >= 12 ) { y = month / 12 ; month %= 12 ; } else if ( month < 0 ) { y = CalendarUtils . floorDivide ( month , 12 ) ; month = CalendarUtils . mod ( month , 12 ) ; } BaseCalendar . Date d = getCalendarDate ( ) ; if ( y != 0 ) { d . setNormalizedYear ( d . getNormalizedYear ( ) + y ) ; } d . setMonth ( month + 1 ) ; // adjust 0 - based to 1 - based month numbering |
public class CollectionConverter { /** * Converts an object to a collection
* @ param collectionType the collection type
* @ return the conversion function */
public static Function < Object , Collection < ? > > COLLECTION ( final Class < ? extends Collection > collectionType ) { } } | return as ( new CollectionConverterImpl < > ( collectionType , null ) ) ; |
public class Tuple { /** * Create new Sextuple ( Tuple with six elements ) .
* @ param < T1 >
* @ param < T2 >
* @ param < T3 >
* @ param < T4 >
* @ param < T5 >
* @ param < T6 >
* @ param e1
* @ param e2
* @ param e3
* @ param e4
* @ param e5
* @ param e6
* @ return Sextuple */
public static < T1 , T2 , T3 , T4 , T5 , T6 > Sextuple < T1 , T2 , T3 , T4 , T5 , T6 > newTuple ( T1 e1 , T2 e2 , T3 e3 , T4 e4 , T5 e5 , T6 e6 ) { } } | return new Sextuple < T1 , T2 , T3 , T4 , T5 , T6 > ( e1 , e2 , e3 , e4 , e5 , e6 ) ; |
public class JMElasticsearchBulk { /** * Delete bulk docs bulk response .
* @ param index the index
* @ param type the type
* @ param filterQueryBuilder the filter query builder
* @ return the bulk response */
public BulkResponse deleteBulkDocs ( String index , String type , QueryBuilder filterQueryBuilder ) { } } | return executeBulkRequest ( buildDeleteBulkRequestBuilder ( buildExtractDeleteRequestBuilderList ( index , type , filterQueryBuilder ) ) ) ; |
public class MappingUtils { /** * Returns class static field value
* Is used to return Constants
* @ param clazz Class static field of which would be returned
* @ param fieldName field name
* @ return field value
* @ throws org . midao . jdbc . core . exception . MjdbcException if field is not present or access is prohibited */
public static Object returnStaticField ( Class clazz , String fieldName ) throws MjdbcException { } } | Object result = null ; Field field = null ; try { field = clazz . getField ( fieldName ) ; result = field . get ( null ) ; } catch ( NoSuchFieldException ex ) { throw new MjdbcException ( ex ) ; } catch ( IllegalAccessException ex ) { throw new MjdbcException ( ex ) ; } return result ; |
public class SpELFunction { /** * 使用spel表达式获取表达式对象 , 使用表达式缓存
* @ param spel
* 表达式
* @ return 表达式对象 */
private synchronized Expression getExpression ( String spel ) { } } | Expression expression = expressionCache . get ( spel ) ; if ( expression == null ) { expression = parser . parseExpression ( spel ) ; expressionCache . put ( spel , expression ) ; } return expression ; |
public class ArrayUtils { /** * This method does a similar job to JSE 6.0 ' s Arrays . copyOf ( ) method and overloads the method for use with arrays of char
* @ param charArray The array to copy
* @ return A copy of the input , of component type U */
public static char [ ] copyOf ( char [ ] charArray ) { } } | char [ ] copy = new char [ charArray . length ] ; System . arraycopy ( charArray , 0 , copy , 0 , charArray . length ) ; return copy ; |
public class _ArrayMap { /** * Gets the object stored with the given key . Scans first
* by object identity , then by object equality . */
static public Object get ( Object [ ] array , Object key ) { } } | Object o = getByIdentity ( array , key ) ; if ( o != null ) { return o ; } return getByEquality ( array , key ) ; |
public class ModelControllerImpl { /** * Await service container stability .
* @ param timeout maximum period to wait for service container stability
* @ param timeUnit unit in which { @ code timeout } is expressed
* @ param interruptibly { @ code true } if thread interruption should be ignored
* @ throws java . lang . InterruptedException if { @ code interruptibly } is { @ code false } and the thread is interrupted while awaiting service container stability
* @ throws java . util . concurrent . TimeoutException if service container stability is not reached before the specified timeout */
void awaitContainerStability ( long timeout , TimeUnit timeUnit , final boolean interruptibly ) throws InterruptedException , TimeoutException { } } | if ( interruptibly ) { stateMonitor . awaitStability ( timeout , timeUnit ) ; } else { stateMonitor . awaitStabilityUninterruptibly ( timeout , timeUnit ) ; } |
public class AuroraHeronShellController { /** * Restart an aurora container */
@ Override public boolean restart ( Integer containerId ) { } } | // there is no backpressure for container 0 , delegate to aurora client
if ( containerId == null || containerId == 0 ) { return cliController . restart ( containerId ) ; } if ( stateMgrAdaptor == null ) { LOG . warning ( "SchedulerStateManagerAdaptor not initialized" ) ; return false ; } StMgr sm = searchContainer ( containerId ) ; if ( sm == null ) { LOG . warning ( "container not found in pplan " + containerId ) ; return false ; } String url = "http://" + sm . getHostName ( ) + ":" + sm . getShellPort ( ) + "/killexecutor" ; String payload = "secret=" + stateMgrAdaptor . getExecutionState ( topologyName ) . getTopologyId ( ) ; LOG . info ( "sending `kill container` to " + url + "; payload: " + payload ) ; HttpURLConnection con = NetworkUtils . getHttpConnection ( url ) ; try { if ( NetworkUtils . sendHttpPostRequest ( con , "X" , payload . getBytes ( ) ) ) { return NetworkUtils . checkHttpResponseCode ( con , 200 ) ; } else { // if heron - shell command fails , delegate to aurora client
LOG . info ( "heron-shell killexecutor failed; try aurora client .." ) ; return cliController . restart ( containerId ) ; } } finally { con . disconnect ( ) ; } |
public class IconicsAnimatedDrawable { /** * Attach an { @ link IconicsAnimationProcessor processor } to this drawable */
@ NonNull public IconicsAnimatedDrawable processor ( @ NonNull IconicsAnimationProcessor processor ) { } } | if ( processor == null ) return this ; processor . setDrawable ( this ) ; mProcessors . add ( processor ) ; return this ; |
public class SimpleRpcDispatcher { /** * Find out which field in the incoming message contains the payload that is .
* delivered to the service method . */
protected FieldDescriptor resolvePayloadField ( Message message ) { } } | for ( FieldDescriptor field : message . getDescriptorForType ( ) . getFields ( ) ) { if ( message . hasField ( field ) ) { return field ; } } throw new RuntimeException ( "No payload found in message " + message ) ; |
public class WebDavServiceImpl { /** * Gives the name of the repository to access .
* @ param repoName the name of the expected repository .
* @ return the name of the repository to access . */
protected String getRepositoryName ( String repoName ) throws RepositoryException { } } | // To be cloud compliant we need now to ignore the provided repository name ( more details in JCR - 2138)
ManageableRepository repo = repositoryService . getCurrentRepository ( ) ; String currentRepositoryName = repo . getConfiguration ( ) . getName ( ) ; if ( PropertyManager . isDevelopping ( ) && log . isWarnEnabled ( ) ) { if ( ! currentRepositoryName . equals ( repoName ) ) { log . warn ( "The expected repository was '" + repoName + "' but we will use the current repository instead which is '" + currentRepositoryName + "'" ) ; } } return currentRepositoryName ; |
public class CacheEventDispatcherImpl { /** * Synchronized to make sure listener removal is atomic
* @ param wrapper the listener wrapper to unregister
* @ param listenersList the listener list to remove from */
private synchronized boolean removeWrapperFromList ( EventListenerWrapper < K , V > wrapper , List < EventListenerWrapper < K , V > > listenersList ) { } } | int index = listenersList . indexOf ( wrapper ) ; if ( index != - 1 ) { EventListenerWrapper < K , V > containedWrapper = listenersList . remove ( index ) ; if ( containedWrapper . isOrdered ( ) && -- orderedListenerCount == 0 ) { storeEventSource . setEventOrdering ( false ) ; } if ( -- listenersCount == 0 ) { storeEventSource . removeEventListener ( eventListener ) ; } return true ; } return false ; |
public class KunderaQuery { /** * Inits the filter . */
private void initFilter ( ) { } } | EntityMetadata metadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , entityClass ) ; Metamodel metaModel = kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( getPersistenceUnit ( ) ) ; EntityType entityType = metaModel . entity ( entityClass ) ; if ( null == filter ) { List < String > clauses = new ArrayList < String > ( ) ; addDiscriminatorClause ( clauses , entityType ) ; return ; } WhereClause whereClause = KunderaQueryUtils . getWhereClause ( getJpqlExpression ( ) ) ; KunderaQueryUtils . traverse ( whereClause . getConditionalExpression ( ) , metadata , kunderaMetadata , this , false ) ; for ( Object filterClause : filtersQueue ) { if ( ! ( filterClause instanceof String ) ) { onTypedParameter ( ( ( FilterClause ) filterClause ) ) ; } } addDiscriminatorClause ( null , entityType ) ; |
public class Iterators { /** * Wraps another iterator and throws away nulls . */
public static < T > Iterator < T > removeNull ( final Iterator < T > itr ) { } } | return com . google . common . collect . Iterators . filter ( itr , Predicates . notNull ( ) ) ; |
public class MatrixFunctions { /** * Applies the < i > cosine < / i > function element - wise on this
* matrix . Note that this is an in - place operation .
* @ see MatrixFunctions # cos ( DoubleMatrix )
* @ return this matrix */
public static DoubleMatrix cosi ( DoubleMatrix x ) { } } | /* # mapfct ( ' Math . cos ' ) # */
// RJPP - BEGIN - - - - -
for ( int i = 0 ; i < x . length ; i ++ ) x . put ( i , ( double ) Math . cos ( x . get ( i ) ) ) ; return x ; // RJPP - END - - - - - |
public class TransformerIdentityImpl { /** * Set an output property that will be in effect for the
* transformation .
* < p > Pass a qualified property name as a two - part string , the namespace URI
* enclosed in curly braces ( { } ) , followed by the local name . If the
* name has a null URL , the String only contain the local name . An
* application can safely check for a non - null URI by testing to see if the first
* character of the name is a ' { ' character . < / p >
* < p > For example , if a URI and local name were obtained from an element
* defined with & lt ; xyz : foo xmlns : xyz = " http : / / xyz . foo . com / yada / baz . html " / & gt ; ,
* then the qualified name would be " { http : / / xyz . foo . com / yada / baz . html } foo " . Note that
* no prefix is used . < / p >
* < p > The Properties object that was passed to { @ link # setOutputProperties } won ' t
* be effected by calling this method . < / p >
* @ param name A non - null String that specifies an output
* property name , which may be namespace qualified .
* @ param value The non - null string value of the output property .
* @ throws IllegalArgumentException If the property is not supported , and is
* not qualified with a namespace .
* @ see javax . xml . transform . OutputKeys */
public void setOutputProperty ( String name , String value ) throws IllegalArgumentException { } } | if ( ! OutputProperties . isLegalPropertyKey ( name ) ) throw new IllegalArgumentException ( XSLMessages . createMessage ( XSLTErrorResources . ER_OUTPUT_PROPERTY_NOT_RECOGNIZED , new Object [ ] { name } ) ) ; // " output property not recognized : "
// + name ) ;
m_outputFormat . setProperty ( name , value ) ; |
public class Options { /** * Returns whether the named { @ link Option } is a member of this { @ link Options } .
* @ param opt long name of the { @ link Option }
* @ return true if the named { @ link Option } is a member of this { @ link Options }
* @ since 1.3 */
public boolean hasLongOption ( String opt ) { } } | opt = Util . stripLeadingHyphens ( opt ) ; return longOpts . containsKey ( opt ) ; |
public class TaskConfig { /** * Sets the default convergence criterion of a { @ link DeltaIteration }
* @ param aggregatorName
* @ param convCriterion */
public void setImplicitConvergenceCriterion ( String aggregatorName , ConvergenceCriterion < ? > convCriterion ) { } } | try { InstantiationUtil . writeObjectToConfig ( convCriterion , this . config , ITERATION_IMPLICIT_CONVERGENCE_CRITERION ) ; } catch ( IOException e ) { throw new RuntimeException ( "Error while writing the implicit convergence criterion object to the task configuration." ) ; } this . config . setString ( ITERATION_IMPLICIT_CONVERGENCE_CRITERION_AGG_NAME , aggregatorName ) ; |
public class AABBUtils { /** * Gets an empty { @ link AxisAlignedBB } ( size 0x0x0 ) at the { @ link BlockPos } position .
* @ param pos the pos
* @ return the axis aligned bb */
public static AxisAlignedBB empty ( BlockPos pos ) { } } | return new AxisAlignedBB ( pos . getX ( ) , pos . getY ( ) , pos . getZ ( ) , pos . getX ( ) , pos . getY ( ) , pos . getZ ( ) ) ; |
public class CalendarModifiedFollowingHandler { public Calendar adjustDate ( final Calendar startDate , final int increment , final NonWorkingDayChecker < Calendar > checker ) { } } | final Calendar cal = ( Calendar ) startDate . clone ( ) ; int step = increment ; final int month = cal . get ( Calendar . MONTH ) ; while ( checker . isNonWorkingDay ( cal ) ) { cal . add ( Calendar . DAY_OF_MONTH , step ) ; if ( month != cal . get ( Calendar . MONTH ) ) { // switch direction and go back
step *= - 1 ; cal . add ( Calendar . DAY_OF_MONTH , step ) ; } } return cal ; |
public class DatabaseProvider { /** * Builder method to create and initialize an instance of this class using
* the JDBC standard DriverManager method . The url parameter will be inspected
* to determine the Flavor for this database . */
@ CheckReturnValue public static Builder fromDriverManager ( String url , Properties info ) { } } | return fromDriverManager ( url , Flavor . fromJdbcUrl ( url ) , info , null , null ) ; |
public class BellaDati { /** * Reflectively loads the implementation ' s constructor to open a
* { @ link BellaDatiConnection } .
* @ return the constructor of a { @ link BellaDatiConnection } implementation
* @ throws ClassNotFoundException if the implementing class isn ' t found
* @ throws NoSuchMethodException if no constructor exists for the expected
* arguments
* @ throws SecurityException if access is denied */
private static Constructor < ? > getConnectionConstructor ( ) throws ClassNotFoundException , NoSuchMethodException , SecurityException { } } | Class < ? > clazz = Class . forName ( "com.belladati.sdk.impl.BellaDatiConnectionImpl" ) ; Constructor < ? > constructor = clazz . getDeclaredConstructor ( String . class , Boolean . TYPE ) ; constructor . setAccessible ( true ) ; return constructor ; |
public class LocalLearnerProcessor { /** * On event .
* @ param event the event
* @ return true , if successful */
@ Override public boolean process ( ContentEvent event ) { } } | InstanceContentEvent inEvent = ( InstanceContentEvent ) event ; Instance instance = inEvent . getInstance ( ) ; if ( inEvent . getInstanceIndex ( ) < 0 ) { // end learning
ResultContentEvent outContentEvent = new ResultContentEvent ( - 1 , instance , 0 , new double [ 0 ] , inEvent . isLastEvent ( ) ) ; outContentEvent . setClassifierIndex ( this . modelId ) ; outContentEvent . setEvaluationIndex ( inEvent . getEvaluationIndex ( ) ) ; outputStream . put ( outContentEvent ) ; return false ; } if ( inEvent . isTesting ( ) ) { double [ ] dist = model . getVotesForInstance ( instance ) ; ResultContentEvent outContentEvent = new ResultContentEvent ( inEvent . getInstanceIndex ( ) , instance , inEvent . getClassId ( ) , dist , inEvent . isLastEvent ( ) ) ; outContentEvent . setClassifierIndex ( this . modelId ) ; outContentEvent . setEvaluationIndex ( inEvent . getEvaluationIndex ( ) ) ; logger . trace ( inEvent . getInstanceIndex ( ) + " {} {}" , modelId , dist ) ; outputStream . put ( outContentEvent ) ; } if ( inEvent . isTraining ( ) ) { updateStats ( inEvent ) ; } return false ; |
public class GlobusGSSContextImpl { /** * Retrieves arbitrary data about this context .
* Currently supported oid : < UL >
* < LI >
* { @ link GSSConstants # X509 _ CERT _ CHAIN GSSConstants . X509 _ CERT _ CHAIN }
* returns certificate chain of the peer ( < code > X509Certificate [ ] < / code > ) .
* < / LI >
* < / UL >
* @ param oid the oid of the information desired .
* @ return the information desired . Might be null .
* @ exception GSSException containing the following major error codes :
* < code > GSSException . FAILURE < / code > */
public Object inquireByOid ( Oid oid ) throws GSSException { } } | if ( oid == null ) { throw new GlobusGSSException ( GSSException . FAILURE , GlobusGSSException . BAD_ARGUMENT , "nullOption" ) ; } if ( oid . equals ( GSSConstants . X509_CERT_CHAIN ) ) { if ( isEstablished ( ) ) { // converting certs is slower but keeping coverted certs
// takes lots of memory .
try { /* DEL
Vector peerCerts = this . conn . getCertificateChain ( ) ; */
Certificate [ ] peerCerts ; try { peerCerts = this . sslEngine . getSession ( ) . getPeerCertificates ( ) ; } catch ( SSLPeerUnverifiedException e ) { peerCerts = null ; } if ( peerCerts != null && peerCerts . length > 0 ) { /* DEL
return PureTLSUtil . certificateChainToArray ( peerCerts ) ; */
return ( X509Certificate [ ] ) peerCerts ; } else { return null ; } } catch ( Exception e ) { throw new GlobusGSSException ( GSSException . DEFECTIVE_CREDENTIAL , e ) ; } } } else if ( oid . equals ( GSSConstants . RECEIVED_LIMITED_PROXY ) ) { return this . peerLimited ; } return null ; |
public class DefaultAnnotationProvider { /** * < p > Return a list of classes to examine from the specified JAR archive .
* If this archive has no classes in it , a zero - length list is returned . < / p >
* @ param context < code > ExternalContext < / code > instance for
* this application
* @ param jar < code > JarFile < / code > for the archive to be scanned
* @ exception ClassNotFoundException if a located class cannot be loaded */
private List < Class < ? > > archiveClasses ( JarFile jar , List < Class < ? > > list ) { } } | // Accumulate and return a list of classes in this JAR file
ClassLoader loader = ClassUtils . getContextClassLoader ( ) ; if ( loader == null ) { loader = this . getClass ( ) . getClassLoader ( ) ; } Enumeration < JarEntry > entries = jar . entries ( ) ; while ( entries . hasMoreElements ( ) ) { JarEntry entry = entries . nextElement ( ) ; if ( entry . isDirectory ( ) ) { continue ; // This is a directory
} String name = entry . getName ( ) ; if ( name . startsWith ( "META-INF/" ) ) { continue ; // Attribute files
} if ( ! name . endsWith ( ".class" ) ) { continue ; // This is not a class
} DataInputStream in = null ; boolean couldContainAnnotation = false ; try { in = new DataInputStream ( jar . getInputStream ( entry ) ) ; couldContainAnnotation = _filter . couldContainAnnotationsOnClassDef ( in , byteCodeAnnotationsNames ) ; } catch ( IOException e ) { // Include this class - we can ' t scan this class using
// the filter , but it could be valid , so we need to
// load it using the classLoader . Anyway , log a debug
// message .
couldContainAnnotation = true ; if ( log . isLoggable ( Level . FINE ) ) { log . fine ( "IOException when filtering class " + name + " for annotations" ) ; } } finally { if ( in != null ) { try { in . close ( ) ; } catch ( IOException e ) { // No Op
} } } if ( couldContainAnnotation ) { name = name . substring ( 0 , name . length ( ) - 6 ) ; // Trim " . class "
Class < ? > clazz = null ; try { clazz = loader . loadClass ( name . replace ( '/' , '.' ) ) ; } catch ( NoClassDefFoundError e ) { // Skip this class - we cannot analyze classes we cannot load
} catch ( Exception e ) { // Skip this class - we cannot analyze classes we cannot load
} if ( clazz != null ) { list . add ( clazz ) ; } } } return list ; |
public class XSLTElementDef { /** * Given a namespace URI , and a local name , get the processor
* for the element , or return null if not allowed .
* @ param uri The Namespace URI , or an empty string .
* @ param localName The local name ( without prefix ) , or empty string if not namespace processing .
* @ return The element processor that matches the arguments , or null . */
XSLTElementProcessor getProcessorFor ( String uri , String localName ) { } } | XSLTElementProcessor elemDef = null ; // return value
if ( null == m_elements ) return null ; int n = m_elements . length ; int order = - 1 ; boolean multiAllowed = true ; for ( int i = 0 ; i < n ; i ++ ) { XSLTElementDef def = m_elements [ i ] ; // A " * " signals that the element allows literal result
// elements , so just assign the def , and continue to
// see if anything else matches .
if ( def . m_name . equals ( "*" ) ) { // Don ' t allow xsl elements
if ( ! equalsMayBeNullOrZeroLen ( uri , Constants . S_XSLNAMESPACEURL ) ) { elemDef = def . m_elementProcessor ; order = def . getOrder ( ) ; multiAllowed = def . getMultiAllowed ( ) ; } } else if ( def . QNameEquals ( uri , localName ) ) { if ( def . getRequired ( ) ) this . setRequiredFound ( def . getName ( ) , true ) ; order = def . getOrder ( ) ; multiAllowed = def . getMultiAllowed ( ) ; elemDef = def . m_elementProcessor ; break ; } } if ( elemDef != null && this . isOrdered ( ) ) { int lastOrder = getLastOrder ( ) ; if ( order > lastOrder ) setLastOrder ( order ) ; else if ( order == lastOrder && ! multiAllowed ) { return null ; } else if ( order < lastOrder && order > 0 ) { return null ; } } return elemDef ; |
public class LicenseHandler { /** * Approve or reject a license
* @ param name String
* @ param approved Boolean */
public void approveLicense ( final String name , final Boolean approved ) { } } | final DbLicense license = getLicense ( name ) ; repoHandler . approveLicense ( license , approved ) ; |
public class NeuralNetworkParser { /** * 获取距离特征
* @ param ctx 当前特征
* @ param features 输出特征 */
void get_distance_features ( final Context ctx , List < Integer > features ) { } } | if ( ! use_distance ) { return ; } int dist = 8 ; if ( ctx . S0 >= 0 && ctx . S1 >= 0 ) { dist = math . binned_1_2_3_4_5_6_10 [ ctx . S0 - ctx . S1 ] ; if ( dist == 10 ) { dist = 7 ; } } features . add ( dist + kDistanceInFeaturespace ) ; |
public class RegionOperationId { /** * Returns a region operation identity given project , region and operation names . */
public static RegionOperationId of ( String project , String region , String operation ) { } } | return new RegionOperationId ( project , region , operation ) ; |
public class Apptentive { /** * Our SDK must connect to our server at least once to download initial configuration for Message
* Center . Call this method to see whether or not Message Center can be displayed . This task is
* performed asynchronously .
* @ param callback Called after we check to see if Message Center can be displayed , but before it
* is displayed . Called with true if an Interaction will be displayed , else false . */
public static void canShowMessageCenter ( BooleanCallback callback ) { } } | dispatchConversationTask ( new ConversationDispatchTask ( callback , DispatchQueue . mainQueue ( ) ) { @ Override protected boolean execute ( Conversation conversation ) { return ApptentiveInternal . canShowMessageCenterInternal ( conversation ) ; } } , "check message center availability" ) ; |
public class Humanize { /** * Same as { @ link # paceFormat ( Number , long , String , String , String ) } for a
* target locale .
* @ param locale
* The target locale
* @ param value
* The number of occurrences within the specified interval
* @ param params
* The pace format parameterezation
* @ return an human readable textual representation of the pace */
public static String paceFormat ( final Locale locale , final Number value , final PaceParameters params ) { } } | return withinLocale ( new Callable < String > ( ) { @ Override public String call ( ) throws Exception { return paceFormat ( value , params ) ; } } , locale ) ; |
public class UnixPath { /** * Returns last component in { @ code path } .
* @ see java . nio . file . Path # getFileName ( ) */
@ Nullable public UnixPath getFileName ( ) { } } | if ( path . isEmpty ( ) ) { return EMPTY_PATH ; } else if ( isRoot ( ) ) { return null ; } else { List < String > parts = getParts ( ) ; String last = parts . get ( parts . size ( ) - 1 ) ; return parts . size ( ) == 1 && path . equals ( last ) ? this : new UnixPath ( permitEmptyComponents , last ) ; } |
public class BigtableClientMetrics { /** * Creates a named { @ link Timer } . This is a shortcut for
* { @ link BigtableClientMetrics # getMetricRegistry ( MetricLevel ) } .
* { @ link MetricRegistry # timer ( String ) } .
* @ return a { @ link Timer } */
public static Timer timer ( MetricLevel level , String name ) { } } | return getMetricRegistry ( level ) . timer ( METRIC_PREFIX + name ) ; |
public class RuleSetExecutor { /** * Applies the given concept .
* @ param concept
* The concept .
* @ throws RuleException
* If the concept cannot be applied . */
private boolean applyConcept ( RuleSet ruleSet , Concept concept , Severity severity ) throws RuleException { } } | Boolean result = executedConcepts . get ( concept ) ; if ( result == null ) { if ( applyRequiredConcepts ( ruleSet , concept ) ) { result = ruleVisitor . visitConcept ( concept , severity ) ; } else { ruleVisitor . skipConcept ( concept , severity ) ; result = false ; } executedConcepts . put ( concept , result ) ; } return result ; |
public class DestinationNamePattern { /** * Match a string against the pattern represented by this object . */
public boolean match ( String destinationName ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "match" , destinationName ) ; boolean matches = false ; if ( ! patternIsWildcarded ) { // Match the name directly through String equality
matches = destinationName . equals ( destinationNamePatternString ) ; } else { // We need to match a wildcarded expression
if ( destinationName . startsWith ( wildcardStem ) ) { // A candidate for full matching as the stem is the same
try { matches = mpm . evaluateDiscriminator ( destinationName , destinationNamePatternString , parsedPattern ) ; } // Any discriminator exceptions should have been caught at the prepare ( )
// stage , so ffdc , etc .
catch ( SIDiscriminatorSyntaxException e ) { // FFDC
FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.DestinationNamePattern.match" , "1:141:1.2" , this ) ; SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "match" , "SIErrorException" ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.impl.DestinationNamePattern" , "1:152:1.2" , e } ) ; throw new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.impl.DestinationNamePattern" , "1:160:1.2" , e } , null ) , e ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "match" , Boolean . valueOf ( matches ) ) ; return matches ; |
public class CommerceOrderNotePersistenceImpl { /** * Caches the commerce order note in the entity cache if it is enabled .
* @ param commerceOrderNote the commerce order note */
@ Override public void cacheResult ( CommerceOrderNote commerceOrderNote ) { } } | entityCache . putResult ( CommerceOrderNoteModelImpl . ENTITY_CACHE_ENABLED , CommerceOrderNoteImpl . class , commerceOrderNote . getPrimaryKey ( ) , commerceOrderNote ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_C_ERC , new Object [ ] { commerceOrderNote . getCompanyId ( ) , commerceOrderNote . getExternalReferenceCode ( ) } , commerceOrderNote ) ; commerceOrderNote . resetOriginalValues ( ) ; |
public class CompareStringQuery { /** * Construct a { @ link Query } implementation that scores documents with a string field value that is greater than or equal to
* the supplied constraint value .
* @ param constraintValue the constraint value ; may not be null
* @ param fieldName the name of the document field containing the value ; may not be null
* @ param caseOperation the operation that should be performed on the indexed values before the constraint value is being
* evaluated ; may be null which indicates that no case conversion should be done
* @ return the query ; never null */
public static Query createQueryForNodesWithFieldGreaterThanOrEqualTo ( String constraintValue , String fieldName , Function < String , String > caseOperation ) { } } | return FieldComparison . GE . createQueryForNodesWithField ( constraintValue , fieldName , caseOperation ) ; |
public class BandwidthClient { /** * This method implements an HTTP delete . Use this method to remove a resource .
* @ param uri the URI .
* @ return the response .
* @ throws IOException unexpected exception .
* @ throws AppPlatformException unexpected exception . */
public RestResponse delete ( final String uri ) throws IOException , AppPlatformException { } } | return request ( getPath ( uri ) , HttpDelete . METHOD_NAME ) ; |
public class XtraBox { /** * Removes specified tag ( all values for that tag will be removed )
* @ param name Tag to remove */
public void removeTag ( String name ) { } } | XtraTag tag = getTagByName ( name ) ; if ( tag != null ) { tags . remove ( tag ) ; } |
public class ReplicationLinksInner { /** * Sets which replica database is primary by failing over from the current primary replica database . This operation might result in data loss .
* @ 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 serverName The name of the server .
* @ param databaseName The name of the database that has the replication link to be failed over .
* @ param linkId The ID of the replication link to be failed over .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceResponse } object if successful . */
public Observable < Void > beginFailoverAllowDataLossAsync ( String resourceGroupName , String serverName , String databaseName , String linkId ) { } } | return beginFailoverAllowDataLossWithServiceResponseAsync ( resourceGroupName , serverName , databaseName , linkId ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ; |
public class TriggersInner { /** * Lists all the triggers configured in the device .
* @ param deviceName The device name .
* @ param resourceGroupName The resource group name .
* @ param expand Specify $ filter = ' CustomContextTag eq & lt ; tag & gt ; ' to filter on custom context tag property
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; TriggerInner & gt ; object */
public Observable < ServiceResponse < Page < TriggerInner > > > listByDataBoxEdgeDeviceWithServiceResponseAsync ( final String deviceName , final String resourceGroupName , final String expand ) { } } | return listByDataBoxEdgeDeviceSinglePageAsync ( deviceName , resourceGroupName , expand ) . concatMap ( new Func1 < ServiceResponse < Page < TriggerInner > > , Observable < ServiceResponse < Page < TriggerInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < TriggerInner > > > call ( ServiceResponse < Page < TriggerInner > > page ) { String nextPageLink = page . body ( ) . nextPageLink ( ) ; if ( nextPageLink == null ) { return Observable . just ( page ) ; } return Observable . just ( page ) . concatWith ( listByDataBoxEdgeDeviceNextWithServiceResponseAsync ( nextPageLink ) ) ; } } ) ; |
public class AbstractJaxRsConformanceProvider { /** * This method will set the conformance during the postconstruct phase . The method { @ link AbstractJaxRsConformanceProvider # getProviders ( ) } is used to get all the resource providers include in the
* conformance */
@ PostConstruct protected synchronized void setUpPostConstruct ( ) { } } | if ( myInitialized ) { return ; } for ( Entry < Class < ? extends IResourceProvider > , IResourceProvider > provider : getProviders ( ) . entrySet ( ) ) { addProvider ( provider . getValue ( ) , provider . getKey ( ) ) ; } List < BaseMethodBinding < ? > > serverBindings = new ArrayList < BaseMethodBinding < ? > > ( ) ; for ( ResourceBinding baseMethodBinding : myResourceNameToBinding . values ( ) ) { serverBindings . addAll ( baseMethodBinding . getMethodBindings ( ) ) ; } serverConfiguration . setServerBindings ( serverBindings ) ; serverConfiguration . setResourceBindings ( new LinkedList < ResourceBinding > ( myResourceNameToBinding . values ( ) ) ) ; HardcodedServerAddressStrategy hardcodedServerAddressStrategy = new HardcodedServerAddressStrategy ( ) ; hardcodedServerAddressStrategy . setValue ( getBaseForServer ( ) ) ; serverConfiguration . setServerAddressStrategy ( hardcodedServerAddressStrategy ) ; FhirVersionEnum fhirContextVersion = super . getFhirContext ( ) . getVersion ( ) . getVersion ( ) ; switch ( fhirContextVersion ) { case R4 : org . hl7 . fhir . r4 . hapi . rest . server . ServerCapabilityStatementProvider r4ServerCapabilityStatementProvider = new org . hl7 . fhir . r4 . hapi . rest . server . ServerCapabilityStatementProvider ( serverConfiguration ) ; r4ServerCapabilityStatementProvider . initializeOperations ( ) ; myR4CapabilityStatement = r4ServerCapabilityStatementProvider . getServerConformance ( null ) ; break ; case DSTU3 : org . hl7 . fhir . dstu3 . hapi . rest . server . ServerCapabilityStatementProvider dstu3ServerCapabilityStatementProvider = new org . hl7 . fhir . dstu3 . hapi . rest . server . ServerCapabilityStatementProvider ( serverConfiguration ) ; dstu3ServerCapabilityStatementProvider . initializeOperations ( ) ; myDstu3CapabilityStatement = dstu3ServerCapabilityStatementProvider . getServerConformance ( null ) ; break ; case DSTU2_1 : org . hl7 . fhir . dstu2016may . hapi . rest . server . ServerConformanceProvider dstu2_1ServerConformanceProvider = new org . hl7 . fhir . dstu2016may . hapi . rest . server . ServerConformanceProvider ( serverConfiguration ) ; dstu2_1ServerConformanceProvider . initializeOperations ( ) ; myDstu2_1Conformance = dstu2_1ServerConformanceProvider . getServerConformance ( null ) ; break ; case DSTU2_HL7ORG : org . hl7 . fhir . instance . conf . ServerConformanceProvider dstu2Hl7OrgServerConformanceProvider = new org . hl7 . fhir . instance . conf . ServerConformanceProvider ( serverConfiguration ) ; dstu2Hl7OrgServerConformanceProvider . initializeOperations ( ) ; myDstu2Hl7OrgConformance = dstu2Hl7OrgServerConformanceProvider . getServerConformance ( null ) ; break ; case DSTU2 : ca . uhn . fhir . rest . server . provider . dstu2 . ServerConformanceProvider dstu2ServerConformanceProvider = new ca . uhn . fhir . rest . server . provider . dstu2 . ServerConformanceProvider ( serverConfiguration ) ; dstu2ServerConformanceProvider . initializeOperations ( ) ; myDstu2Conformance = dstu2ServerConformanceProvider . getServerConformance ( null ) ; break ; default : throw new ConfigurationException ( "Unsupported Fhir version: " + fhirContextVersion ) ; } myInitialized = true ; |
public class BELScriptLexer { /** * $ ANTLR start " OBJECT _ IDENT " */
public final void mOBJECT_IDENT ( ) throws RecognitionException { } } | try { int _type = OBJECT_IDENT ; int _channel = DEFAULT_TOKEN_CHANNEL ; // BELScript . g : 277:13 : ( ( ' _ ' | LETTER | DIGIT ) + )
// BELScript . g : 278:5 : ( ' _ ' | LETTER | DIGIT ) +
{ // BELScript . g : 278:5 : ( ' _ ' | LETTER | DIGIT ) +
int cnt7 = 0 ; loop7 : do { int alt7 = 2 ; int LA7_0 = input . LA ( 1 ) ; if ( ( ( LA7_0 >= '0' && LA7_0 <= '9' ) || ( LA7_0 >= 'A' && LA7_0 <= 'Z' ) || LA7_0 == '_' || ( LA7_0 >= 'a' && LA7_0 <= 'z' ) ) ) { alt7 = 1 ; } switch ( alt7 ) { case 1 : // BELScript . g :
{ if ( ( input . LA ( 1 ) >= '0' && input . LA ( 1 ) <= '9' ) || ( input . LA ( 1 ) >= 'A' && input . LA ( 1 ) <= 'Z' ) || input . LA ( 1 ) == '_' || ( input . LA ( 1 ) >= 'a' && input . LA ( 1 ) <= 'z' ) ) { input . consume ( ) ; } else { MismatchedSetException mse = new MismatchedSetException ( null , input ) ; recover ( mse ) ; throw mse ; } } break ; default : if ( cnt7 >= 1 ) break loop7 ; EarlyExitException eee = new EarlyExitException ( 7 , input ) ; throw eee ; } cnt7 ++ ; } while ( true ) ; } state . type = _type ; state . channel = _channel ; } finally { } |
public class OpenSslSessionStats { /** * Returns the number of successfully reused sessions . In client mode , a session set with { @ code SSL _ set _ session }
* successfully reused is counted as a hit . In server mode , a session successfully retrieved from internal or
* external cache is counted as a hit . */
public long hits ( ) { } } | Lock readerLock = context . ctxLock . readLock ( ) ; readerLock . lock ( ) ; try { return SSLContext . sessionHits ( context . ctx ) ; } finally { readerLock . unlock ( ) ; } |
public class PluralCodeGenerator { /** * Generate a class for plural rule evaluation .
* This will build several Condition fields which evaluate specific AND conditions ,
* and methods which call these AND conditions joined by an OR operator . */
public void generate ( Path outputDir , DataReader reader ) throws IOException { } } | String className = "_PluralRules" ; TypeSpec . Builder type = TypeSpec . classBuilder ( className ) . addModifiers ( PUBLIC ) . superclass ( TYPE_BASE ) ; Map < String , FieldSpec > fieldMap = buildConditionFields ( reader . cardinals ( ) , reader . ordinals ( ) ) ; for ( Map . Entry < String , FieldSpec > entry : fieldMap . entrySet ( ) ) { type . addField ( entry . getValue ( ) ) ; } buildPluralMethod ( type , "Cardinal" , reader . cardinals ( ) , fieldMap ) ; buildPluralMethod ( type , "Ordinal" , reader . ordinals ( ) , fieldMap ) ; CodeGenerator . saveClass ( outputDir , PACKAGE_CLDR_PLURALS , className , type . build ( ) ) ; |
public class LambdaMap { /** * Wrap a { @ link Map } in a { @ link LambdaMap } .
* @ param map the { @ link Map }
* @ param < A > the key type
* @ param < B > the value type
* @ return the { @ link Map } wrapped in a { @ link LambdaMap } */
public static < A , B > LambdaMap < A , B > wrap ( Map < A , B > map ) { } } | return new LambdaMap < > ( map ) ; |
public class ResourceRecordSets { /** * creates sshfp set of { @ link denominator . model . rdata . SSHFPData SSHFP } records for the specified
* name and ttl .
* @ param name ex . { @ code denominator . io . }
* @ param sshfpdata sshfpdata values ex . { @ code 1 1 B33F } */
public static ResourceRecordSet < SSHFPData > sshfp ( String name , String sshfpdata ) { } } | return new SSHFPBuilder ( ) . name ( name ) . add ( sshfpdata ) . build ( ) ; |
public class AerospikeLog4jAppender { /** * ( non - Javadoc )
* @ see org . apache . log4j . AppenderSkeleton # append ( org . apache . log4j . spi . LoggingEvent ) */
@ Override @ SuppressWarnings ( { } } | "unchecked" } ) protected void append ( final LoggingEvent event ) { if ( null == this . client ) { try { connectToAerospike ( ) ; } catch ( UnknownHostException e ) { throw new RuntimeException ( e . getMessage ( ) , e ) ; } } List < Bin > binList = new ArrayList < Bin > ( ) ; StringBuilder keyString = new StringBuilder ( ) ; if ( null != applicationId ) { MDC . put ( APP_ID , applicationId ) ; keyString . append ( applicationId ) . append ( ":" ) ; binList . add ( new Bin ( APP_ID , applicationId ) ) ; } String eventName = event . getLogger ( ) . getName ( ) ; binList . add ( new Bin ( NAME , eventName ) ) ; keyString . append ( eventName ) . append ( ":" ) ; binList . add ( new Bin ( LEVEL , event . getLevel ( ) . toString ( ) ) ) ; keyString . append ( event . getLevel ( ) . toString ( ) ) . append ( ":" ) ; Calendar tstamp = Calendar . getInstance ( ) ; tstamp . setTimeInMillis ( event . getTimeStamp ( ) ) ; binList . add ( new Bin ( TIMESTAMP , event . getTimeStamp ( ) ) ) ; keyString . append ( event . getTimeStamp ( ) ) ; // Copy properties into the record
Map < Object , Object > props = event . getProperties ( ) ; if ( null != props && props . size ( ) > 0 ) { Map < String , String > propsMap = new HashMap < String , String > ( ) ; for ( Map . Entry < Object , Object > entry : props . entrySet ( ) ) { propsMap . put ( entry . getKey ( ) . toString ( ) , entry . getValue ( ) . toString ( ) ) ; } binList . add ( new Bin ( PROPERTIES , propsMap ) ) ; } // Copy traceback info ( if there is any ) into the record
String [ ] traceback = event . getThrowableStrRep ( ) ; if ( null != traceback && traceback . length > 0 ) { List < String > tb = new ArrayList < String > ( ) ; tb . addAll ( Arrays . asList ( traceback ) ) ; binList . add ( new Bin ( TRACEBACK , tb ) ) ; } // Put the rendered message into the record
binList . add ( new Bin ( MESSAGE , event . getRenderedMessage ( ) ) ) ; // Insert a record
Calendar now = Calendar . getInstance ( ) ; MDC . put ( YEAR , now . get ( Calendar . YEAR ) ) ; MDC . put ( MONTH , String . format ( "%1$02d" , now . get ( Calendar . MONTH ) + 1 ) ) ; MDC . put ( DAY , String . format ( "%1$02d" , now . get ( Calendar . DAY_OF_MONTH ) ) ) ; MDC . put ( HOUR , String . format ( "%1$02d" , now . get ( Calendar . HOUR_OF_DAY ) ) ) ; MDC . remove ( YEAR ) ; MDC . remove ( MONTH ) ; MDC . remove ( DAY ) ; MDC . remove ( HOUR ) ; if ( null != applicationId ) { MDC . remove ( APP_ID ) ; } Key key = new Key ( this . namespace , this . set , keyString . toString ( ) ) ; this . client . put ( null , key , binList . toArray ( new Bin [ 0 ] ) ) ; |
public class FileNode { /** * does not include the drive on windows */
@ Override public String getPath ( ) { } } | String result ; result = path . toString ( ) . substring ( getRoot ( ) . getAbsolute ( ) . length ( ) ) ; return result . replace ( File . separatorChar , Filesystem . SEPARATOR_CHAR ) ; |
public class CloseInventoryMessage { /** * Sends a packet to client to notify it to open a { @ link MalisisInventory } .
* @ param player the player */
public static void send ( EntityPlayerMP player ) { } } | Packet packet = new Packet ( ) ; MalisisCore . network . sendTo ( packet , player ) ; |
public class DateTimeFormatter { /** * Parses the text using this formatter , providing control over the text position .
* This parses the text without requiring the parse to start from the beginning
* of the string or finish at the end .
* The result of this method is { @ code TemporalAccessor } which has been resolved ,
* applying basic validation checks to help ensure a valid date - time .
* The text will be parsed from the specified start { @ code ParsePosition } .
* The entire length of the text does not have to be parsed , the { @ code ParsePosition }
* will be updated with the index at the end of parsing .
* The operation of this method is slightly different to similar methods using
* { @ code ParsePosition } on { @ code java . text . Format } . That class will return
* errors using the error index on the { @ code ParsePosition } . By contrast , this
* method will throw a { @ link DateTimeParseException } if an error occurs , with
* the exception containing the error index .
* This change in behavior is necessary due to the increased complexity of
* parsing and resolving dates / times in this API .
* If the formatter parses the same field more than once with different values ,
* the result will be an error .
* @ param text the text to parse , not null
* @ param position the position to parse from , updated with length parsed
* and the index of any error , not null
* @ return the parsed temporal object , not null
* @ throws DateTimeParseException if unable to parse the requested result
* @ throws IndexOutOfBoundsException if the position is invalid */
public TemporalAccessor parse ( CharSequence text , ParsePosition position ) { } } | Jdk8Methods . requireNonNull ( text , "text" ) ; Jdk8Methods . requireNonNull ( position , "position" ) ; try { return parseToBuilder ( text , position ) . resolve ( resolverStyle , resolverFields ) ; } catch ( DateTimeParseException ex ) { throw ex ; } catch ( IndexOutOfBoundsException ex ) { throw ex ; } catch ( RuntimeException ex ) { throw createError ( text , ex ) ; } |
public class LinkedPredict { /** * 确保结果个数小于等于n
* @ param n */
public void assertSize ( int n ) { } } | while ( labels . size ( ) > n ) { labels . removeLast ( ) ; scores . removeLast ( ) ; if ( evidences . size ( ) > n ) evidences . removeLast ( ) ; } |
public class AtomicDouble { /** * Set the value to { @ code amount } and return the previous value . */
public double getAndSet ( double amount ) { } } | long v = value . getAndSet ( Double . doubleToLongBits ( amount ) ) ; return Double . longBitsToDouble ( v ) ; |
public class FlowController { /** * Internal destroy method that is invoked when this object is being removed from the session . This is a
* framework - invoked method ; it should not normally be called directly . */
void destroy ( HttpSession session ) { } } | onDestroy ( ) ; // for backwards compatiblity
super . destroy ( session ) ; // We may have lost our transient ServletContext reference . Try to get the ServletContext reference from the
// HttpSession object if necessary .
ServletContext servletContext = getServletContext ( ) ; if ( servletContext == null && session != null ) servletContext = session . getServletContext ( ) ; if ( servletContext != null ) { PageFlowEventReporter er = AdapterManager . getServletContainerAdapter ( servletContext ) . getEventReporter ( ) ; er . flowControllerDestroyed ( this , session ) ; } |
public class AmazonEC2Client { /** * Moves an Elastic IP address from the EC2 - Classic platform to the EC2 - VPC platform . The Elastic IP address must be
* allocated to your account for more than 24 hours , and it must not be associated with an instance . After the
* Elastic IP address is moved , it is no longer available for use in the EC2 - Classic platform , unless you move it
* back using the < a > RestoreAddressToClassic < / a > request . You cannot move an Elastic IP address that was originally
* allocated for use in the EC2 - VPC platform to the EC2 - Classic platform .
* @ param moveAddressToVpcRequest
* @ return Result of the MoveAddressToVpc operation returned by the service .
* @ sample AmazonEC2 . MoveAddressToVpc
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / MoveAddressToVpc " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public MoveAddressToVpcResult moveAddressToVpc ( MoveAddressToVpcRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeMoveAddressToVpc ( request ) ; |
public class ThreadContextClassLoaderBuilder { /** * Adds the supplied anURL to the list of internal URLs which should be used to build an URLClassLoader .
* Will only add an URL once , and warns about trying to re - add an URL .
* @ param anURL The URL to add .
* @ return This ThreadContextClassLoaderBuilder , for builder pattern chaining . */
public ThreadContextClassLoaderBuilder addURL ( final URL anURL ) { } } | // Check sanity
Validate . notNull ( anURL , "anURL" ) ; // Add the segment unless already added .
for ( URL current : urlList ) { if ( current . toString ( ) . equalsIgnoreCase ( anURL . toString ( ) ) ) { if ( log . isWarnEnabled ( ) ) { log . warn ( "Not adding URL [" + anURL . toString ( ) + "] twice. Check your plugin configuration." ) ; } // Don ' t re - add the supplied URL .
return this ; } } // Add the supplied URL to the urlList
if ( log . isDebugEnabled ( ) ) { log . debug ( "Adding URL [" + anURL . toString ( ) + "]" ) ; } // According to the URLClassLoader ' s documentation :
// " Any URL that ends with a ' / ' is assumed to refer to a directory .
// Otherwise , the URL is assumed to refer to a JAR file which will be downloaded and opened as needed . "
// . . . uhm . . . instead of using the ' protocol ' property of the URL itself ?
// So . . . we need to ensure that any file - protocol URLs which point to directories are actually
// terminated with a ' / ' . Otherwise the URLClassLoader treats those URLs as JARs - and hence ignores them .
urlList . add ( addSlashToDirectoryUrlIfRequired ( anURL ) ) ; return this ; |
public class OperationSupport { /** * Replace a resource , optionally performing placeholder substitution to the response .
* @ param updated updated object
* @ param type type of object provided
* @ param parameters a HashMap containing parameters for processing object
* @ param < T > template argument provided
* @ return returns de - serialized version of api server response .
* @ throws ExecutionException Execution Exception
* @ throws InterruptedException Interrupted Exception
* @ throws KubernetesClientException KubernetesClientException
* @ throws IOException IOException */
protected < T > T handleReplace ( T updated , Class < T > type , Map < String , String > parameters ) throws ExecutionException , InterruptedException , KubernetesClientException , IOException { } } | RequestBody body = RequestBody . create ( JSON , JSON_MAPPER . writeValueAsString ( updated ) ) ; Request . Builder requestBuilder = new Request . Builder ( ) . put ( body ) . url ( getResourceUrl ( checkNamespace ( updated ) , checkName ( updated ) ) ) ; return handleResponse ( requestBuilder , type , parameters ) ; |
public class IntCounter { /** * Subtracts the counts in the given Counter from the counts in this Counter .
* To copy the values from another Counter rather than subtracting them , use */
public void subtractAll ( IntCounter < E > counter ) { } } | for ( E key : map . keySet ( ) ) { decrementCount ( key , counter . getIntCount ( key ) ) ; } |
public class PortletAppTypeImpl { /** * Returns all < code > portlet < / code > elements
* @ return list of < code > portlet < / code > */
public List < PortletType < PortletAppType < T > > > getAllPortlet ( ) { } } | List < PortletType < PortletAppType < T > > > list = new ArrayList < PortletType < PortletAppType < T > > > ( ) ; List < Node > nodeList = childNode . get ( "portlet" ) ; for ( Node node : nodeList ) { PortletType < PortletAppType < T > > type = new PortletTypeImpl < PortletAppType < T > > ( this , "portlet" , childNode , node ) ; list . add ( type ) ; } return list ; |
public class MessageFormat { /** * Sets the Format objects to use for the format elements in the
* previously set pattern string .
* The order of formats in < code > newFormats < / code > corresponds to
* the order of format elements in the pattern string .
* If more formats are provided than needed by the pattern string ,
* the remaining ones are ignored . If fewer formats are provided
* than needed , then only the first < code > newFormats . length < / code >
* formats are replaced .
* Since the order of format elements in a pattern string often
* changes during localization , it is generally better to use the
* { @ link # setFormatsByArgumentIndex setFormatsByArgumentIndex }
* method , which assumes an order of formats corresponding to the
* order of elements in the < code > arguments < / code > array passed to
* the < code > format < / code > methods or the result array returned by
* the < code > parse < / code > methods .
* @ param newFormats the new formats to use
* @ exception NullPointerException if < code > newFormats < / code > is null */
public void setFormats ( Format [ ] newFormats ) { } } | int formatNumber = 0 ; for ( int partIndex = 0 ; formatNumber < newFormats . length && ( partIndex = nextTopLevelArgStart ( partIndex ) ) >= 0 ; ) { setCustomArgStartFormat ( partIndex , newFormats [ formatNumber ] ) ; ++ formatNumber ; } |
public class WebAppDispatcherContext { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . webcontainer . webapp . IWebAppDispatcherContext # setContextPath ( java . lang . String ) */
public void setContextPath ( String _contextPath ) { } } | if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "setContextPath" , "contextPath -> " + _contextPath + " ,this -> " + this ) ; } this . _contextPath = _contextPath ; |
public class TreeDataEvent { /** * Replies the list of current data .
* @ return the list of current data . */
@ Pure public List < Object > getCurrentValues ( ) { } } | if ( this . allValues == null ) { return Collections . emptyList ( ) ; } return Collections . unmodifiableList ( this . allValues ) ; |
public class JavaZipFileSystem { /** * { @ inheritDoc } */
public CodeSigner [ ] getCodeSigners ( VirtualFile mountPoint , VirtualFile target ) { } } | final ZipNode zipNode = getZipNode ( mountPoint , target ) ; if ( zipNode == null ) { return null ; } JarEntry jarEntry = zipNode . entry ; return jarEntry . getCodeSigners ( ) ; |
public class DsParser { /** * Store validation
* @ param v The validation
* @ param writer The writer
* @ exception Exception Thrown if an error occurs */
protected void storeValidation ( Validation v , XMLStreamWriter writer ) throws Exception { } } | writer . writeStartElement ( XML . ELEMENT_VALIDATION ) ; if ( v . getValidConnectionChecker ( ) != null ) { storeExtension ( v . getValidConnectionChecker ( ) , writer , XML . ELEMENT_VALID_CONNECTION_CHECKER ) ; } if ( v . getCheckValidConnectionSql ( ) != null ) { writer . writeStartElement ( XML . ELEMENT_CHECK_VALID_CONNECTION_SQL ) ; writer . writeCharacters ( v . getValue ( XML . ELEMENT_CHECK_VALID_CONNECTION_SQL , v . getCheckValidConnectionSql ( ) ) ) ; writer . writeEndElement ( ) ; } if ( v . isValidateOnMatch ( ) != null ) { writer . writeStartElement ( XML . ELEMENT_VALIDATE_ON_MATCH ) ; writer . writeCharacters ( v . getValue ( XML . ELEMENT_VALIDATE_ON_MATCH , v . isValidateOnMatch ( ) . toString ( ) ) ) ; writer . writeEndElement ( ) ; } if ( v . isBackgroundValidation ( ) != null ) { writer . writeStartElement ( XML . ELEMENT_BACKGROUND_VALIDATION ) ; writer . writeCharacters ( v . getValue ( XML . ELEMENT_BACKGROUND_VALIDATION , v . isBackgroundValidation ( ) . toString ( ) ) ) ; writer . writeEndElement ( ) ; } if ( v . getBackgroundValidationMillis ( ) != null ) { writer . writeStartElement ( XML . ELEMENT_BACKGROUND_VALIDATION_MILLIS ) ; writer . writeCharacters ( v . getValue ( XML . ELEMENT_BACKGROUND_VALIDATION_MILLIS , v . getBackgroundValidationMillis ( ) . toString ( ) ) ) ; writer . writeEndElement ( ) ; } if ( v . isUseFastFail ( ) != null ) { writer . writeStartElement ( XML . ELEMENT_USE_FAST_FAIL ) ; writer . writeCharacters ( v . getValue ( XML . ELEMENT_USE_FAST_FAIL , v . isUseFastFail ( ) . toString ( ) ) ) ; writer . writeEndElement ( ) ; } if ( v . getStaleConnectionChecker ( ) != null ) { storeExtension ( v . getStaleConnectionChecker ( ) , writer , XML . ELEMENT_STALE_CONNECTION_CHECKER ) ; } if ( v . getExceptionSorter ( ) != null ) { storeExtension ( v . getExceptionSorter ( ) , writer , XML . ELEMENT_EXCEPTION_SORTER ) ; } writer . writeEndElement ( ) ; |
public class GRPCUtils { /** * Create an evaluator descriptor info from an EvalautorDescriptor object .
* @ param descriptor object
* @ return EvaluatorDescriptorInfo */
public static EvaluatorDescriptorInfo toEvaluatorDescriptorInfo ( final EvaluatorDescriptor descriptor ) { } } | if ( descriptor == null ) { return null ; } EvaluatorDescriptorInfo . NodeDescriptorInfo nodeDescriptorInfo = descriptor . getNodeDescriptor ( ) == null ? null : EvaluatorDescriptorInfo . NodeDescriptorInfo . newBuilder ( ) . setHostName ( descriptor . getNodeDescriptor ( ) . getName ( ) ) . setId ( descriptor . getNodeDescriptor ( ) . getId ( ) ) . setIpAddress ( descriptor . getNodeDescriptor ( ) . getInetSocketAddress ( ) . getAddress ( ) . getHostAddress ( ) ) . setPort ( descriptor . getNodeDescriptor ( ) . getInetSocketAddress ( ) . getPort ( ) ) . setRackName ( descriptor . getNodeDescriptor ( ) . getRackDescriptor ( ) == null ? "" : descriptor . getNodeDescriptor ( ) . getRackDescriptor ( ) . getName ( ) ) . build ( ) ; return EvaluatorDescriptorInfo . newBuilder ( ) . setCores ( descriptor . getNumberOfCores ( ) ) . setMemory ( descriptor . getMemory ( ) ) . setRuntimeName ( descriptor . getRuntimeName ( ) ) . setNodeDescriptorInfo ( nodeDescriptorInfo ) . build ( ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.