signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class CmsContainerpageService { /** * Fetches the container page data . < p >
* @ param request the current request
* @ return the container page data
* @ throws CmsRpcException if something goes wrong */
public static CmsCntPageData prefetch ( HttpServletRequest request ) throws CmsRpcException { } } | CmsContainerpageService srv = new CmsContainerpageService ( ) ; srv . setCms ( CmsFlexController . getCmsObject ( request ) ) ; srv . setRequest ( request ) ; CmsCntPageData result = null ; try { result = srv . prefetch ( ) ; } finally { srv . clearThreadStorage ( ) ; } return result ; |
public class RqMtBase { /** * Convert a list of requests to a map .
* @ param reqs Requests
* @ return Map of them
* @ throws IOException If fails */
@ SuppressWarnings ( "PMD.AvoidInstantiatingObjectsInLoops" ) private static Map < String , List < Request > > asMap ( final Collection < Request > reqs ) throws IOException { } } | final Map < String , List < Request > > map = new HashMap < > ( reqs . size ( ) ) ; for ( final Request req : reqs ) { final String header = new RqHeaders . Smart ( req ) . single ( "Content-Disposition" ) ; final Matcher matcher = RqMtBase . NAME . matcher ( header ) ; if ( ! matcher . matches ( ) ) { throw new HttpException ( HttpURLConnection . HTTP_BAD_REQUEST , String . format ( "\"name\" not found in Content-Disposition header: %s" , header ) ) ; } final String name = matcher . group ( 1 ) ; if ( ! map . containsKey ( name ) ) { map . put ( name , new LinkedList < > ( ) ) ; } map . get ( name ) . add ( req ) ; } return map ; |
public class AmazonPinpointClient { /** * Use to update the APNs channel for an app .
* @ param updateApnsChannelRequest
* @ return Result of the UpdateApnsChannel operation returned by the service .
* @ throws BadRequestException
* 400 response
* @ throws InternalServerErrorException
* 500 response
* @ throws ForbiddenException
* 403 response
* @ throws NotFoundException
* 404 response
* @ throws MethodNotAllowedException
* 405 response
* @ throws TooManyRequestsException
* 429 response
* @ sample AmazonPinpoint . UpdateApnsChannel
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / pinpoint - 2016-12-01 / UpdateApnsChannel " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public UpdateApnsChannelResult updateApnsChannel ( UpdateApnsChannelRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateApnsChannel ( request ) ; |
public class WordForm { /** * getter for lemma - gets lemma of the Form
* @ generated
* @ return value of the feature */
public String getLemma ( ) { } } | if ( WordForm_Type . featOkTst && ( ( WordForm_Type ) jcasType ) . casFeat_lemma == null ) jcasType . jcas . throwFeatMissing ( "lemma" , "com.digitalpebble.rasp.WordForm" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( WordForm_Type ) jcasType ) . casFeatCode_lemma ) ; |
public class WorkspaceDataImporter { /** * ( non - Javadoc )
* @ seeorg . exoplatform . services . jcr . impl . xml . importing . StreamImporter #
* createContentImporter ( org . exoplatform . services . jcr . impl . core . NodeImpl ,
* int , org . exoplatform . services . jcr . impl . xml . XmlSaveType ,
* org . exoplatform . services . ext . action . InvocationContext ) */
@ Override public ContentImporter createContentImporter ( NodeData parent , int uuidBehavior , ItemDataConsumer dataConsumer , NodeTypeDataManager ntManager , LocationFactory locationFactory , ValueFactoryImpl valueFactory , NamespaceRegistry namespaceRegistry , AccessManager accessManager , ConversationState userState , Map < String , Object > context , RepositoryImpl repository , String currentWorkspaceName ) { } } | return new WorkspaceContentImporter ( parent , parent . getQPath ( ) , uuidBehavior , dataConsumer , ntManager , locationFactory , valueFactory , namespaceRegistry , accessManager , userState , context , repository , currentWorkspaceName ) ; |
public class TurfMeasurement { /** * Takes a { @ link BoundingBox } and uses its coordinates to create a { @ link Polygon }
* geometry .
* @ param boundingBox a { @ link BoundingBox } object to calculate with
* @ return a { @ link Polygon } object
* @ see < a href = " http : / / turfjs . org / docs / # bboxPolygon " > Turf BoundingBox Polygon documentation < / a >
* @ since 4.7.0 */
public static Polygon bboxPolygon ( @ NonNull BoundingBox boundingBox ) { } } | return Polygon . fromLngLats ( Arrays . asList ( Arrays . asList ( Point . fromLngLat ( boundingBox . west ( ) , boundingBox . south ( ) ) , Point . fromLngLat ( boundingBox . east ( ) , boundingBox . south ( ) ) , Point . fromLngLat ( boundingBox . east ( ) , boundingBox . north ( ) ) , Point . fromLngLat ( boundingBox . west ( ) , boundingBox . north ( ) ) , Point . fromLngLat ( boundingBox . west ( ) , boundingBox . south ( ) ) ) ) ) ; |
public class MethodInfo { /** * Returns the parsed type descriptor for the method , which will not include type parameters . If you need
* generic type parameters , call getTypeSignature ( ) instead .
* @ return The parsed type descriptor for the method . */
public MethodTypeSignature getTypeDescriptor ( ) { } } | if ( typeDescriptor == null ) { try { typeDescriptor = MethodTypeSignature . parse ( typeDescriptorStr , declaringClassName ) ; typeDescriptor . setScanResult ( scanResult ) ; } catch ( final ParseException e ) { throw new IllegalArgumentException ( e ) ; } } return typeDescriptor ; |
public class HttpSessionContextImpl { /** * Determine if the requested session id is valid . We will get the session
* passed in if it exists - - we know that getSession has been called */
public boolean isRequestedSessionIdValid ( HttpServletRequest _request , HttpSession sess ) { } } | SessionAffinityContext sac = getSessionAffinityContext ( _request ) ; String sessionId = sac . getRequestedSessionID ( ) ; if ( ( sessionId != null ) && ( sess != null ) && ( ! sess . isNew ( ) || ! _smc . checkSessionNewOnIsValidRequest ( ) ) && sessionId . equals ( sess . getId ( ) ) ) { return true ; } return false ; |
public class SuspiciousClusteredSessionSupport { /** * implements the visitor to collect calls to getAttribute / setAttribute and stores to attributes to see what have been modified without recalling
* setAttribute
* @ param seen
* the currently parsed opcode */
@ Override public void sawOpcode ( int seen ) { } } | String attributeName = null ; boolean sawGetAttribute = false ; try { stack . precomputation ( this ) ; if ( seen == Const . INVOKEINTERFACE ) { String clsName = getClassConstantOperand ( ) ; if ( "javax/servlet/http/HttpSession" . equals ( clsName ) ) { String methodName = getNameConstantOperand ( ) ; if ( "getAttribute" . equals ( methodName ) ) { if ( stack . getStackDepth ( ) > 0 ) { OpcodeStack . Item item = stack . getStackItem ( 0 ) ; Object con = item . getConstant ( ) ; if ( con instanceof String ) { attributeName = ( String ) con ; sawGetAttribute = true ; } } } else if ( "setAttribute" . equals ( methodName ) && ( stack . getStackDepth ( ) > 1 ) ) { OpcodeStack . Item item = stack . getStackItem ( 1 ) ; Object con = item . getConstant ( ) ; if ( con instanceof String ) { attributeName = ( String ) con ; changedAttributes . remove ( attributeName ) ; } } } } else if ( OpcodeUtils . isALoad ( seen ) ) { int reg = RegisterUtils . getALoadReg ( this , seen ) ; attributeName = savedAttributes . get ( Integer . valueOf ( reg ) ) ; sawGetAttribute = attributeName != null ; } else if ( ( ( ( seen >= Const . ASTORE_0 ) && ( seen <= Const . ASTORE_3 ) ) || ( seen == Const . ASTORE ) ) && ( stack . getStackDepth ( ) > 0 ) ) { OpcodeStack . Item item = stack . getStackItem ( 0 ) ; attributeName = ( String ) item . getUserValue ( ) ; int reg = RegisterUtils . getAStoreReg ( this , seen ) ; savedAttributes . put ( Integer . valueOf ( reg ) , attributeName ) ; } if ( ( seen == Const . INVOKEINTERFACE ) || ( seen == Const . INVOKEVIRTUAL ) ) { String methodName = getNameConstantOperand ( ) ; Matcher m = modifyingNames . matcher ( methodName ) ; if ( m . matches ( ) ) { String signature = getSigConstantOperand ( ) ; int numArgs = SignatureUtils . getNumParameters ( signature ) ; if ( stack . getStackDepth ( ) > numArgs ) { OpcodeStack . Item item = stack . getStackItem ( numArgs ) ; attributeName = ( String ) item . getUserValue ( ) ; if ( attributeName != null ) { changedAttributes . put ( attributeName , Integer . valueOf ( getPC ( ) ) ) ; } } } } else if ( ( seen >= Const . IASTORE ) && ( seen <= Const . SASTORE ) && ( stack . getStackDepth ( ) > 2 ) ) { OpcodeStack . Item item = stack . getStackItem ( 2 ) ; attributeName = ( String ) item . getUserValue ( ) ; if ( attributeName != null ) { changedAttributes . put ( attributeName , Integer . valueOf ( getPC ( ) ) ) ; } } } finally { TernaryPatcher . pre ( stack , seen ) ; stack . sawOpcode ( this , seen ) ; TernaryPatcher . post ( stack , seen ) ; if ( sawGetAttribute && ( stack . getStackDepth ( ) > 0 ) ) { OpcodeStack . Item item = stack . getStackItem ( 0 ) ; item . setUserValue ( attributeName ) ; } } |
public class ListImportsResult { /** * A list of stack names that are importing the specified exported output value .
* @ return A list of stack names that are importing the specified exported output value . */
public java . util . List < String > getImports ( ) { } } | if ( imports == null ) { imports = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return imports ; |
public class BaseSerializer { /** * Serialize a list of Transforms */
public String serializeTransformList ( List < Transform > list ) { } } | ObjectMapper om = getObjectMapper ( ) ; try { return om . writeValueAsString ( new ListWrappers . TransformList ( list ) ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } |
public class AbstractConsoleEditor { /** * Stops the editor .
* The methods clears the editor screen and also closes in / out and { @ link Reader } . */
public void stop ( ) { } } | hide ( ) ; running = false ; Closeables . closeQuitely ( reader ) ; Closeables . closeQuitely ( in ) ; |
public class BaseRunner { /** * Create the WebAppContext with basic configurations set like context path
* etc . */
protected void createWebAppContext ( ) { } } | webapp = new WebAppContext ( ) ; webapp . setThrowUnavailableOnStartupException ( true ) ; webapp . setServerClasses ( getServerClasses ( ) ) ; webapp . setContextPath ( getContextPath ( ) ) ; webapp . setTempDirectory ( createTempDir ( "jetty-app-" ) ) ; setSecureCookies ( ) ; |
public class GosuStringUtil { /** * < p > Find the latest index of any of a set of potential substrings . < / p >
* < p > A < code > null < / code > String will return < code > - 1 < / code > .
* A < code > null < / code > search array will return < code > - 1 < / code > .
* A < code > null < / code > or zero length search array entry will be ignored ,
* but a search array containing " " will return the length of < code > str < / code >
* if < code > str < / code > is not null . This method uses { @ link String # indexOf ( String ) } < / p >
* < pre >
* GosuStringUtil . lastIndexOfAny ( null , * ) = - 1
* GosuStringUtil . lastIndexOfAny ( * , null ) = - 1
* GosuStringUtil . lastIndexOfAny ( * , [ ] ) = - 1
* GosuStringUtil . lastIndexOfAny ( * , [ null ] ) = - 1
* GosuStringUtil . lastIndexOfAny ( " zzabyycdxx " , [ " ab " , " cd " ] ) = 6
* GosuStringUtil . lastIndexOfAny ( " zzabyycdxx " , [ " cd " , " ab " ] ) = 6
* GosuStringUtil . lastIndexOfAny ( " zzabyycdxx " , [ " mn " , " op " ] ) = - 1
* GosuStringUtil . lastIndexOfAny ( " zzabyycdxx " , [ " mn " , " op " ] ) = - 1
* GosuStringUtil . lastIndexOfAny ( " zzabyycdxx " , [ " mn " , " " ] ) = 10
* < / pre >
* @ param str the String to check , may be null
* @ param searchStrs the Strings to search for , may be null
* @ return the last index of any of the Strings , - 1 if no match */
public static int lastIndexOfAny ( String str , String [ ] searchStrs ) { } } | if ( ( str == null ) || ( searchStrs == null ) ) { return - 1 ; } int sz = searchStrs . length ; int ret = - 1 ; int tmp = 0 ; for ( int i = 0 ; i < sz ; i ++ ) { String search = searchStrs [ i ] ; if ( search == null ) { continue ; } tmp = str . lastIndexOf ( search ) ; if ( tmp > ret ) { ret = tmp ; } } return ret ; |
public class Bounds { /** * Negates single - ended Bound filters .
* @ param bound filter
* @ return negated filter , or null if this bound is double - ended . */
public static BoundDimFilter not ( final BoundDimFilter bound ) { } } | if ( bound . getUpper ( ) != null && bound . getLower ( ) != null ) { return null ; } else if ( bound . getUpper ( ) != null ) { return new BoundDimFilter ( bound . getDimension ( ) , bound . getUpper ( ) , null , ! bound . isUpperStrict ( ) , false , null , bound . getExtractionFn ( ) , bound . getOrdering ( ) ) ; } else { // bound . getLower ( ) ! = null
return new BoundDimFilter ( bound . getDimension ( ) , null , bound . getLower ( ) , false , ! bound . isLowerStrict ( ) , null , bound . getExtractionFn ( ) , bound . getOrdering ( ) ) ; } |
public class MessageUtils { /** * Builds an appropriate error message .
* @ param resolutionContext The resolution context
* @ param message The message
* @ return The message */
static String buildMessage ( BeanResolutionContext resolutionContext , String message ) { } } | BeanResolutionContext . Path path = resolutionContext . getPath ( ) ; BeanDefinition declaringType ; boolean hasPath = ! path . isEmpty ( ) ; if ( hasPath ) { BeanResolutionContext . Segment segment = path . peek ( ) ; declaringType = segment . getDeclaringType ( ) ; } else { declaringType = resolutionContext . getRootDefinition ( ) ; } String ls = System . getProperty ( "line.separator" ) ; StringBuilder builder = new StringBuilder ( "Error instantiating bean of type [" ) ; builder . append ( declaringType . getName ( ) ) . append ( "]" ) . append ( ls ) . append ( ls ) ; if ( message != null ) { builder . append ( "Message: " ) . append ( message ) . append ( ls ) ; } if ( hasPath ) { String pathString = path . toString ( ) ; builder . append ( "Path Taken: " ) . append ( pathString ) ; } return builder . toString ( ) ; |
public class Variable { /** * Tell if this is a psuedo variable reference , declared by Xalan instead
* of by the user . */
public boolean isPsuedoVarRef ( ) { } } | java . lang . String ns = m_qname . getNamespaceURI ( ) ; if ( ( null != ns ) && ns . equals ( PSUEDOVARNAMESPACE ) ) { if ( m_qname . getLocalName ( ) . startsWith ( "#" ) ) return true ; } return false ; |
public class Utils { /** * Extracts a JSON object from server response with secured string .
* @ param response Server response
* @ return Extracted secured JSON or null . */
public static JSONObject extractSecureJson ( Response response ) { } } | try { String responseText = response . getResponseText ( ) ; if ( ! responseText . startsWith ( SECURE_PATTERN_START ) || ! responseText . endsWith ( SECURE_PATTERN_END ) ) { return null ; } int startIndex = responseText . indexOf ( SECURE_PATTERN_START ) ; int endIndex = responseText . indexOf ( SECURE_PATTERN_END , responseText . length ( ) - SECURE_PATTERN_END . length ( ) - 1 ) ; String jsonString = responseText . substring ( startIndex + SECURE_PATTERN_START . length ( ) , endIndex ) ; return new JSONObject ( jsonString ) ; } catch ( Throwable t ) { logger . error ( "extractSecureJson failed with exception: " + t . getLocalizedMessage ( ) , t ) ; return null ; } |
public class RestRepositoryService { /** * Gives the name of all the existing workspaces for a given repository .
* @ param repositoryName the name of the repository
* @ return Response return the Response with list of workspace names
* @ response
* { code : json }
* { " names " : the name of all the existing workspaces for a given repository }
* { code }
* @ LevelAPI Experimental */
@ GET @ Produces ( MediaType . APPLICATION_JSON ) @ RolesAllowed ( "administrators" ) @ Path ( "/workspaces/{repositoryName}" ) public Response getWorkspaceNames ( @ PathParam ( "repositoryName" ) String repositoryName ) { } } | String errorMessage = new String ( ) ; Status status ; try { List < String > workspaces = new ArrayList < String > ( ) ; for ( WorkspaceEntry wEntry : repositoryService . getRepository ( repositoryName ) . getConfiguration ( ) . getWorkspaceEntries ( ) ) { workspaces . add ( wEntry . getName ( ) ) ; } return Response . ok ( new NamesList ( workspaces ) ) . cacheControl ( NO_CACHE ) . build ( ) ; } catch ( RepositoryException e ) { if ( log . isDebugEnabled ( ) ) { log . error ( e . getMessage ( ) , e ) ; } errorMessage = e . getMessage ( ) ; status = Status . NOT_FOUND ; } catch ( Throwable e ) // NOSONAR
{ if ( log . isDebugEnabled ( ) ) { log . error ( e . getMessage ( ) , e ) ; } errorMessage = e . getMessage ( ) ; status = Status . INTERNAL_SERVER_ERROR ; } return Response . status ( status ) . entity ( errorMessage ) . type ( MediaType . TEXT_PLAIN_TYPE ) . cacheControl ( NO_CACHE ) . build ( ) ; |
public class NavigationService { /** * find and click a button or input containing the passed text . Will return the first match where an input take presedence
* over a button
* @ param text which should be contained on the button
* @ throws AssertionError if no button with this text is found */
public void clickButtonWithText ( String text ) { } } | String caseInsensitiveButtonText = seleniumElementService . constructCaseInsensitiveContains ( "text()" , text ) ; By buttonPpath = By . xpath ( "//button[" + caseInsensitiveButtonText + "]" ) ; String caseInsensitiveValueText = seleniumElementService . constructCaseInsensitiveContains ( "@value" , text ) ; By submitPath = By . xpath ( "//input[@type='submit'][" + caseInsensitiveValueText + "]" ) ; By inputButtonPath = By . xpath ( "//input[@type='button'][" + caseInsensitiveValueText + "]" ) ; By inputResetPath = By . xpath ( "//input[@type='reset'][" + caseInsensitiveValueText + "]" ) ; WebElement foundButton = seleniumElementService . findExpectedFirstMatchedElement ( buttonPpath , submitPath , inputButtonPath , inputResetPath ) ; if ( foundButton == null ) { foundButton = seleniumElementService . findExpectedFirstMatchedElement ( 2 , buttonPpath , submitPath , inputButtonPath , inputResetPath ) ; } foundButton . click ( ) ; |
public class MultiIndex { /** * Returns an read - only < code > IndexReader < / code > that spans alls indexes of
* this < code > MultiIndex < / code > .
* @ param initCache
* when set < code > true < / code > the hierarchy cache is completely
* initialized before this call returns .
* @ return an < code > IndexReader < / code > .
* @ throws IOException
* if an error occurs constructing the < code > IndexReader < / code > . */
public synchronized CachingMultiIndexReader getIndexReader ( final boolean initCache ) throws IOException { } } | return SecurityHelper . doPrivilegedIOExceptionAction ( new PrivilegedExceptionAction < CachingMultiIndexReader > ( ) { public CachingMultiIndexReader run ( ) throws Exception { synchronized ( updateMonitor ) { if ( multiReader != null ) { multiReader . acquire ( ) ; return multiReader ; } // no reader available
// wait until no update is in progress
while ( indexUpdateMonitor . getUpdateInProgress ( ) ) { try { updateMonitor . wait ( ) ; } catch ( InterruptedException e ) { throw new IOException ( "Interrupted while waiting to aquire reader" ) ; } } // some other read thread might have created the reader in the
// meantime - > check again
if ( multiReader == null ) { ReadOnlyIndexReader [ ] readers = getReadOnlyIndexReaders ( initCache , true ) ; multiReader = new CachingMultiIndexReader ( readers , cache ) ; } multiReader . acquire ( ) ; return multiReader ; } } } ) ; |
public class CPMeasurementUnitUtil { /** * Returns the last cp measurement unit in the ordered set where groupId = & # 63 ; .
* @ param groupId the group ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching cp measurement unit
* @ throws NoSuchCPMeasurementUnitException if a matching cp measurement unit could not be found */
public static CPMeasurementUnit findByGroupId_Last ( long groupId , OrderByComparator < CPMeasurementUnit > orderByComparator ) throws com . liferay . commerce . product . exception . NoSuchCPMeasurementUnitException { } } | return getPersistence ( ) . findByGroupId_Last ( groupId , orderByComparator ) ; |
public class PackageDocImpl { /** * Get package name . */
public String qualifiedName ( ) { } } | if ( qualifiedName == null ) { Name fullname = sym . getQualifiedName ( ) ; // Some bogus tests depend on the interned " " being returned .
// See 6457276.
qualifiedName = fullname . isEmpty ( ) ? "" : fullname . toString ( ) ; } return qualifiedName ; |
public class ProjectiveDependencyParser { /** * Runs the outside - algorithm for the parsing algorithm of ( Eisner , 2000 ) .
* @ param scores Input : The edge weights .
* @ param inChart Input : The inside parse chart .
* @ param outChart Output : The outside parse chart . */
private static void outsideAlgorithm ( final double [ ] [ ] scores , final ProjTreeChart inChart , final ProjTreeChart outChart , boolean singleRoot ) { } } | final int n = scores . length ; final int startIdx = singleRoot ? 1 : 0 ; if ( singleRoot ) { // Initialize .
double goalScore = 0.0 ; outChart . updateCell ( 0 , n - 1 , RIGHT , COMPLETE , goalScore , - 1 ) ; // The inside algorithm is effectively doing this . . .
// wallScore [ r ] log + = inChart . scores [ 0 ] [ r ] [ LEFT ] [ COMPLETE ] +
// inChart . scores [ r ] [ n - 1 ] [ RIGHT ] [ COMPLETE ] +
// fracRoot [ r ] ;
// goalScore log + = wallScore [ r ] ;
for ( int r = 1 ; r < n ; r ++ ) { outChart . updateCell ( 0 , r , RIGHT , INCOMPLETE , goalScore , - 1 ) ; } // Un - build goal constituents by combining left and right complete
// constituents , on the left and right respectively . This corresponds to
// left and right triangles . ( Note : this is the opposite of how we
// build an incomplete constituent . )
for ( int r = 1 ; r < n ; r ++ ) { // Left child .
double leftScore = outChart . getScore ( 0 , r , RIGHT , INCOMPLETE ) + inChart . getScore ( r , n - 1 , RIGHT , COMPLETE ) + scores [ 0 ] [ r ] ; outChart . updateCell ( 1 , r , LEFT , COMPLETE , leftScore , - 1 ) ; // Right child .
double rightScore = outChart . getScore ( 0 , r , RIGHT , INCOMPLETE ) + inChart . getScore ( 1 , r , LEFT , COMPLETE ) + scores [ 0 ] [ r ] ; outChart . updateCell ( r , n - 1 , RIGHT , COMPLETE , rightScore , - 1 ) ; } } else { // Base case .
for ( int d = 0 ; d < 2 ; d ++ ) { outChart . updateCell ( 0 , n - 1 , d , COMPLETE , 0.0 , - 1 ) ; } } // Parse .
for ( int width = n - 1 ; width >= 1 ; width -- ) { for ( int s = startIdx ; s < n - width ; s ++ ) { int t = s + width ; // First create complete items ( opposite of inside ) .
// - - Left side .
for ( int r = s ; r < t ; r ++ ) { final int d = LEFT ; // Left child .
double leftScore = outChart . getScore ( s , t , d , COMPLETE ) + inChart . getScore ( r , t , d , INCOMPLETE ) ; outChart . updateCell ( s , r , d , COMPLETE , leftScore , - 1 ) ; // Right child .
double rightScore = outChart . getScore ( s , t , d , COMPLETE ) + inChart . getScore ( s , r , d , COMPLETE ) ; outChart . updateCell ( r , t , d , INCOMPLETE , rightScore , - 1 ) ; } // - - Right side .
for ( int r = s + 1 ; r <= t ; r ++ ) { final int d = RIGHT ; // Left child .
double leftScore = outChart . getScore ( s , t , d , COMPLETE ) + inChart . getScore ( r , t , d , COMPLETE ) ; outChart . updateCell ( s , r , d , INCOMPLETE , leftScore , - 1 ) ; // Right child .
double rightScore = outChart . getScore ( s , t , d , COMPLETE ) + inChart . getScore ( s , r , d , INCOMPLETE ) ; outChart . updateCell ( r , t , d , COMPLETE , rightScore , - 1 ) ; } // Second create incomplete items ( opposite of inside ) .
for ( int r = s ; r < t ; r ++ ) { for ( int d = 0 ; d < 2 ; d ++ ) { double edgeScore = ( d == LEFT ) ? scores [ t ] [ s ] : scores [ s ] [ t ] ; // Left child .
double leftScore = outChart . getScore ( s , t , d , INCOMPLETE ) + inChart . getScore ( r + 1 , t , LEFT , COMPLETE ) + edgeScore ; outChart . updateCell ( s , r , RIGHT , COMPLETE , leftScore , - 1 ) ; // Right child .
double rightScore = outChart . getScore ( s , t , d , INCOMPLETE ) + inChart . getScore ( s , r , RIGHT , COMPLETE ) + edgeScore ; outChart . updateCell ( r + 1 , t , LEFT , COMPLETE , rightScore , - 1 ) ; } } } } |
public class Streams { /** * Attempt to close an array of < tt > InputStream < / tt > s .
* @ param streams Array of < tt > InputStream < / tt > s to attempt to close .
* @ return < tt > True < / tt > if all streams were closed , or < tt > false < / tt > if an
* exception was thrown . */
public static boolean close ( final InputStream [ ] streams ) { } } | boolean success = true ; for ( InputStream stream : streams ) { boolean rv = close ( stream ) ; if ( ! rv ) success = false ; } return success ; |
public class CmsReplaceDialog { /** * Starts the loading animation . < p >
* Used while client is loading files from hard disk into memory . < p >
* @ param msg the message that should be displayed below the loading animation ( can also be HTML as String )
* @ param delayMillis the delay to start the animation with */
private void startLoadingAnimation ( final String msg , int delayMillis ) { } } | m_loadingTimer = new Timer ( ) { @ Override public void run ( ) { m_mainPanel . showLoadingAnimation ( msg ) ; } } ; if ( delayMillis > 0 ) { m_loadingTimer . schedule ( delayMillis ) ; } else { m_loadingTimer . run ( ) ; } |
public class ChannelPool { /** * { @ inheritDoc }
* Create a { @ link ClientCall } on a Channel from the pool chosen in a round - robin fashion to the
* remote operation specified by the given { @ link MethodDescriptor } . The returned
* { @ link ClientCall } does not trigger any remote behavior until
* { @ link ClientCall # start ( ClientCall . Listener , io . grpc . Metadata ) } is invoked . */
@ Override public < ReqT , RespT > ClientCall < ReqT , RespT > newCall ( MethodDescriptor < ReqT , RespT > methodDescriptor , CallOptions callOptions ) { } } | Preconditions . checkState ( ! shutdown , "Cannot perform operations on a closed connection" ) ; return getNextChannel ( ) . newCall ( methodDescriptor , callOptions ) ; |
public class MultiPolygon { /** * Create a new instance of this class by defining a single { @ link Polygon } objects and passing
* it in as a parameter in this method . The Polygon should comply with the GeoJson
* specifications described in the documentation .
* @ param polygon a single Polygon which make up this MultiPolygon
* @ param bbox optionally include a bbox definition
* @ return a new instance of this class defined by the values passed inside this static factory
* method
* @ since 3.0.0 */
public static MultiPolygon fromPolygon ( @ NonNull Polygon polygon , @ Nullable BoundingBox bbox ) { } } | List < List < List < Point > > > coordinates = Arrays . asList ( polygon . coordinates ( ) ) ; return new MultiPolygon ( TYPE , bbox , coordinates ) ; |
public class CommerceNotificationQueueEntryPersistenceImpl { /** * Returns all the commerce notification queue entries where groupId = & # 63 ; .
* @ param groupId the group ID
* @ return the matching commerce notification queue entries */
@ Override public List < CommerceNotificationQueueEntry > findByGroupId ( long groupId ) { } } | return findByGroupId ( groupId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; |
public class SequentialReader { /** * Returns the sequence of bytes punctuated by a < code > \ 0 < / code > value .
* @ param maxLengthBytes The maximum number of bytes to read . If a < code > \ 0 < / code > byte is not reached within this limit ,
* the returned array will be < code > maxLengthBytes < / code > long .
* @ return The read byte array , excluding the null terminator .
* @ throws IOException The buffer does not contain enough bytes to satisfy this request . */
@ NotNull public byte [ ] getNullTerminatedBytes ( int maxLengthBytes ) throws IOException { } } | byte [ ] buffer = new byte [ maxLengthBytes ] ; // Count the number of non - null bytes
int length = 0 ; while ( length < buffer . length && ( buffer [ length ] = getByte ( ) ) != 0 ) length ++ ; if ( length == maxLengthBytes ) return buffer ; byte [ ] bytes = new byte [ length ] ; if ( length > 0 ) System . arraycopy ( buffer , 0 , bytes , 0 , length ) ; return bytes ; |
public class UserDefinedFunction { /** * The resource URIs for the function .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setResourceUris ( java . util . Collection ) } or { @ link # withResourceUris ( java . util . Collection ) } if you want to
* override the existing values .
* @ param resourceUris
* The resource URIs for the function .
* @ return Returns a reference to this object so that method calls can be chained together . */
public UserDefinedFunction withResourceUris ( ResourceUri ... resourceUris ) { } } | if ( this . resourceUris == null ) { setResourceUris ( new java . util . ArrayList < ResourceUri > ( resourceUris . length ) ) ; } for ( ResourceUri ele : resourceUris ) { this . resourceUris . add ( ele ) ; } return this ; |
public class CollectionUtil { /** * 求两个集合指定区间的交集
* @ param arr1 集合1
* @ param start1 集合1区间起始位置 ( 包含 )
* @ param end1 集合1区间结束位置 ( 不包含 )
* @ param arr2 集合2
* @ param start2 集合2区间起始位置 ( 包含 )
* @ param end2 集合2区间结束位置 ( 不包含 )
* @ param < T > 集合数据类型
* @ return 两个集合指定区间的交集 */
public static < T > List < T > intersection ( List < T > arr1 , int start1 , int end1 , List < T > arr2 , int start2 , int end2 ) { } } | if ( start1 > end1 || start2 > end2 ) { throw new IllegalArgumentException ( "起始位置必须小于等于结束位置" ) ; } if ( start1 == end1 || start2 == end2 ) { return Collections . emptyList ( ) ; } List < T > list = new ArrayList < > ( ) ; for ( int i = start1 ; i < end1 ; i ++ ) { int index = arr2 . indexOf ( arr1 . get ( i ) ) ; if ( index < end2 && index >= start2 ) { list . add ( arr1 . get ( i ) ) ; } } return list ; |
public class TypeChecker { /** * Creates a recursing type checker for a { @ link java . util . Set } .
* @ param elementType The class to check the elements against
* @ return a typechecker for a Set containing elements of the specified type */
public static < T > TypeChecker < Set < ? extends T > > tSet ( Class < ? extends T > elementType ) { } } | return tSet ( tSimple ( elementType ) ) ; |
public class ListAssignmentsForHITRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListAssignmentsForHITRequest listAssignmentsForHITRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listAssignmentsForHITRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listAssignmentsForHITRequest . getHITId ( ) , HITID_BINDING ) ; protocolMarshaller . marshall ( listAssignmentsForHITRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listAssignmentsForHITRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( listAssignmentsForHITRequest . getAssignmentStatuses ( ) , ASSIGNMENTSTATUSES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class LdaGibbsSampler { /** * Configure the gibbs sampler
* @ param iterations
* number of total iterations
* @ param burnIn
* number of burn - in iterations
* @ param thinInterval
* update statistics interval
* @ param sampleLag
* sample interval ( - 1 for just one sample at the end ) */
public void configure ( int iterations , int burnIn , int thinInterval , int sampleLag ) { } } | ITERATIONS = iterations ; BURN_IN = burnIn ; THIN_INTERVAL = thinInterval ; SAMPLE_LAG = sampleLag ; |
public class ListView { /** * Handles the configuration submission .
* Load view - specific properties here . */
@ Override protected void submit ( StaplerRequest req ) throws ServletException , FormException , IOException { } } | JSONObject json = req . getSubmittedForm ( ) ; synchronized ( this ) { recurse = json . optBoolean ( "recurse" , true ) ; jobNames . clear ( ) ; Iterable < ? extends TopLevelItem > items ; if ( recurse ) { items = getOwner ( ) . getItemGroup ( ) . getAllItems ( TopLevelItem . class ) ; } else { items = getOwner ( ) . getItemGroup ( ) . getItems ( ) ; } for ( TopLevelItem item : items ) { String relativeNameFrom = item . getRelativeNameFrom ( getOwner ( ) . getItemGroup ( ) ) ; if ( req . getParameter ( relativeNameFrom ) != null ) { jobNames . add ( relativeNameFrom ) ; } } } setIncludeRegex ( req . getParameter ( "useincluderegex" ) != null ? req . getParameter ( "includeRegex" ) : null ) ; if ( columns == null ) { columns = new DescribableList < > ( this ) ; } columns . rebuildHetero ( req , json , ListViewColumn . all ( ) , "columns" ) ; if ( jobFilters == null ) { jobFilters = new DescribableList < > ( this ) ; } jobFilters . rebuildHetero ( req , json , ViewJobFilter . all ( ) , "jobFilters" ) ; String filter = Util . fixEmpty ( req . getParameter ( "statusFilter" ) ) ; statusFilter = filter != null ? "1" . equals ( filter ) : null ; |
public class SchemasInner { /** * Gets a list of integration account schemas .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ 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 PagedList & lt ; IntegrationAccountSchemaInner & gt ; object if successful . */
public PagedList < IntegrationAccountSchemaInner > listByIntegrationAccountsNext ( final String nextPageLink ) { } } | ServiceResponse < Page < IntegrationAccountSchemaInner > > response = listByIntegrationAccountsNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) ; return new PagedList < IntegrationAccountSchemaInner > ( response . body ( ) ) { @ Override public Page < IntegrationAccountSchemaInner > nextPage ( String nextPageLink ) { return listByIntegrationAccountsNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ; |
public class AbstractApi { /** * Returns the group ID or path from the provided Integer , String , or Group instance .
* @ param obj the object to determine the ID or path from
* @ return the group ID or path from the provided Integer , String , or Group instance
* @ throws GitLabApiException if any exception occurs during execution */
public Object getGroupIdOrPath ( Object obj ) throws GitLabApiException { } } | if ( obj == null ) { throw ( new RuntimeException ( "Cannot determine ID or path from null object" ) ) ; } else if ( obj instanceof Integer ) { return ( obj ) ; } else if ( obj instanceof String ) { return ( urlEncode ( ( ( String ) obj ) . trim ( ) ) ) ; } else if ( obj instanceof Group ) { Integer id = ( ( Group ) obj ) . getId ( ) ; if ( id != null && id . intValue ( ) > 0 ) { return ( id ) ; } String path = ( ( Group ) obj ) . getFullPath ( ) ; if ( path != null && path . trim ( ) . length ( ) > 0 ) { return ( urlEncode ( path . trim ( ) ) ) ; } throw ( new RuntimeException ( "Cannot determine ID or path from provided Group instance" ) ) ; } else { throw ( new RuntimeException ( "Cannot determine ID or path from provided " + obj . getClass ( ) . getSimpleName ( ) + " instance, must be Integer, String, or a Group instance" ) ) ; } |
public class CmsLocationController { /** * Adds a callback to be executed once the API is ready . Will be executed right away if the API is already loaded . < p >
* @ param callback the callback */
private void onApiReady ( Command callback ) { } } | if ( isApiLoaded ( ) ) { callback . execute ( ) ; } else { onApiReady . add ( callback ) ; if ( ! loadingApi ) { loadingApi = true ; loadApi ( ) ; } } |
public class WktService { /** * Get the SRID from a string like " SRDI = 4326 " . Used in parsing EWKT . */
private static int parseSrid ( String ewktPart ) { } } | if ( ewktPart != null && ! "" . equals ( ewktPart ) ) { String [ ] parts = ewktPart . split ( "=" ) ; if ( parts . length == 2 ) { try { return Integer . parseInt ( parts [ 1 ] ) ; } catch ( Exception e ) { } } } return 0 ; |
public class MesosToSchedulerDriverAdapter { /** * Task that performs Subscription . */
private synchronized void performReliableSubscription ( ) { } } | // If timer is not running , initialize it .
if ( subscriberTimer == null ) { LOGGER . info ( "Initializing reliable subscriber" ) ; subscriberTimer = createTimerInternal ( ) ; ExponentialBackOff backOff = new ExponentialBackOff . Builder ( ) . setMaxElapsedTimeMillis ( Integer . MAX_VALUE /* Try forever */
) . setMaxIntervalMillis ( MAX_BACKOFF_MS ) . setMultiplier ( MULTIPLIER ) . setRandomizationFactor ( 0.5 ) . setInitialIntervalMillis ( SEED_BACKOFF_MS ) . build ( ) ; subscriberTimer . schedule ( new SubscriberTask ( backOff ) , SEED_BACKOFF_MS , TimeUnit . MILLISECONDS ) ; } |
public class DelegatingWriter { /** * Delegates the close operation to all delegates and merges any occurred exceptions into a single { @ link IOException } .
* @ throws IOException in case at least one of the delegate writers threw an exception while closing .
* < em > Please note : < / em > Attempts are made to close all delegates . */
@ Override public void close ( ) throws IOException { } } | List < Exception > closeExceptions = new ArrayList < > ( delegates . size ( ) ) ; for ( Writer delegate : delegates ) { try { delegate . close ( ) ; } catch ( IOException | RuntimeException closeException ) { closeExceptions . add ( closeException ) ; } } if ( ! closeExceptions . isEmpty ( ) ) { throw mergeExceptions ( "closing" , closeExceptions ) ; } |
public class SpecializedOps_ZDRM { /** * Computes the householder vector used in QR decomposition .
* u = x / max ( x )
* u ( 0 ) = u ( 0 ) + | u |
* u = u / u ( 0)
* @ param x Input vector . Unmodified .
* @ return The found householder reflector vector */
public static ZMatrixRMaj householderVector ( ZMatrixRMaj x ) { } } | ZMatrixRMaj u = x . copy ( ) ; double max = CommonOps_ZDRM . elementMaxAbs ( u ) ; CommonOps_ZDRM . elementDivide ( u , max , 0 , u ) ; double nx = NormOps_ZDRM . normF ( u ) ; Complex_F64 c = new Complex_F64 ( ) ; u . get ( 0 , 0 , c ) ; double realTau , imagTau ; if ( c . getMagnitude ( ) == 0 ) { realTau = nx ; imagTau = 0 ; } else { realTau = c . real / c . getMagnitude ( ) * nx ; imagTau = c . imaginary / c . getMagnitude ( ) * nx ; } u . set ( 0 , 0 , c . real + realTau , c . imaginary + imagTau ) ; CommonOps_ZDRM . elementDivide ( u , u . getReal ( 0 , 0 ) , u . getImag ( 0 , 0 ) , u ) ; return u ; |
public class PassiveState { /** * Applies a query to the state machine . */
protected CompletableFuture < QueryResponse > applyQuery ( QueryEntry entry , CompletableFuture < QueryResponse > future ) { } } | // In the case of the leader , the state machine is always up to date , so no queries will be queued and all query
// indexes will be the last applied index .
context . getStateMachine ( ) . < ServerStateMachine . Result > apply ( entry ) . whenComplete ( ( result , error ) -> { completeOperation ( result , QueryResponse . builder ( ) , error , future ) ; entry . release ( ) ; } ) ; return future ; |
public class DirectSchedulerFactory { /** * Creates a scheduler using the specified thread pool , job store , and
* plugins , and binds it to RMI .
* @ param schedulerName
* The name for the scheduler .
* @ param schedulerInstanceId
* The instance ID for the scheduler .
* @ param threadPool
* The thread pool for executing jobs
* @ param threadExecutor
* The thread executor for executing jobs
* @ param jobStore
* The type of job store
* @ param schedulerPluginMap
* Map from a < code > String < / code > plugin names to
* < code > { @ link com . helger . quartz . spi . ISchedulerPlugin } < / code > s . Can
* use " null " if no plugins are required .
* @ param idleWaitTime
* The idle wait time in milliseconds . You can specify " - 1 " for the
* default value , which is currently 30000 ms .
* @ throws SchedulerException
* if initialization failed */
public void createScheduler ( final String schedulerName , final String schedulerInstanceId , final IThreadPool threadPool , final IThreadExecutor threadExecutor , final IJobStore jobStore , final Map < String , ISchedulerPlugin > schedulerPluginMap , final long idleWaitTime ) throws SchedulerException { } } | createScheduler ( schedulerName , schedulerInstanceId , threadPool , DEFAULT_THREAD_EXECUTOR , jobStore , schedulerPluginMap , idleWaitTime , DEFAULT_BATCH_MAX_SIZE , DEFAULT_BATCH_TIME_WINDOW ) ; |
public class ConcurrentUsersStatisticsController { /** * Create a map of the report column discriminators based on the submitted form to collate the
* aggregation data into each column of a report . The map entries are a time - ordered sorted set
* of aggregation data points .
* @ param form Form submitted by the user
* @ return Map of report column discriminators to sorted set of time - based aggregation data */
@ Override protected Map < ConcurrentUserAggregationDiscriminator , SortedSet < ConcurrentUserAggregation > > createColumnDiscriminatorMap ( ConcurrentUserReportForm form ) { } } | return getDefaultGroupedColumnDiscriminatorMap ( form ) ; |
public class IOUtil { /** * Returns the offset where the first byte is written . This method assumes that 5 bytes will be writable starting at
* the { @ code variableOffset } . */
static int putVarInt32AndGetOffset ( final int value , final byte [ ] buffer , final int variableOffset ) { } } | switch ( ProtobufOutput . computeRawVarint32Size ( value ) ) { case 1 : buffer [ variableOffset + 4 ] = ( byte ) value ; return variableOffset + 4 ; case 2 : buffer [ variableOffset + 3 ] = ( byte ) ( ( value & 0x7F ) | 0x80 ) ; buffer [ variableOffset + 4 ] = ( byte ) ( value >>> 7 ) ; return variableOffset + 3 ; case 3 : buffer [ variableOffset + 2 ] = ( byte ) ( ( value & 0x7F ) | 0x80 ) ; buffer [ variableOffset + 3 ] = ( byte ) ( ( value >>> 7 & 0x7F ) | 0x80 ) ; buffer [ variableOffset + 4 ] = ( byte ) ( value >>> 14 ) ; return variableOffset + 2 ; case 4 : buffer [ variableOffset + 1 ] = ( byte ) ( ( value & 0x7F ) | 0x80 ) ; buffer [ variableOffset + 2 ] = ( byte ) ( ( value >>> 7 & 0x7F ) | 0x80 ) ; buffer [ variableOffset + 3 ] = ( byte ) ( ( value >>> 14 & 0x7F ) | 0x80 ) ; buffer [ variableOffset + 4 ] = ( byte ) ( value >>> 21 ) ; return variableOffset + 1 ; default : buffer [ variableOffset ] = ( byte ) ( ( value & 0x7F ) | 0x80 ) ; buffer [ variableOffset + 1 ] = ( byte ) ( ( value >>> 7 & 0x7F ) | 0x80 ) ; buffer [ variableOffset + 2 ] = ( byte ) ( ( value >>> 14 & 0x7F ) | 0x80 ) ; buffer [ variableOffset + 3 ] = ( byte ) ( ( value >>> 21 & 0x7F ) | 0x80 ) ; buffer [ variableOffset + 4 ] = ( byte ) ( value >>> 28 ) ; return variableOffset ; } |
public class Range { /** * Creates a stream that contains a given number of integers starting from a given number .
* @ param from a staring value
* @ param to an ending value , exclusive
* @ param step the value to add to for the next item
* @ return a stream that contains a given number of integers starting from a given number . */
public static Stream < Integer > range ( final int from , final int to , final int step ) { } } | return new Stream < Integer > ( ) { @ Override public Iterator < Integer > iterator ( ) { return new ReadOnlyIterator < Integer > ( ) { int value = from ; @ Override public boolean hasNext ( ) { return value < to ; } @ Override public Integer next ( ) { final int v = value ; value += step ; return v ; } } ; } } ; |
public class Equation { /** * Parses the equation and compiles it into a sequence which can be executed later on
* @ param equation String in simple equation format .
* @ param assignment if true an assignment is expected and an exception if thrown if there is non
* @ param debug if true it will print out debugging information
* @ return Sequence of operations on the variables */
public Sequence compile ( String equation , boolean assignment , boolean debug ) { } } | functions . setManagerTemp ( managerTemp ) ; Sequence sequence = new Sequence ( ) ; TokenList tokens = extractTokens ( equation , managerTemp ) ; if ( tokens . size ( ) < 3 ) throw new RuntimeException ( "Too few tokens" ) ; TokenList . Token t0 = tokens . getFirst ( ) ; if ( t0 . word != null && t0 . word . compareToIgnoreCase ( "macro" ) == 0 ) { parseMacro ( tokens , sequence ) ; } else { insertFunctionsAndVariables ( tokens ) ; insertMacros ( tokens ) ; if ( debug ) { System . out . println ( "Parsed tokens:\n------------" ) ; tokens . print ( ) ; System . out . println ( ) ; } // Get the results variable
if ( t0 . getType ( ) != Type . VARIABLE && t0 . getType ( ) != Type . WORD ) { compileTokens ( sequence , tokens ) ; // If there ' s no output then this is acceptable , otherwise it ' s assumed to be a bug
// If there ' s no output then a configuration was changed
Variable variable = tokens . getFirst ( ) . getVariable ( ) ; if ( variable != null ) { if ( assignment ) throw new IllegalArgumentException ( "No assignment to an output variable could be found. Found " + t0 ) ; else { sequence . output = variable ; // set this to be the output for print ( )
} } } else { compileAssignment ( sequence , tokens , t0 ) ; } if ( debug ) { System . out . println ( "Operations:\n------------" ) ; for ( int i = 0 ; i < sequence . operations . size ( ) ; i ++ ) { System . out . println ( sequence . operations . get ( i ) . name ( ) ) ; } } } return sequence ; |
public class CmsPublishGroupPanel { /** * Fills a slot for a button in a publish list item widget . < p >
* @ param listItemWidget the list item widget
* @ param index the slot index
* @ param widget the widget which should be displayed in the slot
* @ param slotMapping array mapping logical slot ids to button indexes */
private static void fillButtonSlot ( CmsListItemWidget listItemWidget , int index , Widget widget , int [ ] slotMapping ) { } } | int realIndex = slotMapping [ index ] ; if ( realIndex >= 0 ) { SimplePanel panel = ( SimplePanel ) listItemWidget . getButton ( slotMapping [ index ] ) ; panel . clear ( ) ; panel . add ( widget ) ; } |
public class ServerAdvisorsInner { /** * Updates a server advisor .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server .
* @ param advisorName The name of the Server Advisor .
* @ param autoExecuteStatus Gets the auto - execute status ( whether to let the system execute the recommendations ) of this advisor . Possible values are ' Enabled ' and ' Disabled ' . Possible values include : ' Enabled ' , ' Disabled ' , ' Default '
* @ 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 < AdvisorInner > updateAsync ( String resourceGroupName , String serverName , String advisorName , AutoExecuteStatus autoExecuteStatus , final ServiceCallback < AdvisorInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( updateWithServiceResponseAsync ( resourceGroupName , serverName , advisorName , autoExecuteStatus ) , serviceCallback ) ; |
public class GetMetricStatisticsRequest { /** * The percentile statistics . Specify values between p0.0 and p100 . When calling < code > GetMetricStatistics < / code > ,
* you must specify either < code > Statistics < / code > or < code > ExtendedStatistics < / code > , but not both . Percentile
* statistics are not available for metrics when any of the metric values are negative numbers .
* @ return The percentile statistics . Specify values between p0.0 and p100 . When calling
* < code > GetMetricStatistics < / code > , you must specify either < code > Statistics < / code > or
* < code > ExtendedStatistics < / code > , but not both . Percentile statistics are not available for metrics when
* any of the metric values are negative numbers . */
public java . util . List < String > getExtendedStatistics ( ) { } } | if ( extendedStatistics == null ) { extendedStatistics = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return extendedStatistics ; |
public class Iso9660VolumeDescriptorSet { /** * Read the fields of a primary volume descriptor .
* @ param descriptor the descriptor bytes
* @ throws IOException */
private void deserializePrimary ( byte [ ] descriptor ) throws IOException { } } | // according to the spec , some ISO 9660 file systems can contain multiple identical primary
// volume descriptors
if ( this . hasPrimary ) { return ; } validateBlockSize ( descriptor ) ; if ( ! this . hasSupplementary ) { deserializeCommon ( descriptor ) ; } this . standardIdentifier = Util . getDChars ( descriptor , 2 , 5 ) ; this . volumeSetSize = Util . getUInt16Both ( descriptor , 121 ) ; this . volumeSequenceNumber = Util . getUInt16Both ( descriptor , 125 ) ; this . totalBlocks = Util . getUInt32Both ( descriptor , 81 ) ; this . publisher = Util . getDChars ( descriptor , 319 , 128 ) ; this . preparer = Util . getDChars ( descriptor , 447 , 128 ) ; this . application = Util . getDChars ( descriptor , 575 , 128 ) ; // this . copyrightFile = Descriptor . get ( buffer , 703 , 37)
// this . abstractFile = Descriptor . get ( buffer , 740 , 37)
// this . bibliographicalFile = Descriptor . get ( buffer , 777 , 37)
this . creationTime = Util . getStringDate ( descriptor , 814 ) ; this . mostRecentModificationTime = Util . getStringDate ( descriptor , 831 ) ; this . expirationTime = Util . getStringDate ( descriptor , 848 ) ; this . effectiveTime = Util . getStringDate ( descriptor , 865 ) ; this . pathTableSize = Util . getUInt32Both ( descriptor , 133 ) ; this . locationOfLittleEndianPathTable = Util . getUInt32LE ( descriptor , 141 ) ; this . locationOfOptionalLittleEndianPathTable = Util . getUInt32LE ( descriptor , 145 ) ; this . locationOfBigEndianPathTable = Util . getUInt32BE ( descriptor , 149 ) ; this . locationOfOptionalBigEndianPathTable = Util . getUInt32BE ( descriptor , 153 ) ; this . hasPrimary = true ; |
public class MD5OutputStream { /** * Writes a byte . */
@ Override public void write ( int b ) throws IOException { } } | out . write ( b ) ; md5 . Update ( ( byte ) b ) ; |
public class TreeScanner { /** * { @ inheritDoc } This implementation scans the children in left to right order .
* @ param node { @ inheritDoc }
* @ param p { @ inheritDoc }
* @ return the result of scanning */
@ Override public R visitIntersectionType ( IntersectionTypeTree node , P p ) { } } | return scan ( node . getBounds ( ) , p ) ; |
public class FacesImpl { /** * Identify unknown faces from a person group .
* @ param personGroupId PersonGroupId of the target person group , created by PersonGroups . Create
* @ param faceIds Array of query faces faceIds , created by the Face - Detect . Each of the faces are identified independently . The valid number of faceIds is between [ 1 , 10 ] .
* @ param identifyOptionalParameter the object representing the optional parameters to be set before calling this API
* @ 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 < List < IdentifyResult > > identifyAsync ( String personGroupId , List < UUID > faceIds , IdentifyOptionalParameter identifyOptionalParameter , final ServiceCallback < List < IdentifyResult > > serviceCallback ) { } } | return ServiceFuture . fromResponse ( identifyWithServiceResponseAsync ( personGroupId , faceIds , identifyOptionalParameter ) , serviceCallback ) ; |
public class RectangleArranger { /** * Get the position data of the object
* @ param object Query object
* @ return Position information : x , y , w , h */
public double [ ] get ( T object ) { } } | double [ ] v = map . get ( object ) ; if ( v == null ) { return null ; } return v . clone ( ) ; |
public class Buffer { /** * Sets the data in this buffer . */
public void setData ( int format , ShortBuffer data , int frequency ) { } } | AL10 . alBufferData ( _id , format , data , frequency ) ; |
public class XMLSerializer { /** * Write characters .
* @ param text character data
* @ throws SAXException if processing the event failed
* @ throws IllegalStateException if start element is not open */
public void writeCharacters ( final String text ) throws SAXException { } } | if ( elementStack . isEmpty ( ) ) { throw new IllegalStateException ( "Current state does not allow Character writing" ) ; } final char [ ] ch = text . toCharArray ( ) ; writeCharacters ( ch , 0 , ch . length ) ; |
public class SM2Engine { /** * 增加字段节点
* @ param digest
* @ param v */
private void addFieldElement ( ECFieldElement v ) { } } | final byte [ ] p = BigIntegers . asUnsignedByteArray ( this . curveLength , v . toBigInteger ( ) ) ; this . digest . update ( p , 0 , p . length ) ; |
public class AbstractThriftMetadataBuilder { /** * Assigns all fields an id if possible . Fields are grouped by name and for each group , if there
* is a single id , all fields in the group are assigned this id . If the group has multiple ids ,
* an error is reported . */
protected final Set < String > inferThriftFieldIds ( ) { } } | Set < String > fieldsWithConflictingIds = new HashSet < > ( ) ; // group fields by explicit name or by name extracted from field , method or property
Multimap < String , FieldMetadata > fieldsByExplicitOrExtractedName = Multimaps . index ( fields , getOrExtractThriftFieldName ( ) ) ; inferThriftFieldIds ( fieldsByExplicitOrExtractedName , fieldsWithConflictingIds ) ; // group fields by name extracted from field , method or property
// this allows thrift name to be set explicitly without having to duplicate the name on getters and setters
// todo should this be the only way this works ?
Multimap < String , FieldMetadata > fieldsByExtractedName = Multimaps . index ( fields , extractThriftFieldName ( ) ) ; inferThriftFieldIds ( fieldsByExtractedName , fieldsWithConflictingIds ) ; return fieldsWithConflictingIds ; |
public class JKTableColumn { /** * Checks if is numeric .
* @ return true , if is numeric */
public boolean isNumeric ( ) { } } | final Class c = getColumnClass ( ) ; return c . equals ( Integer . class ) || c . equals ( Float . class ) || c . equals ( Long . class ) || c . equals ( BigDecimal . class ) ; |
public class Applications { /** * Applies a side effect on each elements of the source array . This
* application is evaluated eagerly .
* < code >
* > each ( [ 1,2 ] , println ) - > void
* < / code >
* @ param < E > the array element type parameter
* @ param array the array where elements are fetched from
* @ param consumer the consumer applied to every element fetched from the array */
public static < E > void each ( E [ ] array , Consumer < E > consumer ) { } } | dbc . precondition ( array != null , "cannot call each with a null array" ) ; dbc . precondition ( consumer != null , "cannot call each with a null consumer" ) ; for ( int i = 0 ; i != array . length ; ++ i ) { consumer . accept ( array [ i ] ) ; } |
public class DomainsInner { /** * Get domain name recommendations based on keywords .
* Get domain name recommendations based on keywords .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws DefaultErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the PagedList & lt ; NameIdentifierInner & gt ; object if successful . */
public PagedList < NameIdentifierInner > listRecommendationsNext ( final String nextPageLink ) { } } | ServiceResponse < Page < NameIdentifierInner > > response = listRecommendationsNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) ; return new PagedList < NameIdentifierInner > ( response . body ( ) ) { @ Override public Page < NameIdentifierInner > nextPage ( String nextPageLink ) { return listRecommendationsNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ; |
public class ClassInfoList { /** * Find the union of this { @ link ClassInfoList } with one or more others .
* @ param others
* The other { @ link ClassInfoList } s to union with this one .
* @ return The union of this { @ link ClassInfoList } with the others . */
public ClassInfoList union ( final ClassInfoList ... others ) { } } | final Set < ClassInfo > reachableClassesUnion = new LinkedHashSet < > ( this ) ; final Set < ClassInfo > directlyRelatedClassesUnion = new LinkedHashSet < > ( directlyRelatedClasses ) ; for ( final ClassInfoList other : others ) { reachableClassesUnion . addAll ( other ) ; directlyRelatedClassesUnion . addAll ( other . directlyRelatedClasses ) ; } return new ClassInfoList ( reachableClassesUnion , directlyRelatedClassesUnion , sortByName ) ; |
public class SecStrucState { /** * Set the turn column corresponding to 3,4 or 5 helix patterns . If starting
* > or ending < was set and the opposite is being set , the value will be
* converted to X . If a number was set , it will be overwritten by the new
* character .
* @ param c
* character in the column
* @ param t
* turn of the helix { 3,4,5} */
public void setTurn ( char c , int t ) { } } | if ( turn [ t - 3 ] == 'X' ) return ; else if ( turn [ t - 3 ] == '<' && c == '>' || turn [ t - 3 ] == '>' && c == '<' ) { turn [ t - 3 ] = 'X' ; } else if ( turn [ t - 3 ] == '<' || turn [ t - 3 ] == '>' ) return ; else turn [ t - 3 ] = c ; |
public class CodeGenerator { /** * generate import code
* @ param code */
private void genImportCode ( StringBuilder code ) { } } | code . append ( "import com.google.protobuf.*" ) . append ( JAVA_LINE_BREAK ) ; code . append ( "import java.io.IOException" ) . append ( JAVA_LINE_BREAK ) ; code . append ( "import com.baidu.bjf.remoting.protobuf.utils.*" ) . append ( JAVA_LINE_BREAK ) ; code . append ( "import com.baidu.bjf.remoting.protobuf.code.*" ) . append ( JAVA_LINE_BREAK ) ; code . append ( "import java.lang.reflect.*" ) . append ( JAVA_LINE_BREAK ) ; code . append ( "import com.baidu.bjf.remoting.protobuf.*" ) . append ( JAVA_LINE_BREAK ) ; code . append ( "import java.util.*" ) . append ( JAVA_LINE_BREAK ) ; if ( ! StringUtils . isEmpty ( getPackage ( ) ) ) { code . append ( "import " ) . append ( ClassHelper . getInternalName ( cls . getCanonicalName ( ) ) ) . append ( JAVA_LINE_BREAK ) ; } |
public class Strings { /** * Returns the number of times the token appears in the target .
* @ param token Token value to be counted .
* @ param target Target value to count tokens in .
* @ return the number of tokens . */
@ SuppressWarnings ( "ConstantConditions" ) @ Beta public static int countToken ( @ Nullable String target , String token ) { } } | checkArgument ( token != null && ! token . isEmpty ( ) , "Expected non-empty token, got: '%s'" , token ) ; if ( isNullOrEmpty ( target ) ) { return 0 ; } int count = 0 ; int tokenIndex = 0 ; while ( ( tokenIndex = target . indexOf ( token , tokenIndex ) ) != - 1 ) { count ++ ; tokenIndex += token . length ( ) ; } return count ; |
public class RemovePreferenceHeaderDialogBuilder { /** * Returns a list , which contains the titles of all navigation preferences , which are contained
* by a specific collection .
* @ param navigationPreferences
* A collection , which contains the navigation preferences , whose title should be
* returned , as an instance of the type { @ link Collection }
* @ return A list , which contains the title of the given navigation preferences , as an instance
* of the type { @ link List } */
private List < CharSequence > getNavigationPreferenceTitles ( final Collection < NavigationPreference > navigationPreferences ) { } } | List < CharSequence > titles = new LinkedList < > ( ) ; for ( NavigationPreference navigationPreference : navigationPreferences ) { titles . add ( navigationPreference . getTitle ( ) ) ; } return titles ; |
public class DiskBuffer { /** * Attempts to open and deserialize a single { @ link Event } from a { @ link File } .
* @ param eventFile File to deserialize into an Event
* @ return Event from the File , or null */
private Event fileToEvent ( File eventFile ) { } } | Object eventObj ; try ( FileInputStream fileInputStream = new FileInputStream ( new File ( eventFile . getAbsolutePath ( ) ) ) ; ObjectInputStream ois = new ObjectInputStream ( fileInputStream ) ) { eventObj = ois . readObject ( ) ; } catch ( FileNotFoundException e ) { // event was deleted while we were iterating the array of files
return null ; } catch ( Exception e ) { logger . error ( "Error reading Event file: " + eventFile . getAbsolutePath ( ) , e ) ; if ( ! eventFile . delete ( ) ) { logger . warn ( "Failed to delete Event: " + eventFile . getAbsolutePath ( ) ) ; } return null ; } try { return ( Event ) eventObj ; } catch ( Exception e ) { logger . error ( "Error casting Object to Event: " + eventFile . getAbsolutePath ( ) , e ) ; if ( ! eventFile . delete ( ) ) { logger . warn ( "Failed to delete Event: " + eventFile . getAbsolutePath ( ) ) ; } return null ; } |
public class LittleEndianRandomAccessFile { /** * Reads a two byte signed { @ code short } from the underlying
* input stream in little endian order , low byte first .
* @ return the { @ code short } read .
* @ throws EOFException if the end of the underlying input stream
* has been reached
* @ throws IOException if the underlying stream throws an IOException . */
public short readShort ( ) throws IOException { } } | int byte1 = file . read ( ) ; int byte2 = file . read ( ) ; // only need to test last byte read
// if byte1 is - 1 so is byte2
if ( byte2 < 0 ) { throw new EOFException ( ) ; } return ( short ) ( ( ( byte2 << 24 ) >>> 16 ) + ( byte1 << 24 ) >>> 24 ) ; |
public class PreparedStatement { /** * { @ inheritDoc } */
public void setObject ( final int parameterIndex , final Object x , final int targetSqlType , final int scaleOrLength ) throws SQLException { } } | if ( ! Defaults . jdbcTypeMappings . containsKey ( targetSqlType ) ) { throw new SQLFeatureNotSupportedException ( ) ; } // end of if
if ( x == null ) { setNull ( parameterIndex , targetSqlType ) ; return ; } // end of if
switch ( targetSqlType ) { case Types . DOUBLE : case Types . REAL : case Types . FLOAT : case Types . NUMERIC : case Types . DECIMAL : setParam ( parameterIndex , Scaled ( targetSqlType , scaleOrLength ) , x ) ; break ; default : setParam ( parameterIndex , Default ( targetSqlType ) , x ) ; break ; } |
public class DescribeNFSFileSharesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeNFSFileSharesRequest describeNFSFileSharesRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeNFSFileSharesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeNFSFileSharesRequest . getFileShareARNList ( ) , FILESHAREARNLIST_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class GosuClassTransformer { /** * # # hack :
* Potentially generates a bridge method for an overridden method where the super method is in a proxy
* and the proxy is for a Java interface having param types that are transformed to non - bytecode types
* in the type system .
* E . g . , A guidewire platform plugin interface may declare UserBase or the like as a parameter type ,
* which is always represented as the corresponding app derivative : UserBase - > CC ' s User . Essentially ,
* we need to generate a bridge method to make the otherwise unsavory covariant parameter types work
* in method overrides . */
private boolean genProxyCovariantBridgeMethod ( DynamicFunctionSymbol dfs , DynamicFunctionSymbol superDfs ) { } } | IGosuClassInternal superType = ( IGosuClassInternal ) superDfs . getScriptPart ( ) . getContainingType ( ) ; if ( superType . isProxy ( ) ) { IJavaType javaType = superType . getJavaType ( ) ; javaType = ( IJavaType ) TypeLord . getDefaultParameterizedType ( javaType ) ; IType [ ] dfsArgTypes = dfs . getArgTypes ( ) ; IType [ ] defDfsArgTypes = new IType [ dfsArgTypes . length ] ; for ( int i = 0 ; i < dfsArgTypes . length ; i ++ ) { defDfsArgTypes [ i ] = TypeLord . getDefaultParameterizedTypeWithTypeVars ( dfsArgTypes [ i ] ) ; } IJavaMethodInfo mi = ( IJavaMethodInfo ) ( ( IRelativeTypeInfo ) javaType . getTypeInfo ( ) ) . getMethod ( javaType , NameResolver . getFunctionName ( dfs ) , defDfsArgTypes ) ; if ( mi == null ) { // Probably a generic method ; the caller will gen bridge method for this
return false ; } IJavaClassMethod method = mi . getMethod ( ) ; IJavaClassInfo [ ] paramClasses = method . getParameterTypes ( ) ; for ( int i = 0 ; i < paramClasses . length ; i ++ ) { if ( ! AbstractElementTransformer . isBytecodeType ( defDfsArgTypes [ i ] ) ) { String dfsParamClass = getDescriptor ( defDfsArgTypes [ i ] ) . getName ( ) . replace ( '$' , '.' ) ; if ( ! dfsParamClass . equals ( paramClasses [ i ] . getName ( ) . replace ( '$' , '.' ) ) ) { makeCovariantParamBridgeMethod ( dfs , superDfs , method ) ; return true ; } } } if ( ! AbstractElementTransformer . isBytecodeType ( superDfs . getReturnType ( ) ) ) { String returnClassName = getDescriptor ( method . getReturnClassInfo ( ) ) . getName ( ) ; String superReturnClassName = getDescriptor ( superDfs . getReturnType ( ) ) . getName ( ) ; if ( ! returnClassName . equals ( superReturnClassName ) ) { makeCovariantParamBridgeMethod ( dfs , superDfs , method ) ; return true ; } } } return false ; |
public class ClusterState { /** * Returns a list of member states for the given type .
* @ param type The member type .
* @ return A list of member states for the given type . */
public List < MemberState > getRemoteMemberStates ( Member . Type type ) { } } | List < MemberState > members = memberTypes . get ( type ) ; return members != null ? members : Collections . EMPTY_LIST ; |
public class StandardBullhornData { /** * { @ inheritDoc } */
@ Override public < T extends EditHistoryEntity > FieldChangeListWrapper queryEntityForEditHistoryFieldChanges ( Class < T > entityType , String where , Set < String > fieldSet , QueryParams params ) { } } | return this . handleQueryForEntityEditHistoryFieldChange ( entityType , where , fieldSet , params ) ; |
public class Configuration { /** * Write property and its attributes as json format to given
* { @ link JsonGenerator } .
* @ param jsonGen json writer
* @ param config configuration
* @ param name property name
* @ throws IOException */
private static void appendJSONProperty ( JsonGenerator jsonGen , Configuration config , String name , ConfigRedactor redactor ) throws IOException { } } | // skip writing if given property name is empty or null
if ( ! Strings . isNullOrEmpty ( name ) && jsonGen != null ) { jsonGen . writeStartObject ( ) ; jsonGen . writeStringField ( "key" , name ) ; jsonGen . writeStringField ( "value" , redactor . redact ( name , config . get ( name ) ) ) ; jsonGen . writeBooleanField ( "isFinal" , config . finalParameters . contains ( name ) ) ; String [ ] resources = config . updatingResource != null ? config . updatingResource . get ( name ) : null ; String resource = UNKNOWN_RESOURCE ; if ( resources != null && resources . length > 0 ) { resource = resources [ 0 ] ; } jsonGen . writeStringField ( "resource" , resource ) ; jsonGen . writeEndObject ( ) ; } |
public class View { public Options getOptionsFor ( ClassDoc cd ) { } } | Options localOpt = getGlobalOptions ( ) ; overrideForClass ( localOpt , cd ) ; localOpt . setOptions ( cd ) ; return localOpt ; |
public class OrientedBox3f { /** * Change the attributes of the oriented box .
* The thirds axis is computed from the cross product with the two other axis .
* The cross product may be { @ link Vector3f # crossLeftHand ( org . arakhne . afc . math . geometry . d3 . Vector3D ) }
* or { @ link Vector3f # crossRightHand ( org . arakhne . afc . math . geometry . d3 . Vector3D ) } according to
* { @ link CoordinateSystem3D # getDefaultCoordinateSystem ( ) } .
* @ param cx x coordinate of the box center .
* @ param cy y coordinate of the box center .
* @ param cz z coordinate of the box center .
* @ param axis1x x coordinate of the first axis of the box .
* @ param axis1y y coordinate of the first axis of the box .
* @ param axis1z z coordinate of the first axis of the box .
* @ param axis2x x coordinate of the second axis of the box .
* @ param axis2y y coordinate of the secons axis of the box .
* @ param axis2z z coordinate of the second axis of the box .
* @ param axis1Extent extent of the first axis .
* @ param axis2Extent extent of the second axis .
* @ param axis3Extent extent of the third axis . */
@ Override public void set ( double cx , double cy , double cz , double axis1x , double axis1y , double axis1z , double axis2x , double axis2y , double axis2z , double axis1Extent , double axis2Extent , double axis3Extent ) { } } | set ( cx , cy , cz , axis1x , axis1y , axis1z , axis2x , axis2y , axis2z , axis1Extent , axis2Extent , axis3Extent , CoordinateSystem3D . getDefaultCoordinateSystem ( ) ) ; |
public class CmsWorkplaceManager { /** * Controls if the user / group icon in the administration view should be shown . < p >
* @ param value < code > " true " < / code > if the user / group icon in the administration view should be shown , otherwise false */
public void setUserManagementEnabled ( String value ) { } } | m_showUserGroupIcon = Boolean . valueOf ( value ) . booleanValue ( ) ; if ( CmsLog . INIT . isInfoEnabled ( ) ) { if ( m_showUserGroupIcon ) { CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_USER_MANAGEMENT_ICON_ENABLED_0 ) ) ; } else { CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_USER_MANAGEMENT_ICON_DISABLED_0 ) ) ; } } |
public class JBaseScreen { /** * Free the resources held by this object .
* Besides freeing all the sub - screens , this method disconnects all of my
* fields from their controls . */
public void free ( ) { } } | super . free ( ) ; // Free the sub - screens first !
if ( m_vFieldListList != null ) { for ( int i = m_vFieldListList . size ( ) - 1 ; i >= 0 ; i -- ) { // Step 1 - Disconnect the controls from the fields
FieldList fieldList = this . getFieldList ( i ) ; if ( fieldList != null ) { this . disconnectControls ( fieldList ) ; if ( fieldList . getOwner ( ) == this ) fieldList . free ( ) ; } } if ( m_vFieldListList != null ) m_vFieldListList . clear ( ) ; // Note JBaseField . free ( ) frees all the field lists
m_vFieldListList = null ; } |
public class PostgreSqlRepositoryCollection { /** * Updates foreign keys based on referenced entity changes .
* @ param entityType entity meta data
* @ param attr current attribute
* @ param updatedAttr updated attribute */
private void updateRefEntity ( EntityType entityType , Attribute attr , Attribute updatedAttr ) { } } | if ( isSingleReferenceType ( attr ) && isSingleReferenceType ( updatedAttr ) ) { dropForeignKey ( entityType , attr ) ; if ( attr . getRefEntity ( ) . getIdAttribute ( ) . getDataType ( ) != updatedAttr . getRefEntity ( ) . getIdAttribute ( ) . getDataType ( ) ) { updateColumnDataType ( entityType , updatedAttr ) ; } createForeignKey ( entityType , updatedAttr ) ; } else if ( isMultipleReferenceType ( attr ) && isMultipleReferenceType ( updatedAttr ) ) { throw new MolgenisDataException ( format ( "Updating entity [%s] attribute [%s] referenced entity from [%s] to [%s] not allowed for type [%s]" , entityType . getId ( ) , attr . getName ( ) , attr . getRefEntity ( ) . getId ( ) , updatedAttr . getRefEntity ( ) . getId ( ) , updatedAttr . getDataType ( ) . toString ( ) ) ) ; } |
public class GetRestApisResult { /** * The current page of elements from this collection .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setItems ( java . util . Collection ) } or { @ link # withItems ( java . util . Collection ) } if you want to override the
* existing values .
* @ param items
* The current page of elements from this collection .
* @ return Returns a reference to this object so that method calls can be chained together . */
public GetRestApisResult withItems ( RestApi ... items ) { } } | if ( this . items == null ) { setItems ( new java . util . ArrayList < RestApi > ( items . length ) ) ; } for ( RestApi ele : items ) { this . items . add ( ele ) ; } return this ; |
public class DeleteApplicationRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteApplicationRequest deleteApplicationRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteApplicationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteApplicationRequest . getApplicationName ( ) , APPLICATIONNAME_BINDING ) ; protocolMarshaller . marshall ( deleteApplicationRequest . getCreateTimestamp ( ) , CREATETIMESTAMP_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class RadialPickerLayout { /** * For the currently showing view ( either hours , minutes or seconds ) , re - calculate the position
* for the selector , and redraw it at that position . The text representing the currently
* selected value will be redrawn if required .
* @ param newSelection Timpoint - Time which should be selected .
* @ param forceDrawDot The dot in the circle will generally only be shown when the selection
* @ param index The picker to use as a reference . Will be getCurrentItemShow ( ) except when AM / PM is changed
* is on non - visible values , but use this to force the dot to be shown . */
private void reselectSelector ( Timepoint newSelection , boolean forceDrawDot , int index ) { } } | switch ( index ) { case HOUR_INDEX : // The selection might have changed , recalculate the degrees and innerCircle values
int hour = newSelection . getHour ( ) ; boolean isInnerCircle = isHourInnerCircle ( hour ) ; int degrees = ( hour % 12 ) * 360 / 12 ; if ( ! mIs24HourMode ) hour = hour % 12 ; if ( ! mIs24HourMode && hour == 0 ) hour += 12 ; mHourRadialSelectorView . setSelection ( degrees , isInnerCircle , forceDrawDot ) ; mHourRadialTextsView . setSelection ( hour ) ; // If we rounded the minutes , reposition the minuteSelector too .
if ( newSelection . getMinute ( ) != mCurrentTime . getMinute ( ) ) { int minDegrees = newSelection . getMinute ( ) * ( 360 / 60 ) ; mMinuteRadialSelectorView . setSelection ( minDegrees , isInnerCircle , forceDrawDot ) ; mMinuteRadialTextsView . setSelection ( newSelection . getMinute ( ) ) ; } // If we rounded the seconds , reposition the secondSelector too .
if ( newSelection . getSecond ( ) != mCurrentTime . getSecond ( ) ) { int secDegrees = newSelection . getSecond ( ) * ( 360 / 60 ) ; mSecondRadialSelectorView . setSelection ( secDegrees , isInnerCircle , forceDrawDot ) ; mSecondRadialTextsView . setSelection ( newSelection . getSecond ( ) ) ; } break ; case MINUTE_INDEX : // The selection might have changed , recalculate the degrees
degrees = newSelection . getMinute ( ) * ( 360 / 60 ) ; mMinuteRadialSelectorView . setSelection ( degrees , false , forceDrawDot ) ; mMinuteRadialTextsView . setSelection ( newSelection . getMinute ( ) ) ; // If we rounded the seconds , reposition the secondSelector too .
if ( newSelection . getSecond ( ) != mCurrentTime . getSecond ( ) ) { int secDegrees = newSelection . getSecond ( ) * ( 360 / 60 ) ; mSecondRadialSelectorView . setSelection ( secDegrees , false , forceDrawDot ) ; mSecondRadialTextsView . setSelection ( newSelection . getSecond ( ) ) ; } break ; case SECOND_INDEX : // The selection might have changed , recalculate the degrees
degrees = newSelection . getSecond ( ) * ( 360 / 60 ) ; mSecondRadialSelectorView . setSelection ( degrees , false , forceDrawDot ) ; mSecondRadialTextsView . setSelection ( newSelection . getSecond ( ) ) ; } // Invalidate the currently showing picker to force a redraw
switch ( getCurrentItemShowing ( ) ) { case HOUR_INDEX : mHourRadialSelectorView . invalidate ( ) ; mHourRadialTextsView . invalidate ( ) ; break ; case MINUTE_INDEX : mMinuteRadialSelectorView . invalidate ( ) ; mMinuteRadialTextsView . invalidate ( ) ; break ; case SECOND_INDEX : mSecondRadialSelectorView . invalidate ( ) ; mSecondRadialTextsView . invalidate ( ) ; } |
public class CPDefinitionUtil { /** * Returns the first cp definition in the ordered set where uuid = & # 63 ; .
* @ param uuid the uuid
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching cp definition , or < code > null < / code > if a matching cp definition could not be found */
public static CPDefinition fetchByUuid_First ( String uuid , OrderByComparator < CPDefinition > orderByComparator ) { } } | return getPersistence ( ) . fetchByUuid_First ( uuid , orderByComparator ) ; |
public class AssociateSubnetCidrBlockRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < AssociateSubnetCidrBlockRequest > getDryRunRequest ( ) { } } | Request < AssociateSubnetCidrBlockRequest > request = new AssociateSubnetCidrBlockRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class CommerceTaxFixedRateLocalServiceBaseImpl { /** * Returns a range of all the commerce tax fixed rates .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link com . liferay . commerce . tax . engine . fixed . model . impl . CommerceTaxFixedRateModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param start the lower bound of the range of commerce tax fixed rates
* @ param end the upper bound of the range of commerce tax fixed rates ( not inclusive )
* @ return the range of commerce tax fixed rates */
@ Override public List < CommerceTaxFixedRate > getCommerceTaxFixedRates ( int start , int end ) { } } | return commerceTaxFixedRatePersistence . findAll ( start , end ) ; |
public class Snapshot { /** * The list of node types that this cluster snapshot is able to restore into .
* @ param restorableNodeTypes
* The list of node types that this cluster snapshot is able to restore into . */
public void setRestorableNodeTypes ( java . util . Collection < String > restorableNodeTypes ) { } } | if ( restorableNodeTypes == null ) { this . restorableNodeTypes = null ; return ; } this . restorableNodeTypes = new com . amazonaws . internal . SdkInternalList < String > ( restorableNodeTypes ) ; |
public class MainClassFinder { /** * Find a single main class from a given folder .
* @ param rootFolder the root folder to search
* @ return the main class or { @ code null }
* @ throws IOException if the folder cannot be read */
public static String findSingleMainClass ( File rootFolder ) throws IOException { } } | MainClassesCallback callback = new MainClassesCallback ( ) ; MainClassFinder . doWithMainClasses ( rootFolder , callback ) ; return callback . getMainClass ( ) ; |
public class SendBounceRequest { /** * A list of recipients of the bounced message , including the information required to create the Delivery Status
* Notifications ( DSNs ) for the recipients . You must specify at least one < code > BouncedRecipientInfo < / code > in the
* list .
* @ param bouncedRecipientInfoList
* A list of recipients of the bounced message , including the information required to create the Delivery
* Status Notifications ( DSNs ) for the recipients . You must specify at least one
* < code > BouncedRecipientInfo < / code > in the list . */
public void setBouncedRecipientInfoList ( java . util . Collection < BouncedRecipientInfo > bouncedRecipientInfoList ) { } } | if ( bouncedRecipientInfoList == null ) { this . bouncedRecipientInfoList = null ; return ; } this . bouncedRecipientInfoList = new com . amazonaws . internal . SdkInternalList < BouncedRecipientInfo > ( bouncedRecipientInfoList ) ; |
public class OrderBy { /** * Parse in the form " field1 : asc , field2 : desc , . . . , fieldn : asc | null _ smallest "
* < br / >
* Examples :
* < br / >
* " f1 , f2 , f3"
* < br / >
* " f1 : asc , f2 : desc , f3"
* < br / >
* " f1 , f2 : asc | null _ smallest , f3 : desc | null _ biggest " */
public static OrderBy parse ( String orderBy ) { } } | OrderBy toReturn = new OrderBy ( ) ; String [ ] orderBys = orderBy . split ( "," ) ; for ( String order : orderBys ) { order = order . trim ( ) ; String [ ] fields = order . split ( ":" ) ; Order ord = Order . ASC ; NullOrder nullOrd = NullOrder . NULL_SMALLEST ; if ( fields . length > 1 ) { String [ ] qualifiers = fields [ 1 ] . split ( "\\|" ) ; for ( String qualifier : qualifiers ) { qualifier = qualifier . trim ( ) ; boolean success = false ; try { ord = Order . valueOf ( qualifier . toUpperCase ( ) ) ; success = true ; } catch ( IllegalArgumentException e ) { } try { nullOrd = NullOrder . valueOf ( qualifier . toUpperCase ( ) ) ; success = true ; } catch ( IllegalArgumentException e ) { } if ( ! success ) { throw new PangoolRuntimeException ( "Unrecognised sort qualifier " + qualifier + " on sorting string: " + orderBy + ". Valid qualifiers are " + validQualifiers ( ) ) ; } } } toReturn . add ( fields [ 0 ] . trim ( ) , ord , nullOrd ) ; } return toReturn ; |
public class FPSCounter { /** * Start check of execution time
* @ param extra */
public static void startCheck ( String extra ) { } } | startCheckTime = System . currentTimeMillis ( ) ; nextCheckTime = startCheckTime ; Log . d ( Log . SUBSYSTEM . TRACING , "FPSCounter" , "[%d] startCheck %s" , startCheckTime , extra ) ; |
public class Dispatching { /** * Partial application of the last ( rightmost ) parameter to a binary
* predicate .
* @ param < T1 > the predicate first parameter type
* @ param < T2 > the predicate second parameter type
* @ param predicate the predicate to be curried
* @ param second the value to be curried as second parameter
* @ return the curried predicate */
public static < T1 , T2 > Predicate < T1 > rcurry ( BiPredicate < T1 , T2 > predicate , T2 second ) { } } | dbc . precondition ( predicate != null , "cannot bind parameter of a null predicate" ) ; return first -> predicate . test ( first , second ) ; |
public class InternalErrorSettings { /** * Set the default storage file provider . In case you played around and want to
* restore the default behavior .
* @ see # setStorageFileProvider ( IFunction )
* @ since 8.0.3 */
public static void setDefaultStorageFileProvider ( ) { } } | setStorageFileProvider ( aMetadata -> { final LocalDateTime aNow = PDTFactory . getCurrentLocalDateTime ( ) ; final String sFilename = StringHelper . getConcatenatedOnDemand ( PDTIOHelper . getLocalDateTimeForFilename ( aNow ) , "-" , aMetadata . getErrorID ( ) ) + ".xml" ; return WebFileIO . getDataIO ( ) . getFile ( "internal-errors/" + aNow . getYear ( ) + "/" + StringHelper . getLeadingZero ( aNow . getMonthValue ( ) , 2 ) + "/" + sFilename ) ; } ) ; |
public class ClosureTypeComputer { /** * This method is only public for testing purpose .
* @ noreference This method is not intended to be referenced by clients . */
public void selectStrategy ( ) { } } | LightweightTypeReference expectedType = expectation . getExpectedType ( ) ; if ( expectedType == null ) { strategy = getClosureWithoutExpectationHelper ( ) ; } else { JvmOperation operation = functionTypes . findImplementingOperation ( expectedType ) ; JvmType type = expectedType . getType ( ) ; int closureParameterSize ; if ( closure . isExplicitSyntax ( ) ) { closureParameterSize = closure . getDeclaredFormalParameters ( ) . size ( ) ; } else if ( operation != null ) { closureParameterSize = operation . getParameters ( ) . size ( ) ; } else { closureParameterSize = 1 ; } if ( operation == null || operation . getParameters ( ) . size ( ) != closureParameterSize || type == null ) { strategy = getClosureWithoutExpectationHelper ( ) ; } else { strategy = createClosureWithExpectationHelper ( operation ) ; } } |
public class LinkFromSelect { /** * { @ inheritDoc } */
@ SuppressWarnings ( "unchecked" ) @ Override protected boolean executeOneCompleteStmt ( final String _complStmt , final List < OneSelect > _oneSelects ) throws EFapsException { } } | boolean ret = false ; ConnectionResource con = null ; try { LinkFromSelect . LOG . debug ( "Executing SQLL: {}" , _complStmt ) ; List < Object [ ] > rows = null ; boolean cached = false ; if ( isCacheEnabled ( ) ) { final QueryKey querykey = QueryKey . get ( getKey ( ) , _complStmt ) ; final Cache < QueryKey , Object > cache = QueryCache . getSqlCache ( ) ; if ( cache . containsKey ( querykey ) ) { final Object object = cache . get ( querykey ) ; if ( object instanceof List ) { rows = ( List < Object [ ] > ) object ; } cached = true ; } } if ( ! cached ) { con = Context . getThreadContext ( ) . getConnectionResource ( ) ; final Statement stmt = con . createStatement ( ) ; final ResultSet rs = stmt . executeQuery ( _complStmt . toString ( ) ) ; final ArrayListHandler handler = new ArrayListHandler ( Context . getDbType ( ) . getRowProcessor ( ) ) ; rows = handler . handle ( rs ) ; rs . close ( ) ; stmt . close ( ) ; if ( isCacheEnabled ( ) ) { final QueryKey querykey = QueryKey . get ( getKey ( ) , _complStmt ) ; final Cache < QueryKey , Object > cache = QueryCache . getSqlCache ( ) ; cache . put ( querykey , rows ) ; } } for ( final Object [ ] row : rows ) { for ( final OneSelect onesel : _oneSelects ) { onesel . addObject ( row ) ; } ret = true ; } } catch ( final SQLException e ) { throw new EFapsException ( InstanceQuery . class , "executeOneCompleteStmt" , e ) ; } return ret ; |
public class ReflectUtils { /** * Call the class constructor with the given arguments
* @ param c The class
* @ param args The arguments
* @ return The constructed object */
public static < T > T callConstructor ( Class < T > c , Class < ? > [ ] argTypes , Object [ ] args ) { } } | try { Constructor < T > cons = c . getConstructor ( argTypes ) ; return cons . newInstance ( args ) ; } catch ( InvocationTargetException e ) { throw getCause ( e ) ; } catch ( IllegalAccessException e ) { throw new IllegalStateException ( e ) ; } catch ( NoSuchMethodException e ) { throw new IllegalArgumentException ( e ) ; } catch ( InstantiationException e ) { throw new IllegalArgumentException ( e ) ; } |
public class ThreadUtils { /** * Waits for a specified duration on a { @ link Condition } possibly checking every specified interval
* on whether the { @ link Condition } has been satisfied .
* @ param duration a long value indicating the duration of time to wait for the Condition to be satisfied .
* @ param timeUnit the TimeUnit of the duration time value .
* @ return a boolean value indicating whether the Condition has been satisfied within the given duration .
* @ see org . cp . elements . lang . concurrent . ThreadUtils . WaitTask
* @ see org . cp . elements . lang . annotation . FluentApi
* @ see java . util . concurrent . TimeUnit */
@ FluentApi public static WaitTask waitFor ( long duration , TimeUnit timeUnit ) { } } | return WaitTask . newWaitTask ( ) . waitFor ( duration , timeUnit ) ; |
public class PackageManagerUtils { /** * Checks if the device has a compass sensor .
* @ param context the context .
* @ return { @ code true } if the device has a compass sensor . */
@ TargetApi ( Build . VERSION_CODES . FROYO ) public static boolean hasCompassSensorFeature ( Context context ) { } } | return hasCompassSensorFeature ( context . getPackageManager ( ) ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.