signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class TasksImpl { /** * Lists all of the tasks that are associated with the specified job .
* For multi - instance tasks , information such as affinityId , executionInfo and nodeInfo refer to the primary task . Use the list subtasks API to retrieve information about subtasks .
* @ param jobId The ID of the job .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws BatchErrorException 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 ; CloudTask & gt ; object if successful . */
public PagedList < CloudTask > list ( final String jobId ) { } } | ServiceResponseWithHeaders < Page < CloudTask > , TaskListHeaders > response = listSinglePageAsync ( jobId ) . toBlocking ( ) . single ( ) ; return new PagedList < CloudTask > ( response . body ( ) ) { @ Override public Page < CloudTask > nextPage ( String nextPageLink ) { return listNextSinglePageAsync ( nextPageLink , null ) . toBlocking ( ) . single ( ) . body ( ) ; } } ; |
public class CmsCmisTypeManager { /** * Creates a property definition . < p >
* @ param id the property definition id
* @ param displayName the property display name
* @ param description the property description
* @ param datatype the property type
* @ param cardinality the property cardinality
* @ param updateability the property updatability
* @ param inherited the property inheritance status
* @ param required true true if the property is required
* @ return the property definition */
private static AbstractPropertyDefinition < ? > createPropDef ( String id , String displayName , String description , PropertyType datatype , Cardinality cardinality , Updatability updateability , boolean inherited , boolean required ) { } } | AbstractPropertyDefinition < ? > result = null ; switch ( datatype ) { case BOOLEAN : result = new PropertyBooleanDefinitionImpl ( ) ; break ; case DATETIME : result = new PropertyDateTimeDefinitionImpl ( ) ; break ; case DECIMAL : result = new PropertyDecimalDefinitionImpl ( ) ; break ; case HTML : result = new PropertyHtmlDefinitionImpl ( ) ; break ; case ID : result = new PropertyIdDefinitionImpl ( ) ; break ; case INTEGER : result = new PropertyIntegerDefinitionImpl ( ) ; break ; case STRING : result = new PropertyStringDefinitionImpl ( ) ; break ; case URI : result = new PropertyUriDefinitionImpl ( ) ; break ; default : throw new RuntimeException ( "Unknown datatype! Spec change?" ) ; } result . setId ( id ) ; result . setLocalName ( id ) ; result . setDisplayName ( displayName ) ; result . setDescription ( description ) ; result . setPropertyType ( datatype ) ; result . setCardinality ( cardinality ) ; result . setUpdatability ( updateability ) ; result . setIsInherited ( Boolean . valueOf ( inherited ) ) ; result . setIsRequired ( Boolean . valueOf ( required ) ) ; result . setIsQueryable ( Boolean . FALSE ) ; result . setIsOrderable ( Boolean . FALSE ) ; result . setQueryName ( id ) ; return result ; |
public class NoRethrowSecurityManager { /** * isOffendingClass determines the offending class from the classes defined
* in the stack . */
boolean isOffendingClass ( Class < ? > [ ] classes , int j , ProtectionDomain pd2 , Permission inPerm ) { } } | // Return true if . . .
return ( ! classes [ j ] . getName ( ) . startsWith ( "java" ) ) && // as long as not
// starting with
// java
( classes [ j ] . getName ( ) . indexOf ( "com.ibm.ws.kernel.launch.internal.NoRethrowSecurityManager" ) == - 1 ) && // not
// our
// SecurityManager
( classes [ j ] . getName ( ) . indexOf ( "ClassLoader" ) == - 1 ) && // not a
// class
// loader
// not the end of stack and next is not a class loader
( ( j == classes . length - 1 ) ? true : ( classes [ j + 1 ] . getName ( ) . indexOf ( "ClassLoader" ) == - 1 ) ) && // lacks the required permissions
! pd2 . implies ( inPerm ) ; |
public class UIResults { /** * Store this UIResults object in the given HttpServletRequest , then
* forward the request to target , in this case , an image , html file , . jsp ,
* any file which can return a complete document . Specifically , this means
* that if target is a . jsp , it must render it ' s own header and footer .
* @ param request the HttpServletRequest
* @ param response the HttpServletResponse
* @ param target the String path to the . jsp to handle drawing the data ,
* relative to the contextRoot ( ex . " / WEB - INF / query / foo . jsp " )
* @ throws ServletException for usual reasons . . .
* @ throws IOException for usual reasons . . . */
public void forward ( HttpServletRequest request , HttpServletResponse response , final String target ) throws ServletException , IOException { } } | if ( target . startsWith ( "/WEB-INF/classes" ) || target . startsWith ( "/WEB-INF/lib" ) || target . matches ( "^/WEB-INF/.+\\.xml" ) ) { throw new IOException ( "Not allowed" ) ; } this . contentJsp = target ; this . originalRequestURL = request . getRequestURL ( ) . toString ( ) ; request . setAttribute ( FERRET_NAME , this ) ; RequestDispatcher dispatcher = request . getRequestDispatcher ( target ) ; if ( dispatcher == null ) { throw new IOException ( "No dispatcher for " + target ) ; } dispatcher . forward ( request , response ) ; |
public class UpdateParamMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdateParam updateParam , ProtocolMarshaller protocolMarshaller ) { } } | if ( updateParam == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateParam . getType ( ) , TYPE_BINDING ) ; protocolMarshaller . marshall ( updateParam . getValue ( ) , VALUE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Watch { /** * Assembles a new snapshot from the current set of changes and invokes the user ' s callback .
* Clears the current changes on completion . */
private void pushSnapshot ( final Timestamp readTime , ByteString nextResumeToken ) { } } | final List < DocumentChange > changes = computeSnapshot ( readTime ) ; if ( ! hasPushed || ! changes . isEmpty ( ) ) { final QuerySnapshot querySnapshot = QuerySnapshot . withChanges ( query , readTime , documentSet , changes ) ; userCallbackExecutor . execute ( new Runnable ( ) { @ Override public void run ( ) { listener . onEvent ( querySnapshot , null ) ; } } ) ; hasPushed = true ; } changeMap . clear ( ) ; resumeToken = nextResumeToken ; |
public class ClarkName { /** * Splits given { @ code clarkName } to { @ code namespace } and { @ code localPart }
* @ param clarkName clarkName to be split
* @ return { @ code String } array of size { @ code 2 } .
* First item is { @ code namespace } and second item is { @ code localPart } . */
public static String [ ] split ( String clarkName ) { } } | int end = clarkName . lastIndexOf ( '}' ) ; if ( end == - 1 ) return new String [ ] { "" , clarkName } ; else return new String [ ] { clarkName . substring ( 1 , end ) , clarkName . substring ( end + 1 ) } ; |
public class StreamHelper { /** * Pass the content of the given input stream to the given output stream . The
* input stream is automatically closed , whereas the output stream stays open !
* @ param aIS
* The input stream to read from . May be < code > null < / code > . Automatically
* closed !
* @ param aOS
* The output stream to write to . May be < code > null < / code > . Not
* automatically closed !
* @ param nLimit
* The maximum number of bytes to be copied to the output stream . Must be
* & ge ; 0.
* @ return < code > { @ link ESuccess # SUCCESS } < / code > if copying took place , < code >
* { @ link ESuccess # FAILURE } < / code > otherwise */
@ Nonnull public static ESuccess copyInputStreamToOutputStreamWithLimit ( @ WillClose @ Nullable final InputStream aIS , @ WillNotClose @ Nullable final OutputStream aOS , @ Nonnegative final long nLimit ) { } } | return copyInputStreamToOutputStream ( aIS , aOS , new byte [ DEFAULT_BUFSIZE ] , ( MutableLong ) null , Long . valueOf ( nLimit ) ) ; |
public class FairScheduler { /** * Update fairshare for each JobInfo based on the weight , neededTasks and
* minTasks and the size of the pool . We compute the share by finding the
* ratio of ( # of slots / weight ) using binary search . */
private void updateFairShares ( double totalSlots , final TaskType type ) { } } | // Find the proper ratio of ( # of slots share / weight ) by bineary search
BinarySearcher searcher = new BinarySearcher ( ) { @ Override double targetFunction ( double x ) { return slotsUsedWithWeightToSlotRatio ( x , type ) ; } } ; double ratio = searcher . getSolution ( totalSlots , lastWeightToFairShareRatio ) ; lastWeightToFairShareRatio = ratio ; // Set the fair shares based on the value of R we ' ve converged to
for ( JobInfo info : infos . values ( ) ) { if ( type == TaskType . MAP ) { info . mapFairShare = computeShare ( info , ratio , type ) ; } else { info . reduceFairShare = computeShare ( info , ratio , type ) ; } } |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcIrregularTimeSeries ( ) { } } | if ( ifcIrregularTimeSeriesEClass == null ) { ifcIrregularTimeSeriesEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 282 ) ; } return ifcIrregularTimeSeriesEClass ; |
public class CommerceAccountOrganizationRelLocalServiceBaseImpl { /** * Deletes the commerce account organization rel with the primary key from the database . Also notifies the appropriate model listeners .
* @ param commerceAccountOrganizationRelPK the primary key of the commerce account organization rel
* @ return the commerce account organization rel that was removed
* @ throws PortalException if a commerce account organization rel with the primary key could not be found */
@ Indexable ( type = IndexableType . DELETE ) @ Override public CommerceAccountOrganizationRel deleteCommerceAccountOrganizationRel ( CommerceAccountOrganizationRelPK commerceAccountOrganizationRelPK ) throws PortalException { } } | return commerceAccountOrganizationRelPersistence . remove ( commerceAccountOrganizationRelPK ) ; |
public class OmemoService { /** * Initialize OMEMO functionality for OmemoManager omemoManager .
* @ param managerGuard OmemoManager we ' d like to initialize .
* @ throws InterruptedException
* @ throws CorruptedOmemoKeyException
* @ throws XMPPException . XMPPErrorException
* @ throws SmackException . NotConnectedException
* @ throws SmackException . NoResponseException
* @ throws PubSubException . NotALeafNodeException */
void init ( OmemoManager . LoggedInOmemoManager managerGuard ) throws InterruptedException , CorruptedOmemoKeyException , XMPPException . XMPPErrorException , SmackException . NotConnectedException , SmackException . NoResponseException , PubSubException . NotALeafNodeException { } } | OmemoManager manager = managerGuard . get ( ) ; OmemoDevice userDevice = manager . getOwnDevice ( ) ; // Create new keys if necessary and publish to the server .
getOmemoStoreBackend ( ) . replenishKeys ( userDevice ) ; // Rotate signed preKey if necessary .
if ( shouldRotateSignedPreKey ( userDevice ) ) { getOmemoStoreBackend ( ) . changeSignedPreKey ( userDevice ) ; } // Pack and publish bundle
OmemoBundleElement bundle = getOmemoStoreBackend ( ) . packOmemoBundle ( userDevice ) ; publishBundle ( manager . getConnection ( ) , userDevice , bundle ) ; // Fetch device list and republish deviceId if necessary
refreshAndRepublishDeviceList ( manager . getConnection ( ) , userDevice ) ; |
public class Bytes { /** * Creates a Bytes object by copying the data of a subsequence of the given byte array
* @ param data Byte data
* @ param offset Starting offset in byte array ( inclusive )
* @ param length Number of bytes to include */
public static final Bytes of ( byte [ ] data , int offset , int length ) { } } | Objects . requireNonNull ( data ) ; if ( length == 0 ) { return EMPTY ; } byte [ ] copy = new byte [ length ] ; System . arraycopy ( data , offset , copy , 0 , length ) ; return new Bytes ( copy ) ; |
public class CommerceDiscountUserSegmentRelPersistenceImpl { /** * Caches the commerce discount user segment rels in the entity cache if it is enabled .
* @ param commerceDiscountUserSegmentRels the commerce discount user segment rels */
@ Override public void cacheResult ( List < CommerceDiscountUserSegmentRel > commerceDiscountUserSegmentRels ) { } } | for ( CommerceDiscountUserSegmentRel commerceDiscountUserSegmentRel : commerceDiscountUserSegmentRels ) { if ( entityCache . getResult ( CommerceDiscountUserSegmentRelModelImpl . ENTITY_CACHE_ENABLED , CommerceDiscountUserSegmentRelImpl . class , commerceDiscountUserSegmentRel . getPrimaryKey ( ) ) == null ) { cacheResult ( commerceDiscountUserSegmentRel ) ; } else { commerceDiscountUserSegmentRel . resetOriginalValues ( ) ; } } |
public class SwiftAPIDirect { /** * PUT object
* @ param path path to the object
* @ param account Joss Account wrapper object
* @ param inputStream InputStream
* @ param scm Swift Connection manager
* @ param metadata custom metadata
* @ param size the object size
* @ param type the content type
* @ return HTTP Response code
* @ throws IOException if network errors */
public static int putObject ( final String path , final JossAccount account , final InputStream inputStream , final SwiftConnectionManager scm , final Map < String , String > metadata , final long size , final String type ) throws IOException { } } | int resp = httpPUT ( path , inputStream , account , scm , metadata , size , type ) ; if ( resp >= 400 ) { LOG . warn ( "Re-authentication attempt for GET {}" , path ) ; account . authenticate ( ) ; resp = httpPUT ( path . toString ( ) , inputStream , account , scm , metadata , size , type ) ; } return resp ; |
public class AWSServiceCatalogClient { /** * Associates multiple self - service actions with provisioning artifacts .
* @ param batchAssociateServiceActionWithProvisioningArtifactRequest
* @ return Result of the BatchAssociateServiceActionWithProvisioningArtifact operation returned by the service .
* @ throws InvalidParametersException
* One or more parameters provided to the operation are not valid .
* @ sample AWSServiceCatalog . BatchAssociateServiceActionWithProvisioningArtifact
* @ see < a
* href = " http : / / docs . aws . amazon . com / goto / WebAPI / servicecatalog - 2015-12-10 / BatchAssociateServiceActionWithProvisioningArtifact "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public BatchAssociateServiceActionWithProvisioningArtifactResult batchAssociateServiceActionWithProvisioningArtifact ( BatchAssociateServiceActionWithProvisioningArtifactRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeBatchAssociateServiceActionWithProvisioningArtifact ( request ) ; |
public class JavacParser { /** * TypeDeclaration = ClassOrInterfaceOrEnumDeclaration */
JCTree typeDeclaration ( JCModifiers mods , Comment docComment ) { } } | int pos = token . pos ; if ( mods == null && token . kind == SEMI ) { nextToken ( ) ; return toP ( F . at ( pos ) . Skip ( ) ) ; } else { return classOrInterfaceOrEnumDeclaration ( modifiersOpt ( mods ) , docComment ) ; } |
public class SpotifyApi { /** * Remove one or more albums from the current users " Your Music " library .
* @ param ids A list of the Spotify IDs . Maximum : 50 IDs .
* @ return A { @ link RemoveAlbumsForCurrentUserRequest . Builder } .
* @ see < a href = " https : / / developer . spotify . com / web - api / user - guide / # spotify - uris - and - ids " > Spotify : URLs & amp ; IDs < / a > */
public RemoveAlbumsForCurrentUserRequest . Builder removeAlbumsForCurrentUser ( String ... ids ) { } } | return new RemoveAlbumsForCurrentUserRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . ids ( concat ( ids , ',' ) ) ; |
public class Span { /** * Package private iterator method to access data while downsampling with the
* option to force interpolation .
* @ param start _ time The time in milliseconds at which the data begins .
* @ param end _ time The time in milliseconds at which the data ends .
* @ param interval _ ms The interval in milli seconds wanted between each data
* point .
* @ param downsampler The downsampling function to use .
* @ param fill _ policy Policy specifying whether to interpolate or to fill
* missing intervals with special values .
* @ return A new downsampler . */
Downsampler downsampler ( final long start_time , final long end_time , final long interval_ms , final Aggregator downsampler , final FillPolicy fill_policy ) { } } | if ( FillPolicy . NONE == fill_policy ) { // The default downsampler simply skips missing intervals , causing the
// span group to linearly interpolate .
return new Downsampler ( spanIterator ( ) , interval_ms , downsampler ) ; } else { // Otherwise , we need to instantiate a downsampler that can fill missing
// intervals with special values .
return new FillingDownsampler ( spanIterator ( ) , start_time , end_time , interval_ms , downsampler , fill_policy ) ; } |
public class ParameterAccessListener { /** * pulled into method for testing */
String constructLogMsg ( ) { } } | final StringBuilder msg = new StringBuilder ( ) ; for ( final Map . Entry < String , List < StackTraceElement > > e : paramToStackTrace . build ( ) . entries ( ) ) { msg . append ( "Parameter " ) . append ( e . getKey ( ) ) . append ( " accessed at \n" ) ; msg . append ( FluentIterable . from ( e . getValue ( ) ) // but exclude code in Parameters itself
. filter ( not ( IS_THIS_CLASS ) ) . filter ( not ( IS_PARAMETERS_ITSELF ) ) . filter ( not ( IS_THREAD_CLASS ) ) . join ( StringUtils . unixNewlineJoiner ( ) ) ) ; msg . append ( "\n\n" ) ; } return msg . toString ( ) ; |
public class Hessian2Output { /** * Writes a string value to the stream using UTF - 8 encoding .
* The string will be written with the following syntax :
* < code > < pre >
* S b16 b8 string - value
* < / pre > < / code >
* If the value is null , it will be written as
* < code > < pre >
* < / pre > < / code >
* @ param value the string value to write . */
public void writeString ( char [ ] buffer , int offset , int length ) throws IOException { } } | if ( buffer == null ) { if ( SIZE < _offset + 16 ) flushBuffer ( ) ; _buffer [ _offset ++ ] = ( byte ) ( 'N' ) ; } else { while ( length > 0x8000 ) { int sublen = 0x8000 ; if ( SIZE < _offset + 16 ) flushBuffer ( ) ; // chunk can ' t end in high surrogate
char tail = buffer [ offset + sublen - 1 ] ; if ( 0xd800 <= tail && tail <= 0xdbff ) sublen -- ; _buffer [ _offset ++ ] = ( byte ) BC_STRING_CHUNK ; _buffer [ _offset ++ ] = ( byte ) ( sublen >> 8 ) ; _buffer [ _offset ++ ] = ( byte ) ( sublen ) ; printString ( buffer , offset , sublen ) ; length -= sublen ; offset += sublen ; } if ( SIZE < _offset + 16 ) flushBuffer ( ) ; if ( length <= STRING_DIRECT_MAX ) { _buffer [ _offset ++ ] = ( byte ) ( BC_STRING_DIRECT + length ) ; } else if ( length <= STRING_SHORT_MAX ) { _buffer [ _offset ++ ] = ( byte ) ( BC_STRING_SHORT + ( length >> 8 ) ) ; _buffer [ _offset ++ ] = ( byte ) length ; } else { _buffer [ _offset ++ ] = ( byte ) ( 'S' ) ; _buffer [ _offset ++ ] = ( byte ) ( length >> 8 ) ; _buffer [ _offset ++ ] = ( byte ) ( length ) ; } printString ( buffer , offset , length ) ; } |
public class SLDValidator { /** * validate a . sld against the schema
* @ param xml input stream representing the . sld file
* @ return list of SAXExceptions ( 0 if the file ' s okay ) */
public List validateSLD ( InputSource xml ) { } } | URL schemaURL = SLDValidator . class . getResource ( "/schemas/sld/StyledLayerDescriptor.xsd" ) ; return ResponseUtils . validate ( xml , schemaURL , false , entityResolver ) ; |
public class CellFinder { /** * 条件に一致するセルを探す
* @ return 見つからない場合は 、 nullを返す 。 */
private Cell findCell ( ) { } } | final int rowStart = startRow < 0 ? 0 : startRow ; final int columnStart = startColumn < 0 ? 0 : startColumn ; final int maxRow = POIUtils . getRows ( sheet ) ; for ( int i = rowStart ; i < maxRow ; i ++ ) { final Row row = sheet . getRow ( i ) ; if ( row == null ) { continue ; } final int maxCol = row . getLastCellNum ( ) ; ; for ( int j = columnStart ; j < maxCol ; j ++ ) { if ( excludeStartPoisition && includeInStartPosition ( j , i ) ) { // 開始位置を除外する場合
continue ; } final Cell cell = row . getCell ( j , MissingCellPolicy . CREATE_NULL_AS_BLANK ) ; final String cellValue = POIUtils . getCellContents ( cell , config . getCellFormatter ( ) ) ; if ( Utils . matches ( cellValue , label , config ) ) { return cell ; } } } return null ; |
public class AWSCodePipelineClient { /** * Represents the failure of a job as returned to the pipeline by a job worker . Only used for custom actions .
* @ param putJobFailureResultRequest
* Represents the input of a PutJobFailureResult action .
* @ return Result of the PutJobFailureResult operation returned by the service .
* @ throws ValidationException
* The validation was specified in an invalid format .
* @ throws JobNotFoundException
* The specified job was specified in an invalid format or cannot be found .
* @ throws InvalidJobStateException
* The specified job state was specified in an invalid format .
* @ sample AWSCodePipeline . PutJobFailureResult
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / codepipeline - 2015-07-09 / PutJobFailureResult "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public PutJobFailureResultResult putJobFailureResult ( PutJobFailureResultRequest request ) { } } | request = beforeClientExecution ( request ) ; return executePutJobFailureResult ( request ) ; |
public class PebbleKit { /** * Synchronously query the Pebble application to see if the connected watch is running a firmware version that
* supports PebbleKit data logging .
* @ param context
* The Android context used to perform the query .
* < em > Protip : < / em > You probably want to use your ApplicationContext here .
* @ return true if the watch supports PebbleKit messages , otherwise false . This method will always return false if
* no Pebble is currently connected to the handset . */
public static boolean isDataLoggingSupported ( final Context context ) { } } | Cursor c = null ; try { c = queryProvider ( context ) ; if ( c == null || ! c . moveToNext ( ) ) { return false ; } return c . getInt ( KIT_STATE_COLUMN_DATALOGGING_SUPPORT ) == 1 ; } finally { if ( c != null ) { c . close ( ) ; } } |
public class CPTaxCategoryModelImpl { /** * Converts the soap model instances into normal model instances .
* @ param soapModels the soap model instances to convert
* @ return the normal model instances */
public static List < CPTaxCategory > toModels ( CPTaxCategorySoap [ ] soapModels ) { } } | if ( soapModels == null ) { return null ; } List < CPTaxCategory > models = new ArrayList < CPTaxCategory > ( soapModels . length ) ; for ( CPTaxCategorySoap soapModel : soapModels ) { models . add ( toModel ( soapModel ) ) ; } return models ; |
public class FileConfigurationSource { /** * Returns true , if key represents an array .
* @ param key configuration key
* @ return true if the config key represents an array , false otherwise . */
private boolean representsArray ( String key ) { } } | int openingBracket = key . indexOf ( "[" ) ; int closingBracket = key . indexOf ( "]" ) ; return closingBracket == key . length ( ) - 1 && openingBracket != - 1 ; |
public class GetAggregateComplianceDetailsByConfigRuleRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetAggregateComplianceDetailsByConfigRuleRequest getAggregateComplianceDetailsByConfigRuleRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getAggregateComplianceDetailsByConfigRuleRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getAggregateComplianceDetailsByConfigRuleRequest . getConfigurationAggregatorName ( ) , CONFIGURATIONAGGREGATORNAME_BINDING ) ; protocolMarshaller . marshall ( getAggregateComplianceDetailsByConfigRuleRequest . getConfigRuleName ( ) , CONFIGRULENAME_BINDING ) ; protocolMarshaller . marshall ( getAggregateComplianceDetailsByConfigRuleRequest . getAccountId ( ) , ACCOUNTID_BINDING ) ; protocolMarshaller . marshall ( getAggregateComplianceDetailsByConfigRuleRequest . getAwsRegion ( ) , AWSREGION_BINDING ) ; protocolMarshaller . marshall ( getAggregateComplianceDetailsByConfigRuleRequest . getComplianceType ( ) , COMPLIANCETYPE_BINDING ) ; protocolMarshaller . marshall ( getAggregateComplianceDetailsByConfigRuleRequest . getLimit ( ) , LIMIT_BINDING ) ; protocolMarshaller . marshall ( getAggregateComplianceDetailsByConfigRuleRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class NativeGitProvider { /** * Runs a maven command and returns { @ code true } if output was non empty .
* Can be used to short cut reading output from command when we know it may be a rather long one .
* Return true if the result is empty . */
private boolean tryCheckEmptyRunGitCommand ( File directory , long nativeGitTimeoutInMs , String gitCommand ) { } } | try { String env = System . getenv ( "GIT_PATH" ) ; String exec = env == null ? "git" : env ; String command = String . format ( "%s %s" , exec , gitCommand ) ; return getRunner ( ) . runEmpty ( directory , nativeGitTimeoutInMs , command ) ; } catch ( IOException ex ) { // Error means " non - empty "
return false ; // do nothing . . .
} |
public class CmsXmlContentDefinition { /** * Sets the inner element name to use for the content definition . < p >
* @ param innerName the inner element name to set */
protected void setInnerName ( String innerName ) { } } | m_innerName = innerName ; if ( m_innerName != null ) { m_typeName = createTypeName ( innerName ) ; } |
public class XAssignmentImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setStaticWithDeclaringType ( boolean newStaticWithDeclaringType ) { } } | boolean oldStaticWithDeclaringType = staticWithDeclaringType ; staticWithDeclaringType = newStaticWithDeclaringType ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , XbasePackage . XASSIGNMENT__STATIC_WITH_DECLARING_TYPE , oldStaticWithDeclaringType , staticWithDeclaringType ) ) ; |
public class MalisisInventoryContainer { /** * Transfers slot out of the its inventory . Destination is player inventory or other inventories depending on slot position . < br >
* @ param inventory the inventory
* @ param slot the slot
* @ return the itemStack left that could be transferred ( or EMPTY ) */
private ItemStack transferSlotOutOfInventory ( MalisisInventory inventory , MalisisSlot slot ) { } } | ItemStack itemStack = slot . getItemStack ( ) ; if ( itemStack . isEmpty ( ) || ! inventory . state . is ( PLAYER_EXTRACT ) || ! slot . state . is ( PLAYER_INSERT ) ) return itemStack ; // comes from PlayerInventory
if ( inventory == getPlayerInventory ( ) ) { for ( MalisisInventory inv : getInventories ( ) ) { if ( inv . state . is ( PLAYER_INSERT ) ) { itemStack = inv . transferInto ( itemStack ) ; // placed the full itemStack into the target inventory
if ( itemStack . isEmpty ( ) ) break ; } } } // transfer into PlayerInventory
else if ( getPlayerInventory ( ) . state . is ( PLAYER_INSERT ) ) itemStack = getPlayerInventory ( ) . transferInto ( itemStack ) ; return itemStack ; |
public class PoolsImpl { /** * Lists the usage metrics , aggregated by pool across individual time intervals , for the specified account .
* If you do not specify a $ filter clause including a poolId , the response includes all pools that existed in the account in the time range of the returned aggregation intervals . If you do not specify a $ filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available ; that is , only the last aggregation interval is returned .
* @ param poolListUsageMetricsOptions Additional parameters for the operation
* @ 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 < PoolUsageMetrics > > listUsageMetricsAsync ( final PoolListUsageMetricsOptions poolListUsageMetricsOptions , final ListOperationCallback < PoolUsageMetrics > serviceCallback ) { } } | return AzureServiceFuture . fromHeaderPageResponse ( listUsageMetricsSinglePageAsync ( poolListUsageMetricsOptions ) , new Func1 < String , Observable < ServiceResponseWithHeaders < Page < PoolUsageMetrics > , PoolListUsageMetricsHeaders > > > ( ) { @ Override public Observable < ServiceResponseWithHeaders < Page < PoolUsageMetrics > , PoolListUsageMetricsHeaders > > call ( String nextPageLink ) { PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions = null ; if ( poolListUsageMetricsOptions != null ) { poolListUsageMetricsNextOptions = new PoolListUsageMetricsNextOptions ( ) ; poolListUsageMetricsNextOptions . withClientRequestId ( poolListUsageMetricsOptions . clientRequestId ( ) ) ; poolListUsageMetricsNextOptions . withReturnClientRequestId ( poolListUsageMetricsOptions . returnClientRequestId ( ) ) ; poolListUsageMetricsNextOptions . withOcpDate ( poolListUsageMetricsOptions . ocpDate ( ) ) ; } return listUsageMetricsNextSinglePageAsync ( nextPageLink , poolListUsageMetricsNextOptions ) ; } } , serviceCallback ) ; |
public class SensorAggregatorInterface { /** * Configures the IO connector to establish a connection to the aggregator .
* @ return { @ code true } if the connector was created successfully , else
* { @ code false } . */
protected boolean setConnector ( ) { } } | if ( this . host == null ) { log . error ( "No host value set, cannot set up socket connector." ) ; return false ; } if ( this . port < 0 || this . port > 65535 ) { log . error ( "Port value is invalid {}." , Integer . valueOf ( this . port ) ) ; return false ; } // Disconnect if already connected
if ( this . connector != null ) { boolean tmp = this . stayConnected ; this . stayConnected = false ; this . _disconnect ( ) ; this . stayConnected = tmp ; } this . executors = new ExecutorFilter ( 1 ) ; this . connector = new NioSocketConnector ( ) ; this . connector . getSessionConfig ( ) . setTcpNoDelay ( true ) ; if ( ! this . connector . getFilterChain ( ) . contains ( AggregatorSensorProtocolCodecFactory . CODEC_NAME ) ) { this . connector . getFilterChain ( ) . addLast ( AggregatorSensorProtocolCodecFactory . CODEC_NAME , new ProtocolCodecFilter ( new AggregatorSensorProtocolCodecFactory ( false ) ) ) ; } this . connector . getFilterChain ( ) . addLast ( "ExecutorPool" , this . executors ) ; this . connector . setHandler ( this . ioHandler ) ; log . debug ( "Connector set up successfully." ) ; return true ; |
public class StreamMessageImpl { /** * ( non - Javadoc )
* @ see javax . jms . StreamMessage # readDouble ( ) */
@ Override public double readDouble ( ) throws JMSException { } } | backupState ( ) ; try { return MessageConvertTools . asDouble ( internalReadObject ( ) ) ; } catch ( JMSException e ) { restoreState ( ) ; throw e ; } catch ( RuntimeException e ) { restoreState ( ) ; throw e ; } |
public class BioCValidate3 { /** * Checks text , annotations and relations of the passage .
* @ param passage input passage */
public void check ( BioCPassage passage ) { } } | String text = checkText ( passage ) ; check ( passage , passage . getOffset ( ) , text ) ; for ( BioCSentence sentence : passage . getSentences ( ) ) { check ( sentence , 0 , text , passage ) ; } |
public class Operator { /** * Takes a single Operator and a list of operators and creates a cascade of unions of this inputs , if needed .
* If not needed there was only one operator as input , then this operator is returned .
* @ param input1 The first input operator .
* @ param input2 The other input operators .
* @ return The single operator or a cascade of unions of the operators . */
public static < T > Operator < T > createUnionCascade ( Operator < T > input1 , Operator < T > ... input2 ) { } } | // return cases where we don ' t need a union
if ( input2 == null || input2 . length == 0 ) { return input1 ; } else if ( input2 . length == 1 && input1 == null ) { return input2 [ 0 ] ; } TypeInformation < T > type = null ; if ( input1 != null ) { type = input1 . getOperatorInfo ( ) . getOutputType ( ) ; } else if ( input2 . length > 0 && input2 [ 0 ] != null ) { type = input2 [ 0 ] . getOperatorInfo ( ) . getOutputType ( ) ; } else { throw new IllegalArgumentException ( "Could not determine type information from inputs." ) ; } // Otherwise construct union cascade
Union < T > lastUnion = new Union < T > ( new BinaryOperatorInformation < T , T , T > ( type , type , type ) ) ; int i ; if ( input2 [ 0 ] == null ) { throw new IllegalArgumentException ( "The input may not contain null elements." ) ; } lastUnion . setFirstInput ( input2 [ 0 ] ) ; if ( input1 != null ) { lastUnion . setSecondInput ( input1 ) ; i = 1 ; } else { if ( input2 [ 1 ] == null ) { throw new IllegalArgumentException ( "The input may not contain null elements." ) ; } lastUnion . setSecondInput ( input2 [ 1 ] ) ; i = 2 ; } for ( ; i < input2 . length ; i ++ ) { Union < T > tmpUnion = new Union < T > ( new BinaryOperatorInformation < T , T , T > ( type , type , type ) ) ; tmpUnion . setSecondInput ( lastUnion ) ; if ( input2 [ i ] == null ) { throw new IllegalArgumentException ( "The input may not contain null elements." ) ; } tmpUnion . setFirstInput ( input2 [ i ] ) ; lastUnion = tmpUnion ; } return lastUnion ; |
public class TransformerIdentityImpl { /** * Process the source tree to the output result .
* @ param source The input for the source tree .
* @ param outputTarget The output target .
* @ throws TransformerException If an unrecoverable error occurs
* during the course of the transformation . */
public void transform ( Source source , Result outputTarget ) throws TransformerException { } } | createResultContentHandler ( outputTarget ) ; /* * According to JAXP1.2 , new SAXSource ( ) / StreamSource ( )
* should create an empty input tree , with a default root node .
* new DOMSource ( ) creates an empty document using DocumentBuilder .
* newDocument ( ) ; Use DocumentBuilder . newDocument ( ) for all 3 situations ,
* since there is no clear spec . how to create an empty tree when
* both SAXSource ( ) and StreamSource ( ) are used . */
if ( ( source instanceof StreamSource && source . getSystemId ( ) == null && ( ( StreamSource ) source ) . getInputStream ( ) == null && ( ( StreamSource ) source ) . getReader ( ) == null ) || ( source instanceof SAXSource && ( ( SAXSource ) source ) . getInputSource ( ) == null && ( ( SAXSource ) source ) . getXMLReader ( ) == null ) || ( source instanceof DOMSource && ( ( DOMSource ) source ) . getNode ( ) == null ) ) { try { DocumentBuilderFactory builderF = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder builder = builderF . newDocumentBuilder ( ) ; String systemID = source . getSystemId ( ) ; source = new DOMSource ( builder . newDocument ( ) ) ; // Copy system ID from original , empty Source to new Source
if ( systemID != null ) { source . setSystemId ( systemID ) ; } } catch ( ParserConfigurationException e ) { throw new TransformerException ( e . getMessage ( ) ) ; } } try { if ( source instanceof DOMSource ) { DOMSource dsource = ( DOMSource ) source ; m_systemID = dsource . getSystemId ( ) ; Node dNode = dsource . getNode ( ) ; if ( null != dNode ) { try { if ( dNode . getNodeType ( ) == Node . ATTRIBUTE_NODE ) this . startDocument ( ) ; try { if ( dNode . getNodeType ( ) == Node . ATTRIBUTE_NODE ) { String data = dNode . getNodeValue ( ) ; char [ ] chars = data . toCharArray ( ) ; characters ( chars , 0 , chars . length ) ; } else { org . apache . xml . serializer . TreeWalker walker ; walker = new org . apache . xml . serializer . TreeWalker ( this , m_systemID ) ; walker . traverse ( dNode ) ; } } finally { if ( dNode . getNodeType ( ) == Node . ATTRIBUTE_NODE ) this . endDocument ( ) ; } } catch ( SAXException se ) { throw new TransformerException ( se ) ; } return ; } else { String messageStr = XSLMessages . createMessage ( XSLTErrorResources . ER_ILLEGAL_DOMSOURCE_INPUT , null ) ; throw new IllegalArgumentException ( messageStr ) ; } } InputSource xmlSource = SAXSource . sourceToInputSource ( source ) ; if ( null == xmlSource ) { throw new TransformerException ( XSLMessages . createMessage ( XSLTErrorResources . ER_CANNOT_TRANSFORM_SOURCE_TYPE , new Object [ ] { source . getClass ( ) . getName ( ) } ) ) ; // " Can ' t transform a Source of type "
// + source . getClass ( ) . getName ( ) + " ! " ) ;
} if ( null != xmlSource . getSystemId ( ) ) m_systemID = xmlSource . getSystemId ( ) ; XMLReader reader = null ; boolean managedReader = false ; try { if ( source instanceof SAXSource ) { reader = ( ( SAXSource ) source ) . getXMLReader ( ) ; } if ( null == reader ) { try { reader = XMLReaderManager . getInstance ( ) . getXMLReader ( ) ; managedReader = true ; } catch ( SAXException se ) { throw new TransformerException ( se ) ; } } else { try { reader . setFeature ( "http://xml.org/sax/features/namespace-prefixes" , true ) ; } catch ( org . xml . sax . SAXException se ) { // We don ' t care .
} } // Get the input content handler , which will handle the
// parse events and create the source tree .
ContentHandler inputHandler = this ; reader . setContentHandler ( inputHandler ) ; if ( inputHandler instanceof org . xml . sax . DTDHandler ) reader . setDTDHandler ( ( org . xml . sax . DTDHandler ) inputHandler ) ; try { if ( inputHandler instanceof org . xml . sax . ext . LexicalHandler ) reader . setProperty ( "http://xml.org/sax/properties/lexical-handler" , inputHandler ) ; if ( inputHandler instanceof org . xml . sax . ext . DeclHandler ) reader . setProperty ( "http://xml.org/sax/properties/declaration-handler" , inputHandler ) ; } catch ( org . xml . sax . SAXException se ) { } try { if ( inputHandler instanceof org . xml . sax . ext . LexicalHandler ) reader . setProperty ( "http://xml.org/sax/handlers/LexicalHandler" , inputHandler ) ; if ( inputHandler instanceof org . xml . sax . ext . DeclHandler ) reader . setProperty ( "http://xml.org/sax/handlers/DeclHandler" , inputHandler ) ; } catch ( org . xml . sax . SAXNotRecognizedException snre ) { } reader . parse ( xmlSource ) ; } catch ( org . apache . xml . utils . WrappedRuntimeException wre ) { Throwable throwable = wre . getException ( ) ; while ( throwable instanceof org . apache . xml . utils . WrappedRuntimeException ) { throwable = ( ( org . apache . xml . utils . WrappedRuntimeException ) throwable ) . getException ( ) ; } throw new TransformerException ( wre . getException ( ) ) ; } catch ( org . xml . sax . SAXException se ) { throw new TransformerException ( se ) ; } catch ( IOException ioe ) { throw new TransformerException ( ioe ) ; } finally { if ( managedReader ) { XMLReaderManager . getInstance ( ) . releaseXMLReader ( reader ) ; } } } finally { if ( null != m_outputStream ) { try { m_outputStream . close ( ) ; } catch ( IOException ioe ) { } m_outputStream = null ; } } |
public class DSClient { /** * ( non - Javadoc )
* @ see com . impetus . client . cassandra . CassandraClientBase # findByRange ( byte [ ] , byte [ ] ,
* com . impetus . kundera . metadata . model . EntityMetadata , boolean , java . util . List , java . util . List , java . util . List , int ) */
@ Override public List findByRange ( byte [ ] muinVal , byte [ ] maxVal , EntityMetadata m , boolean isWrapReq , List < String > relations , List < String > columns , List < IndexExpression > conditions , int maxResults ) throws Exception { } } | throw new UnsupportedOperationException ( "Support available only for thrift/pelops." ) ; |
public class AbstractJcrNode { /** * Validates that there is a child node definition on the current node ( as parent ) which allows a child with the given name
* and type .
* @ param childName the name of the child
* @ param childPrimaryNodeTypeName the name of the child ' s primary type
* @ param skipProtected true if validation should skip protected definitions
* @ return a non - null { @ link JcrNodeDefinition }
* @ throws ItemNotFoundException
* @ throws InvalidItemStateException
* @ throws ItemExistsException if the parent does not allow same - name - siblings and a child with the given name already exists
* @ throws ConstraintViolationException if adding the child would violate constraints on the parent
* @ throws NoSuchNodeTypeException if the named primary type does not exist */
JcrNodeDefinition validateChildNodeDefinition ( Name childName , Name childPrimaryNodeTypeName , boolean skipProtected ) throws ItemNotFoundException , InvalidItemStateException , ItemExistsException , ConstraintViolationException , NoSuchNodeTypeException { } } | final SessionCache cache = sessionCache ( ) ; final CachedNode node = node ( ) ; Name primaryTypeName = node . getPrimaryType ( cache ) ; Set < Name > mixins = node . getMixinTypes ( cache ) ; NodeTypes nodeTypes = session ( ) . nodeTypes ( ) ; final SiblingCounter siblingCounter = SiblingCounter . create ( node , cache ) ; if ( childPrimaryNodeTypeName != null ) { if ( INTERNAL_NODE_TYPE_NAMES . contains ( childPrimaryNodeTypeName ) ) { int numExistingSns = siblingCounter . countSiblingsNamed ( childName ) ; String workspaceName = workspaceName ( ) ; String childPath = readable ( session . pathFactory ( ) . create ( path ( ) , childName , numExistingSns + 1 ) ) ; String msg = JcrI18n . unableToCreateNodeWithInternalPrimaryType . text ( childPrimaryNodeTypeName , childPath , workspaceName ) ; throw new ConstraintViolationException ( msg ) ; } JcrNodeType primaryType = nodeTypes . getNodeType ( childPrimaryNodeTypeName ) ; if ( primaryType == null ) { int numExistingSns = siblingCounter . countSiblingsNamed ( childName ) ; Path pathForChild = session . pathFactory ( ) . create ( path ( ) , childName , numExistingSns + 1 ) ; I18n msg = JcrI18n . unableToCreateNodeWithPrimaryTypeThatDoesNotExist ; throw new NoSuchNodeTypeException ( msg . text ( childPrimaryNodeTypeName , pathForChild , workspaceName ( ) ) ) ; } if ( primaryType . isMixin ( ) ) { I18n msg = JcrI18n . cannotUseMixinTypeAsPrimaryType ; throw new ConstraintViolationException ( msg . text ( primaryType . getName ( ) ) ) ; } if ( primaryType . isAbstract ( ) ) { I18n msg = JcrI18n . primaryTypeCannotBeAbstract ; throw new ConstraintViolationException ( msg . text ( primaryType . getName ( ) ) ) ; } } NodeDefinitionSet childDefns = nodeTypes . findChildNodeDefinitions ( primaryTypeName , mixins ) ; JcrNodeDefinition childDefn = childDefns . findBestDefinitionForChild ( childName , childPrimaryNodeTypeName , skipProtected , siblingCounter ) ; if ( childDefn == null ) { // Failed to find an appropriate child node definition . Throw an exception with the appropriate message . . .
String repoName = session . repository ( ) . repositoryName ( ) ; String workspaceName = workspaceName ( ) ; childDefns . determineReasonForMismatch ( childName , childPrimaryNodeTypeName , skipProtected , siblingCounter , primaryTypeName , mixins , path ( ) , workspaceName , repoName , context ( ) ) ; } assert childDefn != null ; if ( childPrimaryNodeTypeName == null && childDefn . getDefaultPrimaryType ( ) == null ) { // There is no default primary type . . .
int numExistingSns = siblingCounter . countSiblingsNamed ( childName ) ; String childPath = readable ( session . pathFactory ( ) . create ( path ( ) , childName , numExistingSns + 1 ) ) ; I18n msg = JcrI18n . unableToCreateNodeWithNoDefaultPrimaryTypeOnChildNodeDefinition ; String nodeTypeName = childDefn . getDeclaringNodeType ( ) . getName ( ) ; throw new ConstraintViolationException ( msg . text ( childDefn . getName ( ) , nodeTypeName , childPath , workspaceName ( ) ) ) ; } return childDefn ; |
public class CommerceAddressUtil { /** * Returns the last commerce address in the ordered set where commerceCountryId = & # 63 ; .
* @ param commerceCountryId the commerce country ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching commerce address
* @ throws NoSuchAddressException if a matching commerce address could not be found */
public static CommerceAddress findByCommerceCountryId_Last ( long commerceCountryId , OrderByComparator < CommerceAddress > orderByComparator ) throws com . liferay . commerce . exception . NoSuchAddressException { } } | return getPersistence ( ) . findByCommerceCountryId_Last ( commerceCountryId , orderByComparator ) ; |
public class UpdateFacetRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdateFacetRequest updateFacetRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( updateFacetRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateFacetRequest . getSchemaArn ( ) , SCHEMAARN_BINDING ) ; protocolMarshaller . marshall ( updateFacetRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( updateFacetRequest . getAttributeUpdates ( ) , ATTRIBUTEUPDATES_BINDING ) ; protocolMarshaller . marshall ( updateFacetRequest . getObjectType ( ) , OBJECTTYPE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ZkUtils { /** * Setup the tunnel if needed
* @ param config basing on which we setup the tunnel process
* @ return Pair of ( zk _ format _ connectionString , List of tunneled processes ) */
public static Pair < String , List < Process > > setupZkTunnel ( Config config , NetworkUtils . TunnelConfig tunnelConfig ) { } } | // Remove all spaces
String connectionString = Context . stateManagerConnectionString ( config ) . replaceAll ( "\\s+" , "" ) ; List < Pair < InetSocketAddress , Process > > ret = new ArrayList < > ( ) ; // For zookeeper , connection String can be a list of host : port , separated by comma
String [ ] endpoints = connectionString . split ( "," ) ; for ( String endpoint : endpoints ) { InetSocketAddress address = NetworkUtils . getInetSocketAddress ( endpoint ) ; // Get the tunnel process if needed
Pair < InetSocketAddress , Process > pair = NetworkUtils . establishSSHTunnelIfNeeded ( address , tunnelConfig , NetworkUtils . TunnelType . PORT_FORWARD ) ; ret . add ( pair ) ; } // Construct the new ConnectionString and tunnel processes
StringBuilder connectionStringBuilder = new StringBuilder ( ) ; List < Process > tunnelProcesses = new ArrayList < > ( ) ; String delim = "" ; for ( Pair < InetSocketAddress , Process > pair : ret ) { // Join the list of String with comma as delim
if ( pair . first != null ) { connectionStringBuilder . append ( delim ) . append ( pair . first . getHostName ( ) ) . append ( ":" ) . append ( pair . first . getPort ( ) ) ; delim = "," ; // If tunneled
if ( pair . second != null ) { tunnelProcesses . add ( pair . second ) ; } } } String newConnectionString = connectionStringBuilder . toString ( ) ; return new Pair < String , List < Process > > ( newConnectionString , tunnelProcesses ) ; |
public class ICUHumanize { /** * Converts the given text to number .
* @ param text
* String containing a spelled out number .
* @ return Text converted to Number
* @ throws ParseException */
public static Number parseNumber ( final String text ) throws ParseException { } } | return context . get ( ) . getRuleBasedNumberFormat ( RuleBasedNumberFormat . SPELLOUT ) . parse ( text ) ; |
public class ArrayUtils { /** * Returns a random element from the given array that ' s not in the values to exclude .
* @ param array array to return random element from
* @ param excludes values to exclude
* @ param < T > the type of elements in the given array
* @ return random element from the given array that ' s not in the values to exclude
* @ throws IllegalArgumentException if the array is empty */
public static < T > T randomFrom ( T [ ] array , Collection < T > excludes ) { } } | checkArgument ( isNotEmpty ( array ) , "Array cannot be empty" ) ; List < T > list = Arrays . asList ( array ) ; Iterable < T > copy = Lists . newArrayList ( list ) ; Iterables . removeAll ( copy , excludes ) ; checkArgument ( ! Iterables . isEmpty ( copy ) , "Array only consists of the given excludes" ) ; return IterableUtils . randomFrom ( list , excludes ) ; |
public class HybridViterbi { /** * 已知分段结果的情况下 , 最优双链解码方法
* @ param inst
* 样本实例
* @ return 双链标注结果 */
public Predict < int [ ] [ ] > getBestWithSegs ( Instance inst ) { } } | Node [ ] [ ] [ ] lattice = initialLatticeWithSegs ( inst ) ; doForwardViterbi ( lattice ) ; return getForwardPath ( lattice ) ; |
public class XMLConfigWebFactory { /** * loads the bundles defined in the extensions
* @ param cs
* @ param config
* @ param doc
* @ param log */
private static void loadExtensionBundles ( ConfigServerImpl cs , ConfigImpl config , Document doc , Log log ) { } } | try { Element parent = getChildByName ( doc . getDocumentElement ( ) , "extensions" ) ; Element [ ] children = getChildren ( parent , "rhextension" ) ; String strBundles ; List < RHExtension > extensions = new ArrayList < RHExtension > ( ) ; RHExtension rhe ; for ( Element child : children ) { BundleInfo [ ] bfsq ; try { rhe = new RHExtension ( config , child ) ; if ( rhe . getStartBundles ( ) ) rhe . deployBundles ( config ) ; extensions . add ( rhe ) ; } catch ( Exception e ) { log . error ( "load-extension" , e ) ; continue ; } } config . setExtensions ( extensions . toArray ( new RHExtension [ extensions . size ( ) ] ) ) ; } catch ( Exception e ) { log ( config , log , e ) ; } |
public class AbstractSAML2ResponseValidator { /** * Validate the given digital signature by checking its profile and value .
* @ param signature the signature
* @ param idpEntityId the idp entity id
* @ param trustEngine the trust engine */
protected final void validateSignature ( final Signature signature , final String idpEntityId , final SignatureTrustEngine trustEngine ) { } } | final SAMLSignatureProfileValidator validator = new SAMLSignatureProfileValidator ( ) ; try { validator . validate ( signature ) ; } catch ( final SignatureException e ) { throw new SAMLSignatureValidationException ( "SAMLSignatureProfileValidator failed to validate signature" , e ) ; } final CriteriaSet criteriaSet = new CriteriaSet ( ) ; criteriaSet . add ( new UsageCriterion ( UsageType . SIGNING ) ) ; criteriaSet . add ( new EntityRoleCriterion ( IDPSSODescriptor . DEFAULT_ELEMENT_NAME ) ) ; criteriaSet . add ( new ProtocolCriterion ( SAMLConstants . SAML20P_NS ) ) ; criteriaSet . add ( new EntityIdCriterion ( idpEntityId ) ) ; final boolean valid ; try { valid = trustEngine . validate ( signature , criteriaSet ) ; } catch ( final SecurityException e ) { throw new SAMLSignatureValidationException ( "An error occurred during signature validation" , e ) ; } if ( ! valid ) { throw new SAMLSignatureValidationException ( "Signature is not trusted" ) ; } |
public class MtasSolrRunningList { /** * Check for exceptions .
* @ return the list */
public final List < MtasSolrStatus > checkForExceptions ( ) { } } | List < MtasSolrStatus > statusWithException = null ; for ( MtasSolrStatus item : data ) { if ( item . checkResponseForException ( ) ) { if ( statusWithException == null ) { statusWithException = new ArrayList < > ( ) ; } statusWithException . add ( item ) ; } } return statusWithException ; |
public class LogRecordHandler { /** * Stops this handler and close its output streams . */
public void stop ( ) { } } | if ( this . logWriter != null ) { this . logWriter . stop ( ) ; this . logWriter . getLogRepositoryManager ( ) . stop ( ) ; this . logWriter = null ; } if ( this . traceWriter != null ) { this . traceWriter . stop ( ) ; this . traceWriter . getLogRepositoryManager ( ) . stop ( ) ; this . traceWriter = null ; } |
public class FXML { /** * { @ inheritDoc } */
@ Override public void parse ( final String ... parameters ) { } } | switch ( parameters . length ) { case 4 : absolutePathProperty ( ) . set ( parameters [ 0 ] ) ; fxmlNameProperty ( ) . set ( parameters [ 1 ] ) ; absoluteBundlePathProperty ( ) . set ( parameters [ 2 ] ) ; bundleNameProperty ( ) . set ( parameters [ 3 ] ) ; break ; case 3 : absolutePathProperty ( ) . set ( parameters [ 0 ] ) ; fxmlNameProperty ( ) . set ( parameters [ 1 ] ) ; break ; case 1 : default : fxmlNameProperty ( ) . set ( parameters [ 0 ] ) ; } |
public class CmsType { /** * Adds an attribute to the type . < p >
* @ param attributeName the attribute name
* @ param attributeType the attribute type
* @ param minOccurrence the minimum occurrence of this attribute
* @ param maxOccurrence the axnimum occurrence of this attribute */
public void addAttribute ( String attributeName , CmsType attributeType , int minOccurrence , int maxOccurrence ) { } } | m_names . add ( attributeName ) ; m_types . put ( attributeName , attributeType ) ; m_mins . put ( attributeName , new Integer ( minOccurrence ) ) ; m_maxs . put ( attributeName , new Integer ( maxOccurrence ) ) ; |
public class SelectJobsBallColorFolderIcon { /** * Calculates the color of the status ball for the owner based on selected descendants .
* < br >
* Logic kanged from Branch API ( original author Stephen Connolly ) .
* @ return the color of the status ball for the owner . */
@ Nonnull private BallColor calculateBallColor ( ) { } } | if ( owner instanceof TemplateDrivenMultiBranchProject && ( ( TemplateDrivenMultiBranchProject ) owner ) . isDisabled ( ) ) { return BallColor . DISABLED ; } BallColor c = BallColor . DISABLED ; boolean animated = false ; StringTokenizer tokens = new StringTokenizer ( Util . fixNull ( jobs ) , "," ) ; while ( tokens . hasMoreTokens ( ) ) { String jobName = tokens . nextToken ( ) . trim ( ) ; TopLevelItem item = owner . getItem ( jobName ) ; if ( item != null && item instanceof Job ) { BallColor d = ( ( Job ) item ) . getIconColor ( ) ; animated |= d . isAnimated ( ) ; d = d . noAnime ( ) ; if ( d . compareTo ( c ) < 0 ) { c = d ; } } } if ( animated ) { c = c . anime ( ) ; } return c ; |
public class InspectorServiceAttributesMarshaller { /** * Marshall the given parameter object . */
public void marshall ( InspectorServiceAttributes inspectorServiceAttributes , ProtocolMarshaller protocolMarshaller ) { } } | if ( inspectorServiceAttributes == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( inspectorServiceAttributes . getSchemaVersion ( ) , SCHEMAVERSION_BINDING ) ; protocolMarshaller . marshall ( inspectorServiceAttributes . getAssessmentRunArn ( ) , ASSESSMENTRUNARN_BINDING ) ; protocolMarshaller . marshall ( inspectorServiceAttributes . getRulesPackageArn ( ) , RULESPACKAGEARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ItemLinkMap { /** * Returns the AbstractItemLink to which the specified key is mapped in this map
* or < tt > null < / tt > if the map contains no mapping for this key .
* @ param key the key whose associated value is to be returned .
* @ return the value to which this map maps the specified key , or
* < tt > null < / tt > if the map contains no mapping for this key .
* @ see # put ( long , com . ibm . ws . sib . msgstore . cache . links . AbstractItemLink ) */
public final AbstractItemLink get ( final long key ) { } } | AbstractItemLink link = null ; synchronized ( _getLock ( key ) ) { if ( null != _entry ) // 666212
{ // 666212
int i = _indexOfKey ( key ) ; AbstractItemLink entry = _entry [ i ] ; while ( null == link && null != entry ) { if ( key == entry . getID ( ) ) { link = entry ; } else { entry = entry . getNextMappedLink ( ) ; } } } // 666212
} return link ; |
public class DataCubeAPI { /** * 拉取卡券概况数据 < br >
* 1 . 查询时间区间需 & lt ; = 62天 , 否则报错 ; < br >
* 2 . 传入时间格式需严格参照示例填写如 ” 2015-06-15 ” , 否则报错 ; < br >
* 3 . 该接口只能拉取非当天的数据 , 不能拉取当天的卡券数据 , 否则报错 。 < br >
* @ param access _ token access _ token
* @ param bizuinCube bizuinCube
* @ return result */
public static BizuinInfoResult getCardBizuinInfo ( String access_token , BizuinInfo bizuinCube ) { } } | return getCardBizuinInfo ( access_token , JsonUtil . toJSONString ( bizuinCube ) ) ; |
public class CoreRemoteMongoCollectionImpl { /** * Finds a document in the collection and performs the given update .
* @ param filter the query filter
* @ param update the update document
* @ param resultClass the class to decode each document into
* @ param < ResultT > the target document type of the iterable .
* @ return the resulting document */
public < ResultT > ResultT findOneAndUpdate ( final Bson filter , final Bson update , final Class < ResultT > resultClass ) { } } | return operations . findOneAndModify ( "findOneAndUpdate" , filter , update , new RemoteFindOneAndModifyOptions ( ) , resultClass ) . execute ( service ) ; |
public class Matrix3x2f { /** * Transform / multiply the given 2D - vector < code > ( x , y ) < / code > , as if it was a 3D - vector with z = 0 , by
* this matrix and store the result in < code > dest < / code > .
* The given 2D - vector is treated as a 3D - vector with its z - component being < code > 0.0 < / code > , so it
* will represent a direction in 2D - space rather than a position . This method will therefore
* not take the translation part of the matrix into account .
* In order to store the result in the same vector , use { @ link # transformDirection ( Vector2f ) } .
* @ see # transformDirection ( Vector2f )
* @ param x
* the x component of the vector to transform
* @ param y
* the y component of the vector to transform
* @ param dest
* will hold the result
* @ return dest */
public Vector2f transformDirection ( float x , float y , Vector2f dest ) { } } | return dest . set ( m00 * x + m10 * y , m01 * x + m11 * y ) ; |
public class FeedbackWindowTinyLfuPolicy { /** * Promotes the entry to the protected region ' s MRU position , demoting an entry if necessary . */
private void onProbationHit ( Node node ) { } } | node . remove ( ) ; node . status = Status . PROTECTED ; node . appendToTail ( headProtected ) ; sizeProtected ++ ; demoteProtected ( ) ; |
public class DOMDifferenceEngine { /** * Compares properties of a processing instruction . */
private ComparisonState compareProcessingInstructions ( ProcessingInstruction control , XPathContext controlContext , ProcessingInstruction test , XPathContext testContext ) { } } | return compare ( new Comparison ( ComparisonType . PROCESSING_INSTRUCTION_TARGET , control , getXPath ( controlContext ) , control . getTarget ( ) , getParentXPath ( controlContext ) , test , getXPath ( testContext ) , test . getTarget ( ) , getParentXPath ( testContext ) ) ) . andThen ( new Comparison ( ComparisonType . PROCESSING_INSTRUCTION_DATA , control , getXPath ( controlContext ) , control . getData ( ) , getParentXPath ( controlContext ) , test , getXPath ( testContext ) , test . getData ( ) , getParentXPath ( testContext ) ) ) ; |
public class ScalaContext { /** * Creates an object instance from the Scala class name
* @ param className the Scala class name
* @ return An Object instance */
public Object newInstance ( String className ) { } } | try { return classLoader . loadClass ( className ) . newInstance ( ) ; } catch ( Exception e ) { throw new ScalaInstanceNotFound ( className ) ; } |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertPGPRGPGorientToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class CmsDateRestrictionParser { /** * Parses a date restriction . < p >
* @ param dateRestriction the location of the date restriction
* @ return the date restriction */
public I_CmsListDateRestriction parse ( CmsXmlContentValueLocation dateRestriction ) { } } | I_CmsListDateRestriction result = null ; result = parseRange ( dateRestriction ) ; if ( result != null ) { return result ; } result = parseFromToday ( dateRestriction ) ; if ( result != null ) { return result ; } result = parsePastFuture ( dateRestriction ) ; return result ; |
public class Groundy { /** * Inserts an ArrayList < String > value into the mapping of this Bundle , replacing any existing
* value for the given key . Either key or value may be null .
* @ param key a String , or null
* @ param value an ArrayList < String > object , or null */
public Groundy addStringArrayList ( String key , ArrayList < String > value ) { } } | mArgs . putStringArrayList ( key , value ) ; return this ; |
public class FctBnAccEntitiesProcessors { /** * < p > Get PrcWageLineSave ( create and put into map ) . < / p >
* @ param pAddParam additional param
* @ return requested PrcWageLineSave
* @ throws Exception - an exception */
protected final PrcWageLineSave < RS > lazyGetPrcWageLineSave ( final Map < String , Object > pAddParam ) throws Exception { } } | @ SuppressWarnings ( "unchecked" ) PrcWageLineSave < RS > proc = ( PrcWageLineSave < RS > ) this . processorsMap . get ( PrcWageLineSave . class . getSimpleName ( ) ) ; if ( proc == null ) { proc = new PrcWageLineSave < RS > ( ) ; proc . setSrvAccSettings ( getSrvAccSettings ( ) ) ; proc . setSrvOrm ( getSrvOrm ( ) ) ; proc . setSrvDatabase ( getSrvDatabase ( ) ) ; // assigning fully initialized object :
this . processorsMap . put ( PrcWageLineSave . class . getSimpleName ( ) , proc ) ; } return proc ; |
public class GitHub { /** * Create an array with only the non - null and non - empty values
* @ param values
* @ return non - null but possibly empty array of non - null / non - empty strings */
public static String [ ] removeEmpties ( final String ... values ) { } } | if ( values == null || values . length == 0 ) { return new String [ 0 ] ; } List < String > validValues = new ArrayList < String > ( ) ; for ( String value : values ) { if ( value != null && value . length ( ) > 0 ) { validValues . add ( value ) ; } } return validValues . toArray ( new String [ validValues . size ( ) ] ) ; |
public class NexusIQCollectorTask { private void addNewApplications ( List < NexusIQApplication > applications , List < NexusIQApplication > existingApplications , NexusIQCollector collector ) { } } | long start = System . currentTimeMillis ( ) ; int count = 0 ; List < NexusIQApplication > newApplications = new ArrayList < > ( ) ; for ( NexusIQApplication application : applications ) { if ( ! existingApplications . contains ( application ) ) { application . setCollectorId ( collector . getId ( ) ) ; application . setEnabled ( false ) ; application . setLastUpdated ( System . currentTimeMillis ( ) ) ; newApplications . add ( application ) ; count ++ ; } } // save all in one shot
if ( ! CollectionUtils . isEmpty ( newApplications ) ) { nexusIQApplicationRepository . save ( newApplications ) ; } log ( "New projects" , start , count ) ; |
public class ShapeGenerator { /** * Return a path for a continuous slider thumb ' s concentric sections .
* @ param x the X coordinate of the upper - left corner of the section
* @ param y the Y coordinate of the upper - left corner of the section
* @ param diameter the diameter of the section
* @ return a path representing the shape . */
public Shape createSliderThumbContinuous ( final int x , final int y , final int diameter ) { } } | return createEllipseInternal ( x , y , diameter , diameter ) ; |
public class ValueExpression { /** * Create a value expression as parameter for a mixin which not change it value in a different context .
* @ param formatter current formatter
* @ param expr current expression
* @ return a ValueExpression */
public static ValueExpression eval ( CssFormatter formatter , Expression expr ) { } } | expr = expr . unpack ( formatter ) ; // unpack to increase the chance to find a ValueExpression
if ( expr . getClass ( ) == ValueExpression . class ) { return ( ValueExpression ) expr ; } ValueExpression valueEx = new ValueExpression ( expr , expr . stringValue ( formatter ) ) ; valueEx . type = expr . getDataType ( formatter ) ; valueEx . unit = expr . unit ( formatter ) ; switch ( valueEx . type ) { case STRING : case BOOLEAN : break ; // string is already set
case LIST : Operation op = valueEx . op = new Operation ( expr , ' ' ) ; ArrayList < Expression > operants = expr . listValue ( formatter ) . getOperands ( ) ; for ( int j = 0 ; j < operants . size ( ) ; j ++ ) { op . addOperand ( ValueExpression . eval ( formatter , operants . get ( j ) ) ) ; } break ; default : valueEx . value = expr . doubleValue ( formatter ) ; } return valueEx ; |
public class IPOImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setXolOset ( Integer newXolOset ) { } } | Integer oldXolOset = xolOset ; xolOset = newXolOset ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . IPO__XOL_OSET , oldXolOset , xolOset ) ) ; |
public class CompactionManager { /** * This is not efficient , do not use in any critical path */
private SSTableReader lookupSSTable ( final ColumnFamilyStore cfs , Descriptor descriptor ) { } } | for ( SSTableReader sstable : cfs . getSSTables ( ) ) { if ( sstable . descriptor . equals ( descriptor ) ) return sstable ; } return null ; |
public class AbstractParser { /** * Does the JSONObject have a specified key ?
* @ param key key to check
* @ param jsonObject object to check
* @ return true if the key exists */
protected boolean hasKey ( final String key , final JSONObject jsonObject ) { } } | return jsonObject != null && jsonObject . has ( key ) ; |
public class ScriptableObject { /** * Removes the property from an object or its prototype chain .
* Searches for a property with < code > name < / code > in obj or
* its prototype chain . If it is found , the object ' s delete
* method is called .
* @ param obj a JavaScript object
* @ param name a property name
* @ return true if the property doesn ' t exist or was successfully removed
* @ since 1.5R2 */
public static boolean deleteProperty ( Scriptable obj , String name ) { } } | Scriptable base = getBase ( obj , name ) ; if ( base == null ) return true ; base . delete ( name ) ; return ! base . has ( name , obj ) ; |
public class LegacyRange { /** * Returns < code > true < / code > if the value falls inside the range .
* @ param metric
* The metric to be checked
* @ return < code > true < / code > if the metric value value falls inside the
* range .
* < code > false < / code > otherwise . */
public final boolean isValueInside ( final Metric metric ) { } } | BigDecimal value = metric . getMetricValue ( prefix ) ; boolean bRes = true ; // Sets the minimum value of the range
if ( minVal != null ) { bRes = bRes && ( value . compareTo ( minVal ) >= 0 ) ; } // Sets the maximum value of the range
if ( maxVal != null ) { bRes = bRes && ( value . compareTo ( maxVal ) <= 0 ) ; } if ( negateThreshold ) { return ! bRes ; } return bRes ; |
public class OGCGeometry { /** * Extension method - checks if geometry is simple for Geodatabase .
* @ return Returns true if geometry is simple , false otherwise .
* Note : If isSimpleRelaxed is true , then isSimple is either true or false . Geodatabase has more relaxed requirements for simple geometries than OGC . */
public boolean isSimpleRelaxed ( ) { } } | OperatorSimplify op = ( OperatorSimplify ) OperatorFactoryLocal . getInstance ( ) . getOperator ( Operator . Type . Simplify ) ; return op . isSimpleAsFeature ( getEsriGeometry ( ) , esriSR , true , null , null ) ; |
public class MainActivity { /** * We ' re being destroyed . It ' s important to dispose of the helper here ! */
@ Override public void onDestroy ( ) { } } | super . onDestroy ( ) ; // very important :
Log . d ( TAG , "Destroying helper." ) ; if ( mHelper != null ) mHelper . dispose ( ) ; mHelper = null ; |
public class CampaignResponse { /** * Treatments that are defined in addition to the default treatment .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setAdditionalTreatments ( java . util . Collection ) } or { @ link # withAdditionalTreatments ( java . util . Collection ) }
* if you want to override the existing values .
* @ param additionalTreatments
* Treatments that are defined in addition to the default treatment .
* @ return Returns a reference to this object so that method calls can be chained together . */
public CampaignResponse withAdditionalTreatments ( TreatmentResource ... additionalTreatments ) { } } | if ( this . additionalTreatments == null ) { setAdditionalTreatments ( new java . util . ArrayList < TreatmentResource > ( additionalTreatments . length ) ) ; } for ( TreatmentResource ele : additionalTreatments ) { this . additionalTreatments . add ( ele ) ; } return this ; |
public class RouterTransaction { /** * Used to serialize this transaction into a Bundle */
@ NonNull public Bundle saveInstanceState ( ) { } } | Bundle bundle = new Bundle ( ) ; bundle . putBundle ( KEY_VIEW_CONTROLLER_BUNDLE , controller . saveInstanceState ( ) ) ; if ( pushControllerChangeHandler != null ) { bundle . putBundle ( KEY_PUSH_TRANSITION , pushControllerChangeHandler . toBundle ( ) ) ; } if ( popControllerChangeHandler != null ) { bundle . putBundle ( KEY_POP_TRANSITION , popControllerChangeHandler . toBundle ( ) ) ; } bundle . putString ( KEY_TAG , tag ) ; bundle . putInt ( KEY_INDEX , transactionIndex ) ; bundle . putBoolean ( KEY_ATTACHED_TO_ROUTER , attachedToRouter ) ; return bundle ; |
public class JavacParser { /** * { @ literal
* Expression = Expression1 [ ExpressionRest ]
* ExpressionRest = [ AssignmentOperator Expression1]
* AssignmentOperator = " = " | " + = " | " - = " | " * = " | " / = " |
* Type = Type1
* TypeNoParams = TypeNoParams1
* StatementExpression = Expression
* ConstantExpression = Expression */
JCExpression term ( ) { } } | JCExpression t = term1 ( ) ; if ( ( mode & EXPR ) != 0 && token . kind == EQ || PLUSEQ . compareTo ( token . kind ) <= 0 && token . kind . compareTo ( GTGTGTEQ ) <= 0 ) return termRest ( t ) ; else return t ; |
public class RESTDataProvider { /** * Checks if a class is or extends the REST Base Collection class .
* @ param clazz The class to be checked .
* @ return True if the class is or extends */
private boolean isCollectionClass ( Class < ? > clazz ) { } } | if ( clazz == RESTBaseEntityUpdateCollectionV1 . class || clazz == RESTBaseEntityCollectionV1 . class ) { return true ; } else if ( clazz . getSuperclass ( ) != null ) { return isCollectionClass ( clazz . getSuperclass ( ) ) ; } else { return false ; } |
public class Search { /** * Queries a Search Index and returns ungrouped results . In case the query
* used grouping , an empty list is returned
* @ param < T > Object type T
* @ param query the Lucene query to be passed to the Search index
* @ param classOfT The class of type T
* @ return The result of the search query as a { @ code List < T > } */
public < T > List < T > query ( String query , Class < T > classOfT ) { } } | InputStream instream = null ; List < T > result = new ArrayList < T > ( ) ; try { Reader reader = new InputStreamReader ( instream = queryForStream ( query ) , "UTF-8" ) ; JsonObject json = new JsonParser ( ) . parse ( reader ) . getAsJsonObject ( ) ; if ( json . has ( "rows" ) ) { if ( ! includeDocs ) { log . warning ( "includeDocs set to false and attempting to retrieve doc. " + "null object will be returned" ) ; } for ( JsonElement e : json . getAsJsonArray ( "rows" ) ) { result . add ( jsonToObject ( client . getGson ( ) , e , "doc" , classOfT ) ) ; } } else { log . warning ( "No ungrouped result available. Use queryGroups() if grouping set" ) ; } return result ; } catch ( UnsupportedEncodingException e1 ) { // This should never happen as every implementation of the java platform is required
// to support UTF - 8.
throw new RuntimeException ( e1 ) ; } finally { close ( instream ) ; } |
public class SubcatalogsCatalogsGs { /** * < p > Usually it ' s simple setter for model ID . < / p >
* @ param pItsId model ID */
@ Override public final void setItsId ( final SubcatalogsCatalogsGsId pItsId ) { } } | this . itsId = pItsId ; if ( this . itsId != null ) { this . itsCatalog = this . itsId . getItsCatalog ( ) ; this . subcatalog = this . itsId . getSubcatalog ( ) ; } else { this . itsCatalog = null ; this . subcatalog = null ; } |
public class AWSOpsWorksClient { /** * Deletes a specified instance , which terminates the associated Amazon EC2 instance . You must stop an instance
* before you can delete it .
* For more information , see < a
* href = " http : / / docs . aws . amazon . com / opsworks / latest / userguide / workinginstances - delete . html " > Deleting Instances < / a > .
* < b > Required Permissions < / b > : To use this action , an IAM user must have a Manage permissions level for the stack ,
* or an attached policy that explicitly grants permissions . For more information on user permissions , see < a
* href = " http : / / docs . aws . amazon . com / opsworks / latest / userguide / opsworks - security - users . html " > Managing User
* Permissions < / a > .
* @ param deleteInstanceRequest
* @ return Result of the DeleteInstance operation returned by the service .
* @ throws ValidationException
* Indicates that a request was not valid .
* @ throws ResourceNotFoundException
* Indicates that a resource was not found .
* @ sample AWSOpsWorks . DeleteInstance
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / opsworks - 2013-02-18 / DeleteInstance " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DeleteInstanceResult deleteInstance ( DeleteInstanceRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDeleteInstance ( request ) ; |
public class Aggregations { /** * Returns an aggregation to find the { @ link java . math . BigDecimal } minimum
* of all supplied values . < br / >
* This aggregation is similar to : < pre > SELECT MIN ( value ) FROM x < / pre >
* @ param < Key > the input key type
* @ param < Value > the supplied value type
* @ return the minimum value over all supplied values */
public static < Key , Value > Aggregation < Key , BigDecimal , BigDecimal > bigDecimalMin ( ) { } } | return new AggregationAdapter ( new BigDecimalMinAggregation < Key , Value > ( ) ) ; |
public class CmsSitemapView { /** * Updates the entry and it ' s children ' s view . < p >
* @ param entry the entry to update */
private void updateAll ( CmsClientSitemapEntry entry ) { } } | CmsSitemapTreeItem item = getTreeItem ( entry . getId ( ) ) ; if ( item != null ) { item . updateEntry ( entry ) ; item . updateSitePath ( entry . getSitePath ( ) ) ; for ( CmsClientSitemapEntry child : entry . getSubEntries ( ) ) { updateAll ( child ) ; } } |
public class DefaultServiceRegistry { /** * - - - CALL TIMEOUT CHECKER TASK - - - */
protected void checkTimeouts ( ) { } } | long now = System . currentTimeMillis ( ) ; // Check timeouted promises
PendingPromise pending ; Iterator < PendingPromise > i = promises . values ( ) . iterator ( ) ; boolean removed = false ; while ( i . hasNext ( ) ) { pending = i . next ( ) ; if ( pending . timeoutAt > 0 && now >= pending . timeoutAt ) { // Action is unknown at this location
pending . promise . complete ( new RequestTimeoutError ( this . nodeID , pending . action ) ) ; i . remove ( ) ; removed = true ; } } // Check timeouted request streams
IncomingStream stream ; long timeoutAt ; Iterator < IncomingStream > j = requestStreams . values ( ) . iterator ( ) ; while ( j . hasNext ( ) ) { stream = j . next ( ) ; timeoutAt = stream . getTimeoutAt ( ) ; if ( timeoutAt > 0 && now >= timeoutAt ) { stream . error ( new RequestTimeoutError ( this . nodeID , "unknown" ) ) ; requestStreamWriteLock . lock ( ) ; try { j . remove ( ) ; } finally { requestStreamWriteLock . unlock ( ) ; } removed = true ; } } // Check timeouted response streams
j = responseStreams . values ( ) . iterator ( ) ; while ( j . hasNext ( ) ) { stream = j . next ( ) ; timeoutAt = stream . getTimeoutAt ( ) ; if ( timeoutAt > 0 && now >= timeoutAt ) { stream . error ( new RequestTimeoutError ( nodeID , "unknown" ) ) ; responseStreamWriteLock . lock ( ) ; try { j . remove ( ) ; } finally { responseStreamWriteLock . unlock ( ) ; } removed = true ; } } // Reschedule
if ( removed ) { scheduler . execute ( ( ) -> { reschedule ( Long . MAX_VALUE ) ; } ) ; } else { prevTimeoutAt . set ( 0 ) ; } |
public class Sort { /** * Check if the double array is reverse sorted . It loops through the entire double
* array once , checking that the elements are reverse sorted .
* < br >
* < br >
* < i > Runtime : < / i > O ( n )
* @ param doubleArray the double array to check
* @ return < i > true < / i > if the double array is reverse sorted , else < i > false < / i > . */
public static boolean isReverseSorted ( double [ ] doubleArray ) { } } | for ( int i = 0 ; i < doubleArray . length - 1 ; i ++ ) { if ( doubleArray [ i ] < doubleArray [ i + 1 ] ) { return false ; } } return true ; |
public class BDXImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setDMXName ( String newDMXName ) { } } | String oldDMXName = dmxName ; dmxName = newDMXName ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . BDX__DMX_NAME , oldDMXName , dmxName ) ) ; |
public class MutableRoaringBitmap { /** * Add the value to the container ( set the value to " true " ) , whether it already appears or not .
* Java lacks native unsigned integers but the x argument is considered to be unsigned .
* Within bitmaps , numbers are ordered according to { @ link Integer # compareUnsigned } .
* We order the numbers like 0 , 1 , . . . , 2147483647 , - 2147483648 , - 2147483647 , . . . , - 1.
* @ param x integer value */
@ Override public void add ( final int x ) { } } | final short hb = BufferUtil . highbits ( x ) ; final int i = highLowContainer . getIndex ( hb ) ; if ( i >= 0 ) { getMappeableRoaringArray ( ) . setContainerAtIndex ( i , highLowContainer . getContainerAtIndex ( i ) . add ( BufferUtil . lowbits ( x ) ) ) ; } else { final MappeableArrayContainer newac = new MappeableArrayContainer ( ) ; getMappeableRoaringArray ( ) . insertNewKeyValueAt ( - i - 1 , hb , newac . add ( BufferUtil . lowbits ( x ) ) ) ; } |
public class PropstatGroupedRepresentation { /** * Returns properties statuses .
* @ return properties statuses
* @ throws RepositoryException { @ link RepositoryException } */
public final Map < String , Set < HierarchicalProperty > > getPropStats ( ) throws RepositoryException { } } | String statname = WebDavConst . getStatusDescription ( HTTPStatus . OK ) ; if ( propNames == null ) { propStats . put ( statname , resource . getProperties ( namesOnly ) ) ; } else { if ( propNames . contains ( PropertyConstants . DAV_ALLPROP_INCLUDE ) ) { propStats . put ( statname , resource . getProperties ( namesOnly ) ) ; propNames . remove ( PropertyConstants . DAV_ALLPROP_INCLUDE ) ; } for ( QName propName : propNames ) { HierarchicalProperty prop = new HierarchicalProperty ( propName ) ; try { if ( propName . equals ( PropertyConstants . IS_READ_ONLY ) && session != null ) { if ( isReadOnly ( ) ) { prop . setValue ( "1" ) ; } else { prop . setValue ( "0" ) ; } statname = WebDavConst . getStatusDescription ( HTTPStatus . OK ) ; } else { prop = resource . getProperty ( propName ) ; statname = WebDavConst . getStatusDescription ( HTTPStatus . OK ) ; } } catch ( AccessDeniedException exc ) { statname = WebDavConst . getStatusDescription ( HTTPStatus . FORBIDDEN ) ; LOG . error ( exc . getMessage ( ) , exc ) ; } catch ( ItemNotFoundException exc ) { statname = WebDavConst . getStatusDescription ( HTTPStatus . NOT_FOUND ) ; } catch ( PathNotFoundException e ) { statname = WebDavConst . getStatusDescription ( HTTPStatus . NOT_FOUND ) ; } catch ( RepositoryException e ) { statname = WebDavConst . getStatusDescription ( HTTPStatus . INTERNAL_ERROR ) ; } if ( ! propStats . containsKey ( statname ) ) { propStats . put ( statname , new HashSet < HierarchicalProperty > ( ) ) ; } Set < HierarchicalProperty > propSet = propStats . get ( statname ) ; propSet . add ( prop ) ; } } return propStats ; |
public class CmsCroppingDialog { /** * Calculates the select area position for the current cropping parameter . < p >
* @ return the select area position */
private CmsPositionBean calculateSelectPosition ( ) { } } | CmsPositionBean result = new CmsPositionBean ( ) ; result . setHeight ( ( int ) Math . round ( m_croppingParam . getCropHeight ( ) / m_heightRatio ) ) ; result . setWidth ( ( int ) Math . round ( m_croppingParam . getCropWidth ( ) / m_widthRatio ) ) ; result . setTop ( ( int ) Math . round ( m_croppingParam . getCropY ( ) / m_heightRatio ) ) ; result . setLeft ( ( int ) Math . round ( m_croppingParam . getCropX ( ) / m_widthRatio ) ) ; return result ; |
public class ViewPropertyAnimatorHC { /** * This method handles setting the property values directly in the View object ' s fields .
* propertyConstant tells it which property should be set , value is the value to set
* the property to .
* @ param propertyConstant The property to be set
* @ param value The value to set the property to */
private void setValue ( int propertyConstant , float value ) { } } | // final View . TransformationInfo info = mView . mTransformationInfo ;
View v = mView . get ( ) ; if ( v != null ) { switch ( propertyConstant ) { case TRANSLATION_X : // info . mTranslationX = value ;
v . setTranslationX ( value ) ; break ; case TRANSLATION_Y : // info . mTranslationY = value ;
v . setTranslationY ( value ) ; break ; case ROTATION : // info . mRotation = value ;
v . setRotation ( value ) ; break ; case ROTATION_X : // info . mRotationX = value ;
v . setRotationX ( value ) ; break ; case ROTATION_Y : // info . mRotationY = value ;
v . setRotationY ( value ) ; break ; case SCALE_X : // info . mScaleX = value ;
v . setScaleX ( value ) ; break ; case SCALE_Y : // info . mScaleY = value ;
v . setScaleY ( value ) ; break ; case X : // info . mTranslationX = value - v . mLeft ;
v . setX ( value ) ; break ; case Y : // info . mTranslationY = value - v . mTop ;
v . setY ( value ) ; break ; case ALPHA : // info . mAlpha = value ;
v . setAlpha ( value ) ; break ; } } |
public class PeerGroup { /** * Returns a future that is triggered when there are at least the requested number of connected peers that support
* the given protocol version or higher . To block immediately , just call get ( ) on the result .
* @ param numPeers How many peers to wait for .
* @ param mask An integer representing a bit mask that will be ANDed with the peers advertised service masks .
* @ return a future that will be triggered when the number of connected peers implementing protocolVersion or higher is greater than or equals numPeers */
public ListenableFuture < List < Peer > > waitForPeersWithServiceMask ( final int numPeers , final int mask ) { } } | lock . lock ( ) ; try { List < Peer > foundPeers = findPeersWithServiceMask ( mask ) ; if ( foundPeers . size ( ) >= numPeers ) return Futures . immediateFuture ( foundPeers ) ; final SettableFuture < List < Peer > > future = SettableFuture . create ( ) ; addConnectedEventListener ( new PeerConnectedEventListener ( ) { @ Override public void onPeerConnected ( Peer peer , int peerCount ) { final List < Peer > peers = findPeersWithServiceMask ( mask ) ; if ( peers . size ( ) >= numPeers ) { future . set ( peers ) ; removeConnectedEventListener ( this ) ; } } } ) ; return future ; } finally { lock . unlock ( ) ; } |
public class FileArtifactNotifier { /** * { @ inheritDoc } */
@ Override public synchronized boolean registerForNotifications ( ArtifactNotification targets , ArtifactListener callbackObject ) throws IllegalArgumentException { } } | verifyTargets ( targets ) ; Set < String > pathsToMonitor = new HashSet < String > ( ) ; Set < String > nonRecursePathsToMonitor = new HashSet < String > ( ) ; for ( String path : targets . getPaths ( ) ) { ArtifactListenerSelector artifactSelectorCallback = new ArtifactListenerSelector ( callbackObject ) ; addTarget ( path , artifactSelectorCallback , pathsToMonitor , nonRecursePathsToMonitor ) ; } updateMonitoredPaths ( pathsToMonitor , null , nonRecursePathsToMonitor , null ) ; return true ; |
public class TtsTrackImpl { /** * Reads packet from currently opened stream .
* @ param packet
* the packet to read
* @ param offset
* the offset from which new data will be inserted
* @ return the number of actualy read bytes .
* @ throws java . io . IOException */
private int readPacket ( byte [ ] packet , int offset , int psize ) throws IOException { } } | int length = 0 ; try { while ( length < psize ) { int len = stream . read ( packet , offset + length , psize - length ) ; if ( len == - 1 ) { return length ; } length += len ; } return length ; } catch ( Exception e ) { logger . error ( e ) ; } return length ; |
public class JQMWidget { /** * Sets new theme only in case if currently no theme is defined for this widget . */
public void setThemeIfCurrentEmpty ( String themeName ) { } } | if ( themeName == null || themeName . isEmpty ( ) ) return ; String theme = getTheme ( ) ; if ( theme == null || theme . isEmpty ( ) ) { setTheme ( themeName ) ; } |
public class CloudWatchOutputConfigMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CloudWatchOutputConfig cloudWatchOutputConfig , ProtocolMarshaller protocolMarshaller ) { } } | if ( cloudWatchOutputConfig == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( cloudWatchOutputConfig . getCloudWatchLogGroupName ( ) , CLOUDWATCHLOGGROUPNAME_BINDING ) ; protocolMarshaller . marshall ( cloudWatchOutputConfig . getCloudWatchOutputEnabled ( ) , CLOUDWATCHOUTPUTENABLED_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Command { /** * getUNodeResult
* @ param response
* @ return UNode object */
protected static UNode getUNodeResult ( RESTResponse response ) { } } | return UNode . parse ( response . getBody ( ) , response . getContentType ( ) ) ; |
public class GetAuthorizationTokenRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetAuthorizationTokenRequest getAuthorizationTokenRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getAuthorizationTokenRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getAuthorizationTokenRequest . getRegistryIds ( ) , REGISTRYIDS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CommerceCurrencyPersistenceImpl { /** * Returns a range of all the commerce currencies where groupId = & # 63 ; .
* 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 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 QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CommerceCurrencyModelImpl } . 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 groupId the group ID
* @ param start the lower bound of the range of commerce currencies
* @ param end the upper bound of the range of commerce currencies ( not inclusive )
* @ return the range of matching commerce currencies */
@ Override public List < CommerceCurrency > findByGroupId ( long groupId , int start , int end ) { } } | return findByGroupId ( groupId , start , end , null ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.