signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class CPDefinitionLinkUtil { /** * Returns a range of all the cp definition links where CPDefinitionId = & # 63 ; and type = & # 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 CPDefinitionLinkModelImpl } . 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 CPDefinitionId the cp definition ID
* @ param type the type
* @ param start the lower bound of the range of cp definition links
* @ param end the upper bound of the range of cp definition links ( not inclusive )
* @ return the range of matching cp definition links */
public static List < CPDefinitionLink > findByCPD_T ( long CPDefinitionId , String type , int start , int end ) { } } | return getPersistence ( ) . findByCPD_T ( CPDefinitionId , type , start , end ) ; |
public class Jsr250Utils { /** * Locates all annotated methods on the type passed in sorted as declared from the type to its super class .
* @ param clazz The type of the class to get methods from .
* @ param annotation The annotation to look for on methods .
* @ param log
* @ return */
private static List < Method > getAnnotatedMethodsFromChildToParent ( Class < ? > clazz , Class < ? extends Annotation > annotation , Logger log ) { } } | List < Method > methodsToRun = new ArrayList < Method > ( ) ; while ( clazz != null ) { List < Method > newMethods = getMethodsWithAnnotation ( clazz , annotation , log ) ; for ( Method newMethod : newMethods ) { if ( containsMethod ( newMethod , methodsToRun ) ) { removeMethodByName ( newMethod , methodsToRun ) ; } else { methodsToRun . add ( newMethod ) ; } } clazz = clazz . getSuperclass ( ) ; if ( clazz != null && clazz . equals ( Object . class ) ) { clazz = null ; } } return methodsToRun ; |
public class SortaServiceImpl { /** * A helper function to produce fuzzy match query with 80 % similarity in elasticsearch because
* PorterStem does not work in some cases , e . g . the stemming results for placenta and placental
* are different , therefore would be missed by elasticsearch */
private String stemQuery ( String queryString ) { } } | StringBuilder stringBuilder = new StringBuilder ( ) ; Set < String > uniqueTerms = Sets . newHashSet ( queryString . toLowerCase ( ) . trim ( ) . split ( NON_WORD_SEPARATOR ) ) ; uniqueTerms . removeAll ( NGramDistanceAlgorithm . STOPWORDSLIST ) ; for ( String word : uniqueTerms ) { if ( StringUtils . isNotEmpty ( word . trim ( ) ) && ! ( ELASTICSEARCH_RESERVED_WORDS . contains ( word ) ) ) { String afterStem = Stemmer . stem ( removeIllegalCharWithEmptyString ( word ) ) ; if ( StringUtils . isNotEmpty ( afterStem ) ) { stringBuilder . append ( afterStem ) . append ( SINGLE_WHITESPACE ) ; } } } return stringBuilder . toString ( ) . trim ( ) ; |
public class QueryCriterionSerializer { /** * serialize the QueryCriterion to a String expression .
* This String expression can be deserialized by the deserialze method back .
* @ param queryCriterion
* the QueryCriterion .
* @ return
* the String expression . */
public static String serialize ( QueryCriterion queryCriterion ) { } } | if ( queryCriterion instanceof EqualQueryCriterion ) { EqualQueryCriterion criterion = ( EqualQueryCriterion ) queryCriterion ; return criterion . getMetadataKey ( ) + " equals " + escapeString ( criterion . getCriterion ( ) ) ; } else if ( queryCriterion instanceof NotEqualQueryCriterion ) { NotEqualQueryCriterion criterion = ( NotEqualQueryCriterion ) queryCriterion ; return criterion . getMetadataKey ( ) + " not equals " + escapeString ( criterion . getCriterion ( ) ) ; } else if ( queryCriterion instanceof ContainQueryCriterion ) { ContainQueryCriterion criterion = ( ContainQueryCriterion ) queryCriterion ; return criterion . getMetadataKey ( ) ; } else if ( queryCriterion instanceof NotContainQueryCriterion ) { NotContainQueryCriterion criterion = ( NotContainQueryCriterion ) queryCriterion ; return "not " + criterion . getMetadataKey ( ) ; } else if ( queryCriterion instanceof InQueryCriterion ) { InQueryCriterion criterion = ( InQueryCriterion ) queryCriterion ; StringBuilder sb = new StringBuilder ( criterion . getMetadataKey ( ) ) ; sb . append ( " in [ " ) ; for ( String s : criterion . getCriterion ( ) ) { sb . append ( escapeString ( s ) ) . append ( ", " ) ; } sb . append ( "]" ) ; return sb . toString ( ) ; } else if ( queryCriterion instanceof NotInQueryCriterion ) { NotInQueryCriterion criterion = ( NotInQueryCriterion ) queryCriterion ; StringBuilder sb = new StringBuilder ( criterion . getMetadataKey ( ) ) ; sb . append ( " not in [ " ) ; for ( String s : criterion . getCriterion ( ) ) { sb . append ( escapeString ( s ) ) . append ( ", " ) ; } sb . append ( "]" ) ; return sb . toString ( ) ; } else if ( queryCriterion instanceof PatternQueryCriterion ) { PatternQueryCriterion criterion = ( PatternQueryCriterion ) queryCriterion ; return criterion . getMetadataKey ( ) + " matches " + escapeString ( criterion . getCriterion ( ) ) ; } return "" ; |
public class ListNumbers { /** * Creates a list of equally spaced values given the range and the number of
* elements .
* Note that , due to rounding errors in double precision , the difference
* between the elements may not be exactly the same .
* @ param minValue the first value in the list
* @ param maxValue the last value in the list
* @ param size the size of the list
* @ return a new list */
public static ListNumber linearListFromRange ( final double minValue , final double maxValue , final int size ) { } } | if ( size <= 0 ) { throw new IllegalArgumentException ( "Size must be positive (was " + size + " )" ) ; } return new LinearListDoubleFromRange ( size , minValue , maxValue ) ; |
public class GeneratorsNameUtil { /** * Return the default name to register a directive based on it ' s class name The name of the tag is
* the name of the component converted to kebab - case If the component class ends with " Directive " ,
* this part is ignored
* @ param directiveClassName The class name of the { @ link VueDirective }
* @ return The name of the directive as kebab case */
public static String directiveToTagName ( String directiveClassName ) { } } | // Drop " Component " at the end of the class name
directiveClassName = directiveClassName . replaceAll ( "Directive$" , "" ) ; // Convert from CamelCase to kebab - case
return CaseFormat . UPPER_CAMEL . to ( CaseFormat . LOWER_HYPHEN , directiveClassName ) . toLowerCase ( ) ; |
public class X509CRLEntryImpl { /** * get Reason Code from CRL entry .
* @ returns Integer or null , if no such extension
* @ throws IOException on error */
public Integer getReasonCode ( ) throws IOException { } } | Object obj = getExtension ( PKIXExtensions . ReasonCode_Id ) ; if ( obj == null ) return null ; CRLReasonCodeExtension reasonCode = ( CRLReasonCodeExtension ) obj ; return reasonCode . get ( CRLReasonCodeExtension . REASON ) ; |
public class TrainingsImpl { /** * Get information about a specific tag .
* @ param projectId The project this tag belongs to
* @ param tagId The tag id
* @ param getTagOptionalParameter 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 < Tag > getTagAsync ( UUID projectId , UUID tagId , GetTagOptionalParameter getTagOptionalParameter , final ServiceCallback < Tag > serviceCallback ) { } } | return ServiceFuture . fromResponse ( getTagWithServiceResponseAsync ( projectId , tagId , getTagOptionalParameter ) , serviceCallback ) ; |
public class ProtoUtils { /** * Checks whether the exception is an { @ link InvalidProtocolBufferException } thrown because of
* a truncated message .
* @ param e the exception
* @ return whether the exception is an { @ link InvalidProtocolBufferException } thrown because of
* a truncated message . */
public static boolean isTruncatedMessageException ( IOException e ) { } } | if ( ! ( e instanceof InvalidProtocolBufferException ) ) { return false ; } String truncatedMessage ; try { Method method = InvalidProtocolBufferException . class . getMethod ( "truncatedMessage" ) ; method . setAccessible ( true ) ; truncatedMessage = ( String ) method . invoke ( null ) ; } catch ( NoSuchMethodException | IllegalAccessException | InvocationTargetException ee ) { throw new RuntimeException ( ee ) ; } return e . getMessage ( ) . equals ( truncatedMessage ) ; |
public class VdmEditor { /** * Computes and returns the source reference that includes the caret and
* serves as provider for the outline page selection and the editor range
* indication .
* @ return the computed source reference
* @ since 3.0 */
protected INode computeHighlightRangeSourceReference ( ) { } } | ISourceViewer sourceViewer = getSourceViewer ( ) ; if ( sourceViewer == null ) return null ; StyledText styledText = sourceViewer . getTextWidget ( ) ; if ( styledText == null ) return null ; int caret = 0 ; if ( sourceViewer instanceof ITextViewerExtension5 ) { ITextViewerExtension5 extension = ( ITextViewerExtension5 ) sourceViewer ; caret = extension . widgetOffset2ModelOffset ( styledText . getCaretOffset ( ) ) ; } else { int offset = sourceViewer . getVisibleRegion ( ) . getOffset ( ) ; caret = offset + styledText . getCaretOffset ( ) ; } // System . out . println ( " Compute element at " + caret ) ;
INode element = getElementAt ( caret , false ) ; // if ( ! ( element instanceof INode ) )
// return null ;
// if ( element . getElementType ( ) = = IJavaElement . IMPORT _ DECLARATION ) {
// IImportDeclaration declaration = ( IImportDeclaration ) element ;
// IImportContainer container = ( IImportContainer )
// declaration . getParent ( ) ;
// ISourceRange srcRange = null ;
// try {
// srcRange = container . getSourceRange ( ) ;
// } catch ( JavaModelException e ) {
// if ( srcRange ! = null & & srcRange . getOffset ( ) = = caret )
// return container ;
return element ; |
public class druidGLexer { /** * $ ANTLR start " LPARAN " */
public final void mLPARAN ( ) throws RecognitionException { } } | try { int _type = LPARAN ; int _channel = DEFAULT_TOKEN_CHANNEL ; // druidG . g : 573:8 : ( ' ( ' )
// druidG . g : 573:11 : ' ( '
{ match ( '(' ) ; } state . type = _type ; state . channel = _channel ; } finally { // do for sure before leaving
} |
public class NamePreservingRunnable { /** * Run the runnable after having renamed the current thread ' s name
* to the new name . When the runnable has completed , set back the
* current thread name back to its origin . */
public void run ( ) { } } | Thread currentThread = Thread . currentThread ( ) ; String oldName = currentThread . getName ( ) ; if ( newName != null ) { setName ( currentThread , newName ) ; } try { runnable . run ( ) ; } finally { setName ( currentThread , oldName ) ; } |
public class HttpUtil { /** * 通过 get 方式请求数据
* @ param url { URL }
* @ param params 在参数过多的时候 , 可能你更喜欢用 Map 来进行保存你的参数
* @ return { URL } 返回的数据 , 类型是 String
* @ throws IOException IO异常 : 给定的 URL 不正确 , 或者其他原因 , 导致服务法法找到
* 或是在向服务器上传数据时 , 当然还有可能在读取服务返回的数据时 */
public static String get ( String url , String params ) throws IOException { } } | return HttpUtil . get ( url , null , params ) ; |
public class BusSupport { /** * Dispatch event to a subscriber , you should not call this method directly .
* @ param event TangramOp1 object */
@ Override public synchronized void dispatch ( @ NonNull Event event ) { } } | String type = event . type ; List < EventHandlerWrapper > eventHandlers = subscribers . get ( type ) ; if ( eventHandlers != null ) { EventHandlerWrapper handler = null ; for ( int i = 0 , size = eventHandlers . size ( ) ; i < size ; i ++ ) { handler = eventHandlers . get ( i ) ; if ( handler . eventHandlerReceiver != null ) { handler . handleEvent ( event ) ; } else { if ( ! TextUtils . isEmpty ( handler . producer ) && handler . producer . equals ( event . sourceId ) || TextUtils . isEmpty ( handler . producer ) ) { handler . handleEvent ( event ) ; } } } } |
public class AbstractChartBuilder { /** * < p > addSubTitle . < / p >
* @ param chart a { @ link org . jfree . chart . JFreeChart } object .
* @ param subTitle a { @ link java . lang . String } object .
* @ param font a { @ link java . awt . Font } object . */
protected void addSubTitle ( JFreeChart chart , String subTitle , Font font ) { } } | if ( StringUtils . isNotEmpty ( subTitle ) ) { TextTitle chartSubTitle = new TextTitle ( subTitle ) ; customizeTitle ( chartSubTitle , font ) ; chart . addSubtitle ( chartSubTitle ) ; } |
public class NaaccrXmlUtils { /** * Returns all the available attributes from the given XML file .
* @ param xmlFile provided data file
* @ return the available attributes in a map , maybe empty but never null */
public static Map < String , String > getAttributesFromXmlFile ( File xmlFile ) { } } | if ( xmlFile == null || ! xmlFile . exists ( ) ) return Collections . emptyMap ( ) ; try ( Reader reader = createReader ( xmlFile ) ) { return getAttributesFromXmlReader ( reader ) ; } catch ( IOException | RuntimeException e ) { return Collections . emptyMap ( ) ; } |
public class PersistentMessageStoreImpl { /** * Feature SIB0112b . ms . 1 */
public List < DataSlice > readDataOnly ( Persistable item ) throws PersistenceException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "readDataOnly" , "Item=" + item ) ; // Defect 363755
if ( ! _available ) { MessageStoreUnavailableException msue = new MessageStoreUnavailableException ( "Operation not possible as MessageStore is unavailable!" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) SibTr . event ( this , tc , "Operation not possible as MessageStore is unavailable!" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "readDataOnly" ) ; throw msue ; } List < DataSlice > dataSlices = ( ( PersistableImpl ) item ) . getPersistedData ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "readDataOnly" , "return=" + dataSlices ) ; return dataSlices ; |
public class BalanceAtAllDirtyCheck { /** * < p > Setter for dateBalanceStoreStart . < / p >
* @ param pDateBalanceStoreStart reference */
public final void setDateBalanceStoreStart ( final Date pDateBalanceStoreStart ) { } } | if ( pDateBalanceStoreStart == null ) { this . dateBalanceStoreStart = null ; } else { this . dateBalanceStoreStart = new Date ( pDateBalanceStoreStart . getTime ( ) ) ; } |
public class ParserAdapter { /** * Parse an XML document .
* @ param input An input source for the document .
* @ exception java . io . IOException If there is a problem reading
* the raw content of the document .
* @ exception SAXException If there is a problem
* processing the document .
* @ see # parse ( java . lang . String )
* @ see org . xml . sax . Parser # parse ( org . xml . sax . InputSource ) */
public void parse ( InputSource input ) throws IOException , SAXException { } } | if ( parsing ) { throw new SAXException ( "Parser is already in use" ) ; } setupParser ( ) ; parsing = true ; try { parser . parse ( input ) ; } finally { parsing = false ; } parsing = false ; |
public class StoreImpl { /** * / * ( non - Javadoc )
* @ see com . att . env . Store # staticSlot ( java . lang . String ) */
public synchronized StaticSlot staticSlot ( String name ) { } } | name = name == null ? "" : name . trim ( ) ; StaticSlot slot = staticMap . get ( name ) ; if ( slot == null ) { if ( stat % growSize == 0 ) { Object [ ] temp = staticState ; staticState = new Object [ temp . length + growSize ] ; System . arraycopy ( temp , 0 , staticState , 0 , temp . length ) ; } slot = new StaticSlot ( stat ++ , name ) ; staticMap . put ( name , slot ) ; } return slot ; |
public class RenamePRequest { /** * < code > optional . alluxio . grpc . file . RenamePOptions options = 3 ; < / code > */
public alluxio . grpc . RenamePOptionsOrBuilder getOptionsOrBuilder ( ) { } } | return options_ == null ? alluxio . grpc . RenamePOptions . getDefaultInstance ( ) : options_ ; |
public class GenericColor { /** * Parses the { @ link GenericColor } given as { @ link String } representation .
* @ param color is the color as { @ link String } .
* @ return the parsed { @ link GenericColor } . */
public static GenericColor valueOf ( String color ) { } } | Objects . requireNonNull ( color , "color" ) ; Color namedColor = Color . fromName ( color ) ; if ( namedColor != null ) { return valueOf ( namedColor ) ; } int length = color . length ( ) ; Throwable cause = null ; try { // " # RRGGBB " / # AARRGGBB
Color hexColor = Color . parseHexString ( color ) ; if ( hexColor != null ) { return valueOf ( hexColor ) ; } // " rgb ( 1,1,1 ) " = 10
if ( length >= 7 ) { String model = BasicHelper . toUpperCase ( color . substring ( 0 , 3 ) ) ; ColorModel colorModel = ColorModel . valueOf ( model ) ; int index = 3 ; boolean hasAlpha = false ; char c = Character . toLowerCase ( color . charAt ( index ) ) ; if ( c == 'a' ) { hasAlpha = true ; index ++ ; c = color . charAt ( index ) ; } if ( c == '(' ) { index ++ ; int endIndex = color . indexOf ( ',' , index ) ; if ( endIndex > 0 ) { String firstSegment = color . substring ( index , endIndex ) . trim ( ) ; index = endIndex + 1 ; endIndex = color . indexOf ( ',' , index ) ; if ( endIndex > 0 ) { String secondSegment = color . substring ( index , endIndex ) . trim ( ) ; index = endIndex + 1 ; if ( hasAlpha ) { endIndex = color . indexOf ( ',' , index ) ; } else { endIndex = length - 1 ; } if ( endIndex > 0 ) { String thirdSegment = color . substring ( index , endIndex ) . trim ( ) ; Alpha alpha ; if ( hasAlpha ) { alpha = new Alpha ( color . substring ( endIndex + 1 , length - 1 ) ) ; } else { alpha = Alpha . OPAQUE ; } switch ( colorModel ) { case RGB : return valueOf ( new Red ( firstSegment ) , new Green ( secondSegment ) , new Blue ( thirdSegment ) , alpha ) ; case HSL : return valueOf ( new Hue ( firstSegment ) , new Saturation ( secondSegment ) , new Lightness ( thirdSegment ) , alpha ) ; case HSV : case HSB : return valueOf ( new Hue ( firstSegment ) , new Saturation ( secondSegment ) , new Brightness ( thirdSegment ) , alpha ) ; default : throw new IllegalStateException ( "" + colorModel ) ; } } } } } } } catch ( RuntimeException e ) { cause = e ; } throw new IllegalArgumentException ( color , cause ) ; |
public class InternalPureXbaseParser { /** * InternalPureXbase . g : 4244:1 : entryRuleXWhileExpression returns [ EObject current = null ] : iv _ ruleXWhileExpression = ruleXWhileExpression EOF ; */
public final EObject entryRuleXWhileExpression ( ) throws RecognitionException { } } | EObject current = null ; EObject iv_ruleXWhileExpression = null ; try { // InternalPureXbase . g : 4244:57 : ( iv _ ruleXWhileExpression = ruleXWhileExpression EOF )
// InternalPureXbase . g : 4245:2 : iv _ ruleXWhileExpression = ruleXWhileExpression EOF
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXWhileExpressionRule ( ) ) ; } pushFollow ( FOLLOW_1 ) ; iv_ruleXWhileExpression = ruleXWhileExpression ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current = iv_ruleXWhileExpression ; } match ( input , EOF , FOLLOW_2 ) ; if ( state . failed ) return current ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class QRColPivDecompositionHouseholderColumn_DDRM { /** * Sets the initial pivot ordering and compute the F - norm squared for each column */
protected void setupPivotInfo ( ) { } } | for ( int col = 0 ; col < numCols ; col ++ ) { pivots [ col ] = col ; double c [ ] = dataQR [ col ] ; double norm = 0 ; for ( int row = 0 ; row < numRows ; row ++ ) { double element = c [ row ] ; norm += element * element ; } normsCol [ col ] = norm ; } |
public class InterceptorMetaDataHelper { /** * Verify a specified AroundInvoke interceptor method has correct method
* modifiers and signature .
* @ param kind the interceptor kind
* @ param m is the java reflection Method object for the around invoke method .
* @ param ejbClass is true if the interceptor is defined on the enterprise bean class
* @ param name is the { @ link J2EEName } of the EJB .
* @ throws EJBConfigurationException is thrown if any configuration error is detected . */
public static void validateAroundSignature ( InterceptorMethodKind kind , Method m , J2EEName name ) throws EJBConfigurationException { } } | // Get the modifers for the interceptor method and verify that the
// method is neither final nor static as required by EJB specification .
int mod = m . getModifiers ( ) ; if ( Modifier . isFinal ( mod ) || Modifier . isStatic ( mod ) ) { // CNTR0229E : The { 0 } interceptor method must not be declared as final or static .
String method = m . toGenericString ( ) ; Tr . error ( tc , "INVALID_INTERCEPTOR_METHOD_MODIFIER_CNTR0229E" , new Object [ ] { method } ) ; throw new EJBConfigurationException ( kind . getXMLElementName ( ) + " interceptor \"" + method + "\" must not be declared as final or static." ) ; } // Verify AroundInvoke has 1 parameter of type InvocationContext .
Class < ? > [ ] parmTypes = m . getParameterTypes ( ) ; if ( ( parmTypes . length == 1 ) && ( parmTypes [ 0 ] . equals ( InvocationContext . class ) ) ) { // Has correct signature of 1 parameter of type InvocationContext
} else { String method = m . toGenericString ( ) ; Tr . error ( tc , "INVALID_AROUND_INVOKE_SIGNATURE_CNTR0230E" , new Object [ ] { method , kind . getXMLElementName ( ) } ) ; // F743-17763.1
throw new EJBConfigurationException ( kind . getXMLElementName ( ) + " interceptor \"" + method + "\" must have a single parameter of type javax.interceptors.InvocationContext." ) ; } // Verify return type .
Class < ? > returnType = m . getReturnType ( ) ; // F743-17763.1 - The spec requires that around interceptor methods have
// exactly Object as the return type . The original AroundInvoke check
// was not as strict , but we keep it for compatibility with previous
// releases .
if ( returnType != Object . class ) { boolean compatiblyValid = kind == InterceptorMethodKind . AROUND_INVOKE && Object . class . isAssignableFrom ( returnType ) ; // d668039
if ( ! compatiblyValid || isValidationLoggable ( ) ) { String method = m . toGenericString ( ) ; Tr . error ( tc , "INVALID_AROUND_INVOKE_SIGNATURE_CNTR0230E" , new Object [ ] { method , kind . getXMLElementName ( ) } ) ; // F743-17763.1
if ( ! compatiblyValid || isValidationFailable ( ) ) // d668039
{ throw new EJBConfigurationException ( kind . getXMLElementName ( ) + " interceptor \"" + method + "\" must have a return value of type java.lang.Object." ) ; } } } // Per the EJB 3.2 spec , " Note : An around - invoke interceptor method may
// be declared to throw any checked exceptions that the associated
// target method allows within its throws clause . It may be declared to
// throw the java . lang . Exception if it interposes on several methods
// that can throw unrelated checked exceptions . " |
public class PatternBox { /** * Finds two Protein that appear together in a Complex .
* @ return the pattern */
public static Pattern bindsTo ( ) { } } | Pattern p = new Pattern ( ProteinReference . class , "first PR" ) ; p . add ( erToPE ( ) , "first PR" , "first simple PE" ) ; p . add ( linkToComplex ( ) , "first simple PE" , "Complex" ) ; p . add ( new Type ( Complex . class ) , "Complex" ) ; p . add ( linkToSpecific ( ) , "Complex" , "second simple PE" ) ; p . add ( peToER ( ) , "second simple PE" , "second PR" ) ; p . add ( equal ( false ) , "first PR" , "second PR" ) ; return p ; |
public class RotateChannelCredentialsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( RotateChannelCredentialsRequest rotateChannelCredentialsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( rotateChannelCredentialsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( rotateChannelCredentialsRequest . getId ( ) , ID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class GCMRegistrar { /** * Checks whether the device was successfully registered in the server side ,
* as set by { @ link # setRegisteredOnServer ( Context , boolean ) } .
* < p > To avoid the scenario where the device sends the registration to the
* server but the server loses it , this flag has an expiration date , which
* is { @ link # DEFAULT _ ON _ SERVER _ LIFESPAN _ MS } by default ( but can be changed
* by { @ link # setRegisterOnServerLifespan ( Context , long ) } ) . */
public static boolean isRegisteredOnServer ( Context context ) { } } | final SharedPreferences prefs = getGCMPreferences ( context ) ; boolean isRegistered = prefs . getBoolean ( PROPERTY_ON_SERVER , false ) ; Log . v ( TAG , "Is registered on server: " + isRegistered ) ; if ( isRegistered ) { // checks if the information is not stale
long expirationTime = prefs . getLong ( PROPERTY_ON_SERVER_EXPIRATION_TIME , - 1 ) ; if ( System . currentTimeMillis ( ) > expirationTime ) { Log . v ( TAG , "flag expired on: " + new Timestamp ( expirationTime ) ) ; return false ; } } return isRegistered ; |
public class PreferenceFragment { /** * Returns , whether the neutral button of the example dialog should be shown , or not .
* @ return True , if the neutral button should be shown , false otherwise */
private boolean shouldNeutralButtonBeShown ( ) { } } | SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . show_neutral_button_preference_key ) ; boolean defaultValue = getResources ( ) . getBoolean ( R . bool . show_neutral_button_preference_default_value ) ; return sharedPreferences . getBoolean ( key , defaultValue ) ; |
public class PartitionedFileSourceBase { /** * Gobblin calls the { @ link Source # getWorkunits ( SourceState ) } method after creating a { @ link Source } object with a
* blank constructor , so any custom initialization of the object needs to be done here . */
protected void init ( SourceState state ) { } } | retriever . init ( state ) ; try { initFileSystemHelper ( state ) ; } catch ( FileBasedHelperException e ) { Throwables . propagate ( e ) ; } AvroFsHelper fsHelper = ( AvroFsHelper ) this . fsHelper ; this . fs = fsHelper . getFileSystem ( ) ; this . sourceState = state ; this . lowWaterMark = getLowWaterMark ( state . getPreviousWorkUnitStates ( ) , state . getProp ( DATE_PARTITIONED_SOURCE_MIN_WATERMARK_VALUE , String . valueOf ( DEFAULT_DATE_PARTITIONED_SOURCE_MIN_WATERMARK_VALUE ) ) ) ; this . maxFilesPerJob = state . getPropAsInt ( DATE_PARTITIONED_SOURCE_MAX_FILES_PER_JOB , DEFAULT_DATE_PARTITIONED_SOURCE_MAX_FILES_PER_JOB ) ; this . maxWorkUnitsPerJob = state . getPropAsInt ( DATE_PARTITIONED_SOURCE_MAX_WORKUNITS_PER_JOB , DEFAULT_DATE_PARTITIONED_SOURCE_MAX_WORKUNITS_PER_JOB ) ; this . tableType = TableType . valueOf ( state . getProp ( ConfigurationKeys . EXTRACT_TABLE_TYPE_KEY ) . toUpperCase ( ) ) ; this . fileCount = 0 ; this . sourceDir = new Path ( state . getProp ( ConfigurationKeys . SOURCE_FILEBASED_DATA_DIRECTORY ) ) ; |
public class ClauseParser { /** * Constructs complex types values from the JSONObjects that represent them . Turns all Numbers
* into BigDecimal for easier comparison . All fields and parameters must be run through this
* method .
* @ param value
* @ return null if value is a JSONObject , but not a complex type . */
public static Object parseValue ( Object value ) { } } | if ( value == null ) { return null ; } if ( value instanceof Double ) { return new BigDecimal ( ( Double ) value ) ; } else if ( value instanceof Long ) { return new BigDecimal ( ( Long ) value ) ; } else if ( value instanceof Integer ) { return new BigDecimal ( ( Integer ) value ) ; } else if ( value instanceof Float ) { return new BigDecimal ( ( Float ) value ) ; } else if ( value instanceof Short ) { return new BigDecimal ( ( Short ) value ) ; } else if ( value instanceof String ) { return ( ( String ) value ) . trim ( ) ; } else if ( value instanceof Apptentive . Version ) { return value ; } else if ( value instanceof Apptentive . DateTime ) { return value ; } else if ( value instanceof JSONObject ) { JSONObject jsonObject = ( JSONObject ) value ; String typeName = jsonObject . optString ( KEY_COMPLEX_TYPE ) ; if ( typeName != null ) { try { if ( Apptentive . Version . TYPE . equals ( typeName ) ) { return new Apptentive . Version ( jsonObject ) ; } else if ( Apptentive . DateTime . TYPE . equals ( typeName ) ) { return new Apptentive . DateTime ( jsonObject ) ; } else { throw new RuntimeException ( String . format ( "Error parsing complex parameter with unrecognized name: \"%s\"" , typeName ) ) ; } } catch ( JSONException e ) { throw new RuntimeException ( String . format ( "Error parsing complex parameter: %s" , Util . classToString ( value ) ) , e ) ; } } else { throw new RuntimeException ( String . format ( "Error: Complex type parameter missing \"%s\"." , KEY_COMPLEX_TYPE ) ) ; } } // All other values , such as Boolean and String should be returned unaltered .
return value ; |
public class JavacParser { /** * Report a syntax error using the given DiagnosticPosition object and
* arguments , unless one was already reported at the same position . */
private void reportSyntaxError ( JCDiagnostic . DiagnosticPosition diagPos , String key , Object ... args ) { } } | int pos = diagPos . getPreferredPosition ( ) ; if ( pos > S . errPos ( ) || pos == Position . NOPOS ) { if ( token . kind == EOF ) { error ( diagPos , "premature.eof" ) ; } else { error ( diagPos , key , args ) ; } } S . errPos ( pos ) ; if ( token . pos == errorPos ) nextToken ( ) ; // guarantee progress
errorPos = token . pos ; |
public class QueryNode { /** * Dumps this QueryNode and its child nodes to a String .
* @ return the query tree as a String .
* @ throws RepositoryException */
public String dump ( ) throws RepositoryException { } } | StringBuilder tmp = new StringBuilder ( ) ; QueryTreeDump . dump ( this , tmp ) ; return tmp . toString ( ) ; |
public class BoxApiCollaboration { /** * A request that adds a { @ link com . box . androidsdk . content . models . BoxUser user } or { @ link com . box . androidsdk . content . models . BoxGroup group } as a collaborator to a file .
* @ param fileId id of the file to be collaborated .
* @ param role role of the collaboration
* @ param collaborator the { @ link com . box . androidsdk . content . models . BoxUser user } or { @ link com . box . androidsdk . content . models . BoxGroup group } to add as a collaborator
* @ return request to add / create a collaboration */
public BoxRequestsShare . AddCollaboration getAddToFileRequest ( String fileId , BoxCollaboration . Role role , BoxCollaborator collaborator ) { } } | return new BoxRequestsShare . AddCollaboration ( getCollaborationsUrl ( ) , BoxFile . createFromId ( fileId ) , role , collaborator , mSession ) ; |
public class CorporationApi { /** * Get corporation structures ( asynchronously ) Get a list of corporation
* structures . This route & # 39 ; s version includes the changes to structures
* detailed in this blog :
* https : / / www . eveonline . com / article / upwell - 2.0 - structures
* - changes - coming - on - february - 13th - - - This route is cached for up to 3600
* seconds - - - Requires one of the following EVE corporation role ( s ) :
* Station _ Manager SSO Scope : esi - corporations . read _ structures . v1
* @ param corporationId
* An EVE corporation ID ( required )
* @ param acceptLanguage
* Language to use in the response ( optional , default to en - us )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param ifNoneMatch
* ETag from a previous request . A 304 will be returned if this
* matches the current ETag ( optional )
* @ param language
* Language to use in the response , takes precedence over
* Accept - Language ( optional , default to en - us )
* @ param page
* Which page of results to return ( optional , default to 1)
* @ param token
* Access token to use if unable to set a header ( optional )
* @ param callback
* The callback to be executed when the API call finishes
* @ return The request call
* @ throws ApiException
* If fail to process the API call , e . g . serializing the request
* body object */
public com . squareup . okhttp . Call getCorporationsCorporationIdStructuresAsync ( Integer corporationId , String acceptLanguage , String datasource , String ifNoneMatch , String language , Integer page , String token , final ApiCallback < List < CorporationStructuresResponse > > callback ) throws ApiException { } } | com . squareup . okhttp . Call call = getCorporationsCorporationIdStructuresValidateBeforeCall ( corporationId , acceptLanguage , datasource , ifNoneMatch , language , page , token , callback ) ; Type localVarReturnType = new TypeToken < List < CorporationStructuresResponse > > ( ) { } . getType ( ) ; apiClient . executeAsync ( call , localVarReturnType , callback ) ; return call ; |
public class FieldDocImpl { /** * A static version of the above . */
static String constantValueExpression ( Object cb ) { } } | if ( cb == null ) return null ; if ( cb instanceof Character ) return sourceForm ( ( ( Character ) cb ) . charValue ( ) ) ; if ( cb instanceof Byte ) return sourceForm ( ( ( Byte ) cb ) . byteValue ( ) ) ; if ( cb instanceof String ) return sourceForm ( ( String ) cb ) ; if ( cb instanceof Double ) return sourceForm ( ( ( Double ) cb ) . doubleValue ( ) , 'd' ) ; if ( cb instanceof Float ) return sourceForm ( ( ( Float ) cb ) . doubleValue ( ) , 'f' ) ; if ( cb instanceof Long ) return cb + "L" ; return cb . toString ( ) ; // covers int , short |
public class LockFile { /** * Opens ( constructs ) this object ' s { @ link # raf RandomAccessFile } . < p >
* @ throws UnexpectedFileNotFoundException if a
* < tt > FileNotFoundException < / tt > is thrown in reponse to
* constructing the < tt > RandomAccessFile < / tt > object .
* @ throws FileSecurityException if a required system property value cannot
* be accessed , or if a Java security manager exists and its
* < tt > { @ link java . lang . SecurityManager # checkRead } < / tt > method
* denies read access to the file ; or if its < tt > { @ link
* java . lang . SecurityManager # checkWrite ( java . lang . String ) } < / tt >
* method denies write access to the file */
private final void openRAF ( ) throws LockFile . UnexpectedFileNotFoundException , LockFile . FileSecurityException { } } | try { raf = new RandomAccessFile ( file , "rw" ) ; } catch ( SecurityException ex ) { throw new FileSecurityException ( this , "openRAF" , ex ) ; } catch ( FileNotFoundException ex ) { throw new UnexpectedFileNotFoundException ( this , "openRAF" , ex ) ; } |
public class DateRangePicker { /** * Adds a date range to the choice list .
* @ param range Date range item
* @ param isCustom If true , range is a custom item . In this case , if another matching custom
* item exists , it will not be added .
* @ return combo box item that was added ( or found if duplicate custom item ) . */
public Dateitem addChoice ( DateRange range , boolean isCustom ) { } } | Dateitem item ; if ( isCustom ) { item = findMatchingItem ( range ) ; if ( item != null ) { return item ; } } item = new Dateitem ( ) ; item . setLabel ( range . getLabel ( ) ) ; item . setData ( range ) ; addChild ( item , isCustom ? null : customItem ) ; if ( range . isDefault ( ) ) { setSelectedItem ( item ) ; } return item ; |
public class KeyVaultClientBaseImpl { /** * Regenerates the specified key value for the given storage account . This operation requires the storage / regeneratekey permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param storageAccountName The name of the storage account .
* @ param keyName The storage account key name .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the StorageBundle object */
public Observable < ServiceResponse < StorageBundle > > regenerateStorageAccountKeyWithServiceResponseAsync ( String vaultBaseUrl , String storageAccountName , String keyName ) { } } | if ( vaultBaseUrl == null ) { throw new IllegalArgumentException ( "Parameter vaultBaseUrl is required and cannot be null." ) ; } if ( storageAccountName == null ) { throw new IllegalArgumentException ( "Parameter storageAccountName is required and cannot be null." ) ; } if ( this . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.apiVersion() is required and cannot be null." ) ; } if ( keyName == null ) { throw new IllegalArgumentException ( "Parameter keyName is required and cannot be null." ) ; } StorageAccountRegenerteKeyParameters parameters = new StorageAccountRegenerteKeyParameters ( ) ; parameters . withKeyName ( keyName ) ; String parameterizedHost = Joiner . on ( ", " ) . join ( "{vaultBaseUrl}" , vaultBaseUrl ) ; return service . regenerateStorageAccountKey ( storageAccountName , this . apiVersion ( ) , this . acceptLanguage ( ) , parameters , parameterizedHost , this . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < StorageBundle > > > ( ) { @ Override public Observable < ServiceResponse < StorageBundle > > call ( Response < ResponseBody > response ) { try { ServiceResponse < StorageBundle > clientResponse = regenerateStorageAccountKeyDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class Mathlib { /** * Calculates whether or not 2 line - segments intersect .
* @ param c1
* First coordinate of the first line - segment .
* @ param c2
* Second coordinate of the first line - segment .
* @ param c3
* First coordinate of the second line - segment .
* @ param c4
* Second coordinate of the second line - segment .
* @ return Returns true or false . */
public static boolean lineIntersects ( Coordinate c1 , Coordinate c2 , Coordinate c3 , Coordinate c4 ) { } } | LineSegment ls1 = new LineSegment ( c1 , c2 ) ; LineSegment ls2 = new LineSegment ( c3 , c4 ) ; return ls1 . intersects ( ls2 ) ; |
public class Function { /** * Override this method for bound event handlers if you wish to deal with
* per - handler user data .
* @ return boolean false means stop propagation and prevent default */
public boolean f ( Event e , Object ... arg ) { } } | setArguments ( arg ) ; setEvent ( e ) ; return f ( e ) ; |
public class CnvBnRsToDouble { /** * < p > Convert parameter with using name . < / p >
* @ param pAddParam additional params , e . g . entity class UserRoleTomcat
* to reveal derived columns for its composite ID , or field Enum class
* to reveal Enum value by index .
* @ param pFrom from a bean
* @ param pName by a name
* @ return pTo to a bean
* @ throws Exception - an exception */
@ Override public final Double convert ( final Map < String , Object > pAddParam , final IRecordSet < RS > pFrom , final String pName ) throws Exception { } } | return pFrom . getDouble ( pName ) ; |
public class ElemLiteralResult { /** * Get whether or not the passed URL is flagged by
* the " extension - element - prefixes " or " exclude - result - prefixes "
* properties .
* @ see < a href = " http : / / www . w3 . org / TR / xslt # extension - element " > extension - element in XSLT Specification < / a >
* @ param prefix non - null reference to prefix that might be excluded . ( not currently used )
* @ param uri reference to namespace that prefix maps to
* @ return true if the prefix should normally be excluded . */
public boolean containsExcludeResultPrefix ( String prefix , String uri ) { } } | if ( uri == null || ( null == m_excludeResultPrefixes && null == m_ExtensionElementURIs ) ) return super . containsExcludeResultPrefix ( prefix , uri ) ; if ( prefix . length ( ) == 0 ) prefix = Constants . ATTRVAL_DEFAULT_PREFIX ; // This loop is ok here because this code only runs during
// stylesheet compile time .
if ( m_excludeResultPrefixes != null ) for ( int i = 0 ; i < m_excludeResultPrefixes . size ( ) ; i ++ ) { if ( uri . equals ( getNamespaceForPrefix ( m_excludeResultPrefixes . elementAt ( i ) ) ) ) return true ; } // JJK Bugzilla 1133 : Also check locally - scoped extensions
if ( m_ExtensionElementURIs != null && m_ExtensionElementURIs . contains ( uri ) ) return true ; return super . containsExcludeResultPrefix ( prefix , uri ) ; |
public class XMLConverUtil { /** * XML to Object
* @ param < T >
* @ param clazz
* clazz
* @ param xml
* xml
* @ return T */
public static < T > T convertToObject ( Class < T > clazz , String xml ) { } } | return convertToObject ( clazz , new StringReader ( xml ) ) ; |
public class DataTablesDom { /** * Add a custom element
* @ param sStr
* Custom element to add . May not be < code > null < / code > nor empty .
* @ return this */
@ Nonnull public DataTablesDom addCustom ( @ Nonnull @ Nonempty final String sStr ) { } } | ValueEnforcer . notEmpty ( sStr , "Str" ) ; _internalAdd ( sStr ) ; return this ; |
public class TrainingsImpl { /** * Delete a specific project .
* @ param projectId The project id
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceResponse } object if successful . */
public Observable < ServiceResponse < Void > > deleteProjectWithServiceResponseAsync ( UUID projectId ) { } } | if ( projectId == null ) { throw new IllegalArgumentException ( "Parameter projectId is required and cannot be null." ) ; } if ( this . client . apiKey ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiKey() is required and cannot be null." ) ; } return service . deleteProject ( projectId , this . client . apiKey ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Void > > > ( ) { @ Override public Observable < ServiceResponse < Void > > call ( Response < ResponseBody > response ) { try { ServiceResponse < Void > clientResponse = deleteProjectDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class GeoPackageCoreConnection { /** * Query for values from the first column
* @ param < T >
* result value type
* @ param sql
* sql statement
* @ param args
* sql arguments
* @ return single column values
* @ since 3.1.0 */
public < T > List < T > querySingleColumnTypedResults ( String sql , String [ ] args ) { } } | @ SuppressWarnings ( "unchecked" ) List < T > result = ( List < T > ) querySingleColumnResults ( sql , args ) ; return result ; |
public class Mapping { /** * Finds an entity given its primary key .
* @ throws RowNotFoundException
* If no such object was found .
* @ throws TooManyRowsException
* If more that one object was returned for the given ID . */
public T findById ( Object id ) throws RowNotFoundException , TooManyRowsException { } } | return findWhere ( eq ( idColumn . getColumnName ( ) , id ) ) . getSingleResult ( ) ; |
public class AbortConfig { /** * The list of abort criteria to define rules to abort the job .
* @ param criteriaList
* The list of abort criteria to define rules to abort the job . */
public void setCriteriaList ( java . util . Collection < AbortCriteria > criteriaList ) { } } | if ( criteriaList == null ) { this . criteriaList = null ; return ; } this . criteriaList = new java . util . ArrayList < AbortCriteria > ( criteriaList ) ; |
public class AngularMomentum { /** * Calculates the I + operator */
public Matrix getIplus ( ) { } } | Matrix Iplus = new Matrix ( size , size ) ; int i , j ; for ( i = 0 ; i < size ; i ++ ) for ( j = 0 ; j < size ; j ++ ) Iplus . matrix [ i ] [ j ] = 0d ; for ( i = 1 ; i < size ; i ++ ) Iplus . matrix [ i - 1 ] [ i ] = Math . sqrt ( J * J + J - ( J - i + 1 ) * ( J - i + 1 ) + ( J - i + 1 ) ) ; return Iplus ; |
public class DBQuery { /** * The field , modulo the given mod argument , is equal to the value
* @ param field The field to compare
* @ param mod The modulo
* @ param value The value to compare to
* @ return the query */
public static Query mod ( String field , Number mod , Number value ) { } } | return new Query ( ) . mod ( field , mod , value ) ; |
public class AtomicShortIntArray { /** * Sets the element at the given index , but only if the previous value was the expected value .
* @ param i the index
* @ param expect the expected value
* @ param update the new value
* @ return true on success */
public boolean compareAndSet ( int i , int expect , int update ) { } } | while ( true ) { try { updateLock . lock ( ) ; try { return store . get ( ) . compareAndSet ( i , expect , update ) ; } finally { updateLock . unlock ( ) ; } } catch ( PaletteFullException pfe ) { resizeLock . lock ( ) ; try { if ( store . get ( ) . isPaletteMaxSize ( ) ) { store . set ( new AtomicShortIntDirectBackingArray ( store . get ( ) ) ) ; } else { store . set ( new AtomicShortIntPaletteBackingArray ( store . get ( ) , true ) ) ; } } finally { resizeLock . unlock ( ) ; } } } |
public class LimesurveyRC { /** * Update a response .
* @ param surveyId the survey id of the survey you want to update the response
* @ param responseId the response id of the response you want to update
* @ param responseData the response data that contains the fields you want to update
* @ return the json element
* @ throws LimesurveyRCException the limesurvey rc exception */
public JsonElement updateResponse ( int surveyId , int responseId , Map < String , String > responseData ) throws LimesurveyRCException { } } | LsApiBody . LsApiParams params = getParamsWithKey ( surveyId ) ; responseData . put ( "id" , String . valueOf ( responseId ) ) ; params . setResponseData ( responseData ) ; return callRC ( new LsApiBody ( "update_response" , params ) ) ; |
public class JolokiaServlet { /** * { @ inheritDoc } */
@ Override public void destroy ( ) { } } | if ( logTracker != null ) { logTracker . close ( ) ; logTracker = null ; } bundleContextGiven = null ; super . destroy ( ) ; |
public class Event { /** * < p > Two events are considered deeply equal if they have same key and exactly same
* parameters lists . < / p >
* < p > Parameters are compared using { @ link Arrays # deepEquals ( Object [ ] , Object [ ] ) } , so be sure
* to have correct implementation of { @ link Object # equals ( Object ) } method for all parameters .
* < p > If you don ' t want some of parameters to be compared pass them as tags using
* { @ link Builder # tag ( Object . . . ) } builder method . < / p > */
public static boolean isDeeplyEqual ( @ NonNull Event e1 , @ NonNull Event e2 ) { } } | return e1 == e2 || ( e1 . key . equals ( e2 . key ) && Arrays . deepEquals ( e1 . params , e2 . params ) ) ; |
public class UserDetailsServiceImpl { /** * This method returns all of the non - system - defined users .
* @ return */
public List < SecurityUserBean > getUsers ( ) { } } | List < SecurityUserBean > users = new ArrayList < SecurityUserBean > ( ) ; for ( DuracloudUserDetails user : this . usersTable . values ( ) ) { SecurityUserBean bean = createUserBean ( user ) ; users . add ( bean ) ; } return users ; |
public class WindowUtils { /** * Creates a { @ link WindowFocusListener } that calls repaint on the given
* { @ link JComponent } when focused gained or focus lost is called . */
private static WindowFocusListener createRepaintWindowListener ( final JComponent component ) { } } | if ( component instanceof WindowFocusListener ) { return ( WindowFocusListener ) component ; } else { return new WindowFocusListener ( ) { public void windowGainedFocus ( WindowEvent e ) { if ( component instanceof WindowFocusListener ) { ( ( WindowFocusListener ) component ) . windowGainedFocus ( e ) ; } component . repaint ( ) ; } public void windowLostFocus ( WindowEvent e ) { if ( component instanceof WindowFocusListener ) { ( ( WindowFocusListener ) component ) . windowLostFocus ( e ) ; } component . repaint ( ) ; } } ; } |
public class Configuration { /** * Return time duration in the given time unit . Valid units are encoded in
* properties as suffixes : nanoseconds ( ns ) , microseconds ( us ) , milliseconds
* ( ms ) , seconds ( s ) , minutes ( m ) , hours ( h ) , and days ( d ) .
* @ param name Property name
* @ param defaultValue Value returned if no mapping exists .
* @ param unit Unit to convert the stored property , if it exists .
* @ throws NumberFormatException If the property stripped of its unit is not
* a number */
public long getTimeDuration ( String name , long defaultValue , TimeUnit unit ) { } } | String vStr = get ( name ) ; if ( null == vStr ) { return defaultValue ; } else { return getTimeDurationHelper ( name , vStr , unit ) ; } |
public class AmazonS3Client { /** * Sets the ACL for the specified resource in S3 . If only bucketName is
* specified , the ACL will be applied to the bucket , otherwise if bucketName
* and key are specified , the ACL will be applied to the object .
* @ param bucketName
* The name of the bucket containing the specified key , or if no
* key is listed , the bucket whose ACL will be set .
* @ param key
* The optional object key within the specified bucket whose ACL
* will be set . If not specified , the bucket ACL will be set .
* @ param versionId
* The version ID of the object version whose ACL is being set .
* @ param acl
* The ACL to apply to the resource .
* @ param originalRequest
* The original , user facing request object . */
private void setAcl ( String bucketName , String key , String versionId , AccessControlList acl , boolean isRequesterPays , AmazonWebServiceRequest originalRequest ) { } } | if ( originalRequest == null ) originalRequest = new GenericBucketRequest ( bucketName ) ; Request < AmazonWebServiceRequest > request = createRequest ( bucketName , key , originalRequest , HttpMethodName . PUT ) ; if ( bucketName != null && key != null ) { request . addHandlerContext ( HandlerContextKey . OPERATION_NAME , "PutObjectAcl" ) ; } else if ( bucketName != null ) { request . addHandlerContext ( HandlerContextKey . OPERATION_NAME , "PutBucketAcl" ) ; } request . addParameter ( "acl" , null ) ; if ( versionId != null ) request . addParameter ( "versionId" , versionId ) ; populateRequesterPaysHeader ( request , isRequesterPays ) ; byte [ ] aclAsXml = new AclXmlFactory ( ) . convertToXmlByteArray ( acl ) ; request . addHeader ( "Content-Type" , "application/xml" ) ; request . addHeader ( "Content-Length" , String . valueOf ( aclAsXml . length ) ) ; request . setContent ( new ByteArrayInputStream ( aclAsXml ) ) ; invoke ( request , voidResponseHandler , bucketName , key ) ; |
public class URLDataSource2 { /** * Returns the value of the URL content - type header field */
@ Override public String getContentType ( ) { } } | URLConnection connection = null ; try { connection = url . openConnection ( ) ; } catch ( IOException e ) { } if ( connection == null ) return DEFAULT_CONTENT_TYPE ; return connection . getContentType ( ) ; |
public class OracleNoSQLSchemaManager { /** * ( non - Javadoc )
* @ see
* com . impetus . kundera . configure . schema . api . AbstractSchemaManager # update
* ( java . util . List ) */
@ Override protected void update ( List < TableInfo > tableInfos ) { } } | StatementResult result = null ; String statement = null ; for ( TableInfo tableInfo : tableInfos ) { try { Table table = tableAPI . getTable ( tableInfo . getTableName ( ) ) ; if ( table == null ) { statement = buildCreateDDLQuery ( tableInfo ) ; result = tableAPI . executeSync ( statement ) ; if ( ! result . isSuccessful ( ) ) { throw new SchemaGenerationException ( "Unable to CREATE TABLE " + tableInfo . getTableName ( ) ) ; } } else { List < ColumnInfo > columnInfos = tableInfo . getColumnMetadatas ( ) ; Map < String , String > newColumns = new HashMap < String , String > ( ) ; for ( ColumnInfo column : columnInfos ) { if ( table . getField ( column . getColumnName ( ) ) == null ) { newColumns . put ( column . getColumnName ( ) , column . getType ( ) . getSimpleName ( ) ) ; } } List < EmbeddedColumnInfo > embeddedColumnInfos = tableInfo . getEmbeddedColumnMetadatas ( ) ; for ( EmbeddedColumnInfo embeddedColumnInfo : embeddedColumnInfos ) { for ( ColumnInfo column : embeddedColumnInfo . getColumns ( ) ) { if ( table . getField ( column . getColumnName ( ) ) == null ) { newColumns . put ( column . getColumnName ( ) , column . getType ( ) . getSimpleName ( ) ) ; } } } if ( ! newColumns . isEmpty ( ) ) { statement = buildAlterDDLQuery ( tableInfo , newColumns ) ; result = tableAPI . executeSync ( statement ) ; if ( ! result . isSuccessful ( ) ) { throw new SchemaGenerationException ( "Unable to ALTER TABLE " + tableInfo . getTableName ( ) ) ; } } } createIndexOnTable ( tableInfo ) ; } catch ( IllegalArgumentException e ) { logger . error ( "Invalid Statement. Caused By: " , e ) ; throw new SchemaGenerationException ( e , "Invalid Statement. Caused By: " ) ; } catch ( FaultException e ) { logger . error ( "Statement couldn't be executed. Caused By: " , e ) ; throw new SchemaGenerationException ( e , "Statement couldn't be executed. Caused By: " ) ; } } |
public class VoiceApi { /** * Resume recording a call
* Resume recording the specified call .
* @ param id The connection ID of the call . ( required )
* @ param resumeRecordingBody Request parameters . ( optional )
* @ return ApiSuccessResponse
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiSuccessResponse resumeRecording ( String id , ResumeRecordingBody resumeRecordingBody ) throws ApiException { } } | ApiResponse < ApiSuccessResponse > resp = resumeRecordingWithHttpInfo ( id , resumeRecordingBody ) ; return resp . getData ( ) ; |
public class Log { /** * Write warn messasge on console .
* @ param message
* the message
* @ since 2.3.0 */
public static void warn ( Object ... message ) { } } | StringBuilder builder = new StringBuilder ( APP_WARN ) ; for ( Object object : message ) { builder . append ( object . toString ( ) ) ; } warnStream . println ( builder . toString ( ) ) ; |
public class CommonExpressionExtractor { /** * TODO extract column name and value from expression */
@ Override public Optional < CommonExpressionSegment > extract ( final ParserRuleContext expressionNode , final Map < ParserRuleContext , Integer > parameterMarkerIndexes ) { } } | return Optional . of ( new CommonExpressionSegment ( expressionNode . getStart ( ) . getStartIndex ( ) , expressionNode . getStop ( ) . getStopIndex ( ) ) ) ; |
public class EventStore { /** * A finder for Event objects in the EventStore
* @ param criteria the { @ link org . owasp . appsensor . core . criteria . SearchCriteria } object to search by
* @ param event the { @ link Event } object to match on
* @ return true or false depending on the matching of the search criteria to the event */
protected boolean isMatchingEvent ( SearchCriteria criteria , Event event ) { } } | boolean match = false ; User user = criteria . getUser ( ) ; DetectionPoint detectionPoint = criteria . getDetectionPoint ( ) ; Rule rule = criteria . getRule ( ) ; Collection < String > detectionSystemIds = criteria . getDetectionSystemIds ( ) ; DateTime earliest = DateUtils . fromString ( criteria . getEarliest ( ) ) ; // check user match if user specified
boolean userMatch = ( user != null ) ? user . equals ( event . getUser ( ) ) : true ; // check detection system match if detection systems specified
boolean detectionSystemMatch = ( detectionSystemIds != null && detectionSystemIds . size ( ) > 0 ) ? detectionSystemIds . contains ( event . getDetectionSystem ( ) . getDetectionSystemId ( ) ) : true ; // check detection point match if detection point specified
boolean detectionPointMatch = ( detectionPoint != null ) ? detectionPoint . typeAndThresholdMatches ( event . getDetectionPoint ( ) ) : true ; // check rule match if rule specified
boolean ruleMatch = ( rule != null ) ? rule . typeAndThresholdContainsDetectionPoint ( event . getDetectionPoint ( ) ) : true ; DateTime eventTimestamp = DateUtils . fromString ( event . getTimestamp ( ) ) ; boolean earliestMatch = ( earliest != null ) ? ( earliest . isBefore ( eventTimestamp ) || earliest . isEqual ( eventTimestamp ) ) : true ; if ( userMatch && detectionSystemMatch && detectionPointMatch && ruleMatch && earliestMatch ) { match = true ; } return match ; |
public class JSONNavi { /** * Access to last + 1 the index position .
* this method can only be used in writing mode . */
public JSONNavi < ? > atNext ( ) { } } | if ( failure ) return this ; if ( ! ( current instanceof List ) ) return failure ( "current node is not an Array" , null ) ; @ SuppressWarnings ( "unchecked" ) List < Object > lst = ( ( List < Object > ) current ) ; return at ( lst . size ( ) ) ; |
public class UserResource { /** * Get details for a single user .
* @ param id unique user id
* @ return user domain object */
@ GET @ Path ( "{id}" ) @ RolesAllowed ( { } } | "ROLE_ADMIN" } ) public Response read ( @ PathParam ( "id" ) Long id ) { checkNotNull ( id ) ; return Response . ok ( userService . getById ( id ) ) . build ( ) ; |
public class CpuEventViewer { /** * Helpers */
private void updateObject ( GenericTabItem tab , TraceObject pobj ) { } } | if ( pobj != null && ! pobj . isVisible ( ) ) { // Draw Object
String name = pobj . getName ( ) + " (" + pobj . getId ( ) . toString ( ) + ")" ; NormalLabel nlb = new NormalLabel ( name , tab . getCurrentFont ( ) ) ; ; RectangleLabelFigure nrr = new RectangleLabelFigure ( nlb ) ; Long objectXPos = tab . getXMax ( ) + CPU_X_OFFSET ; Long objectYPos = CPU_Y_POS + CPU_HEIGHT + ELEMENT_SIZE ; Long objWidth = new Long ( name . length ( ) ) * OBJECT_WIDTH_FACTOR ; Point np = new Point ( objectXPos . intValue ( ) , CPU_Y_POS . intValue ( ) ) ; nrr . setLocation ( np ) ; nrr . setSize ( objWidth , CPU_HEIGHT ) ; tab . addFigure ( nrr ) ; // Save Object timeline
Long lineXPos = objectXPos + new Long ( objWidth / 2 ) ; Long lineYStartPos = objectYPos ; timeLineStart . add ( new Point ( lineXPos . intValue ( ) , lineYStartPos . intValue ( ) ) ) ; // Update Object
pobj . setY ( objectYPos ) ; pobj . setVisible ( true ) ; pobj . setX ( lineXPos ) ; } |
public class AbstractHibernateCriteriaBuilder { /** * Creates an " equals " Criterion based on the specified property name and value . Case - sensitive .
* @ param propertyName The property name
* @ param propertyValue The property value
* @ return A Criterion instance */
public org . grails . datastore . mapping . query . api . Criteria eq ( String propertyName , Object propertyValue ) { } } | return eq ( propertyName , propertyValue , Collections . emptyMap ( ) ) ; |
public class IntegrationAccountsInner { /** * Gets the integration account ' s Key Vault keys .
* @ param resourceGroupName The resource group name .
* @ param integrationAccountName The integration account name .
* @ param listKeyVaultKeys The key vault parameters .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the List & lt ; KeyVaultKeyInner & gt ; object */
public Observable < List < KeyVaultKeyInner > > listKeyVaultKeysAsync ( String resourceGroupName , String integrationAccountName , ListKeyVaultKeysDefinition listKeyVaultKeys ) { } } | return listKeyVaultKeysWithServiceResponseAsync ( resourceGroupName , integrationAccountName , listKeyVaultKeys ) . map ( new Func1 < ServiceResponse < List < KeyVaultKeyInner > > , List < KeyVaultKeyInner > > ( ) { @ Override public List < KeyVaultKeyInner > call ( ServiceResponse < List < KeyVaultKeyInner > > response ) { return response . body ( ) ; } } ) ; |
public class OptionsCertificatePanel { /** * GEN - LAST : event _ deleteButtonActionPerformed */
private void useClientCertificateCheckBoxActionPerformed ( java . awt . event . ActionEvent evt ) { } } | // GEN - FIRST : event _ useClientCertificateCheckBoxActionPerformed
// The enable unsafe SSL renegotiation checkbox is independent of using a client certificate ( although commonly related )
// enableUnsafeSSLRenegotiationCheckBox . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ;
// keyStore tab
certificatejTabbedPane . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; keyStoreScrollPane . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; keyStoreList . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; aliasScrollPane . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; aliasTable . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; deleteButton . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; setActiveButton . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; showAliasButton . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; // pkcs12 tab
fileTextField . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; browseButton . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; pkcs12PasswordField . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; addPkcs12Button . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; // pkcs11 tab
driverComboBox . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; driverButton . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; pkcs11PasswordField . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; addPkcs11Button . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; usePkcs11ExperimentalSliSupportCheckBox . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; usePkcs11ExperimentalSliSupportCheckBox . setSelected ( Model . getSingleton ( ) . getOptionsParam ( ) . getExperimentalFeaturesParam ( ) . isExerimentalSliSupportEnabled ( ) ) ; // actual certificate fields
certificateTextField . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; showActiveCertificateButton . setEnabled ( useClientCertificateCheckBox . isSelected ( ) ) ; |
public class LuceneKey2StringMapper { /** * This method has to perform the inverse transformation of the keys used in the Lucene
* Directory from String to object . So this implementation is strongly coupled to the
* toString method of each key type .
* @ see ChunkCacheKey # toString ( )
* @ see FileCacheKey # toString ( )
* @ see FileListCacheKey # toString ( )
* @ see FileReadLockKey # toString ( ) */
@ Override public Object getKeyMapping ( String key ) { } } | if ( key == null ) { throw new IllegalArgumentException ( "Not supporting null keys" ) ; } // ChunkCacheKey : " C | " + fileName + " | " + chunkId + " | " + bufferSize " | " + indexName + " | " + affinitySegmentId ;
// FileCacheKey : " M | " + fileName + " | " + indexName + " | " + affinitySegmentId ;
// FileListCacheKey : " * | " + indexName + " | " + affinitySegmentId ;
// FileReadLockKey : " RL | " + fileName + " | " + indexName + " | " + affinitySegmentId ;
String [ ] split = singlePipePattern . split ( key ) ; switch ( split [ 0 ] ) { case "C" : { if ( split . length != 6 ) { throw log . keyMappperUnexpectedStringFormat ( key ) ; } final String indexName = split [ 4 ] ; final String fileName = split [ 1 ] ; final int chunkId = toInt ( split [ 2 ] , key ) ; final int bufferSize = toInt ( split [ 3 ] , key ) ; final int affinitySegmentId = toInt ( split [ 5 ] , key ) ; return new ChunkCacheKey ( indexName , fileName , chunkId , bufferSize , affinitySegmentId ) ; } case "M" : { if ( split . length != 4 ) throw log . keyMappperUnexpectedStringFormat ( key ) ; final String indexName = split [ 2 ] ; final String fileName = split [ 1 ] ; final int affinitySegmentId = toInt ( split [ 3 ] , key ) ; return new FileCacheKey ( indexName , fileName , affinitySegmentId ) ; } case "*" : { if ( split . length != 3 ) throw log . keyMappperUnexpectedStringFormat ( key ) ; final String indexName = split [ 1 ] ; final int affinitySegmentId = toInt ( split [ 2 ] , key ) ; return new FileListCacheKey ( indexName , affinitySegmentId ) ; } case "RL" : { if ( split . length != 4 ) throw log . keyMappperUnexpectedStringFormat ( key ) ; final String indexName = split [ 2 ] ; final String fileName = split [ 1 ] ; final int affinitySegmentId = toInt ( split [ 3 ] , key ) ; return new FileReadLockKey ( indexName , fileName , affinitySegmentId ) ; } default : throw log . keyMappperUnexpectedStringFormat ( key ) ; } |
public class RedirectActivity { /** * Show a dialog with a link to the external verification site .
* @ param source the { @ link Source } to verify */
private void showDialog ( @ NonNull final Source source ) { } } | // Caching the source object here because this app makes a lot of them .
mRedirectSource = source ; final SourceRedirect sourceRedirect = source . getRedirect ( ) ; final String redirectUrl = sourceRedirect != null ? sourceRedirect . getUrl ( ) : null ; if ( redirectUrl != null ) { mRedirectDialogController . showDialog ( redirectUrl ) ; } |
public class Page { /** * Create a new page of data from a json blob .
* @ param recordKey key which holds the records
* @ param json json blob
* @ param recordType resource type
* @ param mapper json parser
* @ param < T > record class type
* @ return a page of records of type T */
public static < T > Page < T > fromJson ( String recordKey , String json , Class < T > recordType , ObjectMapper mapper ) { } } | try { List < T > results = new ArrayList < > ( ) ; JsonNode root = mapper . readTree ( json ) ; JsonNode records = root . get ( recordKey ) ; for ( final JsonNode record : records ) { results . add ( mapper . readValue ( record . toString ( ) , recordType ) ) ; } JsonNode uriNode = root . get ( "uri" ) ; if ( uriNode != null ) { return buildPage ( root , results ) ; } else { return buildNextGenPage ( root , results ) ; } } catch ( final IOException e ) { throw new ApiConnectionException ( "Unable to deserialize response: " + e . getMessage ( ) + "\nJSON: " + json , e ) ; } |
public class WSBatchAuthServiceImpl { /** * DS activate */
@ Activate protected void activate ( ComponentContext cc ) { } } | securityServiceRef . activate ( cc ) ; logger . log ( Level . INFO , "BATCH_SECURITY_ENABLED" ) ; |
public class AmazonCloudDirectoryClient { /** * Removes the specified facet from the specified object .
* @ param removeFacetFromObjectRequest
* @ return Result of the RemoveFacetFromObject operation returned by the service .
* @ throws InternalServiceException
* Indicates a problem that must be resolved by Amazon Web Services . This might be a transient error in
* which case you can retry your request until it succeeds . Otherwise , go to the < a
* href = " http : / / status . aws . amazon . com / " > AWS Service Health Dashboard < / a > site to see if there are any
* operational issues with the service .
* @ throws InvalidArnException
* Indicates that the provided ARN value is not valid .
* @ throws RetryableConflictException
* Occurs when a conflict with a previous successful write is detected . For example , if a write operation
* occurs on an object and then an attempt is made to read the object using “ SERIALIZABLE ” consistency , this
* exception may result . This generally occurs when the previous write did not have time to propagate to the
* host serving the current request . A retry ( with appropriate backoff logic ) is the recommended response to
* this exception .
* @ throws ValidationException
* Indicates that your request is malformed in some manner . See the exception message .
* @ throws LimitExceededException
* Indicates that limits are exceeded . See < a
* href = " https : / / docs . aws . amazon . com / clouddirectory / latest / developerguide / limits . html " > Limits < / a > for more
* information .
* @ throws AccessDeniedException
* Access denied . Check your permissions .
* @ throws DirectoryNotEnabledException
* Operations are only permitted on enabled directories .
* @ throws ResourceNotFoundException
* The specified resource could not be found .
* @ throws FacetValidationException
* The < a > Facet < / a > that you provided was not well formed or could not be validated with the schema .
* @ sample AmazonCloudDirectory . RemoveFacetFromObject
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / clouddirectory - 2017-01-11 / RemoveFacetFromObject "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public RemoveFacetFromObjectResult removeFacetFromObject ( RemoveFacetFromObjectRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeRemoveFacetFromObject ( request ) ; |
public class JavaTokenizer { /** * Read fractional part of hexadecimal floating point number . */
private void scanHexExponentAndSuffix ( int pos ) { } } | if ( reader . ch == 'p' || reader . ch == 'P' ) { reader . putChar ( true ) ; skipIllegalUnderscores ( ) ; if ( reader . ch == '+' || reader . ch == '-' ) { reader . putChar ( true ) ; } skipIllegalUnderscores ( ) ; if ( '0' <= reader . ch && reader . ch <= '9' ) { scanDigits ( pos , 10 ) ; if ( ! allowHexFloats ) { lexError ( pos , "unsupported.fp.lit" , source . name ) ; allowHexFloats = true ; } else if ( ! hexFloatsWork ) lexError ( pos , "unsupported.cross.fp.lit" ) ; } else lexError ( pos , "malformed.fp.lit" ) ; } else { lexError ( pos , "malformed.fp.lit" ) ; } if ( reader . ch == 'f' || reader . ch == 'F' ) { reader . putChar ( true ) ; tk = TokenKind . FLOATLITERAL ; radix = 16 ; } else { if ( reader . ch == 'd' || reader . ch == 'D' ) { reader . putChar ( true ) ; } tk = TokenKind . DOUBLELITERAL ; radix = 16 ; } |
public class FileIoUtil { /** * Read a file from different sources depending on _ searchOrder .
* Will return the first successfully read file which can be loaded either from custom path , classpath or system path .
* @ param _ fileName file to read
* @ param _ charset charset used for reading
* @ param _ searchOrder search order
* @ return List of String with file content or null if file could not be found */
public static List < String > readFileFrom ( String _fileName , Charset _charset , SearchOrder ... _searchOrder ) { } } | InputStream stream = openInputStreamForFile ( _fileName , _searchOrder ) ; if ( stream != null ) { return readTextFileFromStream ( stream , _charset , true ) ; } return null ; |
public class EmbeddedNeo4jAssociationQueries { /** * Returns the relationship corresponding to the { @ link AssociationKey } and { @ link RowKey } .
* @ param executionEngine the { @ link GraphDatabaseService } used to run the query
* @ param associationKey represents the association
* @ param rowKey represents a row in an association
* @ return the corresponding relationship */
@ Override public Relationship findRelationship ( GraphDatabaseService executionEngine , AssociationKey associationKey , RowKey rowKey ) { } } | Object [ ] queryValues = relationshipValues ( associationKey , rowKey ) ; Result result = executionEngine . execute ( findRelationshipQuery , params ( queryValues ) ) ; return singleResult ( result ) ; |
public class FileInfo { /** * < code > optional . alluxio . grpc . TtlAction ttlAction = 22 ; < / code > */
public alluxio . grpc . TtlAction getTtlAction ( ) { } } | alluxio . grpc . TtlAction result = alluxio . grpc . TtlAction . valueOf ( ttlAction_ ) ; return result == null ? alluxio . grpc . TtlAction . DELETE : result ; |
public class Properties { /** * Replaces the entry for the specified key only if currently
* mapped to the specified value . */
public boolean replace ( K key , V oldValue , V newValue ) { } } | Object curValue = get ( key ) ; if ( ! Objects . equals ( curValue , oldValue ) || ( curValue == null && ! containsKey ( key ) ) ) { return false ; } put ( key , newValue ) ; return true ; |
public class CmsVaadinUtils { /** * Returns the selectable projects container . < p >
* @ param cms the CMS context
* @ param captionPropertyName the name of the property used to store captions
* @ return the projects container */
public static IndexedContainer getProjectsContainer ( CmsObject cms , String captionPropertyName ) { } } | IndexedContainer result = new IndexedContainer ( ) ; result . addContainerProperty ( captionPropertyName , String . class , null ) ; Locale locale = A_CmsUI . get ( ) . getLocale ( ) ; List < CmsProject > projects = getAvailableProjects ( cms ) ; boolean isSingleOu = isSingleOu ( projects ) ; for ( CmsProject project : projects ) { String projectName = project . getSimpleName ( ) ; if ( ! isSingleOu && ! project . isOnlineProject ( ) ) { try { projectName = projectName + " - " + OpenCms . getOrgUnitManager ( ) . readOrganizationalUnit ( cms , project . getOuFqn ( ) ) . getDisplayName ( locale ) ; } catch ( CmsException e ) { LOG . debug ( "Error reading project OU." , e ) ; projectName = projectName + " - " + project . getOuFqn ( ) ; } } Item projectItem = result . addItem ( project . getUuid ( ) ) ; projectItem . getItemProperty ( captionPropertyName ) . setValue ( projectName ) ; } return result ; |
public class DeploymentResourceSupport { /** * Checks to see if a resource has already been registered for the specified address on the subsystem .
* @ param subsystemName the name of the subsystem
* @ param address the address to check
* @ return { @ code true } if the address exists on the subsystem otherwise { @ code false } */
public boolean hasDeploymentSubModel ( final String subsystemName , final PathElement address ) { } } | final Resource root = deploymentUnit . getAttachment ( DEPLOYMENT_RESOURCE ) ; final PathElement subsystem = PathElement . pathElement ( SUBSYSTEM , subsystemName ) ; return root . hasChild ( subsystem ) && ( address == null || root . getChild ( subsystem ) . hasChild ( address ) ) ; |
public class FessMessages { /** * Add the created action message for the key ' success . update _ crawler _ params ' with parameters .
* < pre >
* message : Updated parameters .
* < / pre >
* @ param property The property name for the message . ( NotNull )
* @ return this . ( NotNull ) */
public FessMessages addSuccessUpdateCrawlerParams ( String property ) { } } | assertPropertyNotNull ( property ) ; add ( property , new UserMessage ( SUCCESS_update_crawler_params ) ) ; return this ; |
public class GIMDImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case AfplibPackage . GIMD__DATA : setDATA ( ( byte [ ] ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class SipSession { /** * This sendUnidirectionalRequest ( ) method sends out a request message with no response expected .
* The Request object passed in must be a fully formed Request with all required content , ready to
* be sent .
* @ param request The request to be sent out .
* @ param viaProxy If true , send the message to the proxy . In this case a Route header is added by
* this method . Else send the message as is . In this case , for an INVITE request , a route
* header must have been added by the caller for the request routing to complete .
* @ return true if the message was successfully sent , false otherwise . */
public boolean sendUnidirectionalRequest ( Request request , boolean viaProxy ) { } } | initErrorInfo ( ) ; if ( viaProxy == true ) { if ( addProxy ( request ) == false ) { return false ; } } try { parent . getSipProvider ( ) . sendRequest ( request ) ; return true ; } catch ( Exception ex ) { setException ( ex ) ; setErrorMessage ( "Exception: " + ex . getClass ( ) . getName ( ) + ": " + ex . getMessage ( ) ) ; setReturnCode ( EXCEPTION_ENCOUNTERED ) ; return false ; } |
public class Quaternion { /** * Set the quaternion with the Euler angles .
* @ param angles the Euler angles .
* @ see < a href = " http : / / en . wikipedia . org / wiki / Euler _ angles " > Euler Angles < / a >
* @ see < a href = " http : / / www . euclideanspace . com / maths / geometry / rotations / conversions / eulerToQuaternion / index . htm " > Euler to Quaternion < / a > */
@ SuppressWarnings ( "synthetic-access" ) public void setEulerAngles ( EulerAngles angles ) { } } | setEulerAngles ( angles . getAttitude ( ) , angles . getBank ( ) , angles . getHeading ( ) , angles . getSystem ( ) ) ; |
public class ViewDragHelper { /** * Process a touch event received by the parent view . This method will dispatch callback events
* as needed before returning . The parent view ' s onTouchEvent implementation should call this .
* @ param ev The touch event received by the parent view */
public void processTouchEvent ( MotionEvent ev ) { } } | final int action = MotionEventCompat . getActionMasked ( ev ) ; final int actionIndex = MotionEventCompat . getActionIndex ( ev ) ; if ( action == MotionEvent . ACTION_DOWN ) { // Reset things for a new event stream , just in case we didn ' t get
// the whole previous stream .
cancel ( ) ; } if ( mVelocityTracker == null ) { mVelocityTracker = VelocityTracker . obtain ( ) ; } mVelocityTracker . addMovement ( ev ) ; switch ( action ) { case MotionEvent . ACTION_DOWN : { final float x = ev . getX ( ) ; final float y = ev . getY ( ) ; final int pointerId = MotionEventCompat . getPointerId ( ev , 0 ) ; final View toCapture = findTopChildUnder ( ( int ) x , ( int ) y ) ; saveInitialMotion ( x , y , pointerId ) ; // Since the parent is already directly processing this touch event ,
// there is no reason to delay for a slop before dragging .
// Start immediately if possible .
tryCaptureViewForDrag ( toCapture , pointerId ) ; final int edgesTouched = mInitialEdgesTouched [ pointerId ] ; if ( ( edgesTouched & mTrackingEdges ) != 0 ) { mCallback . onEdgeTouched ( edgesTouched & mTrackingEdges , pointerId ) ; } break ; } case MotionEventCompat . ACTION_POINTER_DOWN : { final int pointerId = MotionEventCompat . getPointerId ( ev , actionIndex ) ; final float x = MotionEventCompat . getX ( ev , actionIndex ) ; final float y = MotionEventCompat . getY ( ev , actionIndex ) ; saveInitialMotion ( x , y , pointerId ) ; // A ViewDragHelper can only manipulate one view at a time .
if ( mDragState == STATE_IDLE ) { // If we ' re idle we can do anything ! Treat it like a normal down event .
final View toCapture = findTopChildUnder ( ( int ) x , ( int ) y ) ; tryCaptureViewForDrag ( toCapture , pointerId ) ; final int edgesTouched = mInitialEdgesTouched [ pointerId ] ; if ( ( edgesTouched & mTrackingEdges ) != 0 ) { mCallback . onEdgeTouched ( edgesTouched & mTrackingEdges , pointerId ) ; } } else if ( isCapturedViewUnder ( ( int ) x , ( int ) y ) ) { // We ' re still tracking a captured view . If the same view is under this
// point , we ' ll swap to controlling it with this pointer instead .
// ( This will still work if we ' re " catching " a settling view . )
tryCaptureViewForDrag ( mCapturedView , pointerId ) ; } break ; } case MotionEvent . ACTION_MOVE : { if ( mDragState == STATE_DRAGGING ) { // If pointer is invalid then skip the ACTION _ MOVE .
if ( ! isValidPointerForActionMove ( mActivePointerId ) ) break ; final int index = MotionEventCompat . findPointerIndex ( ev , mActivePointerId ) ; final float x = MotionEventCompat . getX ( ev , index ) ; final float y = MotionEventCompat . getY ( ev , index ) ; final int idx = ( int ) ( x - mLastMotionX [ mActivePointerId ] ) ; final int idy = ( int ) ( y - mLastMotionY [ mActivePointerId ] ) ; dragTo ( mCapturedView . getLeft ( ) + idx , mCapturedView . getTop ( ) + idy , idx , idy ) ; saveLastMotion ( ev ) ; } else { // Check to see if any pointer is now over a draggable view .
final int pointerCount = MotionEventCompat . getPointerCount ( ev ) ; for ( int i = 0 ; i < pointerCount ; i ++ ) { final int pointerId = MotionEventCompat . getPointerId ( ev , i ) ; // If pointer is invalid then skip the ACTION _ MOVE .
if ( ! isValidPointerForActionMove ( pointerId ) ) continue ; final float x = MotionEventCompat . getX ( ev , i ) ; final float y = MotionEventCompat . getY ( ev , i ) ; final float dx = x - mInitialMotionX [ pointerId ] ; final float dy = y - mInitialMotionY [ pointerId ] ; reportNewEdgeDrags ( dx , dy , pointerId ) ; if ( mDragState == STATE_DRAGGING ) { // Callback might have started an edge drag .
break ; } final View toCapture = findTopChildUnder ( ( int ) x , ( int ) y ) ; if ( checkTouchSlop ( toCapture , dx , dy ) && tryCaptureViewForDrag ( toCapture , pointerId ) ) { break ; } } saveLastMotion ( ev ) ; } break ; } case MotionEventCompat . ACTION_POINTER_UP : { final int pointerId = MotionEventCompat . getPointerId ( ev , actionIndex ) ; if ( mDragState == STATE_DRAGGING && pointerId == mActivePointerId ) { // Try to find another pointer that ' s still holding on to the captured view .
int newActivePointer = INVALID_POINTER ; final int pointerCount = MotionEventCompat . getPointerCount ( ev ) ; for ( int i = 0 ; i < pointerCount ; i ++ ) { final int id = MotionEventCompat . getPointerId ( ev , i ) ; if ( id == mActivePointerId ) { // This one ' s going away , skip .
continue ; } final float x = MotionEventCompat . getX ( ev , i ) ; final float y = MotionEventCompat . getY ( ev , i ) ; if ( findTopChildUnder ( ( int ) x , ( int ) y ) == mCapturedView && tryCaptureViewForDrag ( mCapturedView , id ) ) { newActivePointer = mActivePointerId ; break ; } } if ( newActivePointer == INVALID_POINTER ) { // We didn ' t find another pointer still touching the view , release it .
releaseViewForPointerUp ( ) ; } } clearMotionHistory ( pointerId ) ; break ; } case MotionEvent . ACTION_UP : { if ( mDragState == STATE_DRAGGING ) { releaseViewForPointerUp ( ) ; } cancel ( ) ; break ; } case MotionEvent . ACTION_CANCEL : { if ( mDragState == STATE_DRAGGING ) { dispatchViewReleased ( 0 , 0 ) ; } cancel ( ) ; break ; } } |
public class ProtectionContainersInner { /** * Inquires all the protectable item in the given container that can be protected .
* Inquires all the protectable items that are protectable under the given container .
* @ param vaultName The name of the recovery services vault .
* @ param resourceGroupName The name of the resource group where the recovery services vault is present .
* @ param fabricName Fabric Name associated with the container .
* @ param containerName Name of the container in which inquiry needs to be triggered .
* @ 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 */
public void inquire ( String vaultName , String resourceGroupName , String fabricName , String containerName ) { } } | inquireWithServiceResponseAsync ( vaultName , resourceGroupName , fabricName , containerName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class ModelBrowser { /** * Add a child resource
* @ param address
* @ param isSingleton */
public void onPrepareAddChildResource ( final ModelNode address , final boolean isSingleton ) { } } | _loadMetaData ( address , new ResourceData ( true ) , new Outcome < ResourceData > ( ) { @ Override public void onFailure ( ResourceData context ) { Console . error ( "Failed to load metadata for " + address . asString ( ) ) ; } @ Override public void onSuccess ( ResourceData context ) { if ( isSingleton && context . description . get ( ATTRIBUTES ) . asList ( ) . isEmpty ( ) && context . description . get ( OPERATIONS ) . get ( ADD ) . get ( REQUEST_PROPERTIES ) . asList ( ) . isEmpty ( ) ) { // no attributes need to be assigned - > skip the next step
onAddChildResource ( address , new ModelNode ( ) ) ; } else { view . showAddDialog ( address , isSingleton , context . securityContext , context . description ) ; } } } ) ; |
public class If { /** * Get the result .
* @ return
* @ throws NoSuchElementException If there is no result be set . */
public T result ( ) throws NoSuchElementException { } } | if ( result == NULL_RESULT ) { if ( parent != null ) { return parent . result ( ) ; } throw new NoSuchElementException ( "There is no result" ) ; } return result ; |
public class SequenceUtil { /** * Check whether the sequence confirms to amboguous protein sequence
* @ param sequence
* @ return return true only if the sequence if ambiguous protein sequence
* Return false otherwise . e . g . if the sequence is non - ambiguous
* protein or DNA */
public static boolean isAmbiguosProtein ( String sequence ) { } } | sequence = SequenceUtil . cleanSequence ( sequence ) ; if ( SequenceUtil . isNonAmbNucleotideSequence ( sequence ) ) { return false ; } if ( SequenceUtil . DIGIT . matcher ( sequence ) . find ( ) ) { return false ; } if ( SequenceUtil . NON_AA . matcher ( sequence ) . find ( ) ) { return false ; } if ( SequenceUtil . AA . matcher ( sequence ) . find ( ) ) { return false ; } final Matcher amb_prot = SequenceUtil . AMBIGUOUS_AA . matcher ( sequence ) ; return amb_prot . find ( ) ; |
public class StreamEx { /** * Returns a sequential { @ code StreamEx } containing an { @ link Optional }
* value , if present , otherwise returns an empty { @ code StreamEx } .
* @ param < T > the type of stream elements
* @ param optional the optional to create a stream of
* @ return a stream with an { @ code Optional } value if present , otherwise an
* empty stream
* @ since 0.1.1 */
public static < T > StreamEx < T > of ( Optional < ? extends T > optional ) { } } | return optional . isPresent ( ) ? of ( optional . get ( ) ) : empty ( ) ; |
public class DataSourceProcessor { /** * All the sub - level attributes .
* @ param name the attribute name .
* @ param attribute the attribute . */
public void setAttribute ( final String name , final Attribute attribute ) { } } | if ( name . equals ( "datasource" ) ) { this . allAttributes . putAll ( ( ( DataSourceAttribute ) attribute ) . getAttributes ( ) ) ; } else if ( this . copyAttributes . contains ( name ) ) { this . allAttributes . put ( name , attribute ) ; } |
public class IntegrationAccountAssembliesInner { /** * Get the content callback url for an integration account assembly .
* @ param resourceGroupName The resource group name .
* @ param integrationAccountName The integration account name .
* @ param assemblyArtifactName The assembly artifact name .
* @ 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 WorkflowTriggerCallbackUrlInner object if successful . */
public WorkflowTriggerCallbackUrlInner listContentCallbackUrl ( String resourceGroupName , String integrationAccountName , String assemblyArtifactName ) { } } | return listContentCallbackUrlWithServiceResponseAsync ( resourceGroupName , integrationAccountName , assemblyArtifactName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class Segment { /** * Truncates entries after the given index .
* @ param index The index after which to remove entries .
* @ return The segment .
* @ throws IllegalStateException if the segment is not open */
public Segment truncate ( long index ) { } } | assertSegmentOpen ( ) ; Assert . index ( index >= manager . commitIndex ( ) , "cannot truncate committed index" ) ; long offset = relativeOffset ( index ) ; long lastOffset = offsetIndex . lastOffset ( ) ; long diff = Math . abs ( lastOffset - offset ) ; skip = Math . max ( skip - diff , 0 ) ; if ( offset < lastOffset ) { long position = offsetIndex . truncate ( offset ) ; buffer . position ( position ) . zero ( position ) . flush ( ) ; termIndex . truncate ( offset ) ; } return this ; |
public class SRTServletRequest { /** * Save the state of the parameters before a call to include or forward . */
public void pushParameterStack ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { // 306998.15
logger . logp ( Level . FINE , CLASS_NAME , "pushParameterStack" , "entry" ) ; } if ( WCCustomProperties . CHECK_REQUEST_OBJECT_IN_USE ) { checkRequestObjectInUse ( ) ; } SRTServletRequestThreadData reqData = SRTServletRequestThreadData . getInstance ( ) ; if ( reqData . getParameters ( ) == null ) { reqData . pushParameterStack ( null ) ; } else { _paramStack . push ( ( ( Hashtable ) reqData . getParameters ( ) ) . clone ( ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) && reqData . getParameters ( ) != null ) // 306998.15
{ debugParams ( reqData . getParameters ( ) ) ; } |
public class sdx_backup_restore { /** * < pre >
* Use this operation to Restore .
* < / pre > */
public static sdx_backup_restore restore ( nitro_service client , sdx_backup_restore resource ) throws Exception { } } | return ( ( sdx_backup_restore [ ] ) resource . perform_operation ( client , "restore" ) ) [ 0 ] ; |
public class JobMaster { /** * Suspending job , all the running tasks will be cancelled , and communication with other components
* will be disposed .
* < p > Mostly job is suspended because of the leadership has been revoked , one can be restart this job by
* calling the { @ link # start ( JobMasterId ) } method once we take the leadership back again .
* @ param cause The reason of why this job been suspended . */
private Acknowledge suspendExecution ( final Exception cause ) { } } | validateRunsInMainThread ( ) ; if ( getFencingToken ( ) == null ) { log . debug ( "Job has already been suspended or shutdown." ) ; return Acknowledge . get ( ) ; } // not leader anymore - - > set the JobMasterId to null
setFencingToken ( null ) ; try { resourceManagerLeaderRetriever . stop ( ) ; resourceManagerAddress = null ; } catch ( Throwable t ) { log . warn ( "Failed to stop resource manager leader retriever when suspending." , t ) ; } suspendAndClearExecutionGraphFields ( cause ) ; // the slot pool stops receiving messages and clears its pooled slots
slotPool . suspend ( ) ; // disconnect from resource manager :
closeResourceManagerConnection ( cause ) ; return Acknowledge . get ( ) ; |
public class DependenciesImpl { /** * / * ( non - Javadoc )
* @ see com . ibm . jaggr . service . config . IConfigListener # configLoaded ( com . ibm . jaggr . service . config . IConfig , long ) */
@ Override public synchronized void configLoaded ( IConfig config , long sequence ) { } } | String previousRawConfig = rawConfig ; rawConfig = config . toString ( ) ; if ( previousRawConfig == null || ! previousRawConfig . equals ( rawConfig ) ) { processDeps ( validate , false , sequence ) ; validate = false ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.