signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AmazonConfigClient { /** * Deletes the retention configuration .
* @ param deleteRetentionConfigurationRequest
* @ return Result of the DeleteRetentionConfiguration operation returned by the service .
* @ throws InvalidParameterValueException
* One or more of the specified parameters are invalid . Verify that your parameters are valid and try again .
* @ throws NoSuchRetentionConfigurationException
* You have specified a retention configuration that does not exist .
* @ sample AmazonConfig . DeleteRetentionConfiguration
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / config - 2014-11-12 / DeleteRetentionConfiguration "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DeleteRetentionConfigurationResult deleteRetentionConfiguration ( DeleteRetentionConfigurationRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDeleteRetentionConfiguration ( request ) ; |
public class BSHPrimaryExpression { /** * Our children are a prefix expression and any number of suffixes .
* We don ' t eval ( ) any nodes until the suffixes have had an
* opportunity to work through them . This lets the suffixes decide
* how to interpret an ambiguous name ( e . g . for the . class operation ) . */
private Object eval ( boolean toLHS , CallStack callstack , Interpreter interpreter ) throws EvalError { } } | // We can cache array expressions evaluated during type inference
if ( isArrayExpression && null != cached ) return cached ; Object obj = jjtGetChild ( 0 ) ; int numChildren = jjtGetNumChildren ( ) ; for ( int i = 1 ; i < numChildren ; i ++ ) obj = ( ( BSHPrimarySuffix ) jjtGetChild ( i ) ) . doSuffix ( obj , toLHS , callstack , interpreter ) ; /* If the result is a Node eval ( ) it to an object or LHS
( as determined by toLHS ) */
if ( obj instanceof SimpleNode ) if ( obj instanceof BSHAmbiguousName ) if ( toLHS ) obj = ( ( BSHAmbiguousName ) obj ) . toLHS ( callstack , interpreter ) ; else obj = ( ( BSHAmbiguousName ) obj ) . toObject ( callstack , interpreter ) ; else // Some arbitrary kind of node
if ( toLHS ) // is this right ?
throw new EvalError ( "Can't assign to prefix." , this , callstack ) ; else obj = ( ( SimpleNode ) obj ) . eval ( callstack , interpreter ) ; if ( isMapExpression ) { if ( obj == Primitive . VOID ) throw new EvalError ( "illegal use of undefined variable or 'void' literal" , this , callstack ) ; // we have a valid map expression return an assignable Map . Entry
obj = new LHS ( obj ) ; } if ( isArrayExpression ) cached = obj ; return obj ; |
public class Utils { /** * Generates route list the same way dialog does .
* @ param response
* @ return
* @ throws ParseException */
public static List < RouteHeader > getRouteList ( Response response , HeaderFactory headerFactory ) throws ParseException { } } | // we have record route set , as we are client , this is reversed
final ArrayList < RouteHeader > routeList = new ArrayList < RouteHeader > ( ) ; final ListIterator < ? > rrLit = response . getHeaders ( RecordRouteHeader . NAME ) ; while ( rrLit . hasNext ( ) ) { final RecordRouteHeader rrh = ( RecordRouteHeader ) rrLit . next ( ) ; final RouteHeader rh = headerFactory . createRouteHeader ( rrh . getAddress ( ) ) ; final Iterator < ? > pIt = rrh . getParameterNames ( ) ; while ( pIt . hasNext ( ) ) { final String pName = ( String ) pIt . next ( ) ; rh . setParameter ( pName , rrh . getParameter ( pName ) ) ; } routeList . add ( 0 , rh ) ; } return routeList ; |
public class ICUHumanize { /** * Converts a number to its ordinal as a string .
* < table border = " 0 " cellspacing = " 0 " cellpadding = " 3 " width = " 100 % " >
* < tr >
* < th class = " colFirst " > Input < / th >
* < th class = " colLast " > Output < / th >
* < / tr >
* < tr >
* < td > 1 < / td >
* < td > " 1st " < / td >
* < / tr >
* < tr >
* < td > 2 < / td >
* < td > " 2nd " < / td >
* < / tr >
* < tr >
* < td > 3 < / td >
* < td > " 3rd " < / td >
* < / tr >
* < tr >
* < td > 4 < / td >
* < td > " 4th " < / td >
* < / tr >
* < tr >
* < td > 1002 < / td >
* < td > " 1002nd " < / td >
* < / tr >
* < tr >
* < td > 2012 < / td >
* < td > " 2012th " < / td >
* < / tr >
* < / table >
* @ param value
* Number to be converted
* @ return String representing the number as ordinal */
public static String ordinalize ( final Number value ) { } } | return context . get ( ) . getRuleBasedNumberFormat ( RuleBasedNumberFormat . ORDINAL ) . format ( value ) ; |
public class SecurityHandler { public void setAuthMethod ( String method ) { } } | if ( isStarted ( ) && _authMethod != null && ! _authMethod . equals ( method ) ) throw new IllegalStateException ( "Handler started" ) ; _authMethod = method ; |
public class ProtobufProxy { /** * To generate a protobuf proxy java source code for target class .
* @ param os to generate java source code
* @ param cls target class
* @ param charset charset type
* @ throws IOException in case of any io relative exception . */
public static void dynamicCodeGenerate ( OutputStream os , Class cls , Charset charset ) throws IOException { } } | dynamicCodeGenerate ( os , cls , charset , getCodeGenerator ( cls ) ) ; |
public class PHPMethods { /** * Sorts an array in ascending order and returns an array with indexes of
* the original order .
* @ param < T >
* @ param array
* @ return */
public static < T extends Comparable < T > > Integer [ ] asort ( T [ ] array ) { } } | return _asort ( array , false ) ; |
public class ToSAXHandler { /** * Sets the SAX ContentHandler .
* @ param _ saxHandler The ContentHandler to set */
public void setContentHandler ( ContentHandler _saxHandler ) { } } | this . m_saxHandler = _saxHandler ; if ( m_lexHandler == null && _saxHandler instanceof LexicalHandler ) { // we are not overwriting an existing LexicalHandler , and _ saxHandler
// is also implements LexicalHandler , so lets use it
m_lexHandler = ( LexicalHandler ) _saxHandler ; } |
public class RoleManager { /** * Sets the { @ link net . dv8tion . jda . core . Permission Permissions } of the selected { @ link net . dv8tion . jda . core . entities . Role Role } .
* < p > Permissions may only include already present Permissions for the currently logged in account .
* < br > You are unable to give permissions you don ' t have !
* @ param permissions
* The new permission for the selected { @ link net . dv8tion . jda . core . entities . Role Role }
* @ throws net . dv8tion . jda . core . exceptions . InsufficientPermissionException
* If the currently logged in account does not have permission to apply one of the specified permissions
* @ throws java . lang . IllegalArgumentException
* If any of the provided values is { @ code null }
* @ return RoleManager for chaining convenience
* @ see # setPermissions ( Collection )
* @ see # setPermissions ( long )
* @ see net . dv8tion . jda . core . Permission # getRaw ( net . dv8tion . jda . core . Permission . . . ) Permission . getRaw ( Permission . . . ) */
@ CheckReturnValue public RoleManager setPermissions ( Permission ... permissions ) { } } | Checks . notNull ( permissions , "Permissions" ) ; return setPermissions ( Arrays . asList ( permissions ) ) ; |
public class RoundLcdClockSkin { /** * * * * * * Initialization * * * * * */
@ Override protected void initGraphics ( ) { } } | // Set initial size
if ( Double . compare ( clock . getPrefWidth ( ) , 0.0 ) <= 0 || Double . compare ( clock . getPrefHeight ( ) , 0.0 ) <= 0 || Double . compare ( clock . getWidth ( ) , 0.0 ) <= 0 || Double . compare ( clock . getHeight ( ) , 0.0 ) <= 0 ) { if ( clock . getPrefWidth ( ) > 0 && clock . getPrefHeight ( ) > 0 ) { clock . setPrefSize ( clock . getPrefWidth ( ) , clock . getPrefHeight ( ) ) ; } else { clock . setPrefSize ( PREFERRED_WIDTH , PREFERRED_HEIGHT ) ; } } backgroundCanvas = new Canvas ( PREFERRED_WIDTH , PREFERRED_HEIGHT ) ; backgroundCtx = backgroundCanvas . getGraphicsContext2D ( ) ; foregroundCanvas = new Canvas ( PREFERRED_WIDTH , PREFERRED_HEIGHT ) ; foregroundCtx = foregroundCanvas . getGraphicsContext2D ( ) ; hoursCanvas = new Canvas ( PREFERRED_WIDTH , PREFERRED_HEIGHT ) ; hoursCtx = hoursCanvas . getGraphicsContext2D ( ) ; minutesCanvas = new Canvas ( PREFERRED_WIDTH , PREFERRED_HEIGHT ) ; minutesCtx = minutesCanvas . getGraphicsContext2D ( ) ; secondsCanvas = new Canvas ( PREFERRED_WIDTH , PREFERRED_HEIGHT ) ; secondsCtx = secondsCanvas . getGraphicsContext2D ( ) ; pane = new Pane ( backgroundCanvas , foregroundCanvas , hoursCanvas , minutesCanvas , secondsCanvas ) ; pane . setBorder ( new Border ( new BorderStroke ( clock . getBorderPaint ( ) , BorderStrokeStyle . SOLID , new CornerRadii ( 1024 ) , new BorderWidths ( clock . getBorderWidth ( ) ) ) ) ) ; pane . setBackground ( new Background ( new BackgroundFill ( clock . getBackgroundPaint ( ) , new CornerRadii ( 1024 ) , Insets . EMPTY ) ) ) ; getChildren ( ) . setAll ( pane ) ; |
public class AddTrial { /** * Runs the example .
* @ param adWordsServices the services factory .
* @ param session the session .
* @ param draftId the ID of the draft .
* @ param baseCampaignId the ID of the base campaign .
* @ 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 */
public static void runExample ( AdWordsServicesInterface adWordsServices , AdWordsSession session , long draftId , long baseCampaignId ) throws RemoteException , InterruptedException { } } | // Get the TrialService .
TrialServiceInterface trialService = adWordsServices . get ( session , TrialServiceInterface . class ) ; Trial trial = new Trial ( ) ; trial . setDraftId ( draftId ) ; trial . setBaseCampaignId ( baseCampaignId ) ; trial . setName ( "Test Trial #" + System . currentTimeMillis ( ) ) ; trial . setTrafficSplitPercent ( 50 ) ; trial . setTrafficSplitType ( CampaignTrialTrafficSplitType . RANDOM_QUERY ) ; TrialOperation trialOperation = new TrialOperation ( ) ; trialOperation . setOperator ( Operator . ADD ) ; trialOperation . setOperand ( trial ) ; long trialId = trialService . mutate ( new TrialOperation [ ] { trialOperation } ) . getValue ( 0 ) . getId ( ) ; // Since creating a trial is asynchronous , we have to poll it to wait for it to finish .
Selector trialSelector = new SelectorBuilder ( ) . fields ( TrialField . Id , TrialField . Status , TrialField . BaseCampaignId , TrialField . TrialCampaignId ) . equalsId ( trialId ) . build ( ) ; trial = null ; boolean isPending = true ; int pollAttempts = 0 ; do { long sleepSeconds = ( long ) Math . scalb ( 30d , pollAttempts ) ; System . out . printf ( "Sleeping for %d seconds.%n" , sleepSeconds ) ; Thread . sleep ( sleepSeconds * 1000 ) ; trial = trialService . get ( trialSelector ) . getEntries ( 0 ) ; System . out . printf ( "Trial ID %d has status '%s'.%n" , trial . getId ( ) , trial . getStatus ( ) ) ; pollAttempts ++ ; isPending = TrialStatus . CREATING . equals ( trial . getStatus ( ) ) ; } while ( isPending && pollAttempts < MAX_POLL_ATTEMPTS ) ; if ( TrialStatus . ACTIVE . equals ( trial . getStatus ( ) ) ) { // The trial creation was successful .
System . out . printf ( "Trial created with ID %d and trial campaign ID %d.%n" , trial . getId ( ) , trial . getTrialCampaignId ( ) ) ; } else if ( TrialStatus . CREATION_FAILED . equals ( trial . getStatus ( ) ) ) { // The trial creation failed , and errors can be fetched from the TrialAsyncErrorService .
Selector errorsSelector = new SelectorBuilder ( ) . fields ( TrialAsyncErrorField . TrialId , TrialAsyncErrorField . AsyncError ) . equals ( TrialAsyncErrorField . TrialId , trial . getId ( ) . toString ( ) ) . build ( ) ; TrialAsyncErrorServiceInterface trialAsyncErrorService = adWordsServices . get ( session , TrialAsyncErrorServiceInterface . class ) ; TrialAsyncErrorPage trialAsyncErrorPage = trialAsyncErrorService . get ( errorsSelector ) ; if ( trialAsyncErrorPage . getEntries ( ) == null || trialAsyncErrorPage . getEntries ( ) . length == 0 ) { System . out . printf ( "Could not retrieve errors for trial ID %d for draft ID %d.%n" , trial . getId ( ) , draftId ) ; } else { System . out . printf ( "Could not create trial ID %d for draft ID %d due to the following errors:%n" , trial . getId ( ) , draftId ) ; int i = 0 ; for ( TrialAsyncError error : trialAsyncErrorPage . getEntries ( ) ) { ApiError asyncError = error . getAsyncError ( ) ; System . out . printf ( "Error #%d: errorType='%s', errorString='%s', trigger='%s', fieldPath='%s'%n" , i ++ , asyncError . getApiErrorType ( ) , asyncError . getErrorString ( ) , asyncError . getTrigger ( ) , asyncError . getFieldPath ( ) ) ; } } } else { // Most likely , the trial is still being created . You can continue polling ,
// but we have limited the number of attempts in the example .
System . out . printf ( "Timed out waiting to create trial from draft ID %d with base campaign ID %d.%n" , draftId , baseCampaignId ) ; } |
public class AppServiceEnvironmentsInner { /** * Get properties of a worker pool .
* Get properties of a worker pool .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the App Service Environment .
* @ param workerPoolName Name of the worker pool .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the WorkerPoolResourceInner object if successful . */
public WorkerPoolResourceInner getWorkerPool ( String resourceGroupName , String name , String workerPoolName ) { } } | return getWorkerPoolWithServiceResponseAsync ( resourceGroupName , name , workerPoolName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class LimitedConnectionsFileSystem { /** * Atomically removes the given output stream from the set of currently open output streams ,
* and signals that new stream can now be opened . */
void unregisterOutputStream ( OutStream stream ) { } } | lock . lock ( ) ; try { // only decrement if we actually remove the stream
if ( openOutputStreams . remove ( stream ) ) { numReservedOutputStreams -- ; available . signalAll ( ) ; } } finally { lock . unlock ( ) ; } |
public class Avicenna { /** * Internal method which iterates over fields and methods to find and store
* dependency producers . */
private static void addDependencyFactoryToContainer ( Object dependencyFactory ) { } } | try { Class clazz = dependencyFactory . getClass ( ) ; for ( Field field : ReflectionHelper . getFields ( clazz ) ) { if ( field . isAnnotationPresent ( Dependency . class ) ) { qualifiers . clear ( ) ; for ( Annotation annotation : field . getAnnotations ( ) ) { if ( annotation . annotationType ( ) . isAnnotationPresent ( Qualifier . class ) ) { qualifiers . add ( annotation . annotationType ( ) . getCanonicalName ( ) ) ; } } dependencyContainer . add ( DependencyIdentifier . getDependencyIdentifierForClass ( field , qualifiers ) , new DependencySource ( DependencySource . DependencySourceType . FIELD , field , null , dependencyFactory , field . isAnnotationPresent ( Singleton . class ) ) ) ; } } for ( Method method : clazz . getMethods ( ) ) { if ( method . isAnnotationPresent ( Dependency . class ) ) { qualifiers . clear ( ) ; for ( Annotation annotation : method . getAnnotations ( ) ) { if ( annotation . annotationType ( ) . isAnnotationPresent ( Qualifier . class ) ) { qualifiers . add ( annotation . annotationType ( ) . getCanonicalName ( ) ) ; } } dependencyContainer . add ( DependencyIdentifier . getDependencyIdentifierForClass ( method , qualifiers ) , new DependencySource ( DependencySource . DependencySourceType . METHOD , null , method , dependencyFactory , method . isAnnotationPresent ( Singleton . class ) ) ) ; } } } catch ( Exception e ) { throw new AvicennaRuntimeException ( e ) ; } |
public class Unchecked { /** * Wrap a { @ link CheckedIntFunction } in a { @ link IntFunction } with a custom handler for checked exceptions .
* Example :
* < code > < pre >
* IntStream . of ( 1 , 2 , 3 ) . mapToObj ( Unchecked . intFunction (
* if ( i & lt ; 0)
* throw new Exception ( " Only positive numbers allowed " ) ;
* return " " + i ;
* throw new IllegalStateException ( e ) ;
* < / pre > < / code > */
public static < R > IntFunction < R > intFunction ( CheckedIntFunction < R > function , Consumer < Throwable > handler ) { } } | return t -> { try { return function . apply ( t ) ; } catch ( Throwable e ) { handler . accept ( e ) ; throw new IllegalStateException ( "Exception handler must throw a RuntimeException" , e ) ; } } ; |
public class MutatorImpl { /** * { @ inheritDoc } */
@ Override public < N > Mutator < K > addDeletion ( K key , String cf ) { } } | addDeletion ( key , cf , null , null , keyspace . createClock ( ) ) ; return this ; |
public class Util { /** * Returns the ip address of the local machine .
* If the ' ip ' system property is defined it is returned ,
* otherwise , the local ip address is lookup using the
* < code > InetAddress < / code > class . In case the lookup
* fails , the address 127.0.0.1 is returned .
* @ return local ip address */
public static String getLocalHostAddress ( ) { } } | String ipAddr = CoGProperties . getDefault ( ) . getIPAddress ( ) ; if ( ipAddr == null ) { try { return InetAddress . getLocalHost ( ) . getHostAddress ( ) ; } catch ( UnknownHostException e ) { return "127.0.0.1" ; } } else { return ipAddr ; } |
public class KunderaQuery { /** * Method to skip string literal as per JPA specification . if literal starts is enclose within " ' ' " then skip " ' "
* and include " ' " in case of " ' ' " replace it with " ' " .
* @ param value
* value .
* @ return replaced string in case of string , else will return original value . */
private static Object getValue ( Object value ) { } } | if ( value != null && value . getClass ( ) . isAssignableFrom ( String . class ) ) { return ( ( String ) value ) . replaceAll ( "^'" , "" ) . replaceAll ( "'$" , "" ) . replaceAll ( "''" , "'" ) ; } return value ; |
public class AutoAnnotationProcessor { /** * Issue a compilation error . This method does not throw an exception , since we want to continue
* processing and perhaps report other errors . */
private void reportError ( Element e , String msg , Object ... msgParams ) { } } | String formattedMessage = String . format ( msg , msgParams ) ; processingEnv . getMessager ( ) . printMessage ( Diagnostic . Kind . ERROR , formattedMessage , e ) ; |
public class CircularLossyQueue { /** * Adds a new item
* @ param newVal
* value to push */
public void push ( final T newVal ) { } } | final int index = ( int ) ( m_aCurrentIndex . incrementAndGet ( ) % m_nMaxSize ) ; m_aCircularArray [ index ] . set ( newVal ) ; |
public class TokenRESTService { /** * Returns the credentials associated with the given request , using the
* provided username and password .
* @ param request
* The request to use to derive the credentials .
* @ param username
* The username to associate with the credentials , or null if the
* username should be derived from the request .
* @ param password
* The password to associate with the credentials , or null if the
* password should be derived from the request .
* @ return
* A new Credentials object whose contents have been derived from the
* given request , along with the provided username and password . */
private Credentials getCredentials ( HttpServletRequest request , String username , String password ) { } } | // If no username / password given , try Authorization header
if ( username == null && password == null ) { String authorization = request . getHeader ( "Authorization" ) ; if ( authorization != null && authorization . startsWith ( "Basic " ) ) { try { // Decode base64 authorization
String basicBase64 = authorization . substring ( 6 ) ; String basicCredentials = new String ( BaseEncoding . base64 ( ) . decode ( basicBase64 ) , "UTF-8" ) ; // Pull username / password from auth data
int colon = basicCredentials . indexOf ( ':' ) ; if ( colon != - 1 ) { username = basicCredentials . substring ( 0 , colon ) ; password = basicCredentials . substring ( colon + 1 ) ; } else logger . debug ( "Invalid HTTP Basic \"Authorization\" header received." ) ; } // UTF - 8 support is required by the Java specification
catch ( UnsupportedEncodingException e ) { throw new UnsupportedOperationException ( "Unexpected lack of UTF-8 support." , e ) ; } } } // end Authorization header fallback
// Build credentials
return new Credentials ( username , password , request ) ; |
public class SeekableStreamIndexTaskRunner { /** * Returns true if , given that recordSequenceNumber has already been read and we want to end at endSequenceNumber ,
* there is more left to read . Used in post - read checks to determine if there is anything left to read . */
private boolean isMoreToReadAfterReadingRecord ( final SequenceOffsetType recordSequenceNumber , final SequenceOffsetType endSequenceNumber ) { } } | final int compareNextToEnd = createSequenceNumber ( getNextStartOffset ( recordSequenceNumber ) ) . compareTo ( createSequenceNumber ( endSequenceNumber ) ) ; // Unlike isMoreToReadBeforeReadingRecord , we don ' t care if the end is exclusive or not . If we read it , we ' re done .
return compareNextToEnd < 0 ; |
public class CreateLineItemsWithCustomCriteria { /** * Runs the example .
* @ param adManagerServices the services factory .
* @ param session the session .
* @ param orderId the ID of the order that the line items will belong to .
* @ param customTargetingKeyId1 the key ID for the equality comparison in the first expression
* group .
* @ param customTargetingKeyId2 the key ID for the equality comparison in the second expression
* group .
* @ param customTargetingKeyId3 the key ID for the equality comparison in the third expression
* group .
* @ param customTargetingValueId1 the value ID that must match the first key ID in the first
* expression group .
* @ param customTargetingValueIds2 the value ID that must match the second key ID in the first
* expression group .
* @ param customTargetingValueId3 he value ID that must match the key ID in the second expression
* group .
* @ throws ApiException if the API request failed with one or more service errors .
* @ throws RemoteException if the API request failed due to other errors . */
public static void runExample ( AdManagerServices adManagerServices , AdManagerSession session , long orderId , long customTargetingKeyId1 , long customTargetingKeyId2 , long customTargetingKeyId3 , long customTargetingValueId1 , List < Long > customTargetingValueIds2 , long customTargetingValueId3 ) throws RemoteException { } } | // Get the LineItemService .
LineItemServiceInterface lineItemService = adManagerServices . get ( session , LineItemServiceInterface . class ) ; // Get the NetworkService .
NetworkServiceInterface networkService = adManagerServices . get ( session , NetworkServiceInterface . class ) ; // Get the root ad unit ID used to target the whole site .
String rootAdUnitId = networkService . getCurrentNetwork ( ) . getEffectiveRootAdUnitId ( ) ; // Create inventory targeting .
InventoryTargeting inventoryTargeting = new InventoryTargeting ( ) ; // Create ad unit targeting for the root ad unit ( i . e . the whole network ) .
AdUnitTargeting adUnitTargeting = new AdUnitTargeting ( ) ; adUnitTargeting . setAdUnitId ( rootAdUnitId ) ; adUnitTargeting . setIncludeDescendants ( true ) ; inventoryTargeting . setTargetedAdUnits ( new AdUnitTargeting [ ] { adUnitTargeting } ) ; // Create targeting .
Targeting targeting = new Targeting ( ) ; targeting . setInventoryTargeting ( inventoryTargeting ) ; // Create the expression :
// TARGETING _ KEY _ ID _ 1 = = TARGETING _ VALUE _ ID _ 1
CustomCriteria customCriteria1 = new CustomCriteria ( ) ; customCriteria1 . setKeyId ( customTargetingKeyId1 ) ; customCriteria1 . setOperator ( CustomCriteriaComparisonOperator . IS ) ; customCriteria1 . setValueIds ( new long [ ] { customTargetingValueId1 } ) ; // Create the expression :
// TARGETING _ KEY _ ID _ 2 ! =
// ( TARGETING _ VALUE _ IDS _ 2[0 ] OR TARGETING _ VALUE _ IDS _ 2[1 ] . . . ) )
CustomCriteria customCriteria2 = new CustomCriteria ( ) ; customCriteria2 . setKeyId ( customTargetingKeyId2 ) ; customCriteria2 . setOperator ( CustomCriteriaComparisonOperator . IS_NOT ) ; customCriteria2 . setValueIds ( Longs . toArray ( customTargetingValueIds2 ) ) ; // Create the expression :
// TARGETING _ KEY _ ID _ 3 = TARGETING _ VALUE _ ID _ 3
CustomCriteria customCriteria3 = new CustomCriteria ( ) ; customCriteria3 . setKeyId ( customTargetingKeyId3 ) ; customCriteria3 . setOperator ( CustomCriteriaComparisonOperator . IS ) ; customCriteria3 . setValueIds ( new long [ ] { customTargetingValueId3 } ) ; // Create the custom criteria set that will resemble :
// ( TARGETING _ KEY _ ID _ 1 = = TARGETING _ VALUE _ ID _ 1 AND
// ( TARGETING _ KEY _ ID _ 2 ! =
// ( TARGETING _ VALUE _ IDS _ 2[0 ] OR TARGETING _ VALUE _ IDS _ 2[1 ] . . . ) )
// OR
// ( TARGETING _ KEY _ ID _ 3 = TARGETING _ VALUE _ ID _ 3)
CustomCriteriaSet topCustomCriteriaSet = new CustomCriteriaSet ( ) ; topCustomCriteriaSet . setLogicalOperator ( CustomCriteriaSetLogicalOperator . OR ) ; // Create the sub expression :
// ( TARGETING _ KEY _ ID _ 1 = = TARGETING _ VALUE _ ID _ 1 AND
// ( TARGETING _ KEY _ ID _ 2 ! =
// ( TARGETING _ VALUE _ IDS _ 2[0 ] OR TARGETING _ VALUE _ IDS _ 2[1 ] . . . ) )
CustomCriteriaSet subCustomCriteriaSet = new CustomCriteriaSet ( ) ; subCustomCriteriaSet . setLogicalOperator ( CustomCriteriaSetLogicalOperator . AND ) ; subCustomCriteriaSet . setChildren ( new CustomCriteriaNode [ ] { customCriteria1 , customCriteria2 } ) ; // Combine the expression
// ( TARGETING _ KEY _ ID _ 3 = TARGETING _ VALUE _ ID _ 3 ) with
// subCustomCriteriaSet .
topCustomCriteriaSet . setChildren ( new CustomCriteriaNode [ ] { subCustomCriteriaSet , customCriteria3 } ) ; // Set the custom targeting .
targeting . setCustomTargeting ( topCustomCriteriaSet ) ; // Create a line item .
LineItem lineItem = new LineItem ( ) ; lineItem . setName ( "Line item #" + new Random ( ) . nextInt ( Integer . MAX_VALUE ) ) ; lineItem . setOrderId ( orderId ) ; lineItem . setTargeting ( targeting ) ; // Allow the line item to be booked even if there is not enough inventory .
lineItem . setAllowOverbook ( true ) ; // Set the line item type to STANDARD and priority to High . In this case ,
// 8 would be Normal , and 10 would be Low .
lineItem . setLineItemType ( LineItemType . STANDARD ) ; lineItem . setPriority ( 6 ) ; // Set the creative rotation type to even .
lineItem . setCreativeRotationType ( CreativeRotationType . EVEN ) ; // Create creative placeholder size .
Size size = new Size ( ) ; size . setWidth ( 300 ) ; size . setHeight ( 250 ) ; size . setIsAspectRatio ( false ) ; // Create the creative placeholder .
CreativePlaceholder creativePlaceholder = new CreativePlaceholder ( ) ; creativePlaceholder . setSize ( size ) ; // Set the size of creatives that can be associated with this line item .
lineItem . setCreativePlaceholders ( new CreativePlaceholder [ ] { creativePlaceholder } ) ; // Set the length of the line item to run .
lineItem . setStartDateTimeType ( StartDateTimeType . IMMEDIATELY ) ; lineItem . setEndDateTime ( DateTimes . toDateTime ( Instant . now ( ) . plus ( Duration . standardDays ( 30L ) ) , "America/New_York" ) ) ; // Set the cost per unit to $ 2.
lineItem . setCostType ( CostType . CPM ) ; lineItem . setCostPerUnit ( new Money ( "USD" , 2000000L ) ) ; // Set the number of units bought to 500,000 so that the budget is
// $ 1,000.
Goal goal = new Goal ( ) ; goal . setUnits ( 500000L ) ; goal . setUnitType ( UnitType . IMPRESSIONS ) ; goal . setGoalType ( GoalType . LIFETIME ) ; lineItem . setPrimaryGoal ( goal ) ; // Create the line item on the server .
LineItem [ ] lineItems = lineItemService . createLineItems ( new LineItem [ ] { lineItem } ) ; for ( LineItem createdLineItem : lineItems ) { System . out . printf ( "A line item with ID %d and name '%s' was created.%n" , createdLineItem . getId ( ) , createdLineItem . getName ( ) ) ; } |
public class StringUtilities { /** * Gets the last index of a character ignoring characters that have been escaped
* @ param input The string to be searched
* @ param delim The character to be found
* @ return The index of the found character or - 1 if the character wasn ' t found */
public static int lastIndexOf ( final String input , final char delim ) { } } | return input == null ? - 1 : lastIndexOf ( input , delim , input . length ( ) ) ; |
public class DictTerm { /** * getter for DictCanon - gets canonical form
* @ generated
* @ return value of the feature */
public String getDictCanon ( ) { } } | if ( DictTerm_Type . featOkTst && ( ( DictTerm_Type ) jcasType ) . casFeat_DictCanon == null ) jcasType . jcas . throwFeatMissing ( "DictCanon" , "org.apache.uima.conceptMapper.DictTerm" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( DictTerm_Type ) jcasType ) . casFeatCode_DictCanon ) ; |
public class FlowTypeCheck { /** * From an arbitrary type , extract the reference type it represents which is
* either readable or writeable depending on the context . */
public SemanticType . Reference extractReferenceType ( SemanticType type , Environment environment , ReadWriteTypeExtractor . Combinator < SemanticType . Reference > combinator , SyntacticItem item ) { } } | if ( type != null ) { SemanticType . Reference refT = rwTypeExtractor . apply ( type , environment , combinator ) ; if ( refT == null ) { syntaxError ( item , EXPECTED_REFERENCE ) ; } else { return refT ; } } return null ; |
public class base_resource { /** * Use this method to perform an Unset operation on netscaler resource .
* @ param service nitro _ service object .
* @ param args Array of args that are to be unset .
* @ return status of the operation performed .
* @ throws Exception Nitro exception is thrown . */
protected base_response unset_resource ( nitro_service service , String args [ ] ) throws Exception { } } | if ( ! service . isLogin ( ) && ! get_object_type ( ) . equals ( "login" ) ) service . login ( ) ; options option = new options ( ) ; option . set_action ( "unset" ) ; base_response response = unset_request ( service , option , args ) ; return response ; |
public class SpringSecurityXmAuthenticationContext { /** * { @ inheritDoc } */
@ Override public boolean isFullyAuthenticated ( ) { } } | return getAuthentication ( ) . filter ( auth -> ! ANONYMOUS_AUTH_CLASS . isAssignableFrom ( auth . getClass ( ) ) && ! REMEMBER_ME_AUTH_CLASS . isAssignableFrom ( auth . getClass ( ) ) ) . isPresent ( ) ; |
public class InlineMediaSource { /** * Get implementation of inline media item
* @ param ntResourceResource nt : resource node
* @ param media Media metadata
* @ param fileName File name
* @ return Inline media item instance */
private Asset getInlineAsset ( Resource ntResourceResource , Media media , String fileName ) { } } | return new InlineAsset ( ntResourceResource , media , fileName , adaptable ) ; |
public class XMLCaster { /** * casts a value to a XML Element Array
* @ param doc XML Document
* @ param o Object to cast
* @ return XML Comment Array
* @ throws PageException */
public static Element [ ] toElementArray ( Document doc , Object o ) throws PageException { } } | // Node [ ]
if ( o instanceof Node [ ] ) { Node [ ] nodes = ( Node [ ] ) o ; if ( _isAllOfSameType ( nodes , Node . ELEMENT_NODE ) ) return ( Element [ ] ) nodes ; Element [ ] elements = new Element [ nodes . length ] ; for ( int i = 0 ; i < nodes . length ; i ++ ) { elements [ i ] = toElement ( doc , nodes [ i ] ) ; } return elements ; } // Collection
else if ( o instanceof Collection ) { Collection coll = ( Collection ) o ; Iterator < Object > it = coll . valueIterator ( ) ; List < Element > elements = new ArrayList < Element > ( ) ; while ( it . hasNext ( ) ) { elements . add ( toElement ( doc , it . next ( ) ) ) ; } return elements . toArray ( new Element [ elements . size ( ) ] ) ; } // Node Map and List
Node [ ] nodes = _toNodeArray ( doc , o ) ; if ( nodes != null ) return toElementArray ( doc , nodes ) ; // Single Text Node
try { return new Element [ ] { toElement ( doc , o ) } ; } catch ( ExpressionException e ) { throw new XMLException ( "can't cast Object of type " + Caster . toClassName ( o ) + " to a XML Element Array" ) ; } |
public class SibDiagnosticModule { /** * Generates a string representation of the object for FFDC .
* If the object is an Object Array , Collection or Map the
* elements are inspected individually up to a maximum of
* multiple _ object _ count _ to _ ffdc
* @ param obj
* Object to generate a string representation of
* @ return
* The string representation of the object */
public final String toFFDCString ( Object obj ) { } } | if ( obj instanceof Map ) { return toFFDCString ( ( Map ) obj ) ; } else if ( obj instanceof Collection ) { return toFFDCString ( ( Collection ) obj ) ; } else if ( obj instanceof Object [ ] ) { return toFFDCString ( ( Object [ ] ) obj ) ; } return toFFDCStringSingleObject ( obj ) ; |
public class AppServicePlansInner { /** * Get a Virtual Network gateway .
* Get a Virtual Network gateway .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the App Service plan .
* @ param vnetName Name of the Virtual Network .
* @ param gatewayName Name of the gateway . Only the ' primary ' gateway is supported .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the VnetGatewayInner object */
public Observable < VnetGatewayInner > getVnetGatewayAsync ( String resourceGroupName , String name , String vnetName , String gatewayName ) { } } | return getVnetGatewayWithServiceResponseAsync ( resourceGroupName , name , vnetName , gatewayName ) . map ( new Func1 < ServiceResponse < VnetGatewayInner > , VnetGatewayInner > ( ) { @ Override public VnetGatewayInner call ( ServiceResponse < VnetGatewayInner > response ) { return response . body ( ) ; } } ) ; |
public class InvalidationAuditDaemon { /** * This ensures that the specified ExternalCacheFragment has not
* been invalidated .
* @ param externalCacheFragment The unfiltered ExternalCacheFragment .
* @ return The filtered ExternalCacheFragment . */
public ExternalInvalidation filterExternalCacheFragment ( String cacheName , ExternalInvalidation externalCacheFragment ) { } } | InvalidationTableList invalidationTableList = getInvalidationTableList ( cacheName ) ; try { invalidationTableList . readWriteLock . readLock ( ) . lock ( ) ; return internalFilterExternalCacheFragment ( cacheName , invalidationTableList , externalCacheFragment ) ; } finally { invalidationTableList . readWriteLock . readLock ( ) . unlock ( ) ; } |
public class EasterRule { /** * Return true if Easter occurs between the two dates given */
@ Override public boolean isBetween ( Date start , Date end ) { } } | return firstBetween ( start , end ) != null ; // TODO : optimize ? |
public class WebUtils { /** * The Grails dispatch servlet maps URIs like / app / grails / example / index . dispatch . This method infers the
* controller URI for the dispatch URI so that / app / grails / example / index . dispatch becomes / app / example / index
* @ param request The request */
public static String getRequestURIForGrailsDispatchURI ( HttpServletRequest request ) { } } | UrlPathHelper pathHelper = new UrlPathHelper ( ) ; if ( request . getRequestURI ( ) . endsWith ( GRAILS_DISPATCH_EXTENSION ) ) { String path = pathHelper . getPathWithinApplication ( request ) ; if ( path . startsWith ( GRAILS_SERVLET_PATH ) ) { path = path . substring ( GRAILS_SERVLET_PATH . length ( ) , path . length ( ) ) ; } return path . substring ( 0 , path . length ( ) - GRAILS_DISPATCH_EXTENSION . length ( ) ) ; } return pathHelper . getPathWithinApplication ( request ) ; |
public class FileOutputCommitter { /** * Did this task write any files in the work directory ?
* @ param context the task ' s context */
@ Override public boolean needsTaskCommit ( TaskAttemptContext context ) throws IOException { } } | return workPath != null && outputFileSystem . exists ( workPath ) ; |
public class KmeansCalculator { /** * 対象点と学習モデルを指定し 、 どのクラスタに判別されるかを取得する 。
* @ param targetPoint 判定対象ポイント
* @ param dataSet 学習モデル
* @ return どのクラスタに判別されるかのインデックス */
public static KmeansResult classify ( KmeansPoint targetPoint , KmeansDataSet dataSet ) { } } | // KMeanクラスタリング結果を算出
int nearestCentroidIndex = 0 ; Double minDistance = Double . MAX_VALUE ; double [ ] currentCentroid = null ; Double currentDistance ; for ( int index = 0 ; index < dataSet . getCentroids ( ) . length ; index ++ ) { currentCentroid = dataSet . getCentroids ( ) [ index ] ; if ( currentCentroid != null ) { currentDistance = MathUtils . distance ( targetPoint . getDataPoint ( ) , currentCentroid ) ; if ( currentDistance < minDistance ) { minDistance = currentDistance ; nearestCentroidIndex = index ; } } } currentCentroid = dataSet . getCentroids ( ) [ nearestCentroidIndex ] ; KmeansResult result = new KmeansResult ( ) ; result . setDataPoint ( targetPoint . getDataPoint ( ) ) ; result . setCentroidIndex ( nearestCentroidIndex ) ; result . setCentroid ( currentCentroid ) ; result . setDistance ( minDistance ) ; return result ; |
public class HostMessenger { /** * Block on this call until the number of ready hosts is
* equal to the number of expected hosts . */
public void waitForAllHostsToBeReady ( int expectedHosts ) { } } | try { m_zk . create ( CoreZK . readyhosts_host , null , Ids . OPEN_ACL_UNSAFE , CreateMode . EPHEMERAL_SEQUENTIAL ) ; while ( true ) { ZKUtil . FutureWatcher fw = new ZKUtil . FutureWatcher ( ) ; int readyHosts = m_zk . getChildren ( CoreZK . readyhosts , fw ) . size ( ) ; if ( readyHosts == expectedHosts ) { break ; } fw . get ( ) ; } } catch ( KeeperException | InterruptedException e ) { org . voltdb . VoltDB . crashLocalVoltDB ( "Error waiting for hosts to be ready" , false , e ) ; } |
public class ServerEnvironment { /** * Get a File from configuration .
* @ param path the file path
* @ return the CanonicalFile form for the given name . */
private File getFileFromPath ( final String path ) { } } | File result = ( path != null ) ? new File ( path ) : null ; // AS7-1752 see if a non - existent relative path exists relative to the home dir
if ( result != null && homeDir != null && ! result . exists ( ) && ! result . isAbsolute ( ) ) { File relative = new File ( homeDir , path ) ; if ( relative . exists ( ) ) { result = relative ; } } return result ; |
public class SuperCsvCellProcessorException { /** * Assembles the exception message when the value received by a CellProcessor isn ' t of the correct type .
* @ param expectedType
* the expected type
* @ param actualValue
* the value received by the CellProcessor
* @ return the message
* @ throws NullPointerException
* if expectedType is null */
private static String getUnexpectedTypeMessage ( final Class < ? > expectedType , final Object actualValue ) { } } | if ( expectedType == null ) { throw new NullPointerException ( "expectedType should not be null" ) ; } String expectedClassName = expectedType . getName ( ) ; String actualClassName = ( actualValue != null ) ? actualValue . getClass ( ) . getName ( ) : "null" ; return String . format ( "the input value should be of type %s but is %s" , expectedClassName , actualClassName ) ; |
public class StackdriverWriter { /** * Sets up the object and makes sure all the required parameters are available < br / >
* Minimally a Stackdriver API key must be provided using the token setting */
@ Override public void validateSetup ( Server server , Query query ) throws ValidationException { } } | logger . info ( "Starting Stackdriver writer connected to '{}', proxy {} ..." , gatewayUrl , proxy ) ; |
public class SessionBeanTypeImpl { /** * If not already created , a new < code > after - completion - method < / code > element with the given value will be created .
* Otherwise , the existing < code > after - completion - method < / code > element will be returned .
* @ return a new or existing instance of < code > NamedMethodType < SessionBeanType < T > > < / code > */
public NamedMethodType < SessionBeanType < T > > getOrCreateAfterCompletionMethod ( ) { } } | Node node = childNode . getOrCreate ( "after-completion-method" ) ; NamedMethodType < SessionBeanType < T > > afterCompletionMethod = new NamedMethodTypeImpl < SessionBeanType < T > > ( this , "after-completion-method" , childNode , node ) ; return afterCompletionMethod ; |
public class LinkedList { /** * Synchronized . Remove an Entry from the list .
* @ param removePointer The Entry to be removed
* @ return The Entry which was removed */
public Entry remove ( Entry removePointer ) { } } | if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "remove" , new Object [ ] { removePointer } ) ; Entry removedEntry = null ; // check that the entry to be removed is not null and is in this list
if ( contains ( removePointer ) ) { // call the internal unsynchronized remove method on the entry to be removed .
removedEntry = removePointer . remove ( ) ; } else // if the entry is not found in this list , throw a runtime exception
{ SIErrorException e = new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.processor.utils.linkedlist.LinkedList" , "1:291:1.3" } , null ) ) ; FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.utils.linkedlist.LinkedList.remove" , "1:297:1.3" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.processor.utils.linkedlist.LinkedList" , "1:304:1.3" } ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "remove" , e ) ; throw e ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "remove" , removedEntry ) ; // return the object which was removed
return removedEntry ; |
public class ApiOvhMe { /** * Enable this SMS account
* REST : POST / me / accessRestriction / sms / { id } / enable
* @ param code [ required ] SMS code send by a cellphone
* @ param id [ required ] The Id of the restriction */
public void accessRestriction_sms_id_enable_POST ( Long id , String code ) throws IOException { } } | String qPath = "/me/accessRestriction/sms/{id}/enable" ; StringBuilder sb = path ( qPath , id ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "code" , code ) ; exec ( qPath , "POST" , sb . toString ( ) , o ) ; |
public class DateCellEditor { /** * of this method so that everything gets cleaned up . */
@ Override public boolean stopCellEditing ( ) { } } | JFormattedTextField ftf = ( JFormattedTextField ) getComponent ( ) ; if ( ftf . isEditValid ( ) ) { try { ftf . commitEdit ( ) ; } catch ( java . text . ParseException ex ) { } } else { // text is invalid
Toolkit . getDefaultToolkit ( ) . beep ( ) ; textField . selectAll ( ) ; return false ; // don ' t let the editor go away
} return super . stopCellEditing ( ) ; |
public class CorpusConfig { /** * Returns a configuration from the underlying property object .
* @ param configName The name of the configuration .
* @ param def the default value , if no config is found .
* @ return Can be null if the config name does not exists . */
public String getConfig ( String configName , String def ) { } } | if ( config != null ) { return config . getProperty ( configName , def ) ; } else { return def ; } |
public class DeterministicScheduler { /** * Runs the next command scheduled to be executed immediately . */
public void runNextPendingCommand ( ) { } } | ScheduledTask < ? > scheduledTask = deltaQueue . pop ( ) ; scheduledTask . run ( ) ; if ( ! scheduledTask . isCancelled ( ) && scheduledTask . repeats ( ) ) { deltaQueue . add ( scheduledTask . repeatDelay , scheduledTask ) ; } |
public class WurflCapabilityServiceImpl { /** * init will properly initialize this service . this would look for wurfl files
* and instantiate a wurfl holder */
public void init ( ) { } } | // before running init check to see if attributes has been injected / set
if ( wurflDirPath == null ) throw new IllegalStateException ( "wurflDirPath not properly set" ) ; // look for wurfl file and patches
File wurflDir = new File ( wurflDirPath ) ; // if file does not exists , it might be relative to the servlet
if ( ! wurflDir . exists ( ) && servletContext != null ) wurflDir = new File ( servletContext . getRealPath ( wurflDirPath ) ) ; // check again
if ( ! wurflDir . exists ( ) ) throw new IllegalArgumentException ( "wurflDirPath " + wurflDir . getAbsolutePath ( ) + " does not exists" ) ; if ( ! wurflDir . isDirectory ( ) ) throw new IllegalArgumentException ( "wurflDirPath " + wurflDir . getAbsolutePath ( ) + " is not a directory" ) ; ArrayList < File > patchFiles = new ArrayList < File > ( ) ; logger . info ( "search for wurfl file and patches on: " + wurflDir . getAbsolutePath ( ) ) ; for ( String filePath : wurflDir . list ( ) ) { File file = new File ( wurflDir . getAbsoluteFile ( ) + "/" + filePath ) ; if ( WURFL_FILENAME . equals ( file . getName ( ) ) ) { wurflFile = file ; logger . debug ( "wurfl file: " + wurflFile . getAbsolutePath ( ) ) ; } else if ( file . getName ( ) . endsWith ( ".xml" ) ) { patchFiles . add ( file ) ; logger . debug ( "wurfl patch file: " + file . getAbsolutePath ( ) ) ; } } this . wurflPatchFiles = patchFiles . toArray ( new File [ ] { } ) ; // initialize wurfl holder
this . wurflHolder = new CustomWURFLHolder ( this . wurflFile , this . wurflPatchFiles ) ; startWatchingFiles ( ) ; this . statusInfo = getNewStatusInfo ( "" ) ; |
public class HtmlReport { /** * each report HTML file is { methodQualifiedParentPath } / { methodSimpleName } . html */
public void generate ( List < File > reportInputDataDirs , File reportOutputDir ) throws IllegalDataStructureException , IllegalTestScriptException { } } | deleteDirIfExists ( reportOutputDir ) ; // delete previous execution output
File htmlExternalResRootDir = CommonPath . htmlExternalResourceRootDir ( reportOutputDir ) ; SrcTree srcTree = generateSrcTree ( reportInputDataDirs ) ; List < RunResults > runResultsList = generateRunResultList ( reportInputDataDirs , srcTree ) ; // generate src - tree - yaml . js
VelocityContext srcTreeContext = new VelocityContext ( ) ; // don ' t need HTML encode
String srcTreeYamlStr = YamlUtils . dumpToString ( srcTree . toYamlObject ( ) ) ; srcTreeContext . put ( "yamlStr" , srcTreeYamlStr ) ; File srcTreeYamlJsFile = new File ( htmlExternalResRootDir , "js/report/src-tree-yaml.js" ) ; generateVelocityOutput ( srcTreeContext , "/template/src-tree-yaml.js.vm" , srcTreeYamlJsFile ) ; // set up HTML external files
// TODO all file paths are hard coded . this is very poor logic . .
extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/common-utils.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/capture-style.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/yaml/js-yaml.min.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/yaml/yaml-utils.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/code/code.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/code/string-code.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/code/method-argument.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/code/unknown-code.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/code/sub-method-invoke.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/code/local-var.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/code/field.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/code/var-assign.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/code/class-instance.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/code/test-step.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/code/test-step-label.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/code/code-line.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/test-class.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/page-class.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/test-field.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/test-field-table.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/test-method.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/test-method-table.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/test-class-table.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/srctree/src-tree.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/share/testdoc-resolver.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "css/fonts/flexslider-icon.eot" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "css/fonts/flexslider-icon.svg" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "css/fonts/flexslider-icon.ttf" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "css/fonts/flexslider-icon.woff" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "css/images/bx_loader.gif" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "css/images/controls.png" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "css/jquery.bxslider.css" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "css/jquery.treetable.css" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "css/jquery.treetable.theme.default.css" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "css/perfect-scrollbar.min.css" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "css/report.css" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "images/noImage.png" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/report/jquery-1.11.1.min.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/report/jquery.bxslider.min.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/report/jquery.treetable.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/report/perfect-scrollbar.min.js" ) ; extractHtmlExternalResFromThisJar ( htmlExternalResRootDir , "js/report/report.js" ) ; // copy screen captures to reportOutputDir
// TODO copying screen capture may be slow action
File htmlReportCaptureRootDir = CommonPath . htmlReportCaptureRootDir ( reportOutputDir ) ; for ( File reportInputDataDir : reportInputDataDirs ) { File inputCaptureRootDir = CommonPath . inputCaptureRootDir ( reportInputDataDir ) ; try { if ( inputCaptureRootDir . exists ( ) ) { // assume runResults for each reportInputDataDir has different root method run results
// and the capture files are not overwritten .
FileUtils . copyDirectory ( inputCaptureRootDir , htmlReportCaptureRootDir ) ; } } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } List < TestMethod > testMethods = srcTree . getRootMethodTable ( ) . getTestMethods ( ) ; File reportMainDir = CommonPath . htmlReportMainFile ( reportOutputDir ) . getParentFile ( ) ; List < ReportMethodLink > reportLinks = new ArrayList < > ( testMethods . size ( ) ) ; // generate each method report
for ( TestMethod rootMethod : testMethods ) { TestMethod method = rootMethod ; // use encoded test class name to avoid various possible file name encoding problem
// TODO use java . nio . charset . StandardCharsets
File methodReportParentDir = new File ( CommonPath . methodHtmlReportRootDir ( reportOutputDir ) , CommonUtils . encodeToSafeAsciiFileNameString ( method . getTestClass ( ) . getQualifiedName ( ) , StandardCharsets . UTF_8 ) ) ; methodReportParentDir . mkdirs ( ) ; VelocityContext methodContext = new VelocityContext ( ) ; methodContext . put ( "number" , new NumberTool ( ) ) ; methodContext . put ( "math" , new MathTool ( ) ) ; if ( rootMethod . getTestDoc ( ) == null ) { escapePut ( methodContext , "title" , rootMethod . getSimpleName ( ) ) ; } else { escapePut ( methodContext , "title" , rootMethod . getTestDoc ( ) ) ; } String externalResourceRootDir = CommonUtils . relativize ( CommonPath . htmlExternalResourceRootDir ( reportOutputDir ) , methodReportParentDir ) . getPath ( ) ; // URL separator is always slash regardless of OS type
escapePut ( methodContext , "externalResourceRootDir" , FilenameUtils . separatorsToUnix ( externalResourceRootDir ) ) ; if ( ! ( rootMethod instanceof TestMethod ) ) { throw new RuntimeException ( "not supported yet: " + rootMethod ) ; } escapePut ( methodContext , "className" , method . getTestClass ( ) . getQualifiedName ( ) ) ; escapePut ( methodContext , "classTestDoc" , method . getTestClass ( ) . getTestDoc ( ) ) ; escapePut ( methodContext , "methodName" , rootMethod . getSimpleName ( ) ) ; escapePut ( methodContext , "methodTestDoc" , rootMethod . getTestDoc ( ) ) ; escapePut ( methodContext , "timeUnit" , SysMessages . get ( SysMessages . REPORT_TIME_UNIT ) ) ; escapePut ( methodContext , "msgShowCode" , SysMessages . get ( SysMessages . REPORT_SHOW_CODE ) ) ; escapePut ( methodContext , "msgHideCode" , SysMessages . get ( SysMessages . REPORT_HIDE_CODE ) ) ; // TODO js logic should construct message according to the user locale
// without any information passed from the java logic
escapePut ( methodContext , "codeLineWithoutTestDoc" , SysMessages . get ( SysMessages . CODE_LINE_WITHOUT_TEST_DOC ) ) ; escapePut ( methodContext , "jsLocalVar" , SysMessages . get ( SysMessages . JS_LOCAL_VAR ) ) ; escapePut ( methodContext , "jsVarAssign" , SysMessages . get ( SysMessages . JS_VAR_ASSIGN ) ) ; RootMethodRunResult runResult = null ; File inputCaptureRootDir = null ; for ( int i = 0 ; i < runResultsList . size ( ) ; i ++ ) { runResult = runResultsList . get ( i ) . getRunResultByRootMethod ( rootMethod ) ; if ( runResult != null ) { inputCaptureRootDir = CommonPath . inputCaptureRootDir ( reportInputDataDirs . get ( i ) ) ; escapePut ( methodContext , "executionTime" , Integer . toString ( runResult . getExecutionTime ( ) ) ) ; break ; // assume results for each runResults are for different root method
} } boolean executed = ( runResult != null ) ; RunFailure runFailure = getRunFailure ( runResult ) ; if ( runFailure == null ) { escapePut ( methodContext , "errMsg" , null ) ; escapePut ( methodContext , "errLineTtId" , "" ) ; } else { escapePut ( methodContext , "errMsg" , runFailure . getMessage ( ) . trim ( ) ) ; escapePut ( methodContext , "errLineTtId" , generateTtId ( runFailure . getStackLines ( ) ) ) ; } List < ReportCodeLine > reportCodeBody = generateReportCodeBody ( rootMethod , runFailure , executed ) ; methodContext . put ( "codeBody" , reportCodeBody ) ; List < LineScreenCapture > lineScreenCaptures ; if ( runResult == null ) { lineScreenCaptures = new ArrayList < > ( 0 ) ; } else { lineScreenCaptures = runResult . getLineScreenCaptures ( ) ; // TODO execution - time tag is used in HTML report now ,
// but should use data - execution - time tag
addExecutionTimeToCodeBody ( lineScreenCaptures , reportCodeBody ) ; } addLineScreenCaptureForErrorEachStackLine ( lineScreenCaptures , runFailure ) ; List < ReportScreenCapture > captures = generateReportScreenCaptures ( lineScreenCaptures , inputCaptureRootDir , reportOutputDir , methodReportParentDir ) ; methodContext . put ( "captures" , captures ) ; // use encoded method name to avoid various possible file name encoding problem
// and to escape invalid file name character ( Method name may contain such characters
// if method is Groovy method , for example ) .
File methodReportFile = new File ( methodReportParentDir , CommonUtils . encodeToSafeAsciiFileNameString ( rootMethod . getSimpleName ( ) , StandardCharsets . UTF_8 ) + ".html" ) ; generateVelocityOutput ( methodContext , "/template/report.html.vm" , methodReportFile ) ; // set reportLinks data
ReportMethodLink reportLink = new ReportMethodLink ( ) ; reportLink . setTitle ( method . getQualifiedName ( ) ) ; String reportLinkPath = CommonUtils . relativize ( methodReportFile , reportMainDir ) . getPath ( ) ; // URL separator is always slash regardless of OS type
reportLink . setPath ( FilenameUtils . separatorsToUnix ( reportLinkPath ) ) ; reportLinks . add ( reportLink ) ; } // TODO HTML encode all codeBody , captures , reportLinks values
// generate main index . html report
VelocityContext mainContext = new VelocityContext ( ) ; mainContext . put ( "reportLinks" , reportLinks ) ; generateVelocityOutput ( mainContext , "/template/index.html.vm" , CommonPath . htmlReportMainFile ( reportOutputDir ) ) ; |
public class SymmetricCrypto { /** * 解密为字符串
* @ param bytes 被解密的bytes
* @ param charset 解密后的charset
* @ return 解密后的String */
public String decryptStr ( byte [ ] bytes , Charset charset ) { } } | return StrUtil . str ( decrypt ( bytes ) , charset ) ; |
public class FwWebDirection { public void directMessage ( Consumer < List < String > > appSetupper , String ... commonNames ) { } } | assertArgumentNotNull ( "appSetupper" , appSetupper ) ; assertArgumentNotNull ( "commonNames" , commonNames ) ; final List < String > nameList = new ArrayList < String > ( 4 ) ; appSetupper . accept ( nameList ) ; nameList . addAll ( Arrays . asList ( commonNames ) ) ; appMessageName = nameList . remove ( 0 ) ; getExtendsMessageNameList ( ) . addAll ( nameList ) ; |
public class JavaScriptEscapeUtil { /** * Perform an unescape operation based on a Reader , writing the results to a Writer .
* Note this reader is going to be read char - by - char , so some kind of buffering might be appropriate if this
* is an inconvenience for the specific Reader implementation . */
static void unescape ( final Reader reader , final Writer writer ) throws IOException { } } | if ( reader == null ) { return ; } int escapei = 0 ; final char [ ] escapes = new char [ 4 ] ; int c1 , c2 , ce ; // c1 : current char , c2 : next char , ce : current escape char
c2 = reader . read ( ) ; while ( c2 >= 0 ) { c1 = c2 ; c2 = reader . read ( ) ; escapei = 0 ; /* * Check the need for an unescape operation at this point */
if ( c1 != ESCAPE_PREFIX || c2 < 0 ) { writer . write ( c1 ) ; continue ; } int codepoint = - 1 ; if ( c1 == ESCAPE_PREFIX ) { switch ( c2 ) { case 'b' : codepoint = 0x08 ; c1 = c2 ; c2 = reader . read ( ) ; break ; case 't' : codepoint = 0x09 ; c1 = c2 ; c2 = reader . read ( ) ; break ; case 'n' : codepoint = 0x0A ; c1 = c2 ; c2 = reader . read ( ) ; break ; case 'v' : codepoint = 0x0B ; c1 = c2 ; c2 = reader . read ( ) ; break ; case 'f' : codepoint = 0x0C ; c1 = c2 ; c2 = reader . read ( ) ; break ; case 'r' : codepoint = 0x0D ; c1 = c2 ; c2 = reader . read ( ) ; break ; case '"' : codepoint = 0x22 ; c1 = c2 ; c2 = reader . read ( ) ; break ; case '\'' : codepoint = 0x27 ; c1 = c2 ; c2 = reader . read ( ) ; break ; case '\\' : codepoint = 0x5C ; c1 = c2 ; c2 = reader . read ( ) ; break ; case '/' : codepoint = 0x2F ; c1 = c2 ; c2 = reader . read ( ) ; break ; // line feed . When escaped , this is a line continuator
case '\n' : codepoint = - 2 ; c1 = c2 ; c2 = reader . read ( ) ; break ; } if ( codepoint == - 1 ) { if ( c2 == ESCAPE_XHEXA_PREFIX2 ) { // This can be a xhexa escape , we need exactly two more characters
escapei = 0 ; ce = reader . read ( ) ; while ( ce >= 0 && escapei < 2 ) { if ( ! ( ( ce >= '0' && ce <= '9' ) || ( ce >= 'A' && ce <= 'F' ) || ( ce >= 'a' && ce <= 'f' ) ) ) { break ; } escapes [ escapei ] = ( char ) ce ; ce = reader . read ( ) ; escapei ++ ; } if ( escapei < 2 ) { // We weren ' t able to consume the required four hexa chars , leave it as slash + ' u ' , which
// is invalid , and let the corresponding JavaScript parser fail .
writer . write ( c1 ) ; writer . write ( c2 ) ; for ( int i = 0 ; i < escapei ; i ++ ) { c1 = c2 ; c2 = escapes [ i ] ; writer . write ( c2 ) ; } c1 = c2 ; c2 = ce ; continue ; } c1 = escapes [ 3 ] ; c2 = ce ; codepoint = parseIntFromReference ( escapes , 0 , 2 , 16 ) ; escapei = 0 ; // Don ' t continue here , just let the unescape code below do its job
} else if ( c2 == ESCAPE_UHEXA_PREFIX2 ) { // This can be a uhexa escape , we need exactly four more characters
escapei = 0 ; ce = reader . read ( ) ; while ( ce >= 0 && escapei < 4 ) { if ( ! ( ( ce >= '0' && ce <= '9' ) || ( ce >= 'A' && ce <= 'F' ) || ( ce >= 'a' && ce <= 'f' ) ) ) { break ; } escapes [ escapei ] = ( char ) ce ; ce = reader . read ( ) ; escapei ++ ; } if ( escapei < 4 ) { // We weren ' t able to consume the required four hexa chars , leave it as slash + ' u ' , which
// is invalid , and let the corresponding JavaScript parser fail .
writer . write ( c1 ) ; writer . write ( c2 ) ; for ( int i = 0 ; i < escapei ; i ++ ) { c1 = c2 ; c2 = escapes [ i ] ; writer . write ( c2 ) ; } c1 = c2 ; c2 = ce ; continue ; } c1 = escapes [ 3 ] ; c2 = ce ; codepoint = parseIntFromReference ( escapes , 0 , 4 , 16 ) ; escapei = 0 ; // Don ' t continue here , just let the unescape code below do its job
} else if ( c2 >= '0' && c2 <= '7' ) { // This can be a octal escape , we need at least 1 more char , and up to 3 more .
// case ' 0 ' : if ( ! isOctalEscape ( text , i + 1 , max ) ) { codepoint = 0x00 ; referenceOffset = i + 1 ; } ; break ;
escapei = 0 ; ce = c2 ; while ( ce >= 0 && escapei < 3 ) { if ( ! ( ce >= '0' && ce <= '7' ) ) { break ; } escapes [ escapei ] = ( char ) ce ; ce = reader . read ( ) ; escapei ++ ; } c1 = escapes [ escapei - 1 ] ; c2 = ce ; codepoint = parseIntFromReference ( escapes , 0 , escapei , 8 ) ; if ( codepoint > 0xFF ) { // Maximum octal escape char is FF . Ignore the last digit
codepoint = parseIntFromReference ( escapes , 0 , escapei - 1 , 8 ) ; System . arraycopy ( escapes , escapei - 2 , escapes , 0 , 1 ) ; escapei = 1 ; } else if ( codepoint == 0x0 && escapei > 1 ) { // In the case of ' \ 000 ' , we will only consider the first ' \ 0 ' as it is an escape on its
// own , and the rest of the ' 00 ' will have to be output . So we save them at the escapes array
System . arraycopy ( escapes , 1 , escapes , 0 , escapei - 1 ) ; escapei -- ; } else { escapei = 0 ; } // Don ' t continue here , just let the unescape code below do its job
} else if ( c2 == '8' || c2 == '9' || c2 == '\r' || c2 == '\u2028' || c2 == '\u2029' ) { // '8 ' and ' 9 ' are not valid octal escape sequences , and the other four characters
// are LineTerminators , which are not allowed as escape sequences . So we leave it as is
// and expect the corresponding JavaScript engine to fail .
writer . write ( c1 ) ; writer . write ( c2 ) ; c1 = c2 ; c2 = reader . read ( ) ; continue ; } else { // We weren ' t able to consume any valid escape chars , just consider it a normal char ,
// which is allowed by the JavaScript specification ( NonEscapeCharacter )
codepoint = c2 ; c1 = c2 ; c2 = reader . read ( ) ; escapei = 0 ; } } } /* * Perform the real unescape */
if ( codepoint > '\uFFFF' ) { writer . write ( Character . toChars ( codepoint ) ) ; } else if ( codepoint != - 2 ) { // We use - 2 to signal the line continuator , which should be ignored in output
writer . write ( ( char ) codepoint ) ; } /* * Cleanup , in case we had a partial match */
if ( escapei > 0 ) { writer . write ( escapes , 0 , escapei ) ; escapei = 0 ; } } |
public class AbstractXTree { /** * Inserts the specified leaf entry into this R * - Tree .
* @ param entry the leaf entry to be inserted */
@ Override protected void insertLeafEntry ( SpatialEntry entry ) { } } | // choose subtree for insertion
IndexTreePath < SpatialEntry > subtree = choosePath ( getRootPath ( ) , entry , height , 1 ) ; if ( getLogger ( ) . isDebugging ( ) ) { getLogger ( ) . debugFine ( "insertion-subtree " + subtree + "\n" ) ; } N parent = getNode ( subtree . getEntry ( ) ) ; parent . addLeafEntry ( entry ) ; writeNode ( parent ) ; // since adjustEntry is expensive , try to avoid unnecessary subtree updates
if ( ! hasOverflow ( parent ) && // no overflow treatment
( isRoot ( parent ) || // is root
// below : no changes in the MBR
SpatialUtil . contains ( subtree . getEntry ( ) , entry ) ) ) { return ; // no need to adapt subtree
} // adjust the tree from subtree to root
adjustTree ( subtree ) ; |
public class AnnotationCollectorTransform { /** * Returns a list of AnnotationNodes for the value attribute of the given
* AnnotationNode .
* @ param collector the node containing the value member with the list
* @ param source the source unit for error reporting
* @ return a list of string constants */
protected List < AnnotationNode > getTargetAnnotationList ( AnnotationNode collector , AnnotationNode aliasAnnotationUsage , SourceUnit source ) { } } | List < AnnotationNode > stored = getStoredTargetList ( aliasAnnotationUsage , source ) ; List < AnnotationNode > targetList = getTargetListFromValue ( collector , aliasAnnotationUsage , source ) ; int size = targetList . size ( ) + stored . size ( ) ; if ( size == 0 ) { return Collections . emptyList ( ) ; } List < AnnotationNode > ret = new ArrayList < AnnotationNode > ( size ) ; ret . addAll ( stored ) ; ret . addAll ( targetList ) ; return ret ; |
public class EventServiceImplementation { /** * Add a J2SSH Listener to the list of listeners that will be sent events
* @ param threadPrefix
* listen to threads whose name have this prefix , string must not
* contain any ' - ' except the final character which must be a
* @ param listener */
public synchronized void addListener ( String threadPrefix , EventListener listener ) { } } | if ( threadPrefix . trim ( ) . equals ( "" ) ) { globalListeners . addElement ( listener ) ; } else { keyedListeners . put ( threadPrefix . trim ( ) , listener ) ; } |
public class SourceDocumentInformation { /** * getter for lastSegment - gets For a CAS that represents a segment of a larger source document , this flag indicates whether this CAS is the final segment of the source document . This is useful for downstream components that want to take some action after having seen all of the segments of a particular source document .
* @ generated */
public boolean getLastSegment ( ) { } } | if ( SourceDocumentInformation_Type . featOkTst && ( ( SourceDocumentInformation_Type ) jcasType ) . casFeat_lastSegment == null ) jcasType . jcas . throwFeatMissing ( "lastSegment" , "org.apache.uima.examples.SourceDocumentInformation" ) ; return jcasType . ll_cas . ll_getBooleanValue ( addr , ( ( SourceDocumentInformation_Type ) jcasType ) . casFeatCode_lastSegment ) ; |
public class GradientLookup { /** * * * * * * Initialization * * * * * */
private void init ( ) { } } | if ( stops . isEmpty ( ) ) return ; double minFraction = Collections . min ( stops . keySet ( ) ) ; double maxFraction = Collections . max ( stops . keySet ( ) ) ; if ( Double . compare ( minFraction , 0 ) > 0 ) { stops . put ( 0.0 , new Stop ( 0.0 , stops . get ( minFraction ) . getColor ( ) ) ) ; } if ( Double . compare ( maxFraction , 1 ) < 0 ) { stops . put ( 1.0 , new Stop ( 1.0 , stops . get ( maxFraction ) . getColor ( ) ) ) ; } |
public class Page { /** * Route String must obey some rules to be valid :
* < UL >
* < LI > no ' / ' at start or end
* < LI > Only characters or digits or the three characters - _ / are allowed
* < / UL >
* @ param route String provided by a page
* @ return Frontend will accept route or not
* @ see java . util . Base64 # getUrlEncoder */
public static boolean validateRoute ( String route ) { } } | if ( StringUtils . isBlank ( route ) ) { return false ; } if ( route . startsWith ( "/" ) || route . endsWith ( "/" ) ) { return false ; } for ( int i = 0 ; i < route . length ( ) ; i ++ ) { char c = route . charAt ( i ) ; if ( ! ( c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '/' || c == '-' || c == '_' ) ) { return false ; } } return true ; |
public class ImageModerationsImpl { /** * Returns the list of faces found .
* @ param imageStream The image file .
* @ param findFacesFileInputOptionalParameter 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 FoundFaces object */
public Observable < ServiceResponse < FoundFaces > > findFacesFileInputWithServiceResponseAsync ( byte [ ] imageStream , FindFacesFileInputOptionalParameter findFacesFileInputOptionalParameter ) { } } | if ( this . client . baseUrl ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.baseUrl() is required and cannot be null." ) ; } if ( imageStream == null ) { throw new IllegalArgumentException ( "Parameter imageStream is required and cannot be null." ) ; } final Boolean cacheImage = findFacesFileInputOptionalParameter != null ? findFacesFileInputOptionalParameter . cacheImage ( ) : null ; return findFacesFileInputWithServiceResponseAsync ( imageStream , cacheImage ) ; |
public class GeometryMergeService { /** * Clear the entire list of geometries for merging , basically resetting the process .
* @ throws GeometryMergeException In case the merging process has not been started . */
public void clearGeometries ( ) throws GeometryMergeException { } } | if ( ! busy ) { throw new GeometryMergeException ( "Can't clear geometry list if no merging process is active." ) ; } for ( Geometry geometry : geometries ) { eventBus . fireEvent ( new GeometryMergeRemovedEvent ( geometry ) ) ; } geometries . clear ( ) ; |
public class LoganSquare { /** * Returns a JsonMapper for a given class that has been annotated with @ JsonObject .
* @ param cls The class for which the JsonMapper should be fetched . */
public static < E > JsonMapper < E > mapperFor ( Class < E > cls ) throws NoSuchMapperException { } } | JsonMapper < E > mapper = getMapper ( cls ) ; if ( mapper == null ) { throw new NoSuchMapperException ( cls ) ; } else { return mapper ; } |
public class ConvergedStandardSession { /** * ( non - Javadoc )
* @ see javax . servlet . sip . ConvergedHttpSession # encodeURL ( java . lang . String , java . lang . String ) */
public String encodeURL ( String relativePath , String scheme ) { } } | return convergedSessionDelegate . encodeURL ( relativePath , scheme ) ; |
public class SecurityActions { /** * Create a WorkClassLoader
* @ param cb The class bundle
* @ return The class loader */
static WorkClassLoader createWorkClassLoader ( final ClassBundle cb ) { } } | return AccessController . doPrivileged ( new PrivilegedAction < WorkClassLoader > ( ) { public WorkClassLoader run ( ) { return new WorkClassLoader ( cb ) ; } } ) ; |
public class RecurlyClient { /** * Update an account ' s billing info
* When new or updated credit card information is updated , the billing information is only saved if the credit card
* is valid . If the account has a past due invoice , the outstanding balance will be collected to validate the
* billing information .
* If the account does not exist before the API request , the account will be created if the billing information
* is valid .
* Please note : this API end - point may be used to import billing information without security codes ( CVV ) .
* Recurly recommends requiring CVV from your customers when collecting new or updated billing information .
* @ deprecated Replaced by { @ link # createOrUpdateBillingInfo ( String , BillingInfo ) } Please pass in the account code rather than setting the account on the BillingInfo object
* @ param billingInfo billing info object to create or update
* @ return the newly created or update billing info object on success , null otherwise */
@ Deprecated public BillingInfo createOrUpdateBillingInfo ( final BillingInfo billingInfo ) { } } | final String accountCode = billingInfo . getAccount ( ) . getAccountCode ( ) ; // Unset it to avoid confusing Recurly
billingInfo . setAccount ( null ) ; return doPUT ( Account . ACCOUNT_RESOURCE + "/" + accountCode + BillingInfo . BILLING_INFO_RESOURCE , billingInfo , BillingInfo . class ) ; |
public class TypeHandler { /** * Returns the URL represented by < code > str < / code > .
* @ param str the URL string
* @ return The URL in < code > str < / code > is well - formed
* @ throws ParseException if the URL in < code > str < / code > is not well - formed */
public static URL createURL ( String str ) throws ParseException { } } | try { return new URL ( str ) ; } catch ( MalformedURLException e ) { throw new ParseException ( "Unable to parse the URL: " + str ) ; } |
public class VanillaDb { /** * Creates a planner for SQL commands . To change how the planner works ,
* modify this method .
* @ return the system ' s planner for SQL commands */
public static Planner newPlanner ( ) { } } | QueryPlanner qplanner ; UpdatePlanner uplanner ; try { qplanner = ( QueryPlanner ) queryPlannerCls . newInstance ( ) ; uplanner = ( UpdatePlanner ) updatePlannerCls . newInstance ( ) ; } catch ( InstantiationException | IllegalAccessException e ) { e . printStackTrace ( ) ; return null ; } return new Planner ( qplanner , uplanner ) ; |
public class BuildContext { /** * Set the variable to the given value . If the value is null , then the
* variable will be removed from the context . */
public void setGlobalVariable ( String name , Element value , boolean finalFlag ) { } } | assert ( name != null ) ; // Either modify an existing value ( with appropriate checks ) or add a
// new one .
if ( globalVariables . containsKey ( name ) ) { GlobalVariable gvar = globalVariables . get ( name ) ; gvar . setValue ( value ) ; gvar . setFinalFlag ( finalFlag ) ; } else if ( value != null ) { GlobalVariable gvar = new GlobalVariable ( finalFlag , value ) ; globalVariables . put ( name , gvar ) ; } |
public class Classes { /** * Lookup implementation for requested interface into given registry and return a new instance of it .
* @ param implementationsRegistry implementations registry ,
* @ param interfaceType interface to lookup into registry .
* @ param < T > instance type .
* @ return implementation instance .
* @ throws BugError if implementation is not found into registry . */
@ SuppressWarnings ( "unchecked" ) private static < T > T newRegisteredInstance ( Map < Class < ? > , Class < ? > > implementationsRegistry , Type interfaceType ) throws BugError { } } | Class < ? > implementation = getImplementation ( implementationsRegistry , interfaceType ) ; try { return ( T ) implementation . newInstance ( ) ; } catch ( IllegalAccessException e ) { // illegal access exception is thrown if the class or its no - arguments constructor is not accessible
// since we use well known JRE classes this condition may never meet
throw new BugError ( e ) ; } catch ( InstantiationException e ) { // instantiation exception is thrown if class is abstract , interface , array , primitive or void
// since we use well known JRE classes this condition may never meet
throw new BugError ( e ) ; } |
public class MBeanServerProxy { /** * { @ inheritDoc } */
public Set < ObjectName > queryNames ( ObjectName name , QueryExp query ) { } } | return delegate . queryNames ( name , query ) ; |
public class BufferManager { /** * Obtain a maker object that can create a new { @ link QueueBuffer } .
* @ param serializer the serializer for the value
* @ return the maker ; never null */
public < T > QueueBufferMaker < T > createQueueBuffer ( Serializer < T > serializer ) { } } | return new MakeOrderedBuffer < T > ( "buffer-" + dbCounter . incrementAndGet ( ) , serializer ) ; |
public class RaftSession { /** * Clears command results up to the given sequence number .
* Command output is removed from memory up to the given sequence number . Additionally , since we know the
* client received a response for all commands up to the given sequence number , command futures are removed
* from memory as well .
* @ param sequence The sequence to clear . */
public void clearResults ( long sequence ) { } } | if ( sequence > commandLowWaterMark ) { for ( long i = commandLowWaterMark + 1 ; i <= sequence ; i ++ ) { results . remove ( i ) ; commandLowWaterMark = i ; } } |
public class MathUtil { /** * Binomial coefficient , also known as " n choose k " .
* @ param n Total number of samples . n & gt ; 0
* @ param k Number of elements to choose . < code > n & gt ; = k < / code > ,
* < code > k & gt ; = 0 < / code >
* @ return n ! / ( k ! * ( n - k ) ! ) */
public static long binomialCoefficient ( long n , long k ) { } } | final long m = Math . max ( k , n - k ) ; double temp = 1 ; for ( long i = n , j = 1 ; i > m ; i -- , j ++ ) { temp = temp * i / j ; } return ( long ) temp ; |
public class PomHandler { /** * Handles the start element event .
* @ param uri the uri of the element being processed
* @ param localName the local name of the element being processed
* @ param qName the qName of the element being processed
* @ param attributes the attributes of the element being processed
* @ throws SAXException thrown if there is an exception processing */
@ Override public void startElement ( String uri , String localName , String qName , Attributes attributes ) throws SAXException { } } | currentText = new StringBuilder ( ) ; stack . push ( qName ) ; if ( LICENSE . equals ( qName ) ) { license = new License ( ) ; } |
public class ServicesInner { /** * Create or update DMS Instance .
* The services resource is the top - level resource that represents the Data Migration Service . The PUT method creates a new service or updates an existing one . When a service is updated , existing child resources ( i . e . tasks ) are unaffected . Services currently support a single kind , " vm " , which refers to a VM - based service , although other kinds may be added in the future . This method can change the kind , SKU , and network of the service , but if tasks are currently running ( i . e . the service is busy ) , this will fail with 400 Bad Request ( " ServiceIsBusy " ) . The provider will reply when successful with 200 OK or 201 Created . Long - running operations use the provisioningState property .
* @ param groupName Name of the resource group
* @ param serviceName Name of the service
* @ param parameters Information about the service
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ApiErrorException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the DataMigrationServiceInner object if successful . */
public DataMigrationServiceInner beginCreateOrUpdate ( String groupName , String serviceName , DataMigrationServiceInner parameters ) { } } | return beginCreateOrUpdateWithServiceResponseAsync ( groupName , serviceName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class HttpFields { private static FieldInfo getFieldInfo ( char [ ] name , int offset , int length ) { } } | Map . Entry entry = __info . getEntry ( name , offset , length ) ; if ( entry == null ) return new FieldInfo ( new String ( name , offset , length ) , false ) ; return ( FieldInfo ) entry . getValue ( ) ; |
public class TemplateDataTenantOperationsListener { /** * High - level implementation method that brokers the queuing , importing , and reporting that is
* common to Create and Update . */
public TenantOperationResponse importWithResources ( final ITenant tenant , final Set < Resource > resources ) { } } | /* * First load dom4j Documents and sort the entity files into the proper order */
final Map < PortalDataKey , Set < BucketTuple > > importQueue ; try { importQueue = prepareImportQueue ( tenant , resources ) ; } catch ( Exception e ) { final TenantOperationResponse error = new TenantOperationResponse ( this , TenantOperationResponse . Result . ABORT ) ; error . addMessage ( createLocalizedMessage ( FAILED_TO_LOAD_TENANT_TEMPLATE , new String [ ] { tenant . getName ( ) } ) ) ; return error ; } log . trace ( "Ready to import data entity templates for new tenant '{}'; importQueue={}" , tenant . getName ( ) , importQueue ) ; // We ' re going to report on every item imported ; TODO it would be better
// if we could display human - friendly entity type name + sysid ( fname , etc . )
final StringBuilder importReport = new StringBuilder ( ) ; /* * Now import the identified entities each bucket in turn */
try { importQueue ( tenant , importQueue , importReport ) ; } catch ( Exception e ) { final TenantOperationResponse error = new TenantOperationResponse ( this , TenantOperationResponse . Result . ABORT ) ; error . addMessage ( finalizeImportReport ( importReport ) ) ; error . addMessage ( createLocalizedMessage ( FAILED_TO_IMPORT_TENANT_TEMPLATE_DATA , new String [ ] { tenant . getName ( ) } ) ) ; return error ; } TenantOperationResponse rslt = new TenantOperationResponse ( this , TenantOperationResponse . Result . SUCCESS ) ; rslt . addMessage ( finalizeImportReport ( importReport ) ) ; rslt . addMessage ( createLocalizedMessage ( TENANT_ENTITIES_IMPORTED , new String [ ] { tenant . getName ( ) } ) ) ; return rslt ; |
public class DevicesInner { /** * Creates or updates a Data Box Edge / Gateway resource .
* @ param deviceName The device name .
* @ param resourceGroupName The resource group name .
* @ param dataBoxEdgeDevice The resource object .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the DataBoxEdgeDeviceInner object if successful . */
public DataBoxEdgeDeviceInner beginCreateOrUpdate ( String deviceName , String resourceGroupName , DataBoxEdgeDeviceInner dataBoxEdgeDevice ) { } } | return beginCreateOrUpdateWithServiceResponseAsync ( deviceName , resourceGroupName , dataBoxEdgeDevice ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class MPJwtNoMpJwtConfig { /** * login - config does NOT exist in web . xml
* login - config does NOT exist in the app
* the mpJwt feature is NOT enabled
* We should receive a 401 status in an exception
* @ throws Exception */
@ Test public void MPJwtNoMpJwtConfig_notInWebXML_notInApp ( ) throws Exception { } } | genericLoginConfigVariationTest ( MpJwtFatConstants . LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_NOT_IN_APP_ROOT_CONTEXT , MpJwtFatConstants . LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_NOT_IN_APP , MpJwtFatConstants . MPJWT_APP_CLASS_NO_LOGIN_CONFIG , ExpectedResult . BAD ) ; |
public class ConnectionWatchdog { /** * Reconnect to the remote address that the closed channel was connected to .
* This creates a new { @ link ChannelPipeline } with the same handler instances
* contained in the old channel ' s pipeline .
* @ param timeout Timer task handle .
* @ throws Exception when reconnection fails . */
@ Override public void run ( Timeout timeout ) throws Exception { } } | ChannelPipeline old = channel . getPipeline ( ) ; CommandHandler < ? , ? > handler = old . get ( CommandHandler . class ) ; RedisAsyncConnection < ? , ? > connection = old . get ( RedisAsyncConnection . class ) ; ChannelPipeline pipeline = Channels . pipeline ( this , handler , connection ) ; Channel c = bootstrap . getFactory ( ) . newChannel ( pipeline ) ; c . getConfig ( ) . setOptions ( bootstrap . getOptions ( ) ) ; c . connect ( ( SocketAddress ) bootstrap . getOption ( "remoteAddress" ) ) ; |
public class FunctionArgumentSignatureFactory { /** * Determine annotated default parameter value .
* @ param parameter The method parameter .
* @ return The parameters default value . */
public Object getDefaultValue ( Parameter parameter ) { } } | Class < ? > type = parameter . getType ( ) ; if ( TypeUtils . isaString ( type ) ) { return getStringDefaultValue ( parameter ) ; } if ( TypeUtils . isaByte ( type ) ) { return getByteDefaultValue ( parameter ) ; } if ( TypeUtils . isaShort ( type ) ) { return getShortDefaultValue ( parameter ) ; } if ( TypeUtils . isaInteger ( type ) ) { return getIntegerDefaultValue ( parameter ) ; } if ( TypeUtils . isaLong ( type ) ) { return getLongDefaultValue ( parameter ) ; } if ( TypeUtils . isaFloat ( type ) ) { return getFloatDefaultValue ( parameter ) ; } if ( TypeUtils . isaDouble ( type ) ) { return getDoubleDefaultValue ( parameter ) ; } if ( TypeUtils . isaCharacter ( type ) ) { return getCharacterDefaultValue ( parameter ) ; } if ( TypeUtils . isaBoolean ( type ) ) { return getBooleanDefaultValue ( parameter ) ; } return null ; |
public class NotificationHubsInner { /** * Patch a NotificationHub in a namespace .
* @ param resourceGroupName The name of the resource group .
* @ param namespaceName The namespace name .
* @ param notificationHubName The notification hub name .
* @ param parameters Parameters supplied to patch a NotificationHub Resource .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < NotificationHubResourceInner > patchAsync ( String resourceGroupName , String namespaceName , String notificationHubName , NotificationHubPatchParameters parameters , final ServiceCallback < NotificationHubResourceInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( patchWithServiceResponseAsync ( resourceGroupName , namespaceName , notificationHubName , parameters ) , serviceCallback ) ; |
public class RetryHandlingMetaMasterMasterClient { /** * Returns a master id for a master address .
* @ param address the address to get a master id for
* @ return a master id */
public long getId ( final Address address ) throws IOException { } } | return retryRPC ( ( ) -> mClient . getMasterId ( GetMasterIdPRequest . newBuilder ( ) . setMasterAddress ( address . toProto ( ) ) . build ( ) ) . getMasterId ( ) ) ; |
public class Flow { /** * Replaces the top key of the history with the given key and dispatches in the given direction . */
public void replaceTop ( @ NonNull final Object key , @ NonNull final Direction direction ) { } } | setHistory ( getHistory ( ) . buildUpon ( ) . pop ( 1 ) . push ( key ) . build ( ) , direction ) ; |
public class MetadataCommand { /** * { @ inheritDoc }
* @ see org . audit4j . core . Initializable # init ( ) */
@ Override public void init ( ) throws InitializationException { } } | List < String > options = getOptionsByCommand ( getCommand ( ) ) ; options . contains ( ASYNC_OPTION ) ; async = true ; |
public class AbstractJPAFacetImpl { /** * Facet methods */
@ Override public String getEntityPackage ( ) { } } | JavaSourceFacet sourceFacet = getFaceted ( ) . getFacet ( JavaSourceFacet . class ) ; return sourceFacet . getBasePackage ( ) + "." + JavaEEPackageConstants . DEFAULT_ENTITY_PACKAGE ; |
public class CmsVfsSitemapService { /** * Creates a client property bean from a server - side property . < p >
* @ param prop the property from which to create the client property
* @ param preserveOrigin if true , the origin will be copied into the new object
* @ return the new client property */
public static CmsClientProperty createClientProperty ( CmsProperty prop , boolean preserveOrigin ) { } } | CmsClientProperty result = new CmsClientProperty ( prop . getName ( ) , prop . getStructureValue ( ) , prop . getResourceValue ( ) ) ; if ( preserveOrigin ) { result . setOrigin ( prop . getOrigin ( ) ) ; } return result ; |
public class OutputAccessor { /** * Create an { @ link OutputAccessor } for the given { @ link ByteBuffer } . Instances are pooled within the thread scope .
* @ param poolHolder
* @ param byteBuffer
* @ return */
public static OutputAccessor from ( OutputAccessorPoolHolder poolHolder , ByteBuffer byteBuffer ) { } } | ByteBufferOutputAccessor accessor = poolHolder . getByteBufferOutputAccessor ( ) ; accessor . byteBuffer = byteBuffer ; return accessor ; |
public class CmsLocationController { /** * Displays the values within the picker widget . < p > */
private void displayValue ( ) { } } | if ( m_currentValue == null ) { m_picker . displayValue ( "" ) ; m_picker . setPreviewVisible ( false ) ; m_picker . setLocationInfo ( Collections . < String , String > emptyMap ( ) ) ; } else { m_picker . displayValue ( m_editValue . getAddress ( ) ) ; Map < String , String > infos = new LinkedHashMap < String , String > ( ) ; if ( hasLatLng ( ) ) { infos . put ( Messages . get ( ) . key ( Messages . GUI_LOCATION_LATITUDE_0 ) , m_editValue . getLatitudeString ( ) ) ; infos . put ( Messages . get ( ) . key ( Messages . GUI_LOCATION_LONGITUDE_0 ) , m_editValue . getLongitudeString ( ) ) ; infos . put ( Messages . get ( ) . key ( Messages . GUI_LOCATION_ZOOM_0 ) , String . valueOf ( m_editValue . getZoom ( ) ) ) ; } if ( hasSize ( ) ) { infos . put ( Messages . get ( ) . key ( Messages . GUI_LOCATION_SIZE_0 ) , m_editValue . getWidth ( ) + " x " + m_editValue . getHeight ( ) ) ; } if ( hasType ( ) ) { infos . put ( Messages . get ( ) . key ( Messages . GUI_LOCATION_TYPE_0 ) , m_editValue . getType ( ) ) ; } if ( hasMode ( ) ) { infos . put ( Messages . get ( ) . key ( Messages . GUI_LOCATION_MODE_0 ) , m_editValue . getMode ( ) ) ; } m_picker . setLocationInfo ( infos ) ; m_picker . setPreviewVisible ( true ) ; if ( ! isApiLoaded ( ) ) { onApiReady ( new Command ( ) { public void execute ( ) { return ; } } ) ; } } |
public class DataStore { /** * Add a data row , consisting of one column , to the store at a particular time .
* @ param timestamp Timestamp for the data point .
* @ param column The column for a field to value mapping
* @ param value The value for a field to value mapping */
public void add ( long timestamp , String column , Object value ) { } } | if ( ! ( value instanceof Long ) && ! ( value instanceof Integer ) && ! ( value instanceof Double ) && ! ( value instanceof Float ) && ! ( value instanceof Boolean ) && ! ( value instanceof String ) ) { throw new IllegalArgumentException ( "value must be of type: Long, Integer, Double, Float, Boolean, or String" ) ; } Map < String , Object > temp = new HashMap < String , Object > ( ) ; temp . put ( column , value ) ; add ( timestamp , temp ) ; |
public class A_CmsJspValueWrapper { /** * Returns a lazy initialized Map that provides Booleans which
* indicate if an Object is equal to the wrapped object . < p >
* @ return a lazy initialized Map that provides Booleans which
* indicate if an Object is equal to the wrapped object */
public Map < Object , Boolean > getIsEqual ( ) { } } | if ( m_isEqual == null ) { m_isEqual = CmsCollectionsGenericWrapper . createLazyMap ( new CmsIsEqualTransformer ( ) ) ; } return m_isEqual ; |
public class OsUtil { /** * @ param pathElements
* @ return boolean
* @ throws Exception
* @ Description : JOIN PATH
* @ author liaoqiqi
* @ date 2013-6-13 */
public static String pathJoin ( final String ... pathElements ) { } } | final String path ; if ( pathElements == null || pathElements . length == 0 ) { path = File . separator ; } else { final StringBuffer sb = new StringBuffer ( ) ; for ( final String pathElement : pathElements ) { if ( pathElement . length ( ) > 0 ) { sb . append ( pathElement ) ; sb . append ( File . separator ) ; } } if ( sb . length ( ) > 0 ) { sb . deleteCharAt ( sb . length ( ) - 1 ) ; } path = sb . toString ( ) ; } return ( path ) ; |
public class DbWebServlet { /** * Perform multiple SQL queries via dbSec .
* queries = {
* key1 : {
* table : < table name >
* , select : [
* < selectExpression >
* , where : [
* ' < columnName > , < comparator > '
* , ' < columnName > , < comparator > '
* , groupBy : [
* < columnName >
* , key2 : {
* < selectExpression > :
* < columnName >
* sum ( < columnName > )
* min ( < columnName > )
* max ( < columnName > )
* < comparator > :
* eq ( < value > ) where value is a valid comparison value for the column ' s data type .
* ne ( < value > ) where value is a valid comparison value for the column ' s data type .
* ge ( < value > ) where value is a valid comparison value for the column ' s data type .
* le ( < value > ) where value is a valid comparison value for the column ' s data type .
* gt ( < value > ) where value is a valid comparison value for the column ' s data type .
* lt ( < value > ) where value is a valid comparison value for the column ' s data type .
* isNull .
* isNotNull .
* response = {
* key1 : [
* { c1 : 1 , c2 : 2 }
* , { c1 : 4 , c2 : 5 }
* , key2 : {
* error : ' Error message '
* @ param request http request containing the query parameters .
* @ param response http response to be sent .
* @ throws Exception ( for a variety of reasons detected while parsing and validating the http parms ) . */
private void performMultiQuery ( HttpServletRequest request , HttpServletResponse response ) throws Exception { } } | User user = AuthenticationUtils . getUserFromRequest ( request ) ; String [ ] queriesStrings = request . getParameterValues ( "queries" ) ; if ( 1 != queriesStrings . length ) { throw new Exception ( "Parameter 'queries' must be specified exactly oncce" ) ; } // Create list of Query instances
List < Query > queries = parseQueriesJson ( queriesStrings [ 0 ] ) ; // Perform queries
JSONObject result = new JSONObject ( ) ; { Map < String , DbTableAccess > tableAccessCache = new HashMap < String , DbTableAccess > ( ) ; for ( Query query : queries ) { String tableName = query . getTableName ( ) ; List < RecordSelector > whereMap = query . getWhereExpressions ( ) ; List < FieldSelector > fieldSelectors = query . getFieldSelectors ( ) ; List < FieldSelector > groupByColumnNames = query . getGroupByColumnNames ( ) ; List < OrderSpecifier > orderSpecifiers = query . getOrderBySpecifiers ( ) ; Integer limit = query . getLimit ( ) ; Integer offset = query . getOffset ( ) ; DbTableAccess tableAccess = tableAccessCache . get ( tableName ) ; if ( null == tableAccess ) { tableAccess = DbTableAccess . getAccess ( dbSecurity , tableName , new DbUserAdaptor ( user ) ) ; tableAccessCache . put ( tableName , tableAccess ) ; } try { JSONArray queriedObjects = tableAccess . query ( whereMap , fieldSelectors , groupByColumnNames , orderSpecifiers , limit , offset ) ; result . put ( query . getQueryKey ( ) , queriedObjects ) ; } catch ( Exception e ) { result . put ( query . getQueryKey ( ) , errorToJson ( e ) ) ; } } } sendJsonResponse ( response , result ) ; |
public class Solo { /** * Returns a View matching the specified tag .
* @ param tag the tag of the { @ link View } to return
* @ return a { @ link View } matching the specified id */
public View getView ( Object tag ) { } } | if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "getView(" + tag + ")" ) ; } return getView ( tag , 0 ) ; |
public class WheelCall { /** * { @ inheritDoc } */
@ Override public Map < String , Object > getPayload ( ) { } } | HashMap < String , Object > payload = new HashMap < > ( ) ; payload . put ( "fun" , getFunction ( ) ) ; kwargs . ifPresent ( payload :: putAll ) ; return payload ; |
public class Matrix { /** * Folds all elements ( in row - by - row manner ) of this matrix with given { @ code accumulator } .
* @ param accumulator the vector accumulator
* @ return the accumulated double array */
public double [ ] foldRows ( VectorAccumulator accumulator ) { } } | double [ ] result = new double [ rows ] ; for ( int i = 0 ; i < rows ; i ++ ) { result [ i ] = foldRow ( i , accumulator ) ; } return result ; |
public class AbstractCollectionJsonDeserializer { /** * < p > newInstance < / p >
* @ param deserializer { @ link JsonDeserializer } used to deserialize the objects inside the { @ link AbstractCollection } .
* @ param < T > Type of the elements inside the { @ link AbstractCollection }
* @ return a new instance of { @ link AbstractCollectionJsonDeserializer } */
public static < T > AbstractCollectionJsonDeserializer < T > newInstance ( JsonDeserializer < T > deserializer ) { } } | return new AbstractCollectionJsonDeserializer < T > ( deserializer ) ; |
public class Ordering { /** * Creates an { @ link Ordering } from the given factory .
* @ param factory factory to use to create the ordering
* @ param annotatedTestClass test class that is annotated with { @ link OrderWith } .
* @ throws InvalidOrderingException if the instance could not be created */
public static Ordering definedBy ( Ordering . Factory factory , Description annotatedTestClass ) throws InvalidOrderingException { } } | if ( factory == null ) { throw new NullPointerException ( "factory cannot be null" ) ; } if ( annotatedTestClass == null ) { throw new NullPointerException ( "annotatedTestClass cannot be null" ) ; } return factory . create ( new Ordering . Context ( annotatedTestClass ) ) ; |
public class UIResults { /** * Extract a generic UIResults from the HttpServletRequest . Probably used
* by a header / footer template . jsp file .
* @ param httpRequest the HttpServletRequest where the UIResults was
* ferreted away
* @ return generic UIResult with info from httpRequest applied . */
public static UIResults getGeneric ( HttpServletRequest httpRequest ) { } } | UIResults results = ( UIResults ) httpRequest . getAttribute ( FERRET_NAME ) ; if ( results == null ) { results = new UIResults ( httpRequest ) ; } return results ; |
public class JavaParser { /** * $ ANTLR start synpred171 _ Java */
public final void synpred171_Java_fragment ( ) throws RecognitionException { } } | // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 787:17 : ( ' if ' parExpression )
// src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 787:17 : ' if ' parExpression
{ match ( input , 87 , FOLLOW_87_in_synpred171_Java3294 ) ; if ( state . failed ) return ; pushFollow ( FOLLOW_parExpression_in_synpred171_Java3296 ) ; parExpression ( ) ; state . _fsp -- ; if ( state . failed ) return ; } |
public class TmsLayer { /** * Adds userToken to url if we are proxying or caching ( eg . indirect calls )
* @ param imageUrl
* @ return */
private String formatUrl ( String imageUrl ) { } } | if ( useProxy || null != authentication || useCache ) { String token = securityContext . getToken ( ) ; if ( null != token ) { StringBuilder url = new StringBuilder ( imageUrl ) ; int pos = url . lastIndexOf ( "?" ) ; if ( pos > 0 ) { url . append ( "&" ) ; } else { url . append ( "?" ) ; } url . append ( "userToken=" ) ; url . append ( token ) ; return url . toString ( ) ; } } return imageUrl ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.