signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class BinaryUtil { /** * Copy src bytes [ ] into dest bytes [ ]
* @ param dest
* @ param src
* @ param copyToIndex */
public static void memcopy ( byte [ ] dest , byte [ ] src , int copyToIndex ) { } } | System . arraycopy ( src , 0 , dest , copyToIndex , src . length ) ; |
public class GroovyScriptEngine { /** * Get a resource connection as a < code > URLConnection < / code > to retrieve a script
* from the < code > ResourceConnector < / code > .
* @ param resourceName name of the resource to be retrieved
* @ return a URLConnection to the resource
* @ throws ResourceException */
public URLConnection getResourceConnection ( String resourceName ) throws ResourceException { } } | // Get the URLConnection
URLConnection groovyScriptConn = null ; ResourceException se = null ; for ( URL root : roots ) { URL scriptURL = null ; try { scriptURL = new URL ( root , resourceName ) ; groovyScriptConn = openConnection ( scriptURL ) ; break ; // Now this is a bit unusual
} catch ( MalformedURLException e ) { String message = "Malformed URL: " + root + ", " + resourceName ; if ( se == null ) { se = new ResourceException ( message ) ; } else { se = new ResourceException ( message , se ) ; } } catch ( IOException e1 ) { String message = "Cannot open URL: " + root + resourceName ; groovyScriptConn = null ; if ( se == null ) { se = new ResourceException ( message ) ; } else { se = new ResourceException ( message , se ) ; } } } if ( se == null ) se = new ResourceException ( "No resource for " + resourceName + " was found" ) ; // If we didn ' t find anything , report on all the exceptions that occurred .
if ( groovyScriptConn == null ) throw se ; return groovyScriptConn ; |
public class BigQuerySnippets { /** * [ VARIABLE " SELECT field FROM my _ dataset _ name . my _ table _ name " ] */
public Job createJob ( String query ) { } } | // [ START ]
Job job = null ; JobConfiguration jobConfiguration = QueryJobConfiguration . of ( query ) ; JobInfo jobInfo = JobInfo . of ( jobConfiguration ) ; try { job = bigquery . create ( jobInfo ) ; } catch ( BigQueryException e ) { // the job was not created
} // [ END ]
return job ; |
public class ActiveMqQueueFactory { /** * { @ inheritDoc }
* @ throws Exception */
@ Override protected void initQueue ( T queue , QueueSpec spec ) throws Exception { } } | queue . setUri ( defaultUri ) . setQueueName ( defaultQueueName ) . setUsername ( defaultUsername ) . setPassword ( defaultPassword ) . setConnectionFactory ( defaultConnectionFactory ) ; String uri = spec . getField ( SPEC_FIELD_URI ) ; if ( ! StringUtils . isBlank ( uri ) ) { queue . setUri ( uri ) ; } String queueName = spec . getField ( SPEC_FIELD_QUEUE_NAME ) ; if ( ! StringUtils . isBlank ( uri ) ) { queue . setQueueName ( queueName ) ; } String username = spec . getField ( SPEC_FIELD_USERNAME ) ; if ( ! StringUtils . isBlank ( username ) ) { queue . setUsername ( username ) ; } String password = spec . getField ( SPEC_FIELD_PASSWORD ) ; if ( ! StringUtils . isBlank ( password ) ) { queue . setPassword ( password ) ; } super . initQueue ( queue , spec ) ; |
public class InspectionReport { /** * Adds detailed event to log . */
public void logBrokenObjectAndSetInconsistency ( String brokenObject ) throws IOException { } } | setInconsistency ( ) ; // The ThreadLocal has been initialized so we know that we are in multithreaded mode .
if ( reportContext . get ( ) != null ) { reportContext . get ( ) . addBrokenObject ( brokenObject ) ; } else { writeBrokenObject ( brokenObject ) ; } |
public class A_CmsResourceCollector { /** * Shrinks a List to fit a maximum size . < p >
* @ param result a List
* @ param maxSize the maximum size of the List
* @ return the reduced list */
protected List < CmsResource > shrinkToFit ( List < CmsResource > result , int maxSize ) { } } | if ( ( maxSize > 0 ) && ( result . size ( ) > maxSize ) ) { // cut off all items > count
result = result . subList ( 0 , maxSize ) ; } return result ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link CurvePropertyType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link CurvePropertyType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "curveMember" ) public JAXBElement < CurvePropertyType > createCurveMember ( CurvePropertyType value ) { } } | return new JAXBElement < CurvePropertyType > ( _CurveMember_QNAME , CurvePropertyType . class , null , value ) ; |
public class Disposables { /** * Performs null checks and disposes of assets . Ignores exceptions .
* @ param disposables its values will be disposed of ( if they exist ) . Can be null . */
public static void gracefullyDisposeOf ( final ObjectMap < ? , ? extends Disposable > disposables ) { } } | if ( disposables != null ) { for ( final Disposable disposable : disposables . values ( ) ) { gracefullyDisposeOf ( disposable ) ; } } |
public class QueuedExecutions { /** * Fetch flow for an execution . Returns null , if execution not in queue */
public ExecutableFlow getFlow ( final int executionId ) { } } | if ( hasExecution ( executionId ) ) { return this . queuedFlowMap . get ( executionId ) . getSecond ( ) ; } return null ; |
public class GVRFloatAnimation { /** * Set the time and value of the key at the given index
* @ param keyIndex 0 based index of key
* @ param time key time in seconds
* @ param values key values */
public void setKey ( int keyIndex , float time , final float [ ] values ) { } } | int index = keyIndex * mFloatsPerKey ; Integer valSize = mFloatsPerKey - 1 ; if ( values . length != valSize ) { throw new IllegalArgumentException ( "This key needs " + valSize . toString ( ) + " float per value" ) ; } mKeys [ index ] = time ; System . arraycopy ( values , 0 , mKeys , index + 1 , values . length ) ; |
public class ProfeatProperties { /** * An adaptor method which returns the number of transition between the specified groups for the given attribute with respect to the length of sequence .
* @ param sequence
* a protein sequence consisting of non - ambiguous characters only
* @ param attribute
* one of the seven attributes ( Hydrophobicity , Volume , Polarity , Polarizability , Charge , SecondaryStructure or SolventAccessibility )
* @ param transition
* the interested transition between the groups
* @ return
* returns the number of transition between the specified groups for the given attribute with respect to the length of sequence .
* @ throws Exception
* throws Exception if attribute or group are unknown */
public static double getTransition ( ProteinSequence sequence , ATTRIBUTE attribute , TRANSITION transition ) throws Exception { } } | return new ProfeatPropertiesImpl ( ) . getTransition ( sequence , attribute , transition ) ; |
public class XmlRuleDisambiguator { /** * Load disambiguation rules from an XML file . Use { @ link JLanguageTool # addRule } to add
* these rules to the checking process .
* @ return a List of { @ link DisambiguationPatternRule } objects */
protected List < DisambiguationPatternRule > loadPatternRules ( String filename ) throws ParserConfigurationException , SAXException , IOException { } } | DisambiguationRuleLoader ruleLoader = new DisambiguationRuleLoader ( ) ; return ruleLoader . getRules ( JLanguageTool . getDataBroker ( ) . getFromResourceDirAsStream ( filename ) ) ; |
public class SFTrustManager { /** * CertificateID to string
* @ param certificateID CertificateID
* @ return a string representation of CertificateID */
private static String CertificateIDToString ( CertificateID certificateID ) { } } | return String . format ( "CertID. NameHash: %s, KeyHash: %s, Serial Number: %s" , byteToHexString ( certificateID . getIssuerNameHash ( ) ) , byteToHexString ( certificateID . getIssuerKeyHash ( ) ) , MessageFormat . format ( "{0,number,#}" , certificateID . getSerialNumber ( ) ) ) ; |
public class Vector { /** * Copies another vector
* @ param vec The other vector
* @ return the same vector */
public Vector copy ( Vector vec ) { } } | x = vec . x ; y = vec . y ; z = vec . z ; return this ; |
public class YarnContainerManager { /** * Update the driver with my current status . */
private void updateRuntimeStatus ( ) { } } | final RuntimeStatusEventImpl . Builder builder = RuntimeStatusEventImpl . newBuilder ( ) . setName ( RUNTIME_NAME ) . setState ( State . RUNNING ) . setOutstandingContainerRequests ( this . containerRequestCounter . get ( ) ) ; for ( final String allocatedContainerId : this . containers . getContainerIds ( ) ) { builder . addContainerAllocation ( allocatedContainerId ) ; } this . reefEventHandlers . onRuntimeStatus ( builder . build ( ) ) ; |
public class ParaClient { /** * Searches for { @ link com . erudika . para . core . Tag } objects .
* This method might be deprecated in the future .
* @ param < P > type of the object
* @ param keyword the tag keyword to search for
* @ param pager a { @ link com . erudika . para . utils . Pager }
* @ return a list of objects found */
public < P extends ParaObject > List < P > findTags ( String keyword , Pager ... pager ) { } } | keyword = ( keyword == null ) ? "*" : keyword . concat ( "*" ) ; return findWildcard ( Utils . type ( Tag . class ) , "tag" , keyword , pager ) ; |
public class JavacParser { /** * QualidentList = [ Annotations ] Qualident { " , " [ Annotations ] Qualident } */
List < JCExpression > qualidentList ( boolean allowAnnos ) { } } | ListBuffer < JCExpression > ts = new ListBuffer < > ( ) ; List < JCAnnotation > typeAnnos = allowAnnos ? typeAnnotationsOpt ( ) : List . nil ( ) ; JCExpression qi = qualident ( allowAnnos ) ; if ( ! typeAnnos . isEmpty ( ) ) { JCExpression at = insertAnnotationsToMostInner ( qi , typeAnnos , false ) ; ts . append ( at ) ; } else { ts . append ( qi ) ; } while ( token . kind == COMMA ) { nextToken ( ) ; typeAnnos = allowAnnos ? typeAnnotationsOpt ( ) : List . nil ( ) ; qi = qualident ( allowAnnos ) ; if ( ! typeAnnos . isEmpty ( ) ) { JCExpression at = insertAnnotationsToMostInner ( qi , typeAnnos , false ) ; ts . append ( at ) ; } else { ts . append ( qi ) ; } } return ts . toList ( ) ; |
public class FilePath { /** * Reads the URL on the current VM , and streams the data to this file using the Remoting channel .
* < p > This is different from resolving URL remotely .
* If you instead wished to open an HTTP ( S ) URL on the remote side ,
* prefer < a href = " http : / / javadoc . jenkins . io / plugin / apache - httpcomponents - client - 4 - api / io / jenkins / plugins / httpclient / RobustHTTPClient . html # copyFromRemotely - hudson . FilePath - java . net . URL - hudson . model . TaskListener - " > { @ code RobustHTTPClient . copyFromRemotely } < / a > .
* @ since 1.293 */
public void copyFrom ( URL url ) throws IOException , InterruptedException { } } | try ( InputStream in = url . openStream ( ) ) { copyFrom ( in ) ; } |
public class CollectionHelp { /** * Returns collection items delimited
* @ param delim
* @ param collection
* @ return
* @ deprecated Use java . util . stream . Collectors . joining
* @ see java . util . stream . Collectors # joining ( java . lang . CharSequence ) */
public static final String print ( String delim , Collection < ? > collection ) { } } | return print ( null , delim , null , null , null , collection ) ; |
public class AwsSecurityFindingFilters { /** * The IPv4 addresses associated with the instance .
* @ param resourceAwsEc2InstanceIpV4Addresses
* The IPv4 addresses associated with the instance . */
public void setResourceAwsEc2InstanceIpV4Addresses ( java . util . Collection < IpFilter > resourceAwsEc2InstanceIpV4Addresses ) { } } | if ( resourceAwsEc2InstanceIpV4Addresses == null ) { this . resourceAwsEc2InstanceIpV4Addresses = null ; return ; } this . resourceAwsEc2InstanceIpV4Addresses = new java . util . ArrayList < IpFilter > ( resourceAwsEc2InstanceIpV4Addresses ) ; |
public class ValueEnforcer { /** * Check if
* < code > nValue & gt ; nLowerBoundInclusive & amp ; & amp ; nValue & lt ; nUpperBoundInclusive < / code >
* @ param aValue
* Value
* @ param sName
* Name
* @ param aLowerBoundExclusive
* Lower bound
* @ param aUpperBoundExclusive
* Upper bound
* @ return The value */
public static BigInteger isBetweenExclusive ( final BigInteger aValue , final String sName , @ Nonnull final BigInteger aLowerBoundExclusive , @ Nonnull final BigInteger aUpperBoundExclusive ) { } } | if ( isEnabled ( ) ) return isBetweenExclusive ( aValue , ( ) -> sName , aLowerBoundExclusive , aUpperBoundExclusive ) ; return aValue ; |
public class IconicsDrawable { /** * Set rounded corner from res
* @ return The current IconicsDrawable for chaining . */
@ NonNull public IconicsDrawable roundedCornersRyRes ( @ DimenRes int sizeResId ) { } } | return roundedCornersRyPx ( mContext . getResources ( ) . getDimensionPixelSize ( sizeResId ) ) ; |
public class AddCompleteCampaignsUsingBatchJob { /** * Runs the example .
* @ param adWordsServices the services factory .
* @ param session the session .
* @ throws BatchJobException if uploading operations or downloading results failed .
* @ throws ApiException if the API request failed with one or more service errors .
* @ throws RemoteException if the API request failed due to other errors .
* @ throws InterruptedException if the thread was interrupted while sleeping between retries .
* @ throws TimeoutException if the job did not complete after job status was polled { @ link
* # MAX _ POLL _ ATTEMPTS } times . */
public static void runExample ( AdWordsServicesInterface adWordsServices , AdWordsSession session ) throws RemoteException , BatchJobException , InterruptedException , TimeoutException { } } | // Get the MutateJobService .
BatchJobServiceInterface batchJobService = adWordsServices . get ( session , BatchJobServiceInterface . class ) ; // Create a BatchJob .
BatchJobOperation addOp = new BatchJobOperation ( ) ; addOp . setOperator ( Operator . ADD ) ; addOp . setOperand ( new BatchJob ( ) ) ; BatchJob batchJob = batchJobService . mutate ( new BatchJobOperation [ ] { addOp } ) . getValue ( 0 ) ; // Get the upload URL from the new job .
String uploadUrl = batchJob . getUploadUrl ( ) . getUrl ( ) ; System . out . printf ( "Created BatchJob with ID %d, status '%s' and upload URL %s.%n" , batchJob . getId ( ) , batchJob . getStatus ( ) , uploadUrl ) ; // Create a temporary ID generator that will produce a sequence of descending negative numbers .
Iterator < Long > tempIdGenerator = new AbstractSequentialIterator < Long > ( - 1L ) { @ Override protected Long computeNext ( Long previous ) { return Long . MIN_VALUE == previous ? null : previous - 1 ; } } ; // Use a random UUID name prefix to avoid name collisions .
String namePrefix = UUID . randomUUID ( ) . toString ( ) ; // Create the mutate request that will be sent to the upload URL .
List < Operation > operations = new ArrayList < > ( ) ; // Create and add an operation to create a new budget .
BudgetOperation budgetOperation = buildBudgetOperation ( tempIdGenerator , namePrefix ) ; operations . add ( budgetOperation ) ; // Create and add operations to create new campaigns .
List < CampaignOperation > campaignOperations = buildCampaignOperations ( tempIdGenerator , namePrefix , budgetOperation ) ; operations . addAll ( campaignOperations ) ; // Create and add operations to create new negative keyword criteria for each campaign .
operations . addAll ( buildCampaignCriterionOperations ( campaignOperations ) ) ; // Create and add operations to create new ad groups .
List < AdGroupOperation > adGroupOperations = new ArrayList < > ( buildAdGroupOperations ( tempIdGenerator , namePrefix , campaignOperations ) ) ; operations . addAll ( adGroupOperations ) ; // Create and add operations to create new ad group criteria ( keywords ) .
operations . addAll ( buildAdGroupCriterionOperations ( adGroupOperations ) ) ; // Create and add operations to create new ad group ads ( text ads ) .
operations . addAll ( buildAdGroupAdOperations ( adGroupOperations ) ) ; // Use a BatchJobHelper to upload all operations .
BatchJobHelper batchJobHelper = adWordsServices . getUtility ( session , BatchJobHelper . class ) ; batchJobHelper . uploadBatchJobOperations ( operations , uploadUrl ) ; System . out . printf ( "Uploaded %d operations for batch job with ID %d.%n" , operations . size ( ) , batchJob . getId ( ) ) ; // Poll for completion of the batch job using an exponential back off .
int pollAttempts = 0 ; boolean isPending ; Selector selector = new SelectorBuilder ( ) . fields ( BatchJobField . Id , BatchJobField . Status , BatchJobField . DownloadUrl , BatchJobField . ProcessingErrors , BatchJobField . ProgressStats ) . equalsId ( batchJob . getId ( ) ) . build ( ) ; do { long sleepSeconds = ( long ) Math . scalb ( 30 , pollAttempts ) ; System . out . printf ( "Sleeping %d seconds...%n" , sleepSeconds ) ; Thread . sleep ( sleepSeconds * 1000 ) ; batchJob = batchJobService . get ( selector ) . getEntries ( 0 ) ; System . out . printf ( "Batch job ID %d has status '%s'.%n" , batchJob . getId ( ) , batchJob . getStatus ( ) ) ; pollAttempts ++ ; isPending = PENDING_STATUSES . contains ( batchJob . getStatus ( ) ) ; } while ( isPending && pollAttempts < MAX_POLL_ATTEMPTS ) ; if ( isPending ) { throw new TimeoutException ( "Job is still in pending state after polling " + MAX_POLL_ATTEMPTS + " times." ) ; } if ( batchJob . getProcessingErrors ( ) != null ) { int i = 0 ; for ( BatchJobProcessingError processingError : batchJob . getProcessingErrors ( ) ) { System . out . printf ( " Processing error [%d]: errorType=%s, trigger=%s, errorString=%s, fieldPath=%s" + ", reason=%s%n" , i ++ , processingError . getApiErrorType ( ) , processingError . getTrigger ( ) , processingError . getErrorString ( ) , processingError . getFieldPath ( ) , processingError . getReason ( ) ) ; } } else { System . out . println ( "No processing errors found." ) ; } if ( batchJob . getDownloadUrl ( ) != null && batchJob . getDownloadUrl ( ) . getUrl ( ) != null ) { BatchJobMutateResponse mutateResponse = batchJobHelper . downloadBatchJobMutateResponse ( batchJob . getDownloadUrl ( ) . getUrl ( ) ) ; System . out . printf ( "Downloaded results from %s:%n" , batchJob . getDownloadUrl ( ) . getUrl ( ) ) ; for ( MutateResult mutateResult : mutateResponse . getMutateResults ( ) ) { String outcome = mutateResult . getErrorList ( ) == null ? "SUCCESS" : "FAILURE" ; System . out . printf ( " Operation [%d] - %s%n" , mutateResult . getIndex ( ) , outcome ) ; } } else { System . out . println ( "No results available for download." ) ; } |
public class Rule { /** * Get a nested mixin of this rule .
* @ param name
* the name of the mixin
* @ return the mixin or null */
List < Rule > getMixin ( String name ) { } } | ArrayList < Rule > rules = null ; for ( Rule rule : subrules ) { for ( String sel : rule . selectors ) { if ( name . equals ( sel ) ) { if ( rules == null ) { rules = new ArrayList < > ( ) ; } rules . add ( rule ) ; break ; } } } return rules ; |
public class DictionaryUtils { /** * Return a Dictionary object backed by the original map ( rather
* than copying the elements from the map into a new dictionary ) .
* @ param map
* Map with String keys and Object values
* @ return Dictionary with String keys and Object values where all
* operations are delegated to the original map */
public static Dictionary < String , Object > mapToDictionary ( Map < String , Object > map ) { } } | return new MapWrapper ( map ) ; |
public class ExpandableAdapter { /** * Get the position of the parent item from the adapter position .
* @ param adapterPosition adapter position of item . */
public final int parentItemPosition ( int adapterPosition ) { } } | int itemCount = 0 ; for ( int i = 0 ; i < parentItemCount ( ) ; i ++ ) { itemCount += 1 ; if ( isExpanded ( i ) ) { int childCount = childItemCount ( i ) ; itemCount += childCount ; } if ( adapterPosition < itemCount ) { return i ; } } throw new IllegalStateException ( "The adapter position is not a parent type: " + adapterPosition ) ; |
public class PathParser { /** * that might require the full parser to deal with . */
private static boolean looksUnsafeForFastParser ( String s ) { } } | boolean lastWasDot = true ; // start of path is also a " dot "
int len = s . length ( ) ; if ( s . isEmpty ( ) ) return true ; if ( s . charAt ( 0 ) == '.' ) return true ; if ( s . charAt ( len - 1 ) == '.' ) return true ; for ( int i = 0 ; i < len ; ++ i ) { char c = s . charAt ( i ) ; if ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) || c == '_' ) { lastWasDot = false ; continue ; } else if ( c == '.' ) { if ( lastWasDot ) return true ; // " . . " means we need to throw an error
lastWasDot = true ; } else if ( c == '-' ) { if ( lastWasDot ) return true ; continue ; } else { return true ; } } if ( lastWasDot ) return true ; return false ; |
public class AmazonPinpointClient { /** * Returns information about the GCM channel for an app .
* @ param getGcmChannelRequest
* @ return Result of the GetGcmChannel operation returned by the service .
* @ throws BadRequestException
* 400 response
* @ throws InternalServerErrorException
* 500 response
* @ throws ForbiddenException
* 403 response
* @ throws NotFoundException
* 404 response
* @ throws MethodNotAllowedException
* 405 response
* @ throws TooManyRequestsException
* 429 response
* @ sample AmazonPinpoint . GetGcmChannel
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / pinpoint - 2016-12-01 / GetGcmChannel " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public GetGcmChannelResult getGcmChannel ( GetGcmChannelRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetGcmChannel ( request ) ; |
public class DefaultDocumentSource { /** * Creates and configures the URL connection .
* @ param url the target URL
* @ return the created connection instance
* @ throws IOException */
protected URLConnection createConnection ( URL url ) throws IOException { } } | URLConnection con = url . openConnection ( ) ; con . setRequestProperty ( "User-Agent" , USER_AGENT ) ; return con ; |
public class MonomerWSLoader { /** * Loads the monomer store using the URL configured in
* { @ code MonomerStoreConfiguration } and the polymerType that was given to
* constructor .
* @ param attachmentDB
* the attachments stored in Toolkit .
* @ return Map containing monomers
* @ throws IOException IO Error
* @ throws URISyntaxException string could not be parsed as URI
* @ throws EncoderException monomer store could be not encoded */
public Map < String , Monomer > loadMonomerStore ( Map < String , Attachment > attachmentDB ) throws IOException , URISyntaxException , EncoderException { } } | Map < String , Monomer > monomers = new TreeMap < String , Monomer > ( String . CASE_INSENSITIVE_ORDER ) ; CloseableHttpClient httpclient = HttpClients . createDefault ( ) ; // There is no need to provide user credentials
// HttpClient will attempt to access current user security context
// through Windows platform specific methods via JNI .
CloseableHttpResponse response = null ; try { HttpGet httpget = new HttpGet ( new URIBuilder ( MonomerStoreConfiguration . getInstance ( ) . getWebserviceMonomersFullURL ( ) + polymerType ) . build ( ) ) ; LOG . debug ( "Executing request " + httpget . getRequestLine ( ) ) ; response = httpclient . execute ( httpget ) ; LOG . debug ( response . getStatusLine ( ) . toString ( ) ) ; JsonFactory jsonf = new JsonFactory ( ) ; InputStream instream = response . getEntity ( ) . getContent ( ) ; if ( response . getStatusLine ( ) . getStatusCode ( ) != 200 ) { throw new MonomerLoadingException ( "Response from the Webservice throws an error" ) ; } JsonParser jsonParser = jsonf . createJsonParser ( instream ) ; monomers = deserializeMonomerStore ( jsonParser , attachmentDB ) ; LOG . debug ( monomers . size ( ) + " " + polymerType + " monomers loaded" ) ; EntityUtils . consume ( response . getEntity ( ) ) ; } finally { if ( response != null ) { response . close ( ) ; } if ( httpclient != null ) { httpclient . close ( ) ; } } return monomers ; |
public class Tile { /** * Defines the Paint object that will be used to draw the border of the gauge .
* @ param PAINT */
public void setBorderColor ( final Color PAINT ) { } } | if ( null == borderColor ) { _borderColor = PAINT ; fireTileEvent ( REDRAW_EVENT ) ; } else { borderColor . set ( PAINT ) ; } |
public class RegisterStreamConsumerRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( RegisterStreamConsumerRequest registerStreamConsumerRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( registerStreamConsumerRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( registerStreamConsumerRequest . getStreamARN ( ) , STREAMARN_BINDING ) ; protocolMarshaller . marshall ( registerStreamConsumerRequest . getConsumerName ( ) , CONSUMERNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class KamDialect { /** * { @ inheritDoc } */
@ Override public KamEdge findEdge ( KamNode sourceNode , RelationshipType relationshipType , KamNode targetNode ) throws InvalidArgument { } } | return wrapEdge ( kam . findEdge ( sourceNode , relationshipType , targetNode ) ) ; |
public class DefaultProcessExecutor { /** * Updates the command list and the buffer .
* @ param commandList
* The command list to update
* @ param buffer
* The input buffer
* @ return The updated buffer */
protected StringBuilder addAllBuffer ( List < String > commandList , StringBuilder buffer ) { } } | commandList . add ( buffer . toString ( ) ) ; buffer . delete ( 0 , buffer . length ( ) ) ; return buffer ; |
public class AuthenticateApi { /** * This method throws an exception if the caller subject is already authenticated and
* WebAlwaysLogin is false . If the caller subject is already authenticated and
* WebAlwaysLogin is true , then it will logout the user .
* @ throws IOException
* @ throws ServletException */
public void throwExceptionIfAlreadyAuthenticate ( HttpServletRequest req , HttpServletResponse resp , WebAppSecurityConfig config , String username ) throws ServletException { } } | Subject callerSubject = subjectManager . getCallerSubject ( ) ; if ( subjectHelper . isUnauthenticated ( callerSubject ) ) return ; if ( ! config . getWebAlwaysLogin ( ) ) { AuthenticationResult authResult = new AuthenticationResult ( AuthResult . FAILURE , username ) ; authResult . setAuditCredType ( req . getAuthType ( ) ) ; authResult . setAuditCredValue ( username ) ; authResult . setAuditOutcome ( AuditEvent . OUTCOME_FAILURE ) ; Audit . audit ( Audit . EventID . SECURITY_API_AUTHN_01 , req , authResult , Integer . valueOf ( HttpServletResponse . SC_UNAUTHORIZED ) ) ; throw new ServletException ( "Authentication had been already established" ) ; } logout ( req , resp , config ) ; |
public class Cells { /** * Returns the Cell ( associated to < i > table < / i > ) whose name is cellName , or null if this Cells object contains no
* cell whose name is cellName .
* @ param cellName the name of the Cell we want to retrieve from this Cells object .
* @ return the Cell whose name is cellName contained in this Cells object . null if no cell named cellName is
* present . */
public Cell getCellByName ( String table , String cellName ) { } } | for ( Cell c : getCellsByTable ( table ) ) { if ( c . getCellName ( ) . equals ( cellName ) ) { return c ; } } return null ; |
public class AbstractCommandSpecProcessor { /** * inherit doc */
@ Override public boolean process ( Set < ? extends TypeElement > annotations , RoundEnvironment roundEnv ) { } } | logger . info ( "Entered process, processingOver=" + roundEnv . processingOver ( ) ) ; IFactory factory = null ; // new NullFactory ( ) ;
Map < Element , CommandSpec > commands = new LinkedHashMap < Element , CommandSpec > ( ) ; Map < TypeMirror , List < CommandSpec > > commandTypes = new LinkedHashMap < TypeMirror , List < CommandSpec > > ( ) ; Map < Element , OptionSpec . Builder > options = new LinkedHashMap < Element , OptionSpec . Builder > ( ) ; Map < Element , PositionalParamSpec . Builder > parameters = new LinkedHashMap < Element , PositionalParamSpec . Builder > ( ) ; List < MixinInfo > mixinInfoList = new ArrayList < MixinInfo > ( ) ; Map < Element , IAnnotatedElement > parentCommands = new LinkedHashMap < Element , IAnnotatedElement > ( ) ; Map < Element , IAnnotatedElement > specs = new LinkedHashMap < Element , IAnnotatedElement > ( ) ; Map < Element , IAnnotatedElement > unmatched = new LinkedHashMap < Element , IAnnotatedElement > ( ) ; logger . fine ( "Building commands..." ) ; buildCommands ( roundEnv , factory , commands , commandTypes , options , parameters ) ; logger . fine ( "Building mixins..." ) ; buildMixins ( roundEnv , factory , commands , mixinInfoList , commandTypes , options , parameters ) ; logger . fine ( "Building options..." ) ; buildOptions ( roundEnv , factory , options ) ; logger . fine ( "Building parameters..." ) ; buildParameters ( roundEnv , factory , parameters ) ; logger . fine ( "Building parentCommands..." ) ; buildParentCommands ( roundEnv , factory , parentCommands ) ; logger . fine ( "Building specs..." ) ; buildSpecs ( roundEnv , factory , specs ) ; logger . fine ( "Building unmatched..." ) ; buildUnmatched ( roundEnv , factory , unmatched ) ; logger . fine ( "---------------------------" ) ; logger . fine ( "Known commands..." ) ; for ( Map . Entry < Element , CommandSpec > cmd : commands . entrySet ( ) ) { logger . fine ( String . format ( "%s has CommandSpec[name=%s]" , cmd . getKey ( ) , cmd . getValue ( ) . name ( ) ) ) ; } logger . fine ( "Known mixins..." ) ; for ( MixinInfo mixinInfo : mixinInfoList ) { logger . fine ( String . format ( "%s is mixin for %s" , mixinInfo . mixin . userObject ( ) , mixinInfo . mixee . userObject ( ) ) ) ; } for ( Map . Entry < Element , OptionSpec . Builder > option : options . entrySet ( ) ) { CommandSpec commandSpec = getOrCreateCommandSpecForArg ( option , commands ) ; logger . fine ( "Building OptionSpec for " + option + " in spec " + commandSpec ) ; commandSpec . addOption ( option . getValue ( ) . build ( ) ) ; } for ( Map . Entry < Element , PositionalParamSpec . Builder > parameter : parameters . entrySet ( ) ) { CommandSpec commandSpec = getOrCreateCommandSpecForArg ( parameter , commands ) ; logger . fine ( "Building PositionalParamSpec for " + parameter ) ; commandSpec . addPositional ( parameter . getValue ( ) . build ( ) ) ; } for ( MixinInfo mixinInfo : mixinInfoList ) { mixinInfo . addMixin ( ) ; } logger . fine ( "Found annotations: " + annotations ) ; // processingEnv . getMessager ( ) . printMessage ( Diagnostic . Kind . MANDATORY _ WARNING , " Found annotations : " + annotations ) ;
for ( TypeElement annotation : annotations ) { Set < ? extends Element > annotatedElements = roundEnv . getElementsAnnotatedWith ( annotation ) ; // processingEnv . getMessager ( ) . printMessage ( Diagnostic . Kind . WARNING , annotatedElements + " is annotated with " + annotation ) ;
logger . finest ( annotatedElements + " is annotated with " + annotation ) ; } validateNoAnnotationsOnInterfaceField ( roundEnv ) ; validateInvalidCombination ( roundEnv , Mixin . class , Option . class ) ; validateInvalidCombination ( roundEnv , Mixin . class , Parameters . class ) ; validateInvalidCombination ( roundEnv , Mixin . class , Unmatched . class ) ; validateInvalidCombination ( roundEnv , Mixin . class , Spec . class ) ; validateInvalidCombination ( roundEnv , Unmatched . class , Option . class ) ; validateInvalidCombination ( roundEnv , Unmatched . class , Parameters . class ) ; validateInvalidCombination ( roundEnv , Spec . class , Option . class ) ; validateInvalidCombination ( roundEnv , Spec . class , Parameters . class ) ; validateInvalidCombination ( roundEnv , Spec . class , Unmatched . class ) ; validateInvalidCombination ( roundEnv , Option . class , Parameters . class ) ; // TODO
// validateSpecFieldTypeIsCommandSpec ( roundEnv ) ;
// validateOptionOrParametersIsNotFinalPrimitiveOrFinalString ( roundEnv ) ;
// validateUnmatchedFieldTypeIsStringArrayOrListOfString ( roundEnv ) ;
return handleCommands ( commands , annotations , roundEnv ) ; |
public class CobolPackedDecimalType { /** * { @ inheritDoc } */
protected FromHostPrimitiveResult < T > fromHostInternal ( Class < T > javaClass , CobolContext cobolContext , byte [ ] hostData , int start ) { } } | int end = start + getBytesLen ( ) ; StringBuffer sb = new StringBuffer ( ) ; int [ ] nibbles = new int [ 2 ] ; for ( int i = start ; i < end ; i ++ ) { setNibbles ( nibbles , hostData [ i ] ) ; char digit0 = getDigit ( nibbles [ 0 ] ) ; if ( digit0 == '\0' ) { return new FromHostPrimitiveResult < T > ( "First nibble is not a digit" , hostData , start , i , getBytesLen ( ) ) ; } sb . append ( digit0 ) ; if ( i == end - 1 ) { if ( isSigned ( ) ) { if ( nibbles [ 1 ] == cobolContext . getNegativeSignNibbleValue ( ) ) { sb . insert ( 0 , "-" ) ; } else if ( nibbles [ 1 ] != cobolContext . getPositiveSignNibbleValue ( ) && nibbles [ 1 ] != cobolContext . getUnspecifiedSignNibbleValue ( ) ) { return new FromHostPrimitiveResult < T > ( "Nibble at sign position does not contain the expected values 0x" + Integer . toHexString ( cobolContext . getNegativeSignNibbleValue ( ) ) + " or 0x" + Integer . toHexString ( cobolContext . getPositiveSignNibbleValue ( ) ) + " or 0x" + Integer . toHexString ( cobolContext . getUnspecifiedSignNibbleValue ( ) ) , hostData , start , i , getBytesLen ( ) ) ; } } else if ( nibbles [ 1 ] != cobolContext . getUnspecifiedSignNibbleValue ( ) ) { return new FromHostPrimitiveResult < T > ( "Nibble at sign position does not contain the expected value 0x" + Integer . toHexString ( cobolContext . getUnspecifiedSignNibbleValue ( ) ) , hostData , start , i , getBytesLen ( ) ) ; } } else { char digit1 = getDigit ( nibbles [ 1 ] ) ; if ( digit1 == '\0' ) { return new FromHostPrimitiveResult < T > ( "Second nibble is not a digit" , hostData , start , i , getBytesLen ( ) ) ; } sb . append ( digit1 ) ; } } if ( getFractionDigits ( ) > 0 ) { sb . insert ( sb . length ( ) - getFractionDigits ( ) , JAVA_DECIMAL_POINT ) ; } try { T value = valueOf ( javaClass , sb . toString ( ) ) ; return new FromHostPrimitiveResult < T > ( value ) ; } catch ( NumberFormatException e ) { return new FromHostPrimitiveResult < T > ( "Host " + getMaxBytesLen ( ) + " bytes numeric converts to '" + sb . toString ( ) + "' which is not a valid " + javaClass . getName ( ) , hostData , start , getBytesLen ( ) ) ; } |
public class CommerceOrderPaymentLocalServiceUtil { /** * Returns a range of all the commerce order payments .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link com . liferay . commerce . model . impl . CommerceOrderPaymentModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param start the lower bound of the range of commerce order payments
* @ param end the upper bound of the range of commerce order payments ( not inclusive )
* @ return the range of commerce order payments */
public static java . util . List < com . liferay . commerce . model . CommerceOrderPayment > getCommerceOrderPayments ( int start , int end ) { } } | return getService ( ) . getCommerceOrderPayments ( start , end ) ; |
public class WriteCampaignRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( WriteCampaignRequest writeCampaignRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( writeCampaignRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( writeCampaignRequest . getAdditionalTreatments ( ) , ADDITIONALTREATMENTS_BINDING ) ; protocolMarshaller . marshall ( writeCampaignRequest . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( writeCampaignRequest . getHoldoutPercent ( ) , HOLDOUTPERCENT_BINDING ) ; protocolMarshaller . marshall ( writeCampaignRequest . getHook ( ) , HOOK_BINDING ) ; protocolMarshaller . marshall ( writeCampaignRequest . getIsPaused ( ) , ISPAUSED_BINDING ) ; protocolMarshaller . marshall ( writeCampaignRequest . getLimits ( ) , LIMITS_BINDING ) ; protocolMarshaller . marshall ( writeCampaignRequest . getMessageConfiguration ( ) , MESSAGECONFIGURATION_BINDING ) ; protocolMarshaller . marshall ( writeCampaignRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( writeCampaignRequest . getSchedule ( ) , SCHEDULE_BINDING ) ; protocolMarshaller . marshall ( writeCampaignRequest . getSegmentId ( ) , SEGMENTID_BINDING ) ; protocolMarshaller . marshall ( writeCampaignRequest . getSegmentVersion ( ) , SEGMENTVERSION_BINDING ) ; protocolMarshaller . marshall ( writeCampaignRequest . getTags ( ) , TAGS_BINDING ) ; protocolMarshaller . marshall ( writeCampaignRequest . getTreatmentDescription ( ) , TREATMENTDESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( writeCampaignRequest . getTreatmentName ( ) , TREATMENTNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Assert { /** * < p > Asserts that the given argument is neither < b > { @ code null } nor { @ code empty } < / b > . The null
* check is performed using { @ link # assertNotNull ( Object ) } . If the argument is { @ code empty } a
* { @ link NullPointerException } will be thrown with the message , < i > " The supplied argument was
* found to be & lt ; empty & gt ; " < / i > . < / p >
* < p > < b > Note < / b > that only the following types are accepted : { @ link CharSequence } , { @ link Collection } ,
* { @ link Map } , { @ code Object [ ] } , { @ code boolean [ ] } , { @ code char [ ] } , { @ code byte [ ] } , { @ code short [ ] } ,
* { @ code int [ ] } , { @ code long [ ] } , { @ code float [ ] } , { @ code double [ ] } . < b > All other types will manage to
* pass this assertion < / b > ( granted the argument is { @ code not null } ) . < / p >
* @ param arg
* the argument to be asserted as being { @ code not empty }
* < br > < br >
* @ return the argument which was asserted to be { @ code not empty }
* < br > < br >
* @ throws NullPointerException
* if the supplied argument was found to be { @ code null }
* < br > < br >
* @ throws IllegalArgumentException
* if the supplied argument was found to be { @ code empty }
* < br > < br >
* @ since 1.3.0 */
public static < T extends Object > T assertNotEmpty ( T arg ) { } } | assertNotNull ( arg ) ; boolean isEmpty = ( arg instanceof CharSequence && ( ( CharSequence ) arg ) . length ( ) == 0 ) || ( arg instanceof Collection < ? > && ( ( Collection < ? > ) arg ) . size ( ) == 0 ) || ( arg instanceof Map < ? , ? > && ( ( Map < ? , ? > ) arg ) . size ( ) == 0 ) || ( arg instanceof Object [ ] && ( ( Object [ ] ) arg ) . length == 0 ) || ( arg instanceof boolean [ ] && ( ( boolean [ ] ) arg ) . length == 0 ) || ( arg instanceof char [ ] && ( ( char [ ] ) arg ) . length == 0 ) || ( arg instanceof byte [ ] && ( ( byte [ ] ) arg ) . length == 0 ) || ( arg instanceof short [ ] && ( ( short [ ] ) arg ) . length == 0 ) || ( arg instanceof int [ ] && ( ( int [ ] ) arg ) . length == 0 ) || ( arg instanceof long [ ] && ( ( long [ ] ) arg ) . length == 0 ) || ( arg instanceof float [ ] && ( ( float [ ] ) arg ) . length == 0 ) || ( arg instanceof double [ ] && ( ( double [ ] ) arg ) . length == 0 ) ; if ( isEmpty ) { throw new IllegalArgumentException ( "The supplied argument was found to be <empty>." ) ; } return arg ; |
public class SocketEventDispatcher { /** * Dispatch conversation message update event .
* @ param event Event to dispatch . */
private void onMessageRead ( MessageReadEvent event ) { } } | handler . post ( ( ) -> listener . onMessageRead ( event ) ) ; log ( "Event published " + event . toString ( ) ) ; |
public class DatabaseTaskStore { /** * { @ inheritDoc } */
@ Override public List < TaskStatus < ? > > findTaskStatus ( String pattern , Character escape , TaskState state , boolean inState , Long minId , Integer maxResults , String owner , boolean includeTrigger , PersistentExecutor executor ) throws Exception { } } | StringBuilder find = new StringBuilder ( 187 ) . append ( "SELECT t.ID,t.LOADER,t.MBITS,t.INAME,t.NEXTEXEC,t.RESLT,t.STATES" ) ; if ( includeTrigger ) find . append ( ",t.TRIG" ) ; find . append ( " FROM Task t" ) ; int i = 0 ; if ( minId != null ) find . append ( ++ i == 1 ? " WHERE" : " AND" ) . append ( " t.ID>=:m" ) ; if ( owner != null ) find . append ( ++ i == 1 ? " WHERE" : " AND" ) . append ( " t.OWNR=:o" ) ; if ( pattern != null ) { find . append ( ++ i == 1 ? " WHERE" : " AND" ) . append ( " t.INAME LIKE :p" ) ; if ( escape != null ) find . append ( " ESCAPE :e" ) ; } Map < String , Object > stateParams = null ; if ( ! TaskState . ANY . equals ( state ) ) stateParams = appendStateComparison ( find . append ( ++ i == 1 ? " WHERE " : " AND " ) , state , inState ) ; else if ( ! inState ) return Collections . emptyList ( ) ; // empty result if someone asks for tasks not in any state
find . append ( " ORDER BY t.ID ASC" ) ; final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "findTaskStatus" , pattern , escape , state + ":" + inState , minId , maxResults , owner , executor , find ) ; List < Object [ ] > results ; EntityManager em = getPersistenceServiceUnit ( ) . createEntityManager ( ) ; try { TypedQuery < Object [ ] > query = em . createQuery ( find . toString ( ) , Object [ ] . class ) ; if ( maxResults != null ) query . setMaxResults ( maxResults ) ; if ( minId != null ) query . setParameter ( "m" , minId ) ; if ( owner != null ) query . setParameter ( "o" , owner ) ; if ( pattern != null ) { query . setParameter ( "p" , pattern ) ; if ( escape != null ) query . setParameter ( "e" , escape ) ; } if ( stateParams != null ) for ( Map . Entry < String , Object > param : stateParams . entrySet ( ) ) query . setParameter ( param . getKey ( ) , param . getValue ( ) ) ; results = query . getResultList ( ) ; } finally { em . close ( ) ; } List < TaskStatus < ? > > statusList = new ArrayList < TaskStatus < ? > > ( results . size ( ) ) ; for ( Object [ ] result : results ) { TaskRecord record = new TaskRecord ( false ) ; record . setId ( ( Long ) result [ 0 ] ) ; record . setIdentifierOfClassLoader ( ( String ) result [ 1 ] ) ; record . setMiscBinaryFlags ( ( Short ) result [ 2 ] ) ; record . setName ( ( String ) result [ 3 ] ) ; record . setNextExecutionTime ( ( Long ) result [ 4 ] ) ; record . setResult ( ( byte [ ] ) result [ 5 ] ) ; record . setState ( ( Short ) result [ 6 ] ) ; if ( includeTrigger ) record . setTrigger ( ( byte [ ] ) result [ 7 ] ) ; statusList . add ( record . toTaskStatus ( executor ) ) ; } if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "findTaskStatus" , statusList . size ( ) < 20 ? statusList : statusList . size ( ) ) ; return statusList ; |
public class ClientSessionSubmitter { /** * Submits a command to the cluster .
* @ param command The command to submit .
* @ param < T > The command result type .
* @ return A completable future to be completed once the command has been submitted . */
public < T > CompletableFuture < T > submit ( Command < T > command ) { } } | CompletableFuture < T > future = new CompletableFuture < > ( ) ; context . executor ( ) . execute ( ( ) -> submitCommand ( command , future ) ) ; return future ; |
public class AbstractCommandLineRunner { /** * Creates JS extern inputs from a list of files . */
@ GwtIncompatible ( "Unnecessary" ) private List < SourceFile > createExternInputs ( List < String > files ) throws IOException { } } | List < FlagEntry < JsSourceType > > externFiles = new ArrayList < > ( ) ; for ( String file : files ) { externFiles . add ( new FlagEntry < JsSourceType > ( JsSourceType . EXTERN , file ) ) ; } try { return createInputs ( externFiles , false , new ArrayList < JsModuleSpec > ( ) ) ; } catch ( FlagUsageException e ) { throw new FlagUsageException ( "Bad --externs flag. " + e . getMessage ( ) ) ; } |
public class DefaultCodecIdentifier { /** * / * ( non - Javadoc )
* @ see CodecIdentifier # isEquivalent ( CodecIdentifier ) */
public boolean isEquivalent ( CodecIdentifier other ) { } } | if ( this . codecName . equals ( other . getCodecName ( ) ) ) { return true ; } if ( this . codecAliases != null && this . codecAliases . contains ( other . getCodecName ( ) ) ) { return true ; } if ( other . getCodecAliases ( ) != null && other . getCodecAliases ( ) . contains ( this . codecName ) ) { return true ; } return false ; |
public class vpnvserver_auditsyslogpolicy_binding { /** * Use this API to fetch vpnvserver _ auditsyslogpolicy _ binding resources of given name . */
public static vpnvserver_auditsyslogpolicy_binding [ ] get ( nitro_service service , String name ) throws Exception { } } | vpnvserver_auditsyslogpolicy_binding obj = new vpnvserver_auditsyslogpolicy_binding ( ) ; obj . set_name ( name ) ; vpnvserver_auditsyslogpolicy_binding response [ ] = ( vpnvserver_auditsyslogpolicy_binding [ ] ) obj . get_resources ( service ) ; return response ; |
public class ApplicationTenancyRepository { /** * region > newTenancy */
@ Programmatic public ApplicationTenancy newTenancy ( final String name , final String path , final ApplicationTenancy parent ) { } } | ApplicationTenancy tenancy = findByPath ( path ) ; if ( tenancy == null ) { tenancy = getApplicationTenancyFactory ( ) . newApplicationTenancy ( ) ; tenancy . setName ( name ) ; tenancy . setPath ( path ) ; tenancy . setParent ( parent ) ; container . persist ( tenancy ) ; } return tenancy ; |
public class NettyServerBuilder { /** * Sets a custom max connection idle time , connection being idle for longer than which will be
* gracefully terminated . Idleness duration is defined since the most recent time the number of
* outstanding RPCs became zero or the connection establishment . An unreasonably small value might
* be increased . { @ code Long . MAX _ VALUE } nano seconds or an unreasonably large value will disable
* max connection idle .
* @ since 1.4.0 */
public NettyServerBuilder maxConnectionIdle ( long maxConnectionIdle , TimeUnit timeUnit ) { } } | checkArgument ( maxConnectionIdle > 0L , "max connection idle must be positive" ) ; maxConnectionIdleInNanos = timeUnit . toNanos ( maxConnectionIdle ) ; if ( maxConnectionIdleInNanos >= AS_LARGE_AS_INFINITE ) { maxConnectionIdleInNanos = MAX_CONNECTION_IDLE_NANOS_DISABLED ; } if ( maxConnectionIdleInNanos < MIN_MAX_CONNECTION_IDLE_NANO ) { maxConnectionIdleInNanos = MIN_MAX_CONNECTION_IDLE_NANO ; } return this ; |
public class TextUtil { /** * Split the given string according to brackets .
* The brackets are used to delimit the groups
* of characters .
* < p > Examples :
* < ul >
* < li > < code > splitBrackets ( " { a } { b } { cd } " ) < / code > returns the array
* < code > [ " a " , " b " , " cd " ] < / code > < / li >
* < li > < code > splitBrackets ( " abcd " ) < / code > returns the array
* < code > [ " abcd " ] < / code > < / li >
* < li > < code > splitBrackets ( " a { bcd " ) < / code > returns the array
* < code > [ " a " , " bcd " ] < / code > < / li >
* < / ul >
* @ param str is the elements enclosed by backets .
* @ return the groups of strings */
@ Pure @ Inline ( value = "textUtil.splitAsList('{', '}', $1)" , imported = { } } | TextUtil . class } ) public static List < String > splitBracketsAsList ( String str ) { return splitAsList ( '{' , '}' , str ) ; |
public class MpscAtomicArrayQueue { /** * { @ inheritDoc }
* IMPLEMENTATION NOTES : < br >
* Lock free peek using ordered loads . As class name suggests access is limited to a single thread .
* @ see java . util . Queue # poll ( )
* @ see org . jctools _ voltpatches . queues . MessagePassingQueue # poll ( ) */
@ Override public E peek ( ) { } } | // Copy field to avoid re - reading after volatile load
final AtomicReferenceArray < E > buffer = this . buffer ; final long consumerIndex = lvConsumerIndex ( ) ; // LoadLoad
final int offset = calcElementOffset ( consumerIndex ) ; E e = lvElement ( buffer , offset ) ; if ( null == e ) { /* * NOTE : Queue may not actually be empty in the case of a producer ( P1 ) being interrupted after
* winning the CAS on offer but before storing the element in the queue . Other producers may go on
* to fill up the queue after this element . */
if ( consumerIndex != lvProducerIndex ( ) ) { do { e = lvElement ( buffer , offset ) ; } while ( e == null ) ; } else { return null ; } } return e ; |
public class CloudhopperBuilder { /** * The bind command type ( see { @ link SmppBindType } ) .
* Default value is { @ link SmppBindType # TRANSMITTER } .
* You can specify one or several property keys . For example :
* < pre >
* . bindType ( " $ { custom . property . high - priority } " , " $ { custom . property . low - priority } " ) ;
* < / pre >
* The properties are not immediately evaluated . The evaluation will be done
* when the { @ link # build ( ) } method is called .
* If you provide several property keys , evaluation will be done on the
* first key and if the property exists ( see { @ link EnvironmentBuilder } ) ,
* its value is used . If the first property doesn ' t exist in properties ,
* then it tries with the second one and so on .
* @ param bindType
* one or several property keys
* @ return this instance for fluent chaining */
public CloudhopperBuilder bindType ( String ... bindType ) { } } | for ( String b : bindType ) { if ( b != null ) { bindTypes . add ( b ) ; } } return this ; |
public class DefaultFcClient { /** * concate query string parameters ( e . g . name = foo )
* @ param parameters query parameters
* @ return concatenated query string
* @ throws UnsupportedEncodingException exceptions */
public String concatQueryString ( Map < String , String > parameters ) throws UnsupportedEncodingException { } } | if ( null == parameters ) { return null ; } StringBuilder urlBuilder = new StringBuilder ( "" ) ; for ( Map . Entry < String , String > entry : parameters . entrySet ( ) ) { String key = entry . getKey ( ) ; String val = entry . getValue ( ) ; urlBuilder . append ( encode ( key ) ) ; if ( val != null ) { urlBuilder . append ( "=" ) . append ( encode ( val ) ) ; } urlBuilder . append ( "&" ) ; } int strIndex = urlBuilder . length ( ) ; if ( parameters . size ( ) > 0 ) { urlBuilder . deleteCharAt ( strIndex - 1 ) ; } return urlBuilder . toString ( ) ; |
public class FloatIterator { /** * Returns an infinite { @ code FloatIterator } .
* @ param supplier
* @ return */
public static FloatIterator generate ( final FloatSupplier supplier ) { } } | N . checkArgNotNull ( supplier ) ; return new FloatIterator ( ) { @ Override public boolean hasNext ( ) { return true ; } @ Override public float nextFloat ( ) { return supplier . getAsFloat ( ) ; } } ; |
public class VariableNumMap { /** * Get the variable referenced by a particular variable number .
* Returns { @ code null } if no variable exists with that number .
* @ param variableNum
* @ return */
public final Variable getVariable ( int variableNum ) { } } | int index = getVariableIndex ( variableNum ) ; if ( index >= 0 ) { return vars [ index ] ; } else { return null ; } |
public class OracleDatabaseWithAutoSequence { /** * For the database from vendor Oracle , an eFaps SQL table with
* auto increment is created in this steps :
* < ul >
* < li > SQL table itself with column < code > ID < / code > and unique key on the
* column is created < / li >
* < li > sequence with same name of table and suffix < code > _ SEQ < / code > is
* created < / li >
* < li > trigger with same name of table and suffix < code > _ TRG < / code > is
* created . The trigger sets automatically the column < code > ID < / code >
* with the next value of the sequence < / li >
* < / ul >
* An eFaps SQL table without auto increment , but with parent table is
* created in this steps :
* < ul >
* < li > SQL table itself with column < code > ID < / code > and unique key on the
* column is created < / li >
* < li > the foreign key to the parent table is automatically set < / li >
* < / ul >
* The creation of the table itself is done by calling the inherited method
* { @ link OracleDatabase # createTable }
* { @ inheritDoc } */
@ Override public OracleDatabase defineTableAutoIncrement ( final Connection _con , final String _table ) throws SQLException { } } | final Statement stmt = _con . createStatement ( ) ; try { final String tableName = getName4DB ( _table , 25 ) ; // create sequence
StringBuilder cmd = new StringBuilder ( ) . append ( "create sequence " ) . append ( tableName ) . append ( "_SEQ" ) . append ( " increment by 1 " ) . append ( " start with 1 " ) . append ( " nocache" ) ; stmt . executeUpdate ( cmd . toString ( ) ) ; // create trigger for auto increment
cmd = new StringBuilder ( ) . append ( "create trigger " ) . append ( tableName ) . append ( "_TRG" ) . append ( " before insert on " ) . append ( _table ) . append ( " for each row " ) . append ( "begin" ) . append ( " select " ) . append ( tableName ) . append ( "_SEQ.nextval " ) . append ( " into :new.ID from dual;" ) . append ( "end;" ) ; stmt . executeUpdate ( cmd . toString ( ) ) ; } catch ( final EFapsException e ) { throw new SQLException ( e ) ; } finally { stmt . close ( ) ; } return this ; |
public class DefaultClusterManager { /** * Handles a queue offer command . */
private void doQueueOffer ( final Message < JsonObject > message ) { } } | final String name = message . body ( ) . getString ( "name" ) ; if ( name == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No name specified." ) ) ; return ; } final Object value = message . body ( ) . getValue ( "value" ) ; if ( value == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No value specified." ) ) ; return ; } context . execute ( new Action < Boolean > ( ) { @ Override public Boolean perform ( ) { return data . getQueue ( formatKey ( name ) ) . offer ( value ) ; } } , new Handler < AsyncResult < Boolean > > ( ) { @ Override public void handle ( AsyncResult < Boolean > result ) { if ( result . failed ( ) ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , result . cause ( ) . getMessage ( ) ) ) ; } else { message . reply ( new JsonObject ( ) . putString ( "status" , "ok" ) . putBoolean ( "result" , result . result ( ) ) ) ; } } } ) ; |
public class CSSCompiler { /** * { @ inheritDoc } */
@ Override protected String getCompiledString ( final Instance _instance ) { } } | String ret = "" ; try { final Checkout checkout = new Checkout ( _instance ) ; final BufferedReader in = new BufferedReader ( new InputStreamReader ( checkout . execute ( ) , "UTF-8" ) ) ; final CssCompressor compressor = new CssCompressor ( in ) ; in . close ( ) ; checkout . close ( ) ; final ByteArrayOutputStream byteout = new ByteArrayOutputStream ( ) ; final OutputStreamWriter out = new OutputStreamWriter ( byteout , "UTF-8" ) ; compressor . compress ( out , 2000 ) ; out . flush ( ) ; ret = byteout . toString ( "UTF-8" ) ; ret += "\n" ; } catch ( final EFapsException e ) { CSSCompiler . LOG . error ( "error during checkout of Instance:" + _instance , e ) ; e . printStackTrace ( ) ; } catch ( final IOException e ) { CSSCompiler . LOG . error ( "error during reqding of the Inputstram of Instance with oid:" + _instance , e ) ; } return ret ; |
public class ResourceContextImpl { /** * ResourceContext . acquire ( ) */
public void acquire ( ) { } } | if ( _hasAcquired ) return ; // Deliver the onAcquire event to registered listeners
for ( ResourceEvents resourceListener : _listeners ) resourceListener . onAcquire ( ) ; // Register this ResourceContext with associated container context
_containerContext . addResourceContext ( this , _bean ) ; // Set the flag to indicate resources have been acquired .
_hasAcquired = true ; |
public class EphemeralKey { /** * Creates an ephemeral API key for a given resource .
* @ param params request parameters
* @ param options request options . { @ code stripeVersion } is required when creating ephemeral
* keys . it must have non - null { @ link RequestOptions # getStripeVersionOverride ( ) } .
* @ return the new ephemeral key */
public static EphemeralKey create ( EphemeralKeyCreateParams params , RequestOptions options ) throws StripeException { } } | checkNullTypedParams ( classUrl ( EphemeralKey . class ) , params ) ; return create ( params . toMap ( ) , options ) ; |
public class ModelsImpl { /** * Gets information about the application version models .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param listModelsOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the List & lt ; ModelInfoResponse & gt ; object */
public Observable < List < ModelInfoResponse > > listModelsAsync ( UUID appId , String versionId , ListModelsOptionalParameter listModelsOptionalParameter ) { } } | return listModelsWithServiceResponseAsync ( appId , versionId , listModelsOptionalParameter ) . map ( new Func1 < ServiceResponse < List < ModelInfoResponse > > , List < ModelInfoResponse > > ( ) { @ Override public List < ModelInfoResponse > call ( ServiceResponse < List < ModelInfoResponse > > response ) { return response . body ( ) ; } } ) ; |
public class AbstractTileFactory { /** * Returns the tile that is located at the given tilePoint
* for this zoom . For example , if getMapSize ( ) returns 10x20
* for this zoom , and the tilePoint is ( 3,5 ) , then the
* appropriate tile will be located and returned . */
@ Override public Tile getTile ( int x , int y , int zoom ) { } } | return getTile ( x , y , zoom , true ) ; |
public class ConfigLoader { /** * Loads the configuration XML from the given string .
* @ since 1.3 */
public static Configuration loadFromString ( String config ) throws IOException , SAXException { } } | ConfigurationImpl cfg = new ConfigurationImpl ( ) ; XMLReader parser = XMLReaderFactory . createXMLReader ( ) ; parser . setContentHandler ( new ConfigHandler ( cfg , null ) ) ; Reader reader = new StringReader ( config ) ; parser . parse ( new InputSource ( reader ) ) ; return cfg ; |
public class WeibullDistributionTypeImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case BpsimPackage . WEIBULL_DISTRIBUTION_TYPE__SCALE : setScale ( ( Double ) newValue ) ; return ; case BpsimPackage . WEIBULL_DISTRIBUTION_TYPE__SHAPE : setShape ( ( Double ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class MtasDataLongBasic { /** * ( non - Javadoc )
* @ see
* mtas . codec . util . collector . MtasDataCollector # validateSegmentBoundary ( java .
* lang . Object ) */
@ Override public boolean validateSegmentBoundary ( Object o ) throws IOException { } } | if ( o instanceof Long ) { return validateWithSegmentBoundary ( ( Long ) o ) ; } else { throw new IOException ( "incorrect type " ) ; } |
public class TableBuilder { /** * Get tr of specified index . If there no tr at the specified index , new tr will be created .
* @ param index 0 = first tr , 1 = second tr
* @ return */
public tr tr ( int index ) { } } | while ( trList . size ( ) <= index ) { trList . add ( new tr ( ) ) ; } return trList . get ( index ) ; |
public class InternalXtextParser { /** * InternalXtext . g : 3330:1 : ruleNegatedToken returns [ EObject current = null ] : ( otherlv _ 0 = ' ! ' ( ( lv _ terminal _ 1_0 = ruleTerminalTokenElement ) ) ) ; */
public final EObject ruleNegatedToken ( ) throws RecognitionException { } } | EObject current = null ; Token otherlv_0 = null ; EObject lv_terminal_1_0 = null ; enterRule ( ) ; try { // InternalXtext . g : 3336:2 : ( ( otherlv _ 0 = ' ! ' ( ( lv _ terminal _ 1_0 = ruleTerminalTokenElement ) ) ) )
// InternalXtext . g : 3337:2 : ( otherlv _ 0 = ' ! ' ( ( lv _ terminal _ 1_0 = ruleTerminalTokenElement ) ) )
{ // InternalXtext . g : 3337:2 : ( otherlv _ 0 = ' ! ' ( ( lv _ terminal _ 1_0 = ruleTerminalTokenElement ) ) )
// InternalXtext . g : 3338:3 : otherlv _ 0 = ' ! ' ( ( lv _ terminal _ 1_0 = ruleTerminalTokenElement ) )
{ otherlv_0 = ( Token ) match ( input , 41 , FollowSets000 . FOLLOW_47 ) ; newLeafNode ( otherlv_0 , grammarAccess . getNegatedTokenAccess ( ) . getExclamationMarkKeyword_0 ( ) ) ; // InternalXtext . g : 3342:3 : ( ( lv _ terminal _ 1_0 = ruleTerminalTokenElement ) )
// InternalXtext . g : 3343:4 : ( lv _ terminal _ 1_0 = ruleTerminalTokenElement )
{ // InternalXtext . g : 3343:4 : ( lv _ terminal _ 1_0 = ruleTerminalTokenElement )
// InternalXtext . g : 3344:5 : lv _ terminal _ 1_0 = ruleTerminalTokenElement
{ newCompositeNode ( grammarAccess . getNegatedTokenAccess ( ) . getTerminalTerminalTokenElementParserRuleCall_1_0 ( ) ) ; pushFollow ( FollowSets000 . FOLLOW_2 ) ; lv_terminal_1_0 = ruleTerminalTokenElement ( ) ; state . _fsp -- ; if ( current == null ) { current = createModelElementForParent ( grammarAccess . getNegatedTokenRule ( ) ) ; } set ( current , "terminal" , lv_terminal_1_0 , "org.eclipse.xtext.Xtext.TerminalTokenElement" ) ; afterParserOrEnumRuleCall ( ) ; } } } } leaveRule ( ) ; } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class Timestamp { /** * Returns a timestamp relative to this one by the given number of days .
* @ param amount a number of days . */
public final Timestamp addDay ( int amount ) { } } | long delta = ( long ) amount * 24 * 60 * 60 * 1000 ; return addMillisForPrecision ( delta , Precision . DAY , false ) ; |
public class NodeTraversal { /** * Creates a new scope ( e . g . when entering a function ) .
* @ param quietly Don ' t fire an enterScope callback . */
private void pushScope ( AbstractScope < ? , ? > s , boolean quietly ) { } } | checkNotNull ( curNode ) ; scopes . push ( s ) ; recordScopeRoot ( s . getRootNode ( ) ) ; if ( ! quietly && scopeCallback != null ) { scopeCallback . enterScope ( this ) ; } |
public class AppMarshaller { /** * Marshall the given parameter object . */
public void marshall ( App app , ProtocolMarshaller protocolMarshaller ) { } } | if ( app == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( app . getAppId ( ) , APPID_BINDING ) ; protocolMarshaller . marshall ( app . getStackId ( ) , STACKID_BINDING ) ; protocolMarshaller . marshall ( app . getShortname ( ) , SHORTNAME_BINDING ) ; protocolMarshaller . marshall ( app . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( app . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( app . getDataSources ( ) , DATASOURCES_BINDING ) ; protocolMarshaller . marshall ( app . getType ( ) , TYPE_BINDING ) ; protocolMarshaller . marshall ( app . getAppSource ( ) , APPSOURCE_BINDING ) ; protocolMarshaller . marshall ( app . getDomains ( ) , DOMAINS_BINDING ) ; protocolMarshaller . marshall ( app . getEnableSsl ( ) , ENABLESSL_BINDING ) ; protocolMarshaller . marshall ( app . getSslConfiguration ( ) , SSLCONFIGURATION_BINDING ) ; protocolMarshaller . marshall ( app . getAttributes ( ) , ATTRIBUTES_BINDING ) ; protocolMarshaller . marshall ( app . getCreatedAt ( ) , CREATEDAT_BINDING ) ; protocolMarshaller . marshall ( app . getEnvironment ( ) , ENVIRONMENT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class IPAddressString { /** * Returns whether this is a valid address string format .
* The accepted IP address formats are :
* an IPv4 address , an IPv6 address , a network prefix alone , the address representing all addresses of all types , or an empty string .
* If this method returns false , and you want more details , call validate ( ) and examine the thrown exception .
* @ return whether this is a valid address string format */
public boolean isValid ( ) { } } | if ( addressProvider . isUninitialized ( ) ) { try { validate ( ) ; return true ; } catch ( AddressStringException e ) { return false ; } } return ! addressProvider . isInvalid ( ) ; |
public class TransformationDescription { /** * Adds a concat transformation step to the transformation description . The values of the source fields are
* concatenated to the target field with the concat string between the source fields values . All fields need to be
* of the type String . */
public void concatField ( String targetField , String concatString , String ... sourceFields ) { } } | TransformationStep step = new TransformationStep ( ) ; step . setTargetField ( targetField ) ; step . setSourceFields ( sourceFields ) ; step . setOperationParameter ( TransformationConstants . CONCAT_PARAM , concatString ) ; step . setOperationName ( "concat" ) ; steps . add ( step ) ; |
public class JobSchedulePatchHeaders { /** * Set the time at which the resource was last modified .
* @ param lastModified the lastModified value to set
* @ return the JobSchedulePatchHeaders object itself . */
public JobSchedulePatchHeaders withLastModified ( DateTime lastModified ) { } } | if ( lastModified == null ) { this . lastModified = null ; } else { this . lastModified = new DateTimeRfc1123 ( lastModified ) ; } return this ; |
public class DataUtils { /** * Return the list of all the module submodules
* @ param module
* @ return List < DbModule > */
public static List < DbModule > getAllSubmodules ( final DbModule module ) { } } | final List < DbModule > submodules = new ArrayList < DbModule > ( ) ; submodules . addAll ( module . getSubmodules ( ) ) ; for ( final DbModule submodule : module . getSubmodules ( ) ) { submodules . addAll ( getAllSubmodules ( submodule ) ) ; } return submodules ; |
public class MiniTemplatorParser { /** * Processes the $ elseIf command . */
private void processElseIfCmd ( String parms , int cmdTPosBegin , int cmdTPosEnd ) throws MiniTemplator . TemplateSyntaxException { } } | excludeTemplateRange ( cmdTPosBegin , cmdTPosEnd ) ; if ( condLevel < 0 ) { throw new MiniTemplator . TemplateSyntaxException ( "$elseIf without matching $if." ) ; } boolean enabled = isCondEnabled ( condLevel - 1 ) && ! condPassed [ condLevel ] && evaluateConditionFlags ( parms ) ; condEnabled [ condLevel ] = enabled ; if ( enabled ) { condPassed [ condLevel ] = true ; } |
public class ConfigImpl { /** * Initializes and returns the map of packages based on the information in
* the server - side config JavaScript
* @ param cfg
* The parsed config JavaScript as a properties map
* @ return the package map
* @ throws URISyntaxException */
protected Map < String , IPackage > loadPackages ( Scriptable cfg ) throws URISyntaxException { } } | Object obj = cfg . get ( PACKAGES_CONFIGPARAM , cfg ) ; Map < String , IPackage > packages = new HashMap < String , IPackage > ( ) ; if ( obj instanceof Scriptable ) { for ( Object id : ( ( Scriptable ) obj ) . getIds ( ) ) { if ( id instanceof Number ) { Number i = ( Number ) id ; Object pkg = ( ( Scriptable ) obj ) . get ( ( Integer ) i , ( Scriptable ) obj ) ; IPackage p = newPackage ( pkg ) ; if ( ! packages . containsKey ( p . getName ( ) ) ) { packages . put ( p . getName ( ) , p ) ; } } } } return packages ; |
public class Director { /** * Installs the specified features and fires appropriate progress event notifications
* @ param featureNames collection of feature names to be installed
* @ param toExtension location of a product extension
* @ param acceptLicense if license is accepted
* @ param allowAlreadyInstalled if already installed features should be ignored
* @ param userId userId for repository
* @ param password password for repository
* @ param checkProgress check progress integer
* @ throws InstallException */
public void installFeatures ( Collection < String > featureNames , String toExtension , boolean acceptLicense , boolean allowAlreadyInstalled , String userId , String password , int checkProgress ) throws InstallException { } } | fireProgressEvent ( InstallProgressEvent . CHECK , checkProgress , Messages . INSTALL_KERNEL_MESSAGES . getLogMessage ( "STATE_CHECKING" ) ) ; if ( featureNames == null || featureNames . isEmpty ( ) ) { throw ExceptionUtils . createByKey ( "ERROR_FEATURES_LIST_INVALID" ) ; } List < List < RepositoryResource > > installResources = getResolveDirector ( ) . resolve ( featureNames , DownloadOption . required , userId , password ) ; if ( isEmpty ( installResources ) ) { if ( allowAlreadyInstalled ) return ; throw ExceptionUtils . createByKey ( InstallException . ALREADY_EXISTS , "ALREADY_INSTALLED" , InstallUtils . getShortNames ( product . getFeatureDefinitions ( ) , featureNames ) . toString ( ) ) ; } if ( ! acceptLicense ) { throw ExceptionUtils . createByKey ( "ERROR_LICENSES_NOT_ACCEPTED" ) ; } this . installAssets = new ArrayList < List < InstallAsset > > ( installResources . size ( ) ) ; int progress = 10 ; int interval1 = installResources . size ( ) == 0 ? 40 : 40 / installResources . size ( ) ; for ( List < RepositoryResource > mrList : installResources ) { List < InstallAsset > iaList = new ArrayList < InstallAsset > ( mrList . size ( ) ) ; installAssets . add ( iaList ) ; int interval2 = mrList . size ( ) == 0 ? interval1 : interval1 / mrList . size ( ) ; for ( RepositoryResource installResource : mrList ) { fireDownloadProgressEvent ( progress , installResource ) ; progress += interval2 ; File d = null ; try { d = InstallUtils . download ( this . product . getInstallTempDir ( ) , installResource ) ; if ( d != null && installResource . getType ( ) . equals ( ResourceType . FEATURE ) ) { Visibility v = ( ( EsaResource ) installResource ) . getVisibility ( ) ; if ( v . equals ( Visibility . PUBLIC ) || v . equals ( Visibility . INSTALL ) ) { log ( Level . FINE , Messages . INSTALL_KERNEL_MESSAGES . getLogMessage ( "MSG_DOWNLOAD_SUCCESS" , installResource . getName ( ) ) ) ; } } log ( Level . FINEST , d == null ? installResource . getName ( ) + " is an unsupported type " + installResource . getType ( ) + " to be downloaded." : "Downloaded " + installResource . getName ( ) + " to " + d . getAbsolutePath ( ) ) ; } catch ( InstallException e ) { throw e ; } catch ( Exception e ) { throw ExceptionUtils . createFailedToDownload ( installResource , e , ( d == null ? this . product . getInstallTempDir ( ) : d ) ) ; } if ( installResource . getType ( ) . equals ( ResourceType . FEATURE ) ) { EsaResource esa = ( EsaResource ) installResource ; ESAAsset esaAsset ; try { esaAsset = new ESAAsset ( esa . getName ( ) , esa . getProvideFeature ( ) , toExtension , d , true ) ; if ( esaAsset . getSubsystemEntry ( ) == null ) { throw ExceptionUtils . create ( Messages . PROVISIONER_MESSAGES . getLogMessage ( "tool.install.content.no.subsystem.manifest" ) , InstallException . BAD_FEATURE_DEFINITION ) ; } ProvisioningFeatureDefinition fd = esaAsset . getProvisioningFeatureDefinition ( ) ; if ( ! fd . isSupportedFeatureVersion ( ) ) { throw ExceptionUtils . create ( Messages . PROVISIONER_MESSAGES . getLogMessage ( "UNSUPPORTED_FEATURE_VERSION" , fd . getFeatureName ( ) , fd . getIbmFeatureVersion ( ) ) , InstallException . BAD_FEATURE_DEFINITION ) ; } iaList . add ( esaAsset ) ; } catch ( Exception e ) { throw ExceptionUtils . createByKey ( e , "ERROR_INVALID_ESA" , esa . getName ( ) ) ; } } else if ( installResource . getType ( ) . equals ( ResourceType . IFIX ) ) { try { iaList . add ( new FixAsset ( installResource . getName ( ) , d , true ) ) ; } catch ( Exception e ) { throw ExceptionUtils . createByKey ( e , "ERROR_INVALID_IFIX" , installResource . getName ( ) ) ; } } } } |
public class CPDefinitionLocalizationPersistenceImpl { /** * Clears the cache for the cp definition localization .
* The { @ link EntityCache } and { @ link FinderCache } are both cleared by this method . */
@ Override public void clearCache ( CPDefinitionLocalization cpDefinitionLocalization ) { } } | entityCache . removeResult ( CPDefinitionLocalizationModelImpl . ENTITY_CACHE_ENABLED , CPDefinitionLocalizationImpl . class , cpDefinitionLocalization . getPrimaryKey ( ) ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; clearUniqueFindersCache ( ( CPDefinitionLocalizationModelImpl ) cpDefinitionLocalization , true ) ; |
public class CmsContainerConfigurationCacheState { /** * Gets the cache key for a given base path . < p >
* @ param basePath the base path
* @ return the cache key for the base path */
protected String getCacheKey ( String basePath ) { } } | assert ! basePath . endsWith ( INHERITANCE_CONFIG_FILE_NAME ) ; return CmsFileUtil . addTrailingSeparator ( basePath ) ; |
public class EventProcessorHost { /** * Stop processing events and shut down this host instance .
* @ return A CompletableFuture that completes when shutdown is finished . */
public CompletableFuture < Void > unregisterEventProcessor ( ) { } } | TRACE_LOGGER . info ( this . hostContext . withHost ( "Stopping event processing" ) ) ; if ( this . unregistered == null ) { // PartitionManager is created in constructor . If this object exists , then
// this . partitionManager is not null .
this . unregistered = this . partitionManager . stopPartitions ( ) ; // If we own the executor , stop it also .
// Owned executor is also created in constructor .
if ( this . weOwnExecutor ) { this . unregistered = this . unregistered . thenRunAsync ( ( ) -> { // IMPORTANT : run this last stage in the default threadpool !
// If a task running in a threadpool waits for that threadpool to terminate , it ' s going to wait a long time . . .
// It is OK to call shutdown ( ) here even if threads are still running .
// Shutdown ( ) causes the executor to stop accepting new tasks , but existing tasks will
// run to completion . The pool will terminate when all existing tasks finish .
// By this point all new tasks generated by the shutdown have been submitted .
this . executorService . shutdown ( ) ; try { this . executorService . awaitTermination ( 10 , TimeUnit . MINUTES ) ; } catch ( InterruptedException e ) { throw new CompletionException ( e ) ; } } , ForkJoinPool . commonPool ( ) ) ; } } return this . unregistered ; |
public class AppOpticsMeterRegistry { /** * VisibleForTesting */
@ Nullable Optional < String > writeFunctionCounter ( FunctionCounter counter ) { } } | double count = counter . count ( ) ; if ( Double . isFinite ( count ) && count > 0 ) { // can ' t use " count " field because sum is required whenever count is set .
return Optional . of ( write ( counter . getId ( ) , "functionCounter" , Fields . Value . tag ( ) , decimal ( count ) ) ) ; } return Optional . empty ( ) ; |
public class AwsSecurityFindingFilters { /** * A finding ' s title .
* @ param title
* A finding ' s title . */
public void setTitle ( java . util . Collection < StringFilter > title ) { } } | if ( title == null ) { this . title = null ; return ; } this . title = new java . util . ArrayList < StringFilter > ( title ) ; |
public class AmazonEC2Client { /** * Describes the data feed for Spot Instances . For more information , see < a
* href = " https : / / docs . aws . amazon . com / AWSEC2 / latest / UserGuide / spot - data - feeds . html " > Spot Instance Data Feed < / a > in
* the < i > Amazon EC2 User Guide for Linux Instances < / i > .
* @ param describeSpotDatafeedSubscriptionRequest
* Contains the parameters for DescribeSpotDatafeedSubscription .
* @ return Result of the DescribeSpotDatafeedSubscription operation returned by the service .
* @ sample AmazonEC2 . DescribeSpotDatafeedSubscription
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / DescribeSpotDatafeedSubscription "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DescribeSpotDatafeedSubscriptionResult describeSpotDatafeedSubscription ( DescribeSpotDatafeedSubscriptionRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeSpotDatafeedSubscription ( request ) ; |
public class StandardPacketInputStream { /** * Create Buffer with Text protocol values .
* @ param rowDatas datas
* @ param columnTypes column types
* @ return Buffer */
public static byte [ ] create ( byte [ ] [ ] rowDatas , ColumnType [ ] columnTypes ) { } } | int totalLength = 0 ; for ( byte [ ] rowData : rowDatas ) { if ( rowData == null ) { totalLength ++ ; } else { int length = rowData . length ; if ( length < 251 ) { totalLength += length + 1 ; } else if ( length < 65536 ) { totalLength += length + 3 ; } else if ( length < 16777216 ) { totalLength += length + 4 ; } else { totalLength += length + 9 ; } } } byte [ ] buf = new byte [ totalLength ] ; int pos = 0 ; for ( byte [ ] arr : rowDatas ) { if ( arr == null ) { buf [ pos ++ ] = ( byte ) 251 ; } else { int length = arr . length ; if ( length < 251 ) { buf [ pos ++ ] = ( byte ) length ; } else if ( length < 65536 ) { buf [ pos ++ ] = ( byte ) 0xfc ; buf [ pos ++ ] = ( byte ) length ; buf [ pos ++ ] = ( byte ) ( length >>> 8 ) ; } else if ( length < 16777216 ) { buf [ pos ++ ] = ( byte ) 0xfd ; buf [ pos ++ ] = ( byte ) length ; buf [ pos ++ ] = ( byte ) ( length >>> 8 ) ; buf [ pos ++ ] = ( byte ) ( length >>> 16 ) ; } else { buf [ pos ++ ] = ( byte ) 0xfe ; buf [ pos ++ ] = ( byte ) length ; buf [ pos ++ ] = ( byte ) ( length >>> 8 ) ; buf [ pos ++ ] = ( byte ) ( length >>> 16 ) ; buf [ pos ++ ] = ( byte ) ( length >>> 24 ) ; // byte [ ] cannot have more than 4 byte length size , so buf [ pos + 5 ] - > buf [ pos + 8 ] = 0x00;
pos += 4 ; } System . arraycopy ( arr , 0 , buf , pos , length ) ; pos += length ; } } return buf ; |
public class TagQueueRequest { /** * The list of tags to be added to the specified queue .
* @ param tags
* The list of tags to be added to the specified queue .
* @ return Returns a reference to this object so that method calls can be chained together . */
public TagQueueRequest withTags ( java . util . Map < String , String > tags ) { } } | setTags ( tags ) ; return this ; |
public class Primitives { /** * Converts an array of primitive doubles to objects .
* This method returns { @ code null } for a { @ code null } input array .
* @ param a
* a { @ code double } array
* @ return a { @ code Double } array , { @ code null } if null array input */
@ SafeVarargs public static Double [ ] box ( final double ... a ) { } } | if ( a == null ) { return null ; } return box ( a , 0 , a . length ) ; |
public class XmpSchema { /** * @ see java . util . Properties # setProperty ( java . lang . String , java . lang . String )
* @ param key
* @ param value
* @ return the previous property ( null if there wasn ' t one ) */
public Object setProperty ( String key , XmpArray value ) { } } | return super . setProperty ( key , value . toString ( ) ) ; |
public class ListCertificateAuthoritiesResult { /** * Summary information about each certificate authority you have created .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setCertificateAuthorities ( java . util . Collection ) } or
* { @ link # withCertificateAuthorities ( java . util . Collection ) } if you want to override the existing values .
* @ param certificateAuthorities
* Summary information about each certificate authority you have created .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListCertificateAuthoritiesResult withCertificateAuthorities ( CertificateAuthority ... certificateAuthorities ) { } } | if ( this . certificateAuthorities == null ) { setCertificateAuthorities ( new java . util . ArrayList < CertificateAuthority > ( certificateAuthorities . length ) ) ; } for ( CertificateAuthority ele : certificateAuthorities ) { this . certificateAuthorities . add ( ele ) ; } return this ; |
public class CmsFocalPointController { /** * Updates the focal point widget . < p > */
private void updatePoint ( ) { } } | clearImagePoint ( ) ; CmsPoint nativePoint ; if ( m_focalPoint == null ) { CmsPoint cropCenter = getCropCenter ( ) ; nativePoint = cropCenter ; } else if ( ! getNativeCropRegion ( ) . contains ( m_focalPoint ) ) { return ; } else { nativePoint = m_focalPoint ; } m_pointWidget = new CmsFocalPoint ( CmsFocalPointController . this ) ; boolean isDefault = m_savedFocalPoint == null ; m_pointWidget . setIsDefault ( isDefault ) ; m_container . add ( m_pointWidget ) ; CmsPoint screenPoint = m_coordinateTransform . transformBack ( nativePoint ) ; m_pointWidget . setCenterCoordsRelativeToParent ( ( int ) screenPoint . getX ( ) , ( int ) screenPoint . getY ( ) ) ; |
public class AtlasKnoxSSOAuthenticationFilter { /** * Encapsulate the acquisition of the JWT token from HTTP cookies within the
* request .
* @ param req servlet request to get the JWT token from
* @ return serialized JWT token */
protected String getJWTFromCookie ( HttpServletRequest req ) { } } | String serializedJWT = null ; Cookie [ ] cookies = req . getCookies ( ) ; if ( cookieName != null && cookies != null ) { for ( Cookie cookie : cookies ) { if ( cookieName . equals ( cookie . getName ( ) ) ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "{} cookie has been found and is being processed" , cookieName ) ; } serializedJWT = cookie . getValue ( ) ; break ; } } } return serializedJWT ; |
public class ManagerConnectionImpl { /** * This method is called when a { @ link ProtocolIdentifierReceivedEvent } is
* received from the reader . Having received a correct protocol identifier
* is the precondition for logging in .
* @ param identifier the protocol version used by the Asterisk server . */
private void setProtocolIdentifier ( final String identifier ) { } } | logger . info ( "Connected via " + identifier ) ; // NOTE : value is AMI _ VERSION , defined in include / asterisk / manager . h
if ( // Asterisk 13
! "Asterisk Call Manager/2.6.0" . equals ( identifier ) // Asterisk 13.2
&& ! "Asterisk Call Manager/2.7.0" . equals ( identifier ) // Asterisk > 13.5
&& ! "Asterisk Call Manager/2.8.0" . equals ( identifier ) // Asterisk > 13.13
&& ! "Asterisk Call Manager/2.9.0" . equals ( identifier ) // Asterisk = 14.3.0
&& ! "Asterisk Call Manager/3.1.0" . equals ( identifier ) // since Asterisk 14.4.0
&& ! "Asterisk Call Manager/3.2.0" . equals ( identifier ) // since Asterisk 15
&& ! "Asterisk Call Manager/4.0.0" . equals ( identifier ) // since Asterisk 15.1
&& ! "Asterisk Call Manager/4.0.1" . equals ( identifier ) // since Asterisk 15.2
&& ! "Asterisk Call Manager/4.0.2" . equals ( identifier ) // since Asterisk 15.3
&& ! "Asterisk Call Manager/4.0.3" . equals ( identifier ) // Asterisk 16
&& ! "Asterisk Call Manager/5.0.0" . equals ( identifier ) && ! "OpenPBX Call Manager/1.0" . equals ( identifier ) && ! "CallWeaver Call Manager/1.0" . equals ( identifier ) && ! ( identifier != null && identifier . startsWith ( "Asterisk Call Manager Proxy/" ) ) ) { logger . warn ( "Unsupported protocol version '" + identifier + "'. Use at your own risk." ) ; } protocolIdentifier . setValue ( identifier ) ; protocolIdentifier . countDown ( ) ; |
public class MetricRegistry { /** * Return the { @ link Meter } registered under this name ; or create and register
* a new { @ link Meter } using the provided MetricSupplier if none is registered .
* @ param name the name of the metric
* @ param supplier a MetricSupplier that can be used to manufacture a Meter
* @ return a new or pre - existing { @ link Meter } */
public Meter meter ( String name , final MetricSupplier < Meter > supplier ) { } } | return getOrAdd ( name , new MetricBuilder < Meter > ( ) { @ Override public Meter newMetric ( ) { return supplier . newMetric ( ) ; } @ Override public boolean isInstance ( Metric metric ) { return Meter . class . isInstance ( metric ) ; } } ) ; |
public class Scope { /** * Searches for or creates a variable with the given name .
* If no variable with the given name is found , a new variable is created in this scope
* @ param name the variable to look for
* @ return a variable with the given name
* @ throws IllegalArgumentException if { @ link # autocreateVariables } is < tt > false < / tt > and the given
* variable was not creted yet . */
public Variable getVariable ( String name ) { } } | Variable result = find ( name ) ; if ( result != null ) { return result ; } if ( ! autocreateVariables ) { throw new IllegalArgumentException ( ) ; } return create ( name ) ; |
public class VdmPluginImages { /** * / * package */
static ImageRegistry getImageRegistry ( ) { } } | if ( fgImageRegistry == null ) { ImageRegistry registry = new ImageRegistry ( ) ; for ( Iterator < String > iter = fgAvoidSWTErrorMap . keySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { String key = iter . next ( ) ; registry . put ( key , fgAvoidSWTErrorMap . get ( key ) ) ; } fgImageRegistry = registry ; fgAvoidSWTErrorMap = null ; } return fgImageRegistry ; |
public class MultiUserChat { /** * Creates the room according to some default configuration , assign the requesting user as the
* room owner , and add the owner to the room but not allow anyone else to enter the room
* ( effectively " locking " the room ) . The requesting user will join the room under the specified
* nickname as soon as the room has been created .
* To create an " Instant Room " , that means a room with some default configuration that is
* available for immediate access , the room ' s owner should send an empty form after creating the
* room . Simply call { @ link MucCreateConfigFormHandle # makeInstant ( ) } on the returned { @ link MucCreateConfigFormHandle } .
* To create a " Reserved Room " , that means a room manually configured by the room creator before
* anyone is allowed to enter , the room ' s owner should complete and send a form after creating
* the room . Once the completed configuration form is sent to the server , the server will unlock
* the room . You can use the returned { @ link MucCreateConfigFormHandle } to configure the room .
* @ param nickname the nickname to use .
* @ return a handle to the MUC create configuration form API .
* @ throws XMPPErrorException if the room couldn ' t be created for some reason ( e . g . 405 error if
* the user is not allowed to create the room )
* @ throws NoResponseException if there was no response from the server .
* @ throws InterruptedException
* @ throws NotConnectedException
* @ throws MucAlreadyJoinedException
* @ throws MissingMucCreationAcknowledgeException
* @ throws NotAMucServiceException */
public synchronized MucCreateConfigFormHandle create ( Resourcepart nickname ) throws NoResponseException , XMPPErrorException , InterruptedException , MucAlreadyJoinedException , NotConnectedException , MissingMucCreationAcknowledgeException , NotAMucServiceException { } } | if ( joined ) { throw new MucAlreadyJoinedException ( ) ; } MucCreateConfigFormHandle mucCreateConfigFormHandle = createOrJoin ( nickname ) ; if ( mucCreateConfigFormHandle != null ) { // We successfully created a new room
return mucCreateConfigFormHandle ; } // We need to leave the room since it seems that the room already existed
try { leave ( ) ; } catch ( MucNotJoinedException e ) { LOGGER . log ( Level . INFO , "Unexpected MucNotJoinedException" , e ) ; } throw new MissingMucCreationAcknowledgeException ( ) ; |
public class CollapseProperties { /** * Updates the first initialization ( a . k . a " declaration " ) of a global name that occurs at a VAR
* node . See comment for { @ link # updateGlobalNameDeclaration } .
* @ param n An object representing a global name ( e . g . " a " ) */
private void updateGlobalNameDeclarationAtVariableNode ( Name n , boolean canCollapseChildNames ) { } } | if ( ! canCollapseChildNames ) { return ; } Ref ref = n . getDeclaration ( ) ; String name = ref . getNode ( ) . getString ( ) ; Node rvalue = ref . getNode ( ) . getFirstChild ( ) ; Node variableNode = ref . getNode ( ) . getParent ( ) ; Node grandparent = variableNode . getParent ( ) ; boolean isObjLit = rvalue . isObjectLit ( ) ; if ( isObjLit ) { declareVariablesForObjLitValues ( n , name , rvalue , variableNode , variableNode . getPrevious ( ) , grandparent ) ; } addStubsForUndeclaredProperties ( n , name , grandparent , variableNode ) ; if ( isObjLit && canEliminate ( n ) ) { variableNode . removeChild ( ref . getNode ( ) ) ; compiler . reportChangeToEnclosingScope ( variableNode ) ; if ( ! variableNode . hasChildren ( ) ) { grandparent . removeChild ( variableNode ) ; } // Clear out the object reference , since we ' ve eliminated it from the
// parse tree .
n . updateRefNode ( ref , null ) ; } |
public class RegistryEntryImpl { /** * Check the legacy is a parent of < b > this < / b > { @ link RegistryEntryImpl }
* instance
* @ param registryEntry parent to check
* @ return true if the legacy is a parent */
public boolean isParent ( RegistryEntry registryEntry ) { } } | RegistryEntry entry = getParentRegistryEntry ( ) ; while ( entry != null ) { if ( entry . equals ( registryEntry ) ) { return true ; } entry = entry . getParentRegistryEntry ( ) ; } return false ; |
public class DataPipeline { /** * At least one source is active - notify the operator . */
@ Override public void sourceConnected ( VehicleDataSource source ) { } } | if ( mOperator != null ) { mOperator . onPipelineActivated ( ) ; for ( VehicleDataSource s : mSources ) { s . onPipelineActivated ( ) ; } } |
public class BinaryReader { /** * Read binary data from stream .
* @ param out The output buffer to read into .
* @ throws IOException if unable to read from stream . */
@ Override public int read ( byte [ ] out ) throws IOException { } } | int i , off = 0 ; while ( off < out . length && ( i = in . read ( out , off , out . length - off ) ) > 0 ) { off += i ; } return off ; |
public class QuadCurve { /** * Configures the start , control , and end points for this curve to be the same as the supplied
* curve . */
public void setCurve ( IQuadCurve curve ) { } } | setCurve ( curve . x1 ( ) , curve . y1 ( ) , curve . ctrlX ( ) , curve . ctrlY ( ) , curve . x2 ( ) , curve . y2 ( ) ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.