signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class IfcSoundPropertiesImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) public EList < IfcSoundValue > getSoundValues ( ) { } } | return ( EList < IfcSoundValue > ) eGet ( Ifc2x3tc1Package . Literals . IFC_SOUND_PROPERTIES__SOUND_VALUES , true ) ; |
public class IntegerDateElement { /** * < p > Erzeugt ein neues Datumselement . < / p >
* @ param name name of element
* @ param index index of element
* @ param dmin default minimum
* @ param dmax default maximum
* @ param symbol format symbol
* @ return new element instance */
static IntegerDateElement create ( String name , int index , int dmin , int dmax , char symbol ) { } } | return new IntegerDateElement ( name , index , Integer . valueOf ( dmin ) , Integer . valueOf ( dmax ) , symbol ) ; |
public class AuditLogger { /** * Opens our log file , sets up our print writer and writes a message to it indicating that it
* was opened . */
protected void openLog ( boolean freakout ) { } } | try { // create our file writer to which we ' ll log
FileOutputStream fout = new FileOutputStream ( _logPath , true ) ; OutputStreamWriter writer = new OutputStreamWriter ( fout , "UTF8" ) ; _logWriter = new PrintWriter ( new BufferedWriter ( writer ) , true ) ; // log a standard message
log ( "log_opened " + _logPath ) ; } catch ( IOException ioe ) { String errmsg = "Unable to open audit log '" + _logPath + "'" ; if ( freakout ) { throw new RuntimeException ( errmsg , ioe ) ; } else { log . warning ( errmsg , "ioe" , ioe ) ; } } |
public class cmpaction { /** * Use this API to fetch filtered set of cmpaction resources .
* filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */
public static cmpaction [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | cmpaction obj = new cmpaction ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; cmpaction [ ] response = ( cmpaction [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class RegexpOnFilenameOrgCheck { /** * Setter .
* @ param pSelection the new value of { @ link # selection } */
public void setSelection ( final String pSelection ) { } } | if ( pSelection != null && pSelection . length ( ) > 0 ) { selection = Pattern . compile ( pSelection ) ; } |
public class ContainerTracker { /** * Register a started container to this tracker
* @ param containerId container id to register
* @ param imageConfig configuration of associated image
* @ param gavLabel pom label to identifying the reactor project where the container was created */
public synchronized void registerContainer ( String containerId , ImageConfiguration imageConfig , GavLabel gavLabel ) { } } | ContainerShutdownDescriptor descriptor = new ContainerShutdownDescriptor ( imageConfig , containerId ) ; shutdownDescriptorPerContainerMap . put ( containerId , descriptor ) ; updatePomLabelMap ( gavLabel , descriptor ) ; updateImageToContainerMapping ( imageConfig , containerId ) ; |
public class AmazonApiGatewayV2Client { /** * Creates a RouteResponse for a Route .
* @ param createRouteResponseRequest
* @ return Result of the CreateRouteResponse operation returned by the service .
* @ throws NotFoundException
* The resource specified in the request was not found .
* @ throws TooManyRequestsException
* The client is sending more than the allowed number of requests per unit of time .
* @ throws BadRequestException
* One of the parameters in the request is invalid .
* @ throws ConflictException
* The resource already exists .
* @ sample AmazonApiGatewayV2 . CreateRouteResponse */
@ Override public CreateRouteResponseResult createRouteResponse ( CreateRouteResponseRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeCreateRouteResponse ( request ) ; |
public class Primitives { /** * Returns the corresponding primitive type of { @ code type } if it is a wrapper type ; otherwise
* returns { @ code type } itself . Idempotent .
* < pre >
* unwrap ( Integer . class ) = = int . class
* unwrap ( int . class ) = = int . class
* unwrap ( String . class ) = = String . class
* < / pre > */
public static Class < ? > unwrap ( final Class < ? > cls ) { } } | N . checkArgNotNull ( cls , "cls" ) ; Class < ? > unwrapped = PRIMITIVE_2_WRAPPER . getByValue ( cls ) ; return unwrapped == null ? cls : unwrapped ; |
public class CmsIdentifiableObjectContainer { /** * Resets the container . < p > */
public void clear ( ) { } } | m_cache = null ; m_objectList . clear ( ) ; m_objectsById . clear ( ) ; m_orderedObjectList . clear ( ) ; m_objectsListsById . clear ( ) ; |
public class Blade { /** * Add a after route to routes , the before route will be executed after matching route
* @ param path your route path
* @ param handler route implement
* @ return return blade instance
* @ see # after ( String , RouteHandler ) */
@ Deprecated public Blade after ( @ NonNull String path , @ NonNull RouteHandler0 handler ) { } } | this . routeMatcher . addRoute ( path , handler , HttpMethod . AFTER ) ; return this ; |
public class NonBlockingBitOutputStream { /** * Write a single bit to the stream . It will only be flushed to the underlying
* OutputStream when a byte has been completed or when flush ( ) manually .
* @ param aBit
* 1 if the bit should be set , 0 if not
* @ throws IOException
* In case writing to the output stream failed */
public void writeBit ( final int aBit ) throws IOException { } } | if ( m_aOS == null ) throw new IllegalStateException ( "BitOutputStream is already closed" ) ; if ( aBit != CGlobal . BIT_NOT_SET && aBit != CGlobal . BIT_SET ) throw new IllegalArgumentException ( aBit + " is not a bit" ) ; if ( aBit == CGlobal . BIT_SET ) if ( m_bHighOrderBitFirst ) m_nBuffer |= ( aBit << ( 7 - m_nBufferedBitCount ) ) ; else m_nBuffer |= ( aBit << m_nBufferedBitCount ) ; ++ m_nBufferedBitCount ; if ( m_nBufferedBitCount == CGlobal . BITS_PER_BYTE ) flush ( ) ; |
public class ProtoParser { /** * Reads an integer and returns it . */
private int readInt ( ) { } } | String tag = readWord ( ) ; try { int radix = 10 ; if ( tag . startsWith ( "0x" ) || tag . startsWith ( "0X" ) ) { tag = tag . substring ( "0x" . length ( ) ) ; radix = 16 ; } return Integer . valueOf ( tag , radix ) ; } catch ( Exception e ) { throw unexpected ( "expected an integer but was " + tag ) ; } |
public class FingerprintGenerator { /** * Generate a fingerprint based on class and method
* @ param cl The class
* @ param m The method
* @ return The fingerprint generated */
public static String fingerprint ( Class cl , Method m ) { } } | return fingerprint ( cl , m . getName ( ) ) ; |
public class ClassicAuthenticator { /** * Sets the { @ link CredentialContext # CLUSTER _ MANAGEMENT } credential . Specific is ignored in this context .
* @ param adminName the administrative login to use .
* @ param adminPassword the administrative password to use .
* @ return this { @ link ClassicAuthenticator } for chaining . */
public ClassicAuthenticator cluster ( String adminName , String adminPassword ) { } } | this . clusterManagementCredential = new Credential ( adminName , adminPassword ) ; return this ; |
public class AbstrCFMLScriptTransformer { /** * Prueft ob sich der Zeiger am Ende eines Script Blockes befindet
* @ return Ende ScriptBlock ?
* @ throws TemplateException */
private final boolean isFinish ( Data data ) throws TemplateException { } } | comments ( data ) ; if ( data . tagName == null ) return false ; return data . srcCode . isCurrent ( "</" , data . tagName ) ; |
public class EUI64 { /** * Creates a { @ link EUI64 } from a string standard representation in { @ code name } . The standard
* representation is eight groups of two hexadecimal digits , separated by hyphens ( { @ code - } ) or
* colons ( { @ code : } ) , in transmission order .
* @ param name The string representation of of an EUI - 64.
* @ return The EUI - 64 represented by the specified { @ code name } .
* @ throws IllegalArgumentException if { @ code name } is not a valid string representation of an
* EUI - 64.
* @ throws NullPointerException if { @ code name } is { @ code null } .
* @ see # toString ( ) */
public static EUI64 fromString ( String name ) { } } | long bits = 0 ; char sep = 0 ; for ( int n = 0 ; ; ++ n ) { if ( n == name . length ( ) ) { if ( n == 23 ) { return new EUI64 ( bits ) ; } else { break ; } } char c = name . charAt ( n ) ; if ( n == 2 ) { if ( c != ':' && c != '-' ) { break ; } sep = c ; } else if ( ( n - 2 ) % 3 == 0 ) { if ( c != sep ) { break ; } } else if ( c >= '0' && c <= '9' ) { bits = ( bits << 4 ) | ( c - '0' ) ; } else if ( c >= 'a' && c <= 'f' ) { bits = ( bits << 4 ) | ( 10 + c - 'a' ) ; } else if ( c >= 'A' && c <= 'F' ) { bits = ( bits << 4 ) | ( 10 + c - 'A' ) ; } else { break ; } } throw new IllegalArgumentException ( "Invalid EUI-64 string: " + name ) ; |
public class BeansImpl { /** * If not already created , a new < code > decorators < / code > element will be created and returned .
* Otherwise , the first existing < code > decorators < / code > element will be returned .
* @ return the instance defined for the element < code > decorators < / code > */
public Decorators < Beans < T > > getOrCreateDecorators ( ) { } } | List < Node > nodeList = childNode . get ( "decorators" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new DecoratorsImpl < Beans < T > > ( this , "decorators" , childNode , nodeList . get ( 0 ) ) ; } return createDecorators ( ) ; |
public class ListServiceSpecificCredentialsResult { /** * A list of structures that each contain details about a service - specific credential .
* @ param serviceSpecificCredentials
* A list of structures that each contain details about a service - specific credential . */
public void setServiceSpecificCredentials ( java . util . Collection < ServiceSpecificCredentialMetadata > serviceSpecificCredentials ) { } } | if ( serviceSpecificCredentials == null ) { this . serviceSpecificCredentials = null ; return ; } this . serviceSpecificCredentials = new com . amazonaws . internal . SdkInternalList < ServiceSpecificCredentialMetadata > ( serviceSpecificCredentials ) ; |
public class Processor { /** * Creates a Source Processor
* @ param source the data source itself
* @ param parallelism the parallelism of this processor
* @ param description the description of this processor
* @ param taskConf the configuration of this processor
* @ param system actor system
* @ return the new created source processor */
public static Processor < DataSourceTask > source ( DataSource source , int parallelism , String description , UserConfig taskConf , ActorSystem system ) { } } | io . gearpump . streaming . Processor < DataSourceTask < Object , Object > > p = DataSourceProcessor . apply ( source , parallelism , description , taskConf , system ) ; return new Processor ( p ) ; |
public class SecurityContextImpl { /** * After deserializing the security context , re - inflate the subjects ( need to add the missing credentials , since these don ' t get serialized )
* @ param securityService the security service to use for authenticating the user
* @ param unauthenticatedSubjectServiceRef reference to the unauthenticated subject service for creating the unauthenticated subject */
protected void recreateFullSubjects ( SecurityService securityService , AtomicServiceReference < UnauthenticatedSubjectService > unauthenticatedSubjectServiceRef ) { } } | callerSubject = recreateFullSubject ( callerPrincipal , securityService , unauthenticatedSubjectServiceRef , callerSubjectCacheKey ) ; if ( ! subjectsAreEqual ) { invocationSubject = recreateFullSubject ( invocationPrincipal , securityService , unauthenticatedSubjectServiceRef , invocationSubjectCacheKey ) ; } else { invocationSubject = callerSubject ; } |
public class MPXWriter { /** * This method is called to format a task type .
* @ param value task type value
* @ return formatted task type */
private String formatTaskType ( TaskType value ) { } } | return ( LocaleData . getString ( m_locale , ( value == TaskType . FIXED_DURATION ? LocaleData . YES : LocaleData . NO ) ) ) ; |
public class Layout { /** * Layout children inside the layout container */
public void layoutChildren ( ) { } } | Set < Integer > copySet ; synchronized ( mMeasuredChildren ) { Log . d ( Log . SUBSYSTEM . LAYOUT , TAG , "layoutChildren [%d] layout = %s" , mMeasuredChildren . size ( ) , this ) ; copySet = new HashSet < > ( mMeasuredChildren ) ; } for ( int nextMeasured : copySet ) { Widget child = mContainer . get ( nextMeasured ) ; if ( child != null ) { child . preventTransformChanged ( true ) ; layoutChild ( nextMeasured ) ; postLayoutChild ( nextMeasured ) ; child . preventTransformChanged ( false ) ; } } |
public class KeydefFilter { /** * Parse the keys attributes .
* @ param atts all attributes */
private void handleKeysAttr ( final Attributes atts ) { } } | final String attrValue = atts . getValue ( ATTRIBUTE_NAME_KEYS ) ; if ( attrValue != null ) { URI target = toURI ( atts . getValue ( ATTRIBUTE_NAME_HREF ) ) ; final URI copyTo = toURI ( atts . getValue ( ATTRIBUTE_NAME_COPY_TO ) ) ; if ( copyTo != null ) { target = copyTo ; } final String keyRef = atts . getValue ( ATTRIBUTE_NAME_KEYREF ) ; // Many keys can be defined in a single definition , like
// keys = " a b c " , a , b and c are seperated by blank .
for ( final String key : attrValue . trim ( ) . split ( "\\s+" ) ) { if ( ! keysDefMap . containsKey ( key ) ) { if ( target != null && ! target . toString ( ) . isEmpty ( ) ) { final String attrScope = atts . getValue ( ATTRIBUTE_NAME_SCOPE ) ; final String attrFormat = atts . getValue ( ATTRIBUTE_NAME_FORMAT ) ; if ( attrScope != null && ( attrScope . equals ( ATTR_SCOPE_VALUE_EXTERNAL ) || attrScope . equals ( ATTR_SCOPE_VALUE_PEER ) ) ) { keysDefMap . put ( key , new KeyDef ( key , target , attrScope , attrFormat , null , null ) ) ; } else { String tail = null ; if ( target . getFragment ( ) != null ) { tail = target . getFragment ( ) ; target = stripFragment ( target ) ; } if ( ! target . isAbsolute ( ) ) { target = currentDir . resolve ( target ) ; } keysDefMap . put ( key , new KeyDef ( key , setFragment ( target , tail ) , ATTR_SCOPE_VALUE_LOCAL , attrFormat , null , null ) ) ; } } else if ( ! StringUtils . isEmptyString ( keyRef ) ) { // store multi - level keys .
keysRefMap . put ( key , keyRef ) ; } else { // target is null or empty , it is useful in the future
// when consider the content of key definition
keysDefMap . put ( key , new KeyDef ( key , null , null , null , null , null ) ) ; } } else { logger . info ( MessageUtils . getMessage ( "DOTJ045I" , key ) . toString ( ) ) ; } } } |
public class NettyHttpResponseFactory { /** * Lookup the response from the context .
* @ param request The context
* @ return The { @ link NettyMutableHttpResponse } */
@ Internal public static NettyMutableHttpResponse getOrCreate ( NettyHttpRequest < ? > request ) { } } | return getOr ( request , io . micronaut . http . HttpResponse . ok ( ) ) ; |
public class BooleanUI { /** * { @ inheritDoc } */
@ Override public Object transformObject ( final UIValue _uiValue , final Object _object ) throws EFapsException { } } | Object ret = null ; if ( _object instanceof Map ) { ret = _object ; } else if ( _object instanceof Serializable ) { _uiValue . setDbValue ( ( Serializable ) _object ) ; ret = getValue ( _uiValue ) ; } return ret ; |
public class TomcatServerXML { /** * Sets the http port and Fedora default http connector options .
* @ see " http : / / tomcat . apache . org / tomcat - 6.0 - doc / config / http . html "
* @ throws InstallationFailedException */
public void setHTTPPort ( ) throws InstallationFailedException { } } | // Note this very significant assumption : this xpath will select exactly one connector
Element httpConnector = ( Element ) getDocument ( ) . selectSingleNode ( HTTP_CONNECTOR_XPATH ) ; if ( httpConnector == null ) { throw new InstallationFailedException ( "Unable to set server.xml HTTP Port. XPath for Connector element failed." ) ; } httpConnector . addAttribute ( "port" , options . getValue ( InstallOptions . TOMCAT_HTTP_PORT ) ) ; httpConnector . addAttribute ( "enableLookups" , "true" ) ; // supports client dns / fqdn in xacml authz policies
httpConnector . addAttribute ( "acceptCount" , "100" ) ; httpConnector . addAttribute ( "maxThreads" , "150" ) ; httpConnector . addAttribute ( "minSpareThreads" , "25" ) ; httpConnector . addAttribute ( "maxSpareThreads" , "75" ) ; |
public class InMemoryEngine { /** * { @ inheritDoc } */
@ Override public < K , V > Map < K , V > getBigMap ( String name , Class < K > keyClass , Class < V > valueClass , MapType type , StorageHint storageHint , boolean isConcurrent , boolean isTemporary ) { } } | assertConnectionOpen ( ) ; Map < K , V > m ; if ( MapType . HASHMAP . equals ( type ) ) { m = isConcurrent ? new ConcurrentHashMap < > ( ) : new HashMap < > ( ) ; } else if ( MapType . TREEMAP . equals ( type ) ) { m = isConcurrent ? new ConcurrentSkipListMap < > ( ) : new TreeMap < > ( ) ; } else { throw new IllegalArgumentException ( "Unsupported MapType." ) ; } catalog . put ( name , new WeakReference < > ( m ) ) ; return m ; |
public class SeaGlassButtonUI { /** * DOCUMENT ME !
* @ param b DOCUMENT ME !
* @ param defaultIcon DOCUMENT ME !
* @ return DOCUMENT ME ! */
private Icon getPressedIcon ( AbstractButton b , Icon defaultIcon ) { } } | return getIcon ( b , b . getPressedIcon ( ) , defaultIcon , SynthConstants . PRESSED ) ; |
public class CmsDialog { /** * Builds a button row with a " close " and a " details " button . < p >
* @ param closeAttribute additional attributes for the " close " button
* @ param detailsAttribute additional attributes for the " details " button
* @ return the button row */
public String dialogButtonsCloseDetails ( String closeAttribute , String detailsAttribute ) { } } | return dialogButtons ( new int [ ] { BUTTON_CLOSE , BUTTON_DETAILS } , new String [ ] { closeAttribute , detailsAttribute } ) ; |
public class AuthenticationApi { /** * Sign - out a logged in user
* Sign - out the current user and invalidate either the current token or all tokens associated with the user .
* @ param authorization The OAuth 2 bearer access token you received from [ / auth / v3 / oauth / token ] ( / reference / authentication / Authentication / index . html # retrieveToken ) . For example : \ & quot ; Authorization : bearer a4b5da75 - a584-4053-9227-0f0ab23ff06e \ & quot ; ( required )
* @ param global Specifies whether to invalidate all tokens for the current user ( & # x60 ; true & # x60 ; ) or only the current token ( & # x60 ; false & # x60 ; ) . ( optional )
* @ param redirectUri Specifies the URI where the browser is redirected after sign - out is successful . ( optional )
* @ return ModelApiResponse
* @ throws AuthenticationApiException if the call is unsuccessful . */
public ModelApiResponse signOutGet ( String authorization , Boolean global , String redirectUri ) throws AuthenticationApiException { } } | try { return authenticationApi . signOut1 ( authorization , global , redirectUri ) ; } catch ( ApiException e ) { throw new AuthenticationApiException ( "Error sign out" , e ) ; } |
public class Exceptions { /** * Throws the specified exception violating the { @ code throws } clause of the enclosing method .
* This method is useful when you need to rethrow a checked exception in { @ link Function } , { @ link Consumer } ,
* { @ link Supplier } and { @ link Runnable } , only if you are sure that the rethrown exception will be handled
* as a { @ link Throwable } or an { @ link Exception } . For example :
* < pre > { @ code
* CompletableFuture . supplyAsync ( ( ) - > {
* try ( FileInputStream fin = new FileInputStream ( . . . ) ) {
* return someValue ;
* } catch ( IOException e ) {
* / / ' throw e ; ' won ' t work because Runnable . run ( ) does not allow any checked exceptions .
* return Exceptions . throwUnsafely ( e ) ;
* } ) . exceptionally ( CompletionActions : : log ) ;
* } < / pre >
* @ return This method never returns because it always throws an exception . However , combined with an
* arbitrary return clause , you can terminate any non - void function with a single statement .
* e . g . { @ code return Exceptions . throwUnsafely ( . . . ) ; } vs .
* { @ code Exceptions . throwUnsafely ( . . . ) ; return null ; } */
@ SuppressWarnings ( "ReturnOfNull" ) public static < T > T throwUnsafely ( Throwable cause ) { } } | doThrowUnsafely ( requireNonNull ( cause , "cause" ) ) ; return null ; // Never reaches here . |
public class Messages { /** * Create state message key for resource name . < p >
* @ param state resource state
* @ return title message key to resource state
* @ see org . opencms . file . CmsResource # getState ( ) */
public static String getStateKey ( CmsResourceState state ) { } } | StringBuffer sb = new StringBuffer ( GUI_STATE_PREFIX ) ; sb . append ( state . getState ( ) ) ; sb . append ( GUI_STATE_POSTFIX ) ; return sb . toString ( ) ; |
public class SQLLexer { /** * Quickly determine if the characters in a char array match the given token .
* Token must be specified in lower case , and must be all ASCII letters .
* Will return false if the token is preceded by alphanumeric characters - - -
* it may be embedded in an indentifier in this case .
* Similar to the method matchesToken , but makes some assumptions that may
* enhance performance .
* @ param buffer char array in which to look for token
* @ param position position in char array to look for token
* @ param lowercaseToken token to look for , must be all lowercase ASCII characters
* @ return true if the token is found , and false otherwise */
private static boolean matchTokenFast ( char [ ] buffer , int position , String lowercaseToken ) { } } | if ( position != 0 && isIdentifierPartFast ( buffer [ position - 1 ] ) ) { // character at position is preceded by a letter or digit
return false ; } int tokenLength = lowercaseToken . length ( ) ; if ( position + tokenLength > buffer . length ) { // Buffer not long enough to contain token .
return false ; } if ( position + tokenLength < buffer . length && isIdentifierPartFast ( buffer [ position + tokenLength ] ) ) { // Character after where token would be is a letter
return false ; } for ( int i = 0 ; i < tokenLength ; ++ i ) { char c = buffer [ position + i ] ; if ( ! isLetterFast ( c ) || ( toLowerFast ( c ) != lowercaseToken . charAt ( i ) ) ) { return false ; } } return true ; |
public class AnnotationScanner { /** * Created and adds the event to the eventsFound set , if its package matches the includeRegExp .
* @ param eventBuilderFactory Event Factory used to create the EventConfig instance with .
* @ param eventsFound Set of events found , to add the newly created EventConfig to .
* @ param includeRegExp Regular expression to test eventClassName with .
* @ param eventClassName Name of the class . */
@ SuppressWarnings ( "unchecked" ) private < T > void addClass ( Set < Class < ? extends T > > classes , String includeRegExp , String className , Class < T > ofType , Class < ? extends Annotation > annotationClass ) { } } | if ( className . matches ( includeRegExp ) ) { try { Class < ? > matchingClass = Class . forName ( className ) ; matchingClass . asSubclass ( ofType ) ; classes . add ( ( Class < T > ) matchingClass ) ; } catch ( ClassNotFoundException cnfe ) { throw new IllegalStateException ( "Scannotation found a class that does not exist " + className + " !" , cnfe ) ; } catch ( ClassCastException cce ) { throw new IllegalStateException ( "Class " + className + " is annoted with @" + annotationClass + " but does not extend or implement " + ofType ) ; } } |
public class SampleRandomGroupsHttpHandler { /** * test , how many times the group was present in the list of groups . */
private Map < String , Integer > runSampling ( final ProctorContext proctorContext , final Set < String > targetTestNames , final TestType testType , final int determinationsToRun ) { } } | final Set < String > targetTestGroups = getTargetTestGroups ( targetTestNames ) ; final Map < String , Integer > testGroupToOccurrences = Maps . newTreeMap ( ) ; for ( final String testGroup : targetTestGroups ) { testGroupToOccurrences . put ( testGroup , 0 ) ; } for ( int i = 0 ; i < determinationsToRun ; ++ i ) { final Identifiers identifiers = TestType . RANDOM . equals ( testType ) ? new Identifiers ( Collections . < TestType , String > emptyMap ( ) , /* randomEnabled */
true ) : Identifiers . of ( testType , Long . toString ( random . nextLong ( ) ) ) ; final AbstractGroups groups = supplier . getRandomGroups ( proctorContext , identifiers ) ; for ( final Entry < String , TestBucket > e : groups . getProctorResult ( ) . getBuckets ( ) . entrySet ( ) ) { final String testName = e . getKey ( ) ; if ( targetTestNames . contains ( testName ) ) { final int group = e . getValue ( ) . getValue ( ) ; final String testGroup = testName + group ; testGroupToOccurrences . put ( testGroup , testGroupToOccurrences . get ( testGroup ) + 1 ) ; } } } return testGroupToOccurrences ; |
public class NotifyWorkersRequest { /** * A list of Worker IDs you wish to notify . You can notify upto 100 Workers at a time .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setWorkerIds ( java . util . Collection ) } or { @ link # withWorkerIds ( java . util . Collection ) } if you want to
* override the existing values .
* @ param workerIds
* A list of Worker IDs you wish to notify . You can notify upto 100 Workers at a time .
* @ return Returns a reference to this object so that method calls can be chained together . */
public NotifyWorkersRequest withWorkerIds ( String ... workerIds ) { } } | if ( this . workerIds == null ) { setWorkerIds ( new java . util . ArrayList < String > ( workerIds . length ) ) ; } for ( String ele : workerIds ) { this . workerIds . add ( ele ) ; } return this ; |
public class ListTagsForResourceResult { /** * A list of tags for the resource .
* @ param tagList
* A list of tags for the resource . */
public void setTagList ( java . util . Collection < Tag > tagList ) { } } | if ( tagList == null ) { this . tagList = null ; return ; } this . tagList = new java . util . ArrayList < Tag > ( tagList ) ; |
public class Dstream { /** * Adjusts the clustering of a dense density grid . Implements lines 8 through 18 from Figure 4 of Chen and Tu 2007.
* @ param dg the dense density grid being adjusted
* @ param cv the characteristic vector of dg
* @ param dgClass the cluster to which dg belonged
* @ return a HashMap < DensityGrid , CharacteristicVector > containing density grids for update after this iteration */
private HashMap < DensityGrid , CharacteristicVector > adjustForDenseGrid ( DensityGrid dg , CharacteristicVector cv , int dgClass ) { } } | // System . out . print ( " Density grid " + dg . toString ( ) + " is adjusted as a dense grid at time " + this . getCurrTime ( ) + " . " ) ;
// Among all neighbours of dg , find the grid h whose cluster ch has the largest size
GridCluster ch ; // The cluster , ch , of h
DensityGrid hChosen = new DensityGrid ( dg ) ; // The chosen grid h , whose cluster ch has the largest size
double hChosenSize = - 1.0 ; // The size of ch , the largest cluster
DensityGrid dgH ; // The neighbour of g being considered
int hClass = NO_CLASS ; // The class label of h
int hChosenClass = NO_CLASS ; // The class label of ch
Iterator < DensityGrid > dgNeighbourhood = dg . getNeighbours ( ) . iterator ( ) ; HashMap < DensityGrid , CharacteristicVector > glNew = new HashMap < DensityGrid , CharacteristicVector > ( ) ; while ( dgNeighbourhood . hasNext ( ) ) { dgH = dgNeighbourhood . next ( ) ; if ( this . grid_list . containsKey ( dgH ) ) { hClass = this . grid_list . get ( dgH ) . getLabel ( ) ; if ( hClass != NO_CLASS ) { ch = this . cluster_list . get ( hClass ) ; if ( ch . getWeight ( ) > hChosenSize ) { hChosenSize = ch . getWeight ( ) ; hChosenClass = hClass ; hChosen = new DensityGrid ( dgH ) ; } } } } // System . out . println ( " Chosen neighbour is " + hChosen . toString ( ) + " from cluster " + hChosenClass + " . " ) ;
if ( hChosenClass != NO_CLASS && hChosenClass != dgClass ) { ch = this . cluster_list . get ( hChosenClass ) ; // If h is a dense grid
if ( this . grid_list . get ( hChosen ) . getAttribute ( ) == DENSE ) { // System . out . println ( " h is dense . " ) ;
// If dg is labelled as NO _ CLASS
if ( dgClass == NO_CLASS ) { // System . out . println ( " g was labelled NO _ CLASS " ) ;
cv . setLabel ( hChosenClass ) ; glNew . put ( dg , cv ) ; ch . addGrid ( dg ) ; this . cluster_list . set ( hChosenClass , ch ) ; } // Else if dg belongs to cluster c and h belongs to c '
else { // System . out . println ( " g was labelled " + dgClass ) ;
double gSize = this . cluster_list . get ( dgClass ) . getWeight ( ) ; if ( gSize <= hChosenSize ) mergeClusters ( dgClass , hChosenClass ) ; else mergeClusters ( hChosenClass , dgClass ) ; } } // Else if h is a transitional grid
else if ( this . grid_list . get ( hChosen ) . getAttribute ( ) == TRANSITIONAL ) { // System . out . print ( " h is transitional . " ) ;
// If dg is labelled as no class and if h is an outside grid if dg is added to ch
if ( dgClass == NO_CLASS && ! ch . isInside ( hChosen , dg ) ) { cv . setLabel ( hChosenClass ) ; glNew . put ( dg , cv ) ; ch . addGrid ( dg ) ; this . cluster_list . set ( hChosenClass , ch ) ; // System . out . println ( " dg is added to cluster " + hChosenClass + " . " ) ;
} // Else if dg is in cluster c and | c | > = | ch |
else if ( dgClass != NO_CLASS ) { GridCluster c = this . cluster_list . get ( dgClass ) ; double gSize = c . getWeight ( ) ; if ( gSize >= hChosenSize ) { // Move h from cluster ch to cluster c
ch . removeGrid ( hChosen ) ; c . addGrid ( hChosen ) ; CharacteristicVector cvhChosen = this . grid_list . get ( hChosen ) ; cvhChosen . setLabel ( dgClass ) ; glNew . put ( hChosen , cvhChosen ) ; // System . out . println ( " dgClass is " + dgClass + " , hChosenClass is " + hChosenClass + " , gSize is " + gSize + " and hChosenSize is " + hChosenSize + " h is added to cluster " + dgClass + " . " ) ;
this . cluster_list . set ( hChosenClass , ch ) ; this . cluster_list . set ( dgClass , c ) ; } } } } // If dgClass is dense and not in a cluster , and none if its neighbours are in a cluster ,
// put it in its own new cluster and search the neighbourhood for transitional or dense
// grids to add
else if ( dgClass == NO_CLASS ) { int newClass = this . cluster_list . size ( ) ; GridCluster c = new GridCluster ( ( CFCluster ) dg , new ArrayList < CFCluster > ( ) , newClass ) ; c . addGrid ( dg ) ; // System . out . println ( " Added " + dg . toString ( ) + " to cluster " + newClass + " . " ) ;
this . cluster_list . add ( c ) ; cv . setLabel ( newClass ) ; glNew . put ( dg , cv ) ; // Iterate through the neighbourhood until no more transitional neighbours can be added
// ( dense neighbours will add themselves as part of their adjust process )
dgNeighbourhood = dg . getNeighbours ( ) . iterator ( ) ; while ( dgNeighbourhood . hasNext ( ) ) { DensityGrid dghprime = dgNeighbourhood . next ( ) ; if ( this . grid_list . containsKey ( dghprime ) && ! c . getGrids ( ) . containsKey ( dghprime ) ) { CharacteristicVector cvhprime = this . grid_list . get ( dghprime ) ; if ( cvhprime . getAttribute ( ) == TRANSITIONAL ) { // System . out . println ( " Added " + dghprime . toString ( ) + " to cluster " + newClass + " . " ) ;
c . addGrid ( dghprime ) ; cvhprime . setLabel ( newClass ) ; glNew . put ( dghprime , cvhprime ) ; } } } this . cluster_list . set ( newClass , c ) ; // System . out . println ( " Cluster " + newClass + " : " + this . cluster _ list . get ( newClass ) . toString ( ) ) ;
} return glNew ; |
public class PublicanPODocBookBuilder { /** * Add any bug link strings for a specific topic .
* @ param buildData Information and data structures for the build .
* @ param specTopic The spec topic to create any bug link translation strings for .
* @ param translations The mapping of original strings to translation strings , that will be used to build the po / pot files .
* @ throws BuildProcessingException Thrown if the bug links cannot be created . */
protected void processPOTopicBugLink ( final POBuildData buildData , final SpecTopic specTopic , final Map < String , TranslationDetails > translations ) throws BuildProcessingException { } } | try { final DocBookXMLPreProcessor preProcessor = buildData . getXMLPreProcessor ( ) ; final String bugLinkUrl = preProcessor . getBugLinkUrl ( buildData , specTopic ) ; processPOBugLinks ( buildData , preProcessor , bugLinkUrl , translations ) ; } catch ( BugLinkException e ) { throw new BuildProcessingException ( e ) ; } catch ( Exception e ) { throw new BuildProcessingException ( "Failed to insert Bug Links into the DOM Document" , e ) ; } |
public class RunsInner { /** * Patch the run properties .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ param runId The run ID .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < RunInner > updateAsync ( String resourceGroupName , String registryName , String runId ) { } } | return updateWithServiceResponseAsync ( resourceGroupName , registryName , runId ) . map ( new Func1 < ServiceResponse < RunInner > , RunInner > ( ) { @ Override public RunInner call ( ServiceResponse < RunInner > response ) { return response . body ( ) ; } } ) ; |
public class SDVariable { /** * Reverse subtraction operation : elementwise { @ code x - this } < br >
* If this and x variables have equal shape , the output shape is the same as the inputs . < br >
* Supports broadcasting : if this and x have different shapes and are broadcastable , the output shape is broadcast .
* @ param name Name of the output variable
* @ param x Variable to perform operation with
* @ return Output ( result ) SDVariable */
public SDVariable rsub ( String name , SDVariable x ) { } } | val result = sameDiff . f ( ) . rsub ( this , x ) ; return sameDiff . updateVariableNameAndReference ( result , name ) ; |
public class MemoryPoolStats { /** * Sets new used memory amount .
* @ param value the memory amount . */
public void setUsed ( long value ) { } } | used . setValueAsLong ( value ) ; minUsed . setValueIfLesserThanCurrentAsLong ( value ) ; maxUsed . setValueIfGreaterThanCurrentAsLong ( value ) ; |
public class Main { /** * Main
* @ param args args */
public static void main ( String [ ] args ) { } } | final int argsLength = args . length ; if ( argsLength < 1 ) { usage ( ) ; System . exit ( OTHER ) ; } String rarFile = "" ; String [ ] cps = null ; boolean stdout = false ; String reportFile = "" ; for ( int i = 0 ; i < argsLength ; i ++ ) { String arg = args [ i ] ; if ( arg . equals ( ARGS_CP ) ) { cps = args [ ++ i ] . split ( System . getProperty ( "path.separator" ) ) ; } else if ( arg . equals ( ARGS_STDOUT ) ) { stdout = true ; } else if ( arg . equals ( ARGS_OUT ) ) { reportFile = args [ ++ i ] ; } else if ( arg . endsWith ( "rar" ) ) { rarFile = arg ; } else { usage ( ) ; System . exit ( OTHER ) ; } } int exitCode = rarInfo ( rarFile , cps , stdout , reportFile ) ; if ( exitCode == SUCCESS ) { System . out . println ( "Done." ) ; } System . exit ( exitCode ) ; |
public class ReconnectionManager { /** * Disable the automatic reconnection mechanism . Does nothing if already disabled . */
public synchronized void disableAutomaticReconnection ( ) { } } | if ( ! automaticReconnectEnabled ) { return ; } XMPPConnection connection = weakRefConnection . get ( ) ; if ( connection == null ) { throw new IllegalStateException ( "Connection instance no longer available" ) ; } connection . removeConnectionListener ( connectionListener ) ; automaticReconnectEnabled = false ; |
public class BigMoney { /** * Returns a copy of this monetary value with the specified amount .
* The returned instance will have this currency and the new amount .
* The scale of the returned instance will be that of the specified BigDecimal .
* This instance is immutable and unaffected by this method .
* @ param amount the monetary amount to set in the returned instance , not null
* @ return the new instance with the input amount set , never null */
public BigMoney withAmount ( BigDecimal amount ) { } } | MoneyUtils . checkNotNull ( amount , "Amount must not be null" ) ; if ( this . amount . equals ( amount ) ) { return this ; } return BigMoney . of ( currency , amount ) ; |
public class SwipeBack { /** * Sets the color of the divider , if you have set the option to use a shadow
* gradient as divider
* You must enable the divider by calling
* { @ link # setDividerEnabled ( boolean ) }
* @ param color
* The color of the divider shadow . */
public SwipeBack setDividerAsShadowColor ( int color ) { } } | GradientDrawable . Orientation orientation = getDividerOrientation ( ) ; final int endColor = color & 0x00FFFFFF ; GradientDrawable gradient = new GradientDrawable ( orientation , new int [ ] { color , endColor , } ) ; setDivider ( gradient ) ; return this ; |
public class WebhookCluster { /** * Closes all { @ link net . dv8tion . jda . webhook . WebhookClient WebhookClients } that meet
* the specified filter .
* < br > The filter may return { @ code true } for all clients that should be < b > removed and closed < / b > .
* @ param predicate
* The filter to decide which clients to remove
* @ throws java . lang . IllegalArgumentException
* If the provided filter is { @ code null }
* @ return List of removed and closed clients */
public List < WebhookClient > closeIf ( Predicate < WebhookClient > predicate ) { } } | Checks . notNull ( predicate , "Filter" ) ; List < WebhookClient > clients = new ArrayList < > ( ) ; for ( WebhookClient client : webhooks ) { if ( predicate . test ( client ) ) clients . add ( client ) ; } removeWebhooks ( clients ) ; clients . forEach ( WebhookClient :: close ) ; return clients ; |
public class GBSInsertFringe { /** * Balance a fringe with a K factor of thirty - two .
* @ param stack The stack of nodes through which the insert operation
* passed .
* @ param bparent The parent of the fringe balance point .
* @ param fpoint The fringe balance point ( the top of the fringe ) .
* @ param fpidx The index within the stack of fpoint
* @ param maxBal Maximum allowed fringe imbalance . */
private void balance32 ( NodeStack stack , GBSNode bparent , /* Parent of fringe balance point */
GBSNode fpoint , /* Fringe balance point */
int fpidx , /* Index within stack of fpoint */
int maxBal ) /* Maximum allowed fringe imbalance */
{ } } | /* k = 32 , 2k - 1 = 63 , k - 1 = 31
[ A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - 0-1-2-3-4 ] [ 31 children ]
becomes :
* - - - - - H - - - - - * * - - - - - X - - - - - *
* - - - D - - - * * - - - L - - - * * - - - T - - - * * - - - 1 - - - *
* - B - * * - F - * * - J - * * - N - * * - R - * * - V - * * - Z - * * - 3 - *
A C E G I K M O Q S U W Y 0 2 4
* - - - - - H - - - - - * * - - - - - X - - - - - *
* - - - D - - - * * - - - L - - - * * - - - T - - - * * - - - 1 - - - *
* - B - * * - F - * * - J - * * - N - * * - R - * * - V - * * - Z - * * - 3 - * [ 33 children ]
A C E G I K M O Q S U W Y 0 2 4 - A - B - C - D - E - F - G - H - I - J - K - L - M - N - O -
P - Q - R - S - T - U - V - W - X - Y - Z - 0-1-2-3-4-5
becomes :
* - - - - - P - - - - - * * - - - - - Q - - - - - *
* - - - - - H - - - - - * * - - - - - X - - - - - * * - - - - - I - - - - - * * - - - - - Y - - - - - *
* - - - D - - - * * - - - L - - - * * - - - T - - - * * - - - 1 - - - * * - - - E - - - * * - - - M - - - * * - - - U - - - * * - - - 2 - - - *
* - B - * * - F - * * - J - * * - N - * * - R - * * - V - * * - Z - * * - 3 - * * - C - * * - G - * * - K - * * - O - * * - S - * * - W - * * - 0 - * * - 4 - *
A C E G I K M O Q S U W Y 0 2 4 B D F H J L N P R T V X Z 1 3 5
- - - - - * * - - - - - I - - - - - * * - - - - - Y - - - - - *
* - - - 1 - - - * * - - - E - - - * * - - - M - - - * * - - - U - - - * * - - - 2 - - - *
* - Z - * * - 3 - * * - C - * * - G - * * - K - * * - O - * * - S - * * - W - * * - 0 - * * - 4 - *
Y 0 2 4 B D F H J L N P R T V X Z 1 3 5
* - - - - - P - - - - - * * - - - - - Q - - - - - *
* - - - H - - - * * - - - X - - - * * - - - I - - - * * - - - Y - - - *
* - D - * * - L - * * - T - * * - 1 - * * - E - * * - M - * * - U - * * - 2 - *
* B * * F * * J * * N * * R * * V * * Z * * 3 * * C * * G * * K * * O * * S * * W * * 0 * * 4*
A C E G I K M O Q S U W Y 0 2 4 B D F H J L N P R T V X Z 1 3 5 */
if ( maxBal == 31 ) { GBSNode b = fpoint . rightChild ( ) ; GBSNode c = b . rightChild ( ) ; GBSNode d = c . rightChild ( ) ; GBSNode e = d . rightChild ( ) ; GBSNode f = e . rightChild ( ) ; GBSNode g = f . rightChild ( ) ; GBSNode h = g . rightChild ( ) ; GBSNode i = h . rightChild ( ) ; GBSNode j = i . rightChild ( ) ; GBSNode k = j . rightChild ( ) ; GBSNode l = k . rightChild ( ) ; GBSNode m = l . rightChild ( ) ; GBSNode n = m . rightChild ( ) ; GBSNode o = n . rightChild ( ) ; GBSNode p = o . rightChild ( ) ; GBSNode q = p . rightChild ( ) ; GBSNode r = q . rightChild ( ) ; GBSNode s = r . rightChild ( ) ; GBSNode t = s . rightChild ( ) ; GBSNode u = t . rightChild ( ) ; GBSNode v = u . rightChild ( ) ; GBSNode w = v . rightChild ( ) ; GBSNode x = w . rightChild ( ) ; GBSNode y = x . rightChild ( ) ; GBSNode z = y . rightChild ( ) ; GBSNode p0 = z . rightChild ( ) ; GBSNode p1 = p0 . rightChild ( ) ; GBSNode p2 = p1 . rightChild ( ) ; GBSNode p3 = p2 . rightChild ( ) ; GBSNode p4 = p3 . rightChild ( ) ; p . setLeftChild ( h ) ; p . setRightChild ( x ) ; h . setLeftChild ( d ) ; h . setRightChild ( l ) ; d . setLeftChild ( b ) ; d . setRightChild ( f ) ; b . setLeftChild ( fpoint ) ; b . setRightChild ( c ) ; fpoint . clearRightChild ( ) ; c . clearRightChild ( ) ; f . setLeftChild ( e ) ; f . setRightChild ( g ) ; e . clearRightChild ( ) ; g . clearRightChild ( ) ; l . setLeftChild ( j ) ; l . setRightChild ( n ) ; j . setLeftChild ( i ) ; j . setRightChild ( k ) ; i . clearRightChild ( ) ; k . clearRightChild ( ) ; n . setLeftChild ( m ) ; n . setRightChild ( o ) ; m . clearRightChild ( ) ; o . clearRightChild ( ) ; x . setLeftChild ( t ) ; x . setRightChild ( p1 ) ; t . setLeftChild ( r ) ; t . setRightChild ( v ) ; r . setLeftChild ( q ) ; r . setRightChild ( s ) ; q . clearRightChild ( ) ; s . clearRightChild ( ) ; v . setLeftChild ( u ) ; v . setRightChild ( w ) ; u . clearRightChild ( ) ; w . clearRightChild ( ) ; p1 . setLeftChild ( z ) ; p1 . setRightChild ( p3 ) ; z . setLeftChild ( y ) ; z . setRightChild ( p0 ) ; y . clearRightChild ( ) ; p0 . clearRightChild ( ) ; p3 . setLeftChild ( p2 ) ; p3 . setRightChild ( p4 ) ; p2 . clearRightChild ( ) ; if ( bparent . rightChild ( ) == fpoint ) bparent . setRightChild ( p ) ; else bparent . setLeftChild ( p ) ; } else { if ( maxBal != 33 ) error ( "fringeBalance32: maxBal != 33, maxBal = " + maxBal ) ; GBSNode t0_top = stack . node ( fpidx - 5 ) ; GBSNode xp1 = stack . node ( fpidx - 4 ) ; GBSNode a = fpoint . rightChild ( ) ; GBSNode b = a . rightChild ( ) ; GBSNode c = b . rightChild ( ) ; GBSNode d = c . rightChild ( ) ; GBSNode e = d . rightChild ( ) ; GBSNode f = e . rightChild ( ) ; GBSNode g = f . rightChild ( ) ; GBSNode h = g . rightChild ( ) ; GBSNode i = h . rightChild ( ) ; GBSNode j = i . rightChild ( ) ; GBSNode k = j . rightChild ( ) ; GBSNode l = k . rightChild ( ) ; GBSNode m = l . rightChild ( ) ; GBSNode n = m . rightChild ( ) ; GBSNode o = n . rightChild ( ) ; GBSNode p = o . rightChild ( ) ; GBSNode q = p . rightChild ( ) ; GBSNode r = q . rightChild ( ) ; GBSNode s = r . rightChild ( ) ; GBSNode t = s . rightChild ( ) ; GBSNode u = t . rightChild ( ) ; GBSNode v = u . rightChild ( ) ; GBSNode w = v . rightChild ( ) ; GBSNode x = w . rightChild ( ) ; GBSNode y = x . rightChild ( ) ; GBSNode z = y . rightChild ( ) ; GBSNode p0 = z . rightChild ( ) ; GBSNode p1 = p0 . rightChild ( ) ; GBSNode p2 = p1 . rightChild ( ) ; GBSNode p3 = p2 . rightChild ( ) ; GBSNode p4 = p3 . rightChild ( ) ; GBSNode p5 = p4 . rightChild ( ) ; a . setChildren ( xp1 , q ) ; q . setChildren ( i , y ) ; i . setChildren ( e , m ) ; e . setChildren ( c , g ) ; c . setChildren ( b , d ) ; b . clearRightChild ( ) ; d . clearRightChild ( ) ; g . setChildren ( f , h ) ; f . clearRightChild ( ) ; h . clearRightChild ( ) ; m . setChildren ( k , o ) ; k . setChildren ( j , l ) ; j . clearRightChild ( ) ; l . clearRightChild ( ) ; o . setChildren ( n , p ) ; n . clearRightChild ( ) ; p . clearRightChild ( ) ; y . setChildren ( u , p2 ) ; u . setChildren ( s , w ) ; s . setChildren ( r , t ) ; r . clearRightChild ( ) ; t . clearRightChild ( ) ; w . setChildren ( v , x ) ; v . clearRightChild ( ) ; x . clearRightChild ( ) ; p2 . setChildren ( p0 , p4 ) ; p0 . setChildren ( z , p1 ) ; z . clearRightChild ( ) ; p1 . clearRightChild ( ) ; p4 . setChildren ( p3 , p5 ) ; p3 . clearRightChild ( ) ; fpoint . clearRightChild ( ) ; if ( t0_top . rightChild ( ) == xp1 ) t0_top . setRightChild ( a ) ; else t0_top . setLeftChild ( a ) ; if ( ( fpidx > 5 ) && ( stack . balancePointIndex ( ) > - 1 ) ) { GBSNode qpoint = a ; stack . setNode ( fpidx - 4 , qpoint ) ; GBSInsertHeight . singleInstance ( ) . balance ( stack , qpoint ) ; } } |
public class MemoryBandwidth { /** * memory bandwidth in bytes / second */
double run_benchmark ( ) { } } | // use the lesser of 40MB or 10 % of Heap
final long M = Math . min ( 10000000l , Runtime . getRuntime ( ) . maxMemory ( ) / 40 ) ; int [ ] vals = MemoryManager . malloc4 ( ( int ) M ) ; double total ; int repeats = 20 ; Timer timer = new Timer ( ) ; // ms
long sum = 0 ; // write repeats * M ints
// read repeats * M ints
for ( int l = repeats - 1 ; l >= 0 ; -- l ) { for ( int i = 0 ; i < M ; ++ i ) { vals [ i ] = i + l ; } sum = 0 ; for ( int i = 0 ; i < M ; ++ i ) { sum += vals [ i ] ; } } total = ( double ) timer . time ( ) / 1000. / repeats ; // use the sum in a way that doesn ' t affect the result ( don ' t want the compiler to optimize it away )
double time = total + ( ( M * ( M - 1 ) / 2 ) - sum ) ; // = = total
return ( double ) 2 * M * 4 / time ; // ( read + write ) * 4 bytes |
public class BitSet { /** * Every public method must preserve these invariants . */
private void checkInvariants ( ) { } } | assert ( wordsInUse == 0 || words [ wordsInUse - 1 ] != 0 ) ; assert ( wordsInUse >= 0 && wordsInUse <= words . length ) ; assert ( wordsInUse == words . length || words [ wordsInUse ] == 0 ) ; |
public class ArrayUtils { /** * Null - safe method returning the array if not null otherwise returns an empty array .
* @ param < T > Class type of the elements in the array .
* @ param array array to evaluate .
* @ param componentType { @ link Class } type of the elements in the array . Defaults to { @ link Object } if null .
* @ return the array if not null otherwise an empty array .
* @ see java . lang . reflect . Array # newInstance ( Class , int )
* @ see # nullSafeArray ( Object [ ] ) */
@ NullSafe @ SuppressWarnings ( "unchecked" ) public static < T > T [ ] nullSafeArray ( T [ ] array , Class < ? > componentType ) { } } | return array != null ? array : ( T [ ] ) Array . newInstance ( defaultIfNull ( componentType , Object . class ) , 0 ) ; |
public class BuilderImpl { /** * ( non - Javadoc )
* @ see com . ibm . ws . security . jwt . internal . Builder # claimFrom ( java . lang . String , java . lang . String ) */
@ Override public Builder claimFrom ( String jsonOrJwt , String claim ) throws InvalidClaimException , InvalidTokenException { } } | if ( JwtUtils . isNullEmpty ( claim ) ) { String err = Tr . formatMessage ( tc , "JWT_INVALID_CLAIM_ERR" , new Object [ ] { claim } ) ; throw new InvalidClaimException ( err ) ; } if ( isValidToken ( jsonOrJwt ) ) { String decoded = jsonOrJwt ; if ( JwtUtils . isBase64Encoded ( jsonOrJwt ) ) { decoded = JwtUtils . decodeFromBase64String ( jsonOrJwt ) ; } boolean isJson = JwtUtils . isJson ( decoded ) ; if ( ! isJson ) { String jwtPayload = JwtUtils . getPayload ( jsonOrJwt ) ; decoded = JwtUtils . decodeFromBase64String ( jwtPayload ) ; } // } else {
// / / either decoded payload from jwt or encoded / decoded json string
// if ( JwtUtils . isBase64Encoded ( jsonOrJwt ) ) {
// decoded = JwtUtils . decodeFromBase64String ( jsonOrJwt ) ;
if ( decoded != null ) { Object claimValue = null ; try { if ( ( claimValue = JwtUtils . claimFromJsonObject ( decoded , claim ) ) != null ) { claims . put ( claim , claimValue ) ; } } catch ( JoseException e ) { String err = Tr . formatMessage ( tc , "JWT_INVALID_TOKEN_ERR" ) ; throw new InvalidTokenException ( err ) ; } } } return this ; |
public class Consumers { /** * Yields the only element if found , nothing otherwise .
* @ param < E > the iterator element type
* @ param iterator the iterator that will be consumed
* @ throws IllegalStateException if the iterator contains more than one
* element
* @ return just the element or nothing */
public static < E > Optional < E > maybeOne ( Iterator < E > iterator ) { } } | return new MaybeOneElement < E > ( ) . apply ( iterator ) ; |
public class SimpleBloomFilter { /** * Computes the optimal number of hash functions to apply to each element added to the Bloom Filter as a factor
* of the approximate ( estimated ) number of elements that will be added to the filter along with
* the required number of bits needed by the filter , which was computed from the probability of false positives .
* k = m / n * log 2
* m is the required number of bits needed for the bloom filter
* n is the approximate number of elements to be added to the bloom filter
* k is the optimal number of hash functions to apply to the element added to the bloom filter
* @ param approximateNumberOfElements integer value indicating the approximate , estimated number of elements
* the user expects will be added to the Bloom Filter .
* @ param requiredNumberOfBits the required number of bits needed by the Bloom Filter to satify the probability
* of false positives .
* @ return the optimal number of hash functions used by the Bloom Filter . */
protected static int computeOptimalNumberOfHashFunctions ( double approximateNumberOfElements , double requiredNumberOfBits ) { } } | double numberOfHashFunctions = ( requiredNumberOfBits / approximateNumberOfElements ) * Math . log ( 2.0d ) ; return Double . valueOf ( Math . ceil ( numberOfHashFunctions ) ) . intValue ( ) ; |
public class ScriptRuntimeException { /** * Returns a message containing the String passed to a constructor as well as line and column numbers and filename if any of these are known .
* @ return The error message . */
@ Override public String getMessage ( ) { } } | String ret = super . getMessage ( ) ; if ( fileName != null ) { ret += ( " in " + fileName ) ; if ( lineNumber != - 1 ) { ret += " at line number " + lineNumber ; } if ( columnNumber != - 1 ) { ret += " at column number " + columnNumber ; } } return ret ; |
public class ApiOvhCloud { /** * Delete a group
* REST : DELETE / cloud / project / { serviceName } / instance / group / { groupId }
* @ param groupId [ required ] Group id
* @ param serviceName [ required ] Project name */
public void project_serviceName_instance_group_groupId_DELETE ( String serviceName , String groupId ) throws IOException { } } | String qPath = "/cloud/project/{serviceName}/instance/group/{groupId}" ; StringBuilder sb = path ( qPath , serviceName , groupId ) ; exec ( qPath , "DELETE" , sb . toString ( ) , null ) ; |
public class NFRule { /** * Searches the rule ' s rule text for the first substitution token ,
* creates a substitution based on it , and removes the token from
* the rule ' s rule text .
* @ param owner The rule set containing this rule
* @ param predecessor The rule preceding this one in the rule set ' s
* rule list
* @ return The newly - created substitution . This is never null ; if
* the rule text doesn ' t contain any substitution tokens , this will
* be a NullSubstitution . */
private NFSubstitution extractSubstitution ( NFRuleSet owner , NFRule predecessor ) { } } | NFSubstitution result ; int subStart ; int subEnd ; // search the rule ' s rule text for the first two characters of
// a substitution token
subStart = indexOfAnyRulePrefix ( ruleText ) ; // if we didn ' t find one , create a null substitution positioned
// at the end of the rule text
if ( subStart == - 1 ) { return null ; } // special - case the " > > > " token , since searching for the > at the
// end will actually find the > in the middle
if ( ruleText . startsWith ( ">>>" , subStart ) ) { subEnd = subStart + 2 ; } else { // otherwise the substitution token ends with the same character
// it began with
char c = ruleText . charAt ( subStart ) ; subEnd = ruleText . indexOf ( c , subStart + 1 ) ; // special case for ' < % foo < < '
if ( c == '<' && subEnd != - 1 && subEnd < ruleText . length ( ) - 1 && ruleText . charAt ( subEnd + 1 ) == c ) { // ordinals use " = # , # # 0 = = % abbrev = " as their rule . Notice that the ' = = ' in the middle
// occurs because of the juxtaposition of two different rules . The check for ' < ' is a hack
// to get around this . Having the duplicate at the front would cause problems with
// rules like " < < % " to format , say , percents . . .
++ subEnd ; } } // if we don ' t find the end of the token ( i . e . , if we ' re on a single ,
// unmatched token character ) , create a null substitution positioned
// at the end of the rule
if ( subEnd == - 1 ) { return null ; } // if we get here , we have a real substitution token ( or at least
// some text bounded by substitution token characters ) . Use
// makeSubstitution ( ) to create the right kind of substitution
result = NFSubstitution . makeSubstitution ( subStart , this , predecessor , owner , this . formatter , ruleText . substring ( subStart , subEnd + 1 ) ) ; // remove the substitution from the rule text
ruleText = ruleText . substring ( 0 , subStart ) + ruleText . substring ( subEnd + 1 ) ; return result ; |
public class InstantSearch { /** * Registers a { @ link SearchView } to trigger search requests on text change , replacing the current one if any .
* @ param activity The searchable activity , see { @ link android . app . SearchableInfo } .
* @ param searchView a SearchView whose query text will be used . */
@ SuppressWarnings ( { } } | "WeakerAccess" , "unused" } ) // For library users
public void registerSearchView ( @ NonNull final Activity activity , @ NonNull final SearchView searchView ) { registerSearchView ( activity , new SearchViewFacade ( searchView ) ) ; |
public class TrainableDistanceMetric { /** * Static helper method for training a distance metric only if it is needed .
* This method can be safely called for any Distance Metric .
* @ param dm the distance metric to train
* @ param dataset the data set to train from
* @ param threadpool the source of threads for parallel training . May be
* < tt > null < / tt > , in which case { @ link # trainIfNeeded ( jsat . linear . distancemetrics . DistanceMetric , jsat . DataSet ) }
* is used instead .
* @ deprecated I WILL DELETE THIS METHOD SOON */
public static void trainIfNeeded ( DistanceMetric dm , DataSet dataset , ExecutorService threadpool ) { } } | // TODO I WILL DELETE , JUST STUBBING FOR NOW TO MAKE LIFE EASY AS I DO ONE CODE SECTION AT A TIME
trainIfNeeded ( dm , dataset ) ; |
public class ChemSequenceManipulator { /** * Get the total number of bonds inside an IChemSequence .
* @ param sequence The IChemSequence object .
* @ return The number of Bond objects inside . */
public static int getBondCount ( IChemSequence sequence ) { } } | int count = 0 ; for ( int i = 0 ; i < sequence . getChemModelCount ( ) ; i ++ ) { count += ChemModelManipulator . getBondCount ( sequence . getChemModel ( i ) ) ; } return count ; |
public class BatchWriteOperationMarshaller { /** * Marshall the given parameter object . */
public void marshall ( BatchWriteOperation batchWriteOperation , ProtocolMarshaller protocolMarshaller ) { } } | if ( batchWriteOperation == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( batchWriteOperation . getCreateObject ( ) , CREATEOBJECT_BINDING ) ; protocolMarshaller . marshall ( batchWriteOperation . getAttachObject ( ) , ATTACHOBJECT_BINDING ) ; protocolMarshaller . marshall ( batchWriteOperation . getDetachObject ( ) , DETACHOBJECT_BINDING ) ; protocolMarshaller . marshall ( batchWriteOperation . getUpdateObjectAttributes ( ) , UPDATEOBJECTATTRIBUTES_BINDING ) ; protocolMarshaller . marshall ( batchWriteOperation . getDeleteObject ( ) , DELETEOBJECT_BINDING ) ; protocolMarshaller . marshall ( batchWriteOperation . getAddFacetToObject ( ) , ADDFACETTOOBJECT_BINDING ) ; protocolMarshaller . marshall ( batchWriteOperation . getRemoveFacetFromObject ( ) , REMOVEFACETFROMOBJECT_BINDING ) ; protocolMarshaller . marshall ( batchWriteOperation . getAttachPolicy ( ) , ATTACHPOLICY_BINDING ) ; protocolMarshaller . marshall ( batchWriteOperation . getDetachPolicy ( ) , DETACHPOLICY_BINDING ) ; protocolMarshaller . marshall ( batchWriteOperation . getCreateIndex ( ) , CREATEINDEX_BINDING ) ; protocolMarshaller . marshall ( batchWriteOperation . getAttachToIndex ( ) , ATTACHTOINDEX_BINDING ) ; protocolMarshaller . marshall ( batchWriteOperation . getDetachFromIndex ( ) , DETACHFROMINDEX_BINDING ) ; protocolMarshaller . marshall ( batchWriteOperation . getAttachTypedLink ( ) , ATTACHTYPEDLINK_BINDING ) ; protocolMarshaller . marshall ( batchWriteOperation . getDetachTypedLink ( ) , DETACHTYPEDLINK_BINDING ) ; protocolMarshaller . marshall ( batchWriteOperation . getUpdateLinkAttributes ( ) , UPDATELINKATTRIBUTES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class TokenManager { /** * get a Jwt with a provided clientRequest ,
* it will get token based on Jwt . Key ( either scope or service _ id )
* if the user declared both scope and service _ id in header , it will get jwt based on scope
* @ param clientRequest
* @ return */
public Result < Jwt > getJwt ( ClientRequest clientRequest ) { } } | HeaderValues scope = clientRequest . getRequestHeaders ( ) . get ( OauthHelper . SCOPE ) ; if ( scope != null ) { String scopeStr = scope . getFirst ( ) ; Set < String > scopeSet = new HashSet < > ( ) ; scopeSet . addAll ( Arrays . asList ( scopeStr . split ( " " ) ) ) ; return getJwt ( new Jwt . Key ( scopeSet ) ) ; } HeaderValues serviceId = clientRequest . getRequestHeaders ( ) . get ( OauthHelper . SERVICE_ID ) ; if ( serviceId != null ) { return getJwt ( new Jwt . Key ( serviceId . getFirst ( ) ) ) ; } return getJwt ( new Jwt . Key ( ) ) ; |
public class ConsumerDispatcher { /** * ( non - Javadoc )
* @ see com . ibm . ws . sib . msgstore . transactions . TransactionCallback # afterCompletion ( com . ibm . ws . sib . msgstore . transactions . Transaction , boolean ) */
@ Override public void afterCompletion ( TransactionCommon transaction , boolean committed ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "afterCompletion" , new Object [ ] { transaction , Boolean . valueOf ( committed ) } ) ; // Reset the current transaction now that this one has completed
synchronized ( orderLock ) { // If asynch and a rollback occurred , unlock all messages
// in the LME
try { if ( ! committed && currentLME != null ) currentLME . unlockAll ( ) ; } catch ( SIResourceException e ) { // FFDC
FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.ConsumerDispatcher.afterCompletion" , "1:3673:1.280.5.25" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "ORDERED_MESSAGING_ERROR_CWSIP0117" , new Object [ ] { _baseDestHandler . getName ( ) , _messageProcessor . getMessagingEngineName ( ) } ) ; } catch ( SISessionDroppedException e ) { // FFDC
FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.ConsumerDispatcher.afterCompletion" , "1:3689:1.280.5.25" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "ORDERED_MESSAGING_ERROR_CWSIP0117" , new Object [ ] { _baseDestHandler . getName ( ) , _messageProcessor . getMessagingEngineName ( ) } ) ; } catch ( SIMPMessageNotLockedException e ) { // No FFDC code needed
// This exception has occurred beause someone has deleted the
// message ( s ) . Ignore this exception as it is unlocked anyway
} currentTran = null ; currentLME = null ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "afterCompletion" ) ; |
public class GroupHandlerImpl { /** * Remove all membership entities related to current group . */
private void removeMemberships ( Node groupNode , boolean broadcast ) throws RepositoryException { } } | NodeIterator refUsers = groupNode . getNode ( JCROrganizationServiceImpl . JOS_MEMBERSHIP ) . getNodes ( ) ; while ( refUsers . hasNext ( ) ) { refUsers . nextNode ( ) . remove ( ) ; } |
public class TableImpl { /** * records . add ( newEntity ( ) ) ; / / CHANGE # 7b */
private void revertInsertRow ( long id , int row , boolean reuseRow ) { } } | // INFORM INSIDER
insider . uninserting ( clazz , id ) ; idColl . cancelId ( id ) ; // UNDO CHANGE # 1
if ( reuseRow ) { deleted . add ( row ) ; // UNDO CHANGE # 2
} else { rows -- ; // UNDO CHANGE # 3
} idColl . delete ( id ) ; // UNDO CHANGE # 4
size -- ; // UNDO CHANGE # 5
ids . remove ( id ) ; // UNDO CHANGE # 6
if ( reuseRow ) { // NO NEED TO UNDO CHANGE # 7a
} else { records . remove ( records . size ( ) - 1 ) ; // UNDO CHANGE # 7b
} |
public class ComponentRegister { /** * Identifies if the current VM has a native support for multidex .
* @ return true , otherwise is false .
* @ see android . support . multidex . MultiDexExtractor # isVMMultidexCapable ( String ) */
private static boolean isVMMultidexCapable ( ) { } } | boolean isMultidexCapable = false ; String vmVersion = System . getProperty ( "java.vm.version" ) ; try { Matcher matcher = Pattern . compile ( "(\\d+)\\.(\\d+)(\\.\\d+)?" ) . matcher ( vmVersion ) ; if ( matcher . matches ( ) ) { int major = Integer . parseInt ( matcher . group ( 1 ) ) ; int minor = Integer . parseInt ( matcher . group ( 2 ) ) ; isMultidexCapable = ( major > 2 ) || ( ( major == 2 ) && ( minor >= 1 ) ) ; } } catch ( Exception ignore ) { } String multidex = isMultidexCapable ? "has Multidex support" : "does not have Multidex support" ; Log . i ( AndServer . TAG , String . format ( "VM with version %s %s." , vmVersion , multidex ) ) ; return false ; |
public class WebContainerListener { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . container . service . state . ApplicationStateListener # applicationStopped ( com . ibm . ws . container . service . app . deploy . ApplicationInfo ) */
@ Override @ FFDCIgnore ( NullPointerException . class ) public void applicationStopped ( ApplicationInfo appInfo ) { } } | // If we can ' t get the J2EEName of the application , then we don ' t care about this application .
String appName = appInfo . getDeploymentName ( ) ; if ( null == appName ) return ; // Handle an app being stopped
webModulesInStartingApps . remove ( appName ) ; webModulesInStartedApps . remove ( appName ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Web application stopped- " + appName ) ; } |
public class DefaultMonitorService { /** * ~ Methods * * * * * */
@ Override @ Transactional public synchronized void enableMonitoring ( ) { } } | requireNotDisposed ( ) ; _logger . info ( "Globally enabling all system monitoring." ) ; _setServiceEnabled ( true ) ; _checkAlertExistence ( true ) ; _logger . info ( "All system monitoring globally enabled." ) ; |
public class ExecutionImpl { /** * creates a new execution . properties processDefinition , processInstance and activity will be initialized . */
public ExecutionImpl createExecution ( boolean initializeExecutionStartContext ) { } } | // create the new child execution
ExecutionImpl createdExecution = newExecution ( ) ; // initialize sequence counter
createdExecution . setSequenceCounter ( getSequenceCounter ( ) ) ; // manage the bidirectional parent - child relation
createdExecution . setParent ( this ) ; // initialize the new execution
createdExecution . setProcessDefinition ( getProcessDefinition ( ) ) ; createdExecution . setProcessInstance ( getProcessInstance ( ) ) ; createdExecution . setActivity ( getActivity ( ) ) ; // make created execution start in same activity instance
createdExecution . activityInstanceId = activityInstanceId ; // with the fix of CAM - 9249 we presume that the parent and the child have the same startContext
if ( initializeExecutionStartContext ) { createdExecution . setStartContext ( new ExecutionStartContext ( ) ) ; } else if ( startContext != null ) { createdExecution . setStartContext ( startContext ) ; } createdExecution . skipCustomListeners = this . skipCustomListeners ; createdExecution . skipIoMapping = this . skipIoMapping ; return createdExecution ; |
public class DirectFilepathMapper { /** * file for a given path in the specified subdir
* @ param path path
* @ param dir dir
* @ return file */
private File withPath ( Path path , File dir ) { } } | return new File ( dir , path . getPath ( ) ) ; |
public class TaskHolder { /** * Get the next ( String ) param .
* @ param strName The param name ( in most implementations this is optional ) .
* @ return The next param as a string . */
public Map < String , Object > getNextPropertiesParam ( InputStream in , String strName , Map < String , Object > properties ) { } } | return m_proxyTask . getNextPropertiesParam ( in , strName , properties ) ; |
public class IntFloatSortedVector { /** * Gets the entrywise difference of the two vectors . */
public IntFloatSortedVector getDiff ( IntFloatVector other ) { } } | IntFloatSortedVector diff = new IntFloatSortedVector ( this ) ; diff . subtract ( other ) ; return diff ; |
public class KeyLongValue { /** * This method does not keep order of list . */
public static Map < String , Long > toMap ( List < KeyLongValue > values ) { } } | return values . stream ( ) . collect ( uniqueIndex ( KeyLongValue :: getKey , KeyLongValue :: getValue , values . size ( ) ) ) ; |
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIfcBoilerTypeEnumToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class CraftingHelper { /** * Attempt to craft the given recipe . < br >
* This pays no attention to tedious things like using the right crafting table / brewing stand etc , or getting the right shape . < br >
* It simply takes the raw ingredients out of the player ' s inventory , and inserts the output of the recipe , if possible .
* @ param player the SERVER SIDE player that will do the crafting .
* @ param recipe the IRecipe we wish to craft .
* @ return true if the recipe had an output , and the player had the required ingredients to create it ; false otherwise . */
public static boolean attemptCrafting ( EntityPlayerMP player , IRecipe recipe ) { } } | if ( player == null || recipe == null ) return false ; ItemStack is = recipe . getRecipeOutput ( ) ; if ( is == null ) return false ; List < ItemStack > ingredients = getIngredients ( recipe ) ; if ( playerHasIngredients ( player , ingredients ) ) { // We have the ingredients we need , so directly manipulate the inventory .
// First , remove the ingredients :
removeIngredientsFromPlayer ( player , ingredients ) ; // Now add the output of the recipe :
ItemStack resultForInventory = is . copy ( ) ; ItemStack resultForReward = is . copy ( ) ; player . inventory . addItemStackToInventory ( resultForInventory ) ; RewardForCollectingItemImplementation . GainItemEvent event = new RewardForCollectingItemImplementation . GainItemEvent ( resultForReward ) ; MinecraftForge . EVENT_BUS . post ( event ) ; return true ; } return false ; |
public class CmsResultsTab { /** * Scrolls to the result which corresponds to a preset value in the editor . < p > */
protected void scrollToPreset ( ) { } } | final ScrollPanel scrollPanel = getList ( ) ; if ( m_preset != null ) { Widget child = scrollPanel . getWidget ( ) ; if ( child instanceof CmsList < ? > ) { @ SuppressWarnings ( "unchecked" ) CmsList < I_CmsListItem > list = ( CmsList < I_CmsListItem > ) child ; if ( list . getWidgetCount ( ) > 0 ) { final Widget first = ( Widget ) list . getItem ( 0 ) ; Timer timer = new Timer ( ) { @ Override public void run ( ) { int firstTop = first . getElement ( ) . getAbsoluteTop ( ) ; int presetTop = m_preset . getElement ( ) . getAbsoluteTop ( ) ; final int offset = presetTop - firstTop ; if ( offset >= 0 ) { scrollPanel . setVerticalScrollPosition ( offset ) ; } else { // something is seriously wrong with the positioning if this case occurs
scrollPanel . scrollToBottom ( ) ; } } } ; timer . schedule ( 10 ) ; } } } |
public class Parser { /** * parse the given sql from index i , appending it to the given buffer until we hit an unmatched
* right parentheses or end of string . When the stopOnComma flag is set we also stop processing
* when a comma is found in sql text that isn ' t inside nested parenthesis .
* @ param sql the original query text
* @ param i starting position for replacing
* @ param newsql where to write the replaced output
* @ param stopOnComma should we stop after hitting the first comma in sql text ?
* @ param stdStrings whether standard _ conforming _ strings is on
* @ return the position we stopped processing at
* @ throws SQLException if given SQL is wrong */
private static int parseSql ( char [ ] sql , int i , StringBuilder newsql , boolean stopOnComma , boolean stdStrings ) throws SQLException { } } | SqlParseState state = SqlParseState . IN_SQLCODE ; int len = sql . length ; int nestedParenthesis = 0 ; boolean endOfNested = false ; // because of the + + i loop
i -- ; while ( ! endOfNested && ++ i < len ) { char c = sql [ i ] ; state_switch : switch ( state ) { case IN_SQLCODE : if ( c == '$' ) { int i0 = i ; i = parseDollarQuotes ( sql , i ) ; checkParsePosition ( i , len , i0 , sql , "Unterminated dollar quote started at position {0} in SQL {1}. Expected terminating $$" ) ; newsql . append ( sql , i0 , i - i0 + 1 ) ; break ; } else if ( c == '\'' ) { // start of a string ?
int i0 = i ; i = parseSingleQuotes ( sql , i , stdStrings ) ; checkParsePosition ( i , len , i0 , sql , "Unterminated string literal started at position {0} in SQL {1}. Expected ' char" ) ; newsql . append ( sql , i0 , i - i0 + 1 ) ; break ; } else if ( c == '"' ) { // start of a identifier ?
int i0 = i ; i = parseDoubleQuotes ( sql , i ) ; checkParsePosition ( i , len , i0 , sql , "Unterminated identifier started at position {0} in SQL {1}. Expected \" char" ) ; newsql . append ( sql , i0 , i - i0 + 1 ) ; break ; } else if ( c == '/' ) { int i0 = i ; i = parseBlockComment ( sql , i ) ; checkParsePosition ( i , len , i0 , sql , "Unterminated block comment started at position {0} in SQL {1}. Expected */ sequence" ) ; newsql . append ( sql , i0 , i - i0 + 1 ) ; break ; } else if ( c == '-' ) { int i0 = i ; i = parseLineComment ( sql , i ) ; newsql . append ( sql , i0 , i - i0 + 1 ) ; break ; } else if ( c == '(' ) { // begin nested sql
nestedParenthesis ++ ; } else if ( c == ')' ) { // end of nested sql
nestedParenthesis -- ; if ( nestedParenthesis < 0 ) { endOfNested = true ; break ; } } else if ( stopOnComma && c == ',' && nestedParenthesis == 0 ) { endOfNested = true ; break ; } else if ( c == '{' ) { // start of an escape code ?
if ( i + 1 < len ) { SqlParseState [ ] availableStates = SqlParseState . VALUES ; // skip first state , it ' s not a escape code state
for ( int j = 1 ; j < availableStates . length ; j ++ ) { SqlParseState availableState = availableStates [ j ] ; int matchedPosition = availableState . getMatchedPosition ( sql , i + 1 ) ; if ( matchedPosition == 0 ) { continue ; } i += matchedPosition ; if ( availableState . replacementKeyword != null ) { newsql . append ( availableState . replacementKeyword ) ; } state = availableState ; break state_switch ; } } } newsql . append ( c ) ; break ; case ESC_FUNCTION : // extract function name
i = escapeFunction ( sql , i , newsql , stdStrings ) ; state = SqlParseState . IN_SQLCODE ; // end of escaped function ( or query )
break ; case ESC_DATE : case ESC_TIME : case ESC_TIMESTAMP : case ESC_OUTERJOIN : case ESC_ESCAPECHAR : if ( c == '}' ) { state = SqlParseState . IN_SQLCODE ; // end of escape code .
} else { newsql . append ( c ) ; } break ; } // end switch
} return i ; |
public class Datepicker { /** * Generates the default language for the date picker . Originally implemented in
* the HeadRenderer , this code has been moved here to provide better
* compatibility to PrimeFaces . If multiple date pickers are on the page , the
* script is generated redundantly , but this shouldn ' t do no harm .
* @ param fc
* The current FacesContext
* @ throws IOException */
private void encodeDefaultLanguageJS ( FacesContext fc ) throws IOException { } } | ResponseWriter rw = fc . getResponseWriter ( ) ; rw . startElement ( "script" , null ) ; rw . write ( "$.datepicker.setDefaults($.datepicker.regional['" + fc . getViewRoot ( ) . getLocale ( ) . getLanguage ( ) + "']);" ) ; rw . endElement ( "script" ) ; |
public class Manager { /** * Returns the database with the given name , or creates it if it doesn ' t exist .
* Multiple calls with the same name will return the same { @ link Database } instance .
* This is equivalent to calling { @ link # openDatabase ( String , DatabaseOptions ) }
* with a default set of options with the ` Create ` flag set .
* NOTE : Database names may not contain capital letters . */
@ InterfaceAudience . Public public Database getDatabase ( String name ) throws CouchbaseLiteException { } } | DatabaseOptions options = getDefaultOptions ( name ) ; options . setCreate ( true ) ; return openDatabase ( name , options ) ; |
public class Blob { /** * { @ inheritDoc } */
public long position ( final byte [ ] pattern , final long start ) throws SQLException { } } | synchronized ( this ) { if ( this . underlying == null ) { if ( start > 1 ) { throw new SQLException ( "Invalid offset: " + start ) ; } // end of if
return - 1L ; } // end of if
return this . underlying . position ( pattern , start ) ; } // end of sync |
public class PromiseNotificationUtil { /** * Try to mark the { @ link Promise } as failure and log if { @ code logger } is not { @ code null } in case this fails . */
public static void tryFailure ( Promise < ? > p , Throwable cause , InternalLogger logger ) { } } | if ( ! p . tryFailure ( cause ) && logger != null ) { Throwable err = p . cause ( ) ; if ( err == null ) { logger . warn ( "Failed to mark a promise as failure because it has succeeded already: {}" , p , cause ) ; } else { logger . warn ( "Failed to mark a promise as failure because it has failed already: {}, unnotified cause: {}" , p , ThrowableUtil . stackTraceToString ( err ) , cause ) ; } } |
public class IconProviderFromUrlProvider { /** * / * ( non - Javadoc )
* @ see com . sporniket . libre . ui . swing . IconProvider # retrieveIcon ( java . lang . Object ) */
public ImageIcon retrieveIcon ( String location ) throws IconProviderException { } } | try { URL _url = getUrlProvider ( ) . getUrl ( location ) ; return getIconProvider ( ) . retrieveIcon ( _url ) ; } catch ( UrlProviderException _exception ) { throw new IconProviderException ( _exception ) ; } |
public class GrpclbState { /** * Handle new addresses of the balancer and backends from the resolver , and create connection if
* not yet connected . */
void handleAddresses ( List < LbAddressGroup > newLbAddressGroups , List < EquivalentAddressGroup > newBackendServers ) { } } | if ( newLbAddressGroups . isEmpty ( ) ) { // No balancer address : close existing balancer connection and enter fallback mode
// immediately .
shutdownLbComm ( ) ; syncContext . execute ( new FallbackModeTask ( ) ) ; } else { LbAddressGroup newLbAddressGroup = flattenLbAddressGroups ( newLbAddressGroups ) ; startLbComm ( newLbAddressGroup ) ; // Avoid creating a new RPC just because the addresses were updated , as it can cause a
// stampeding herd . The current RPC may be on a connection to an address not present in
// newLbAddressGroups , but we ' re considering that " okay " . If we detected the RPC is to an
// outdated backend , we could choose to re - create the RPC .
if ( lbStream == null ) { startLbRpc ( ) ; } // Start the fallback timer if it ' s never started
if ( fallbackTimer == null ) { fallbackTimer = syncContext . schedule ( new FallbackModeTask ( ) , FALLBACK_TIMEOUT_MS , TimeUnit . MILLISECONDS , timerService ) ; } } fallbackBackendList = newBackendServers ; if ( usingFallbackBackends ) { // Populate the new fallback backends to round - robin list .
useFallbackBackends ( ) ; } maybeUpdatePicker ( ) ; |
public class YogaBuilder { /** * there are cases where a user might want to override meta data registry ,
* selector resolver and / or CoreSelector implementations . This would be the
* place to do it , since we have complex dependencies for those objects , and
* we need those objects set up before other setters are called . */
protected void init ( ) { } } | _metaDataRegistry = new DefaultMetaDataRegistry ( ) ; _selectorResolver = new SelectorResolver ( ) ; _selectorResolver . getBaseSelector ( ) . setEntityConfigurationRegistry ( new DefaultEntityConfigurationRegistry ( ) ) ; _metaDataRegistry . setCoreSelector ( this . _selectorResolver . getBaseSelector ( ) ) ; _metaDataRegistry . setRootMetaDataUrl ( "/metadata/" ) ; |
public class Heritrix3Wrapper { /** * Build an existing job .
* @ param jobname job name
* @ return job state */
public JobResult buildJobConfiguration ( String jobname ) { } } | HttpPost postRequest = new HttpPost ( baseUrl + "job/" + jobname ) ; StringEntity postEntity = null ; try { postEntity = new StringEntity ( BUILD_ACTION ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; } postEntity . setContentType ( "application/x-www-form-urlencoded" ) ; postRequest . addHeader ( "Accept" , "application/xml" ) ; postRequest . setEntity ( postEntity ) ; return jobResult ( postRequest ) ; |
public class HttpRedirectBindingUtil { /** * Encodes the specified { @ code message } into a deflated base64 string . */
static String toDeflatedBase64 ( SAMLObject message ) { } } | requireNonNull ( message , "message" ) ; final String messageStr ; try { messageStr = nodeToString ( XMLObjectSupport . marshall ( message ) ) ; } catch ( MarshallingException e ) { throw new SamlException ( "failed to serialize a SAML message" , e ) ; } final ByteArrayOutputStream bytesOut = new ByteArrayOutputStream ( ) ; try ( DeflaterOutputStream deflaterStream = new DeflaterOutputStream ( Base64 . getEncoder ( ) . wrap ( bytesOut ) , new Deflater ( Deflater . DEFLATED , true ) ) ) { deflaterStream . write ( messageStr . getBytes ( StandardCharsets . UTF_8 ) ) ; } catch ( IOException e ) { throw new SamlException ( "failed to deflate a SAML message" , e ) ; } return bytesOut . toString ( ) ; |
public class StubAmpOut { /** * @ Override
* public AnnotatedType getApiClass ( )
* return getClass ( ) ; */
@ Override public Object onLookup ( String path , ServiceRefAmp parentRef ) { } } | PodRef podCaller = null ; StubLink actorLink = new StubLink ( getServiceManager ( ) , path , parentRef , podCaller , this ) ; ServiceRefAmp actorRef = parentRef . pin ( actorLink , parentRef . address ( ) + path ) ; actorLink . initSelfRef ( actorRef ) ; // ServiceManagerAmp manager = getServiceManager ( ) ;
// return manager . service ( parentRef , actor , path ) ;
return actorRef ; |
public class Descriptor { /** * Add the given service calls to this service .
* @ param calls The calls to add .
* @ return A copy of this descriptor with the new calls added . */
public Descriptor withCalls ( Call < ? , ? > ... calls ) { } } | return replaceAllCalls ( this . calls . plusAll ( Arrays . asList ( calls ) ) ) ; |
public class GenericsUtils { /** * Try to get the parameterized type from the cache .
* If no cached item found , cache and return the result of { @ link # findParameterizedType ( ClassNode , ClassNode , boolean ) } */
public static ClassNode findParameterizedTypeFromCache ( final ClassNode genericsClass , final ClassNode actualType , boolean tryToFindExactType ) { } } | if ( ! PARAMETERIZED_TYPE_CACHE_ENABLED ) { return findParameterizedType ( genericsClass , actualType , tryToFindExactType ) ; } SoftReference < ClassNode > sr = PARAMETERIZED_TYPE_CACHE . getAndPut ( new ParameterizedTypeCacheKey ( genericsClass , actualType ) , key -> new SoftReference < > ( findParameterizedType ( key . getGenericsClass ( ) , key . getActualType ( ) , tryToFindExactType ) ) ) ; return null == sr ? null : sr . get ( ) ; |
public class JWSHeader { /** * Construct JWSHeader from base64url string .
* @ param base64
* base64 url string .
* @ return Constructed JWSHeader */
public static JWSHeader fromBase64String ( String base64 ) throws IOException { } } | String json = MessageSecurityHelper . base64UrltoString ( base64 ) ; ObjectMapper mapper = new ObjectMapper ( ) ; return mapper . readValue ( json , JWSHeader . class ) ; |
public class TextAccessor { /** * / * [ deutsch ]
* < p > Interpretiert die angegebene Textform als Enum - Elementwert . < / p >
* @ param < V > generic value type of element
* @ param parseable text to be parsed
* @ param status current parsing position
* @ param valueType value class of element
* @ param leniency leniency mode
* @ return element value ( as enum ) or { @ code null } if not found
* @ see Attributes # LENIENCY
* @ see # parse ( CharSequence , ParsePosition , Class , AttributeQuery )
* @ since 3.15/4.12 */
public < V extends Enum < V > > V parse ( CharSequence parseable , ParsePosition status , Class < V > valueType , Leniency leniency ) { } } | boolean caseInsensitive = true ; boolean partialCompare = false ; boolean smart = true ; if ( leniency == Leniency . STRICT ) { caseInsensitive = false ; smart = false ; } else if ( leniency == Leniency . LAX ) { partialCompare = true ; } return this . parse ( parseable , status , valueType , caseInsensitive , partialCompare , smart ) ; |
public class MultiProviderPropertyConfig { /** * { @ inheritDoc } */
public void add ( Properties newer ) { } } | for ( Object key : newer . keySet ( ) ) { this . properties . put ( key . toString ( ) , newer . get ( key ) ) ; } |
public class AlignmentTrimmer { /** * Try increase total alignment score by partially ( or fully ) trimming it from right side . If score can ' t be
* increased the same alignment will be returned .
* @ param alignment input alignment
* @ param scoring scoring
* @ return resulting alignment */
public static < S extends Sequence < S > > Alignment < S > rightTrimAlignment ( Alignment < S > alignment , AlignmentScoring < S > scoring ) { } } | if ( scoring instanceof LinearGapAlignmentScoring ) return rightTrimAlignment ( alignment , ( LinearGapAlignmentScoring < S > ) scoring ) ; else if ( scoring instanceof AffineGapAlignmentScoring ) return rightTrimAlignment ( alignment , ( AffineGapAlignmentScoring < S > ) scoring ) ; else throw new IllegalArgumentException ( "Unknown scoring type" ) ; |
public class BlockBox { /** * Calculates the position for a floating box in the given context .
* @ param subbox the box to be placed
* @ param wlimit the width limit for placing all the boxes
* @ param stat status of the layout that should be updated */
protected void layoutBlockFloating ( BlockBox subbox , int wlimit , BlockLayoutStatus stat ) { } } | subbox . setFloats ( new FloatList ( subbox ) , new FloatList ( subbox ) , 0 , 0 , 0 ) ; subbox . doLayout ( wlimit , true , true ) ; FloatList f = ( subbox . getFloating ( ) == FLOAT_LEFT ) ? fleft : fright ; // float list at my side
FloatList of = ( subbox . getFloating ( ) == FLOAT_LEFT ) ? fright : fleft ; // float list at the opposite side
int floatX = ( subbox . getFloating ( ) == FLOAT_LEFT ) ? floatXl : floatXr ; // float offset at this side
int oFloatX = ( subbox . getFloating ( ) == FLOAT_LEFT ) ? floatXr : floatXl ; // float offset at the opposite side
int fy = stat . y + floatY ; // float Y position
if ( fy < f . getLastY ( ) ) fy = f . getLastY ( ) ; // don ' t place above the last placed box
int fx = f . getWidth ( fy ) ; // total width of floats at this side
if ( fx < floatX ) fx = floatX ; // stay in the containing box if it is narrower
if ( fx == 0 && floatX < 0 ) fx = floatX ; // if it is wider ( and there are no floating boxes yet )
int ofx = of . getWidth ( fy ) ; // total width of floats at the opposite side
if ( ofx < oFloatX ) ofx = oFloatX ; // stay in the containing box at the opposite side
if ( ofx == 0 && oFloatX < 0 ) ofx = oFloatX ; // moving the floating box down until it fits
while ( ( fx > floatX || ofx > oFloatX || stat . inlineWidth > 0 ) // if the space can be narrower at least at one side
&& ( stat . inlineWidth + fx - floatX + ofx - oFloatX + subbox . getWidth ( ) > wlimit ) ) // the subbox doesn ' t fit in this Y coordinate
{ int nexty = FloatList . getNextY ( fleft , fright , fy ) ; if ( nexty == - 1 ) fy += Math . max ( stat . maxh , getLineHeight ( ) ) ; // if we don ' t know try increasing by a line
else fy = nexty ; // recompute the limits for the new fy
fx = f . getWidth ( fy ) ; if ( fx < floatX ) fx = floatX ; if ( fx == 0 && floatX < 0 ) fx = floatX ; ofx = of . getWidth ( fy ) ; if ( ofx < oFloatX ) ofx = oFloatX ; if ( ofx == 0 && oFloatX < 0 ) ofx = oFloatX ; // do not consider current line below
stat . inlineWidth = 0 ; } subbox . setPosition ( fx , fy ) ; f . add ( subbox ) ; // a floating box must enclose all the floats inside
int floatw = maxFloatWidth ( fy , fy + subbox . getHeight ( ) ) ; // maximal width
if ( floatw > stat . maxw ) stat . maxw = floatw ; if ( stat . maxw > wlimit ) stat . maxw = wlimit ; |
public class XLinkUtils { /** * Returns a future Date - String in the format ' yyyyMMddkkmmss ' . */
private static String getExpirationDate ( int futureDays ) { } } | Calendar calendar = Calendar . getInstance ( ) ; calendar . add ( Calendar . DAY_OF_YEAR , futureDays ) ; Format formatter = new SimpleDateFormat ( XLinkConstants . DATEFORMAT ) ; return formatter . format ( calendar . getTime ( ) ) ; |
public class Shard { /** * / * ( non - Javadoc )
* @ see org . apache . hadoop . io . Writable # readFields ( java . io . DataInput ) */
public void readFields ( DataInput in ) throws IOException { } } | version = in . readLong ( ) ; dir = Text . readString ( in ) ; gen = in . readLong ( ) ; |
public class ValueList { /** * Get the ValueList .
* @ return String with the Values , which looks like the original */
public String getValueList ( ) { } } | final StringBuffer buf = new StringBuffer ( ) ; for ( final Token token : this . tokens ) { switch ( token . type ) { case EXPRESSION : buf . append ( "$<" ) . append ( token . value ) . append ( ">" ) ; break ; case TEXT : buf . append ( token . value ) ; break ; default : break ; } } return buf . toString ( ) ; |
public class CamelCase { /** * Return camelCase
* @ param text
* @ return */
public static final String property ( String text ) { } } | CamelSpliterator cs = new CamelSpliterator ( text ) ; StringBuilder sb = new StringBuilder ( ) ; cs . tryAdvance ( ( s ) -> sb . append ( lower ( s ) ) ) ; StreamSupport . stream ( cs , false ) . forEach ( ( s ) -> sb . append ( s ) ) ; return sb . toString ( ) ; |
public class AnnotationUtil { /** * Returns the { @ link Annotation } tagged on another annotation instance .
* @ param annotation
* the annotation instance
* @ param tagClass
* the expected annotation class
* @ param < T >
* the generic type of the expected annotation
* @ return
* the annotation tagged on annotation of type ` tagClass ` */
public static < T extends Annotation > T tagAnnotation ( Annotation annotation , Class < T > tagClass ) { } } | Class < ? > c = annotation . annotationType ( ) ; for ( Annotation a : c . getAnnotations ( ) ) { if ( tagClass . isInstance ( a ) ) { return ( T ) a ; } } return null ; |
public class DaoService { /** * / * ( non - Javadoc )
* @ see org . esupportail . smsuapi . dao . DaoService # isPhoneNumberInBlackList ( java . lang . String ) */
public boolean isPhoneNumberInBlackList ( final String phoneNumber ) { } } | final Criteria criteria = getCurrentSession ( ) . createCriteria ( Blacklist . class ) ; criteria . add ( Restrictions . eq ( Blacklist . PROP_BLA_PHONE , phoneNumber ) ) ; return criteria . uniqueResult ( ) != null ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.