signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class CmsCroppingParamBean { /** * Returns the resulting image ratio . < p >
* @ return the image ratio */
public double getRatio ( ) { } }
|
double ratio = 1 ; if ( ( getTargetWidth ( ) == - 1 ) || ( getTargetHeight ( ) == - 1 ) ) { ratio = ( double ) getOrgWidth ( ) / getOrgHeight ( ) ; } else { ratio = ( double ) getTargetWidth ( ) / getTargetHeight ( ) ; } return ratio ;
|
public class ServiceManagerSparql { /** * Obtains the list of input URIs for a given Operation
* @ param operationUri the operation URI
* @ return a List of URIs with the inputs of the operation . If no input is necessary the List should be empty NOT null . */
@ Override public Set < URI > listInputs ( URI operationUri ) { } }
|
if ( operationUri == null || ! operationUri . isAbsolute ( ) ) { log . warn ( "The Operation URI is either absent or relative. Provide an absolute URI" ) ; return ImmutableSet . of ( ) ; } URI graphUri ; try { graphUri = getGraphUriForElement ( operationUri ) ; } catch ( URISyntaxException e ) { log . warn ( "The namespace of the URI of the operation is incorrect." , e ) ; return ImmutableSet . of ( ) ; } if ( graphUri == null ) { log . warn ( "Could not obtain a graph URI for the element. The URI may not be managed by the server - " + operationUri ) ; return ImmutableSet . of ( ) ; } String queryStr = new StringBuilder ( ) . append ( "SELECT DISTINCT ?input WHERE { \n" ) . append ( " GRAPH <" ) . append ( graphUri . toASCIIString ( ) ) . append ( "> { \n" ) . append ( "<" ) . append ( operationUri . toASCIIString ( ) ) . append ( "> " ) . append ( "<" ) . append ( MSM . hasInput . getURI ( ) ) . append ( ">" ) . append ( " ?input ." ) . append ( "?input " ) . append ( "<" ) . append ( RDF . type . getURI ( ) ) . append ( ">" ) . append ( " " ) . append ( "<" ) . append ( MSM . MessageContent . getURI ( ) ) . append ( "> ." ) . append ( " } \n " ) . append ( "} \n " ) . toString ( ) ; return this . graphStoreManager . listResourcesByQuery ( queryStr , "input" ) ;
|
public class SecurityDelegating { /** * 认证
* @ param name
* @ param password */
public static BaseUserInfo doAuthentication ( String name , String password ) { } }
|
BaseUserInfo userInfo = getInstance ( ) . decisionProvider . validateUser ( name , password ) ; UserSession session = getCurrentSession ( false ) ; session . update ( userInfo , getInstance ( ) . decisionProvider . sessionExpireIn ( ) ) ; if ( getInstance ( ) . decisionProvider . multiPointEnable ( ) ) { UserSession otherSession = getInstance ( ) . sessionManager . getLoginSessionByUserId ( userInfo . getId ( ) ) ; if ( otherSession != null && ! otherSession . getSessionId ( ) . equals ( session . getSessionId ( ) ) ) { getInstance ( ) . sessionManager . removeLoginSession ( otherSession . getSessionId ( ) ) ; } } getInstance ( ) . sessionManager . storgeLoginSession ( session ) ; getInstance ( ) . resourceManager . getUserPermissionCodes ( userInfo . getId ( ) ) ; return userInfo ;
|
public class WaitMessageDialog { /** * This method initializes this */
private void initialize ( ) { } }
|
this . setCursor ( new java . awt . Cursor ( java . awt . Cursor . WAIT_CURSOR ) ) ; this . setContentPane ( getJPanel ( ) ) ; if ( Model . getSingleton ( ) . getOptionsParam ( ) . getViewParam ( ) . getWmUiHandlingOption ( ) == 0 ) { this . setSize ( 282 , 118 ) ; } this . setDefaultCloseOperation ( javax . swing . WindowConstants . DO_NOTHING_ON_CLOSE ) ; this . setResizable ( false ) ;
|
public class Stream { /** * Zip together the " a " , " b " and " c " iterators until all of them runs out of values .
* Each triple of values is combined into a single value using the supplied zipFunction function .
* @ param a
* @ param b
* @ param c
* @ param valueForNoneA value to fill if " a " runs out of values .
* @ param valueForNoneB value to fill if " b " runs out of values .
* @ param valueForNoneC value to fill if " c " runs out of values .
* @ param zipFunction
* @ return */
public static < R > Stream < R > zip ( final short [ ] a , final short [ ] b , final short [ ] c , final short valueForNoneA , final short valueForNoneB , final short valueForNoneC , final ShortTriFunction < R > zipFunction ) { } }
|
return zip ( ShortIteratorEx . of ( a ) , ShortIteratorEx . of ( b ) , ShortIteratorEx . of ( c ) , valueForNoneA , valueForNoneB , valueForNoneC , zipFunction ) ;
|
public class SimpleLSResourceResolver { /** * Internal resource resolving
* @ param sType
* The type of the resource being resolved . For XML [
* < a href = ' http : / / www . w3 . org / TR / 2004 / REC - xml - 20040204 ' > XML 1.0 < / a > ]
* resources ( i . e . entities ) , applications must use the value < code >
* " http : / / www . w3 . org / TR / REC - xml " < / code > . For XML Schema [
* < a href = ' http : / / www . w3 . org / TR / 2001 / REC - xmlschema - 1-20010502 / ' > XML
* Schema Part 1 < / a > ] , applications must use the value < code >
* " http : / / www . w3 . org / 2001 / XMLSchema " < / code > . Other types of resources
* are outside the scope of this specification and therefore should
* recommend an absolute URI in order to use this method .
* @ param sNamespaceURI
* The namespace of the resource being resolved , e . g . the target
* namespace of the XML Schema [
* < a href = ' http : / / www . w3 . org / TR / 2001 / REC - xmlschema - 1-20010502 / ' > XML
* Schema Part 1 < / a > ] when resolving XML Schema resources .
* @ param sPublicId
* The public identifier of the external entity being referenced , or
* < code > null < / code > if no public identifier was supplied or if the
* resource is not an entity .
* @ param sSystemId
* the path of the resource to find - may be relative to the including
* resource . The system identifier , a URI reference [
* < a href = ' http : / / www . ietf . org / rfc / rfc2396 . txt ' > IETF RFC 2396 < / a > ] , of
* the external resource being referenced , or < code > null < / code > if no
* system identifier was supplied .
* @ param sBaseURI
* The systemId of the including resource . The absolute base URI of the
* resource being parsed , or < code > null < / code > if there is no base URI .
* @ return < code > null < / code > if the resource could not be resolved .
* @ throws Exception
* in case something goes wrong */
@ OverrideOnDemand @ Nullable protected IReadableResource internalResolveResource ( @ Nonnull @ Nonempty final String sType , @ Nullable final String sNamespaceURI , @ Nullable final String sPublicId , @ Nullable final String sSystemId , @ Nullable final String sBaseURI ) throws Exception { } }
|
if ( DEBUG_RESOLVE ) if ( LOGGER . isInfoEnabled ( ) ) LOGGER . info ( "internalResolveResource (" + sType + ", " + sNamespaceURI + ", " + sPublicId + ", " + sSystemId + ", " + sBaseURI + ")" ) ; return DefaultResourceResolver . getResolvedResource ( sSystemId , sBaseURI , getClassLoader ( ) ) ;
|
public class Condition { /** * 获取属性的真实值
* @ param cls
* @ param fieldName
* @ param strValue
* @ return */
private static Object getFieldValue ( Class < ? > cls , String fieldName , String strValue ) { } }
|
try { Class < ? > type = Reflections . getDeclaredField ( cls , fieldName ) . getType ( ) ; // 是数字类型
if ( Number . class . isAssignableFrom ( type ) ) { return type . getMethod ( "valueOf" , String . class ) . invoke ( null , strValue ) ; } // 字符类型
if ( Character . class . isAssignableFrom ( type ) ) { return strValue . charAt ( 0 ) ; } // 字符串类型
if ( String . class . isAssignableFrom ( type ) ) { return strValue ; } // 日期类型
if ( Date . class . isAssignableFrom ( type ) ) { // TODO 日期类型处理
return null ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } return null ;
|
public class ZWaveCommandClass { /** * Gets an instance of the right command class .
* Returns null if the command class is not found .
* @ param i the code to instantiate
* @ param node the node this instance commands .
* @ param controller the controller to send messages to .
* @ return the ZWaveCommandClass instance that was instantiated , null otherwise */
public static ZWaveCommandClass getInstance ( int i , ZWaveNode node , ZWaveController controller ) { } }
|
return ZWaveCommandClass . getInstance ( i , node , controller , null ) ;
|
public class MustacheMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Mustache mustache , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( mustache == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( mustache . getValue ( ) , VALUE_BINDING ) ; protocolMarshaller . marshall ( mustache . getConfidence ( ) , CONFIDENCE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class BagObject { /** * Add an object to a BagArray stored at the requested key . The key may be a simple name , or it may be a path
* ( with keys separated by " / " ) to create a hierarchical " bag - of - bags " that is indexed
* recursively . If the key does not already exist a non - null value will be stored as a bare
* value , just as if " put " had been called . If it does exist , and is not already an array or the
* stored value is null , then a new array will be created to store any existing values and the
* requested element .
* Using a binary search of the underlying store , finds where the first component of the path
* should be . If it does not already exist , it is created ( recursively in the case of a path ) ,
* and the underlying store is shifted to make a space for it . The shift might cause the
* underlying store to be resized if there is insufficient room .
* Note that null values for the BagArray ARE stored per the design decision for arrays .
* @ param key A string value used to index the element , using " / " as separators , for example :
* " com / brettonw / bag / key " .
* @ param object The element to store .
* @ return The BagObject , so that operations can be chained together . */
public BagObject add ( String key , Object object ) { } }
|
// separate the key into path components , the " local " key value is the first component ,
// so use that to conduct the search . If there is an element there , we want to get it ,
// otherwise we want to create it .
String [ ] path = Key . split ( key ) ; Pair pair = getOrAddPair ( path [ 0 ] ) ; if ( path . length == 1 ) { // this is the end of the line , so we want to store the requested object
BagArray bagArray ; Object found = pair . value ; if ( ( object = objectify ( object ) ) == null ) { if ( found == null ) { // 1 ) object is null , key does not exist - create array
pair . value = ( bagArray = new BagArray ( ) ) ; } else if ( found instanceof BagArray ) { // 2 ) object is null , key exists ( is array )
bagArray = ( BagArray ) found ; } else { // 3 ) object is null , key exists ( is not array ) - create array , store existing value
pair . value = ( bagArray = new BagArray ( 2 ) ) ; bagArray . add ( found ) ; } // and store the null value in the array
bagArray . add ( null ) ; } else { if ( found == null ) { // 4 ) object is not null , key does not exist - store as bare value
pair . value = object ; } else { if ( found instanceof BagArray ) { // 5 ) object is not null , key exists ( is array ) - add new value to array
bagArray = ( BagArray ) found ; } else { // 6 ) object is not null , key exists ( is not array ) - create array , store existing value , store new value
pair . value = ( bagArray = new BagArray ( 2 ) ) ; bagArray . add ( found ) ; } bagArray . add ( object ) ; } } } else { // this is not the leaf key , so we set the pair value to be a new BagObject if
// necessary , then traverse via recursion ,
BagObject bagObject = ( BagObject ) pair . value ; if ( bagObject == null ) { pair . value = ( bagObject = new BagObject ( ) ) ; } bagObject . add ( path [ 1 ] , object ) ; } return this ;
|
public class GetUserProfile { /** * Authenticate the given user . If you are distributing an installed application , this method
* should exist on your server so that the client ID and secret are not shared with the end
* user . */
private static Credential authenticate ( String userId , SessionConfiguration config ) throws Exception { } }
|
OAuth2Credentials oAuth2Credentials = createOAuth2Credentials ( config ) ; // First try to load an existing Credential . If that credential is null , authenticate the user .
Credential credential = oAuth2Credentials . loadCredential ( userId ) ; if ( credential == null || credential . getAccessToken ( ) == null ) { // Send user to authorize your application .
System . out . printf ( "Add the following redirect URI to your developer.uber.com application: %s%n" , oAuth2Credentials . getRedirectUri ( ) ) ; System . out . println ( "Press Enter when done." ) ; System . in . read ( ) ; // Generate an authorization URL .
String authorizationUrl = oAuth2Credentials . getAuthorizationUrl ( ) ; System . out . printf ( "In your browser, navigate to: %s%n" , authorizationUrl ) ; System . out . println ( "Waiting for authentication..." ) ; // Wait for the authorization code .
String authorizationCode = localServerReceiver . waitForCode ( ) ; System . out . println ( "Authentication received." ) ; // Authenticate the user with the authorization code .
credential = oAuth2Credentials . authenticate ( authorizationCode , userId ) ; } localServerReceiver . stop ( ) ; return credential ;
|
public class OTAUpdateSummaryMarshaller { /** * Marshall the given parameter object . */
public void marshall ( OTAUpdateSummary oTAUpdateSummary , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( oTAUpdateSummary == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( oTAUpdateSummary . getOtaUpdateId ( ) , OTAUPDATEID_BINDING ) ; protocolMarshaller . marshall ( oTAUpdateSummary . getOtaUpdateArn ( ) , OTAUPDATEARN_BINDING ) ; protocolMarshaller . marshall ( oTAUpdateSummary . getCreationDate ( ) , CREATIONDATE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class RTFDocsSwingDisplayer { /** * * * * * * READING THE Siva FILE * * * * * */
/ * / public String readFile ( String fileName , String jarName ) { } }
|
File file = null ; BufferedReader reader = null ; InputStream inputStream = null ; StringBuilder builder = new StringBuilder ( ) ; try { file = new File ( fileName ) ; // When we run this program from Eclipse , it doesnt need the Code
// described below .
// But when it is being run as a JAR File , then we cannot specify a
// PATH as the files are located in the JAR
// Hence this ! file . exists allows us to
if ( ! file . exists ( ) ) { Log . logInfo ( "No file: Will try retirieving using JarFile Logic for " + fileName ) ; JarFile jarFile = new JarFile ( jarName ) ; Log . logInfo ( "file for reading: " + jarFile . getName ( ) ) ; JarEntry jarEntry = jarFile . getJarEntry ( fileName ) ; inputStream = jarFile . getInputStream ( jarEntry ) ; byte [ ] b = new byte [ 8092 ] ; int n = 0 ; while ( ( n = inputStream . read ( b ) ) > 0 ) { for ( int i = 0 ; i < b . length ; i ++ ) { builder . append ( ( char ) b [ i ] ) ; } } } else { Log . logInfo ( "file for reading: " + file . getAbsolutePath ( ) ) ; reader = new BufferedReader ( new FileReader ( file ) ) ; String inputLine = "" ; while ( ( inputLine = reader . readLine ( ) ) != null ) { builder . append ( inputLine ) ; } } } catch ( Exception e ) { Log . logInfo ( "File not found." ) ; e . printStackTrace ( ) ; } finally { try { if ( reader != null ) reader . close ( ) ; if ( inputStream != null ) inputStream . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return builder . toString ( ) ;
|
public class TypeQualifierResolver { /** * Resolve an annotation into AnnotationValues representing any type
* qualifier ( s ) the annotation resolves to . Detects annotations which are
* directly marked as TypeQualifier annotations , and also resolves the use
* of TypeQualifierNickname annotations .
* @ param value
* AnnotationValue representing the use of an annotation
* @ param result
* LinkedList containing resolved type qualifier AnnotationValues
* @ param onStack
* stack of annotations being processed ; used to detect cycles in
* type qualifier nicknames */
private static void resolveTypeQualifierDefaults ( AnnotationValue value , ElementType defaultFor , LinkedList < AnnotationValue > result ) { } }
|
try { XClass c = Global . getAnalysisCache ( ) . getClassAnalysis ( XClass . class , value . getAnnotationClass ( ) ) ; AnnotationValue defaultAnnotation = c . getAnnotation ( typeQualifierDefault ) ; if ( defaultAnnotation == null ) { return ; } for ( Object o : ( Object [ ] ) defaultAnnotation . getValue ( "value" ) ) { if ( o instanceof EnumValue ) { EnumValue e = ( EnumValue ) o ; if ( e . desc . equals ( elementTypeDescriptor ) && e . value . equals ( defaultFor . name ( ) ) ) { for ( ClassDescriptor d : c . getAnnotationDescriptors ( ) ) { if ( ! d . equals ( typeQualifierDefault ) ) { resolveTypeQualifierNicknames ( c . getAnnotation ( d ) , result , new LinkedList < ClassDescriptor > ( ) ) ; } } break ; } } } } catch ( MissingClassException e ) { logMissingAnnotationClass ( e ) ; } catch ( CheckedAnalysisException e ) { AnalysisContext . logError ( "Error resolving " + value . getAnnotationClass ( ) , e ) ; } catch ( ClassCastException e ) { AnalysisContext . logError ( "ClassCastException " + value . getAnnotationClass ( ) , e ) ; }
|
public class PortableConcurrentDirectDeque { /** * Initializes head and tail , ensuring invariants hold . */
private void initHeadTail ( Node < E > h , Node < E > t ) { } }
|
if ( h == t ) { if ( h == null ) h = t = new Node < > ( null ) ; else { // Avoid edge case of a single Node with non - null item .
Node < E > newNode = new Node < > ( null ) ; t . lazySetNext ( newNode ) ; newNode . lazySetPrev ( t ) ; t = newNode ; } } head = h ; tail = t ;
|
public class MtasSolrCollectionResult { /** * Rewrite .
* @ param searchComponent the search component
* @ return the simple ordered map
* @ throws IOException Signals that an I / O exception has occurred . */
public SimpleOrderedMap < Object > rewrite ( MtasSolrSearchComponent searchComponent ) throws IOException { } }
|
SimpleOrderedMap < Object > response = new SimpleOrderedMap < > ( ) ; Iterator < Entry < String , Object > > it ; switch ( action ) { case ComponentCollection . ACTION_LIST : response . add ( "now" , now ) ; response . add ( "list" , list ) ; break ; case ComponentCollection . ACTION_CREATE : case ComponentCollection . ACTION_POST : case ComponentCollection . ACTION_IMPORT : if ( componentCollection != null && status != null ) { it = status . iterator ( ) ; while ( it . hasNext ( ) ) { Entry < String , Object > entry = it . next ( ) ; response . add ( entry . getKey ( ) , entry . getValue ( ) ) ; } } break ; case ComponentCollection . ACTION_CHECK : if ( status != null ) { it = status . iterator ( ) ; while ( it . hasNext ( ) ) { Entry < String , Object > entry = it . next ( ) ; response . add ( entry . getKey ( ) , entry . getValue ( ) ) ; } } break ; case ComponentCollection . ACTION_GET : if ( status != null ) { it = status . iterator ( ) ; while ( it . hasNext ( ) ) { Entry < String , Object > entry = it . next ( ) ; response . add ( entry . getKey ( ) , entry . getValue ( ) ) ; } } if ( values != null ) { response . add ( "values" , values ) ; } break ; default : break ; } return response ;
|
public class ContractsApi { /** * Get contracts Returns contracts available to a character , only if the
* character is issuer , acceptor or assignee . Only returns contracts no
* older than 30 days , or if the status is \ & quot ; in _ progress \ & quot ; . - - -
* This route is cached for up to 300 seconds
* @ param characterId
* An EVE character ID ( required )
* @ 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 page
* Which page of results to return ( optional , default to 1)
* @ param token
* Access token to use if unable to set a header ( optional )
* @ return ApiResponse & lt ; List & lt ; CharacterContractsResponse & gt ; & gt ;
* @ throws ApiException
* If fail to call the API , e . g . server error or cannot
* deserialize the response body */
public ApiResponse < List < CharacterContractsResponse > > getCharactersCharacterIdContractsWithHttpInfo ( Integer characterId , String datasource , String ifNoneMatch , Integer page , String token ) throws ApiException { } }
|
com . squareup . okhttp . Call call = getCharactersCharacterIdContractsValidateBeforeCall ( characterId , datasource , ifNoneMatch , page , token , null ) ; Type localVarReturnType = new TypeToken < List < CharacterContractsResponse > > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ;
|
public class ConversionResult { /** * Get all messages of a particular type
* @ param messageType
* @ return */
public List < ConversionMessage > getMessages ( ConversionMessageType messageType ) { } }
|
List < ConversionMessage > messages = new ArrayList < ConversionMessage > ( ) ; for ( ConversionMessage message : this . messages ) { if ( message . getMessageType ( ) == messageType ) { messages . add ( message ) ; } } return messages ;
|
public class JMPath { /** * Gets ancestor path list .
* @ param startPath the start path
* @ return the ancestor path list */
public static List < Path > getAncestorPathList ( Path startPath ) { } }
|
List < Path > ancestorPathList = new ArrayList < > ( ) ; buildPathListOfAncestorDirectory ( ancestorPathList , startPath ) ; Collections . reverse ( ancestorPathList ) ; return ancestorPathList ;
|
public class FragmentBundler { /** * Inserts a Boolean value into the mapping of the underlying Bundle , replacing
* any existing value for the given key . Either key or value may be null .
* @ param key a String , or null
* @ param value a Boolean , or null
* @ return this bundler instance to chain method calls */
public FragmentBundler < F > put ( String key , boolean value ) { } }
|
bundler . put ( key , value ) ; return this ;
|
public class LambdaIterable { /** * { @ inheritDoc }
* @ param lazyAppFn */
@ Override public < B > Lazy < LambdaIterable < B > > lazyZip ( Lazy < ? extends Applicative < Function < ? super A , ? extends B > , LambdaIterable < ? > > > lazyAppFn ) { } }
|
return Empty . empty ( as ) ? lazy ( LambdaIterable . empty ( ) ) : Monad . super . lazyZip ( lazyAppFn ) . fmap ( Monad < B , LambdaIterable < ? > > :: coerce ) ;
|
public class VehicleManager { /** * Register to receive asynchronous updates for a specific Measurement type .
* A Measurement is a specific , known VehicleMessage subtype .
* Use this method to register an object implementing the
* Measurement . Listener interface to receive real - time updates
* whenever a new value is received for the specified measurementType .
* Make sure you unregister your listeners with
* VehicleManager . removeListener ( . . . ) when your activity or service closes
* and no longer requires updates .
* @ param measurementType The class of the Measurement
* ( e . g . VehicleSpeed . class ) the listener was listening for
* @ param listener An listener instance to receive the callback . */
public void addListener ( Class < ? extends Measurement > measurementType , Measurement . Listener listener ) { } }
|
Log . i ( TAG , "Adding listener " + listener + " for " + measurementType ) ; mNotifier . register ( measurementType , listener ) ;
|
public class AbstractCacheableLockManager { /** * Returns the number of active locks . */
@ Managed @ ManagedDescription ( "The number of active locks" ) public int getNumLocks ( ) { } }
|
try { return getNumLocks . run ( ) ; } catch ( LockException e ) { if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "An exception occurred: " + e . getMessage ( ) ) ; } } return - 1 ;
|
public class AbstractIntegerVector { /** * { @ inheritDoc } */
public double magnitude ( ) { } }
|
double m = 0 ; int length = length ( ) ; for ( int i = 0 ; i < length ; ++ i ) { double d = get ( i ) ; m += d * d ; } return Math . sqrt ( m ) ;
|
public class JFontChooser { /** * Updates the font in the preview component according to the selected values . */
private void updateComponents ( ) { } }
|
updatingComponents = true ; Font font = getFont ( ) ; fontList . setSelectedValue ( font . getName ( ) , true ) ; sizeList . setSelectedValue ( font . getSize ( ) , true ) ; boldCheckBox . setSelected ( font . isBold ( ) ) ; italicCheckBox . setSelected ( font . isItalic ( ) ) ; if ( previewText == null ) { previewLabel . setText ( font . getName ( ) ) ; } // set the font and fire a property change
Font oldValue = previewLabel . getFont ( ) ; previewLabel . setFont ( font ) ; firePropertyChange ( "font" , oldValue , font ) ; updatingComponents = false ;
|
public class SignalServiceMessageReceiver { /** * Creates a pipe for receiving SignalService messages .
* Callers must call { @ link SignalServiceMessagePipe # shutdown ( ) } when finished with the pipe .
* @ return A SignalServiceMessagePipe for receiving Signal Service messages . */
public SignalServiceMessagePipe createMessagePipe ( ) { } }
|
WebSocketConnection webSocket = new WebSocketConnection ( urls . getSignalServiceUrls ( ) [ 0 ] . getUrl ( ) , urls . getSignalServiceUrls ( ) [ 0 ] . getTrustStore ( ) , Optional . of ( credentialsProvider ) , userAgent , connectivityListener , sleepTimer ) ; return new SignalServiceMessagePipe ( webSocket , Optional . of ( credentialsProvider ) ) ;
|
public class AnnotationTypeWriterImpl { /** * Add summary details to the navigation bar .
* @ param subDiv the content tree to which the summary detail links will be added */
@ Override protected void addSummaryDetailLinks ( Content subDiv ) { } }
|
Content div = HtmlTree . DIV ( getNavSummaryLinks ( ) ) ; div . addContent ( getNavDetailLinks ( ) ) ; subDiv . addContent ( div ) ;
|
public class Balancer { /** * Check that this Balancer is compatible with the Block Placement Policy
* used by the Namenode .
* In case it is not compatible , throw IllegalArgumentException */
private void checkReplicationPolicyCompatibility ( Configuration conf ) { } }
|
if ( ! ( BlockPlacementPolicy . getInstance ( conf , null , null , null , null , null ) instanceof BlockPlacementPolicyDefault ) ) { throw new IllegalArgumentException ( "Configuration lacks BlockPlacementPolicyDefault" ) ; }
|
public class PatchSchedulesInner { /** * Gets the patching schedule of a redis cache ( requires Premium SKU ) .
* @ param resourceGroupName The name of the resource group .
* @ param name The name of the redis cache .
* @ 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 RedisPatchScheduleInner object if successful . */
public RedisPatchScheduleInner get ( String resourceGroupName , String name ) { } }
|
return getWithServiceResponseAsync ( resourceGroupName , name ) . toBlocking ( ) . single ( ) . body ( ) ;
|
public class VFSUtils { /** * Copy input stream to output stream without closing streams . Flushes output stream when done .
* @ param is input stream
* @ param os output stream
* @ param bufferSize the buffer size to use
* @ throws IOException for any error */
public static void copyStream ( InputStream is , OutputStream os , int bufferSize ) throws IOException { } }
|
if ( is == null ) { throw MESSAGES . nullArgument ( "input stream" ) ; } if ( os == null ) { throw MESSAGES . nullArgument ( "output stream" ) ; } byte [ ] buff = new byte [ bufferSize ] ; int rc ; while ( ( rc = is . read ( buff ) ) != - 1 ) { os . write ( buff , 0 , rc ) ; } os . flush ( ) ;
|
public class YarnClasspathProvider { /** * Fetches the string [ ] under the given key , if it exists and contains entries ( . length > 0 ) .
* @ param configuration
* @ param key
* @ return */
private static Optional < String [ ] > getTrimmedStrings ( final YarnConfiguration configuration , final String key ) { } }
|
final String [ ] result = configuration . getTrimmedStrings ( key ) ; if ( null == result || result . length == 0 ) { return Optional . empty ( ) ; } else { return Optional . of ( result ) ; }
|
public class ImageSprite { /** * Set the image array used to render the sprite .
* @ param frames the sprite images . */
public void setFrames ( MultiFrameImage frames ) { } }
|
if ( frames == null ) { // log . warning ( " Someone set up us the null frames ! " , " sprite " , this ) ;
return ; } // if these are the same frames we already had , no need to do a bunch of pointless business
if ( frames == _frames ) { return ; } // set and init our frames
_frames = frames ; _frameIdx = 0 ; layout ( ) ;
|
public class SmbFile { /** * This method will copy the file or directory represented by this
* < tt > SmbFile < / tt > and it ' s sub - contents to the location specified by the
* < tt > dest < / tt > parameter . This file and the destination file do not
* need to be on the same host . This operation does not copy extended
* file attibutes such as ACLs but it does copy regular attributes as
* well as create and last write times . This method is almost twice as
* efficient as manually copying as it employs an additional write
* thread to read and write data concurrently .
* It is not possible ( nor meaningful ) to copy entire workgroups or
* servers .
* @ param dest the destination file or directory
* @ throws SmbException */
public void copyTo ( SmbFile dest ) throws SmbException { } }
|
SmbComReadAndX req ; SmbComReadAndXResponse resp ; WriterThread w ; int bsize ; byte [ ] [ ] b ; /* Should be able to copy an entire share actually */
if ( share == null || dest . share == null ) { throw new SmbException ( "Invalid operation for workgroups or servers" ) ; } req = new SmbComReadAndX ( ) ; resp = new SmbComReadAndXResponse ( ) ; connect0 ( ) ; dest . connect0 ( ) ; /* At this point the maxBufferSize values are from the server
* exporting the volumes , not the one that we will actually
* end up performing IO with . If the server hosting the
* actual files has a smaller maxBufSize this could be
* incorrect . To handle this properly it is necessary
* to redirect the tree to the target server first before
* establishing buffer size . These exists ( ) calls facilitate
* that . */
resolveDfs ( null ) ; /* It is invalid for the source path to be a child of the destination
* path or visa versa . */
try { if ( getAddress ( ) . equals ( dest . getAddress ( ) ) && canon . regionMatches ( true , 0 , dest . canon , 0 , Math . min ( canon . length ( ) , dest . canon . length ( ) ) ) ) { throw new SmbException ( "Source and destination paths overlap." ) ; } } catch ( UnknownHostException uhe ) { } w = new WriterThread ( ) ; w . setDaemon ( true ) ; w . start ( ) ; /* Downgrade one transport to the lower of the negotiated buffer sizes
* so we can just send whatever is received . */
SmbTransport t1 = tree . session . transport ; SmbTransport t2 = dest . tree . session . transport ; if ( t1 . snd_buf_size < t2 . snd_buf_size ) { t2 . snd_buf_size = t1 . snd_buf_size ; } else { t1 . snd_buf_size = t2 . snd_buf_size ; } bsize = Math . min ( t1 . rcv_buf_size - 70 , t1 . snd_buf_size - 70 ) ; b = new byte [ 2 ] [ bsize ] ; try { copyTo0 ( dest , b , bsize , w , req , resp ) ; } finally { w . write ( null , - 1 , null , 0 ) ; }
|
public class CService { /** * Get all methods including methods declared in extended services .
* @ return The list of service methods . */
public Collection < CServiceMethod > getMethodsIncludingExtended ( ) { } }
|
CService extended = getExtendsService ( ) ; if ( extended == null ) { return getMethods ( ) ; } List < CServiceMethod > out = new ArrayList < > ( ) ; out . addAll ( extended . getMethodsIncludingExtended ( ) ) ; out . addAll ( getMethods ( ) ) ; return ImmutableList . copyOf ( out ) ;
|
public class CmsDynamicFunctionParser { /** * Parses the main format from the XML content . < p >
* @ param cms the current CMS context
* @ param location the location from which to parse main format
* @ param functionRes the dynamic function resource
* @ return the parsed main format */
protected Format getMainFormat ( CmsObject cms , I_CmsXmlContentLocation location , CmsResource functionRes ) { } }
|
I_CmsXmlContentValueLocation jspLoc = location . getSubValue ( "FunctionProvider" ) ; CmsUUID structureId = jspLoc . asId ( cms ) ; I_CmsXmlContentValueLocation containerSettings = location . getSubValue ( "ContainerSettings" ) ; Map < String , String > parameters = parseParameters ( cms , location , "Parameter" ) ; if ( containerSettings != null ) { String type = getStringValue ( cms , containerSettings . getSubValue ( "Type" ) , "" ) ; String minWidth = getStringValue ( cms , containerSettings . getSubValue ( "MinWidth" ) , "" ) ; String maxWidth = getStringValue ( cms , containerSettings . getSubValue ( "MaxWidth" ) , "" ) ; Format result = new Format ( structureId , type , minWidth , maxWidth , parameters ) ; return result ; } else { Format result = new Format ( structureId , "" , "" , "" , parameters ) ; result . setNoContainerSettings ( true ) ; return result ; }
|
public class AbstractValidate { /** * Returns the index of the first null element , or { @ code - 1 } if no null element was found .
* @ param iterable
* the iterable to check for null elements
* @ param < T >
* the type of the iterable
* @ return the index of the first null element , or { @ code - 1 } if no null element was found */
private static < T extends Iterable < ? > > int indexOfNullElement ( T iterable ) { } }
|
final Iterator < ? > it = iterable . iterator ( ) ; for ( int i = 0 ; it . hasNext ( ) ; i ++ ) { if ( it . next ( ) == null ) { return i ; } } return - 1 ;
|
public class KamImpl { /** * { @ inheritDoc } */
@ Override public KamEdge replaceEdge ( KamEdge kamEdge , FunctionEnum sourceFunction , String sourceLabel , RelationshipType relationship , FunctionEnum targetFunction , String targetLabel ) { } }
|
// replace source node
final int sourceNodeId = kamEdge . getSourceNode ( ) . getId ( ) ; final KamNode sourceReplacement = new KamNodeImpl ( this , sourceNodeId , sourceFunction , sourceLabel ) ; // establish id to replacement node
idNodeMap . put ( sourceNodeId , sourceReplacement ) ; nodeIdMap . put ( sourceReplacement , sourceNodeId ) ; // replace target node
final int targetNodeId = kamEdge . getTargetNode ( ) . getId ( ) ; final KamNode targetReplacement = new KamNodeImpl ( this , targetNodeId , targetFunction , targetLabel ) ; // establish id to replacement node
idNodeMap . put ( targetNodeId , targetReplacement ) ; nodeIdMap . put ( targetReplacement , targetNodeId ) ; final int edgeId = kamEdge . getId ( ) ; final KamEdge replacement = new KamEdgeImpl ( this , edgeId , sourceReplacement , relationship , targetReplacement ) ; // establish id to replacement edge
idEdgeMap . put ( edgeId , replacement ) ; edgeIdMap . put ( replacement , edgeId ) ; // reconnect network
Set < KamEdge > sourceOutgoing = nodeSourceMap . remove ( kamEdge . getSourceNode ( ) ) ; sourceOutgoing . remove ( kamEdge ) ; sourceOutgoing . add ( replacement ) ; nodeSourceMap . put ( sourceReplacement , sourceOutgoing ) ; Set < KamEdge > targetIncoming = nodeTargetMap . remove ( kamEdge . getTargetNode ( ) ) ; targetIncoming . remove ( kamEdge ) ; targetIncoming . add ( replacement ) ; nodeTargetMap . put ( targetReplacement , targetIncoming ) ; Set < KamEdge > sourceIncoming = nodeTargetMap . remove ( kamEdge . getSourceNode ( ) ) ; nodeTargetMap . put ( sourceReplacement , sourceIncoming ) ; Set < KamEdge > targetOutgoing = nodeSourceMap . remove ( kamEdge . getTargetNode ( ) ) ; nodeSourceMap . put ( targetReplacement , targetOutgoing ) ; return replacement ;
|
public class BuildRun { /** * Stories and Defects completed in this Build Run .
* @ param filter Filter for PrimaryWorkitems .
* @ return completed Stories and Defects completed in this Build Run . */
public Collection < PrimaryWorkitem > getCompletedPrimaryWorkitems ( PrimaryWorkitemFilter filter ) { } }
|
filter = ( filter != null ) ? filter : new PrimaryWorkitemFilter ( ) ; filter . completedIn . clear ( ) ; filter . completedIn . add ( this ) ; return getInstance ( ) . get ( ) . primaryWorkitems ( filter ) ;
|
public class JCuda { /** * Gets a mipmap level of a CUDA mipmapped array .
* < pre >
* cudaError _ t cudaGetMipmappedArrayLevel (
* cudaArray _ t * levelArray ,
* cudaMipmappedArray _ const _ t mipmappedArray ,
* unsigned int level )
* < / pre >
* < div >
* < p > Gets a mipmap level of a CUDA mipmapped
* array . Returns in < tt > * levelArray < / tt > a CUDA array that represents
* a single mipmap level of the CUDA mipmapped array < tt > mipmappedArray < / tt > .
* < p > If < tt > level < / tt > is greater than the
* maximum number of levels in this mipmapped array , cudaErrorInvalidValue
* is returned .
* < div >
* < span > Note : < / span >
* < p > Note that this
* function may also return error codes from previous , asynchronous
* launches .
* < / div >
* < / div >
* @ param levelArray Returned mipmap level CUDA array
* @ param mipmappedArray CUDA mipmapped array
* @ param level Mipmap level
* @ return cudaSuccess , cudaErrorInvalidValue
* @ see JCuda # cudaMalloc3D
* @ see JCuda # cudaMalloc
* @ see JCuda # cudaMallocPitch
* @ see JCuda # cudaFree
* @ see JCuda # cudaFreeArray
* @ see JCuda # cudaMallocHost
* @ see JCuda # cudaFreeHost
* @ see JCuda # cudaHostAlloc
* @ see cudaExtent */
public static int cudaGetMipmappedArrayLevel ( cudaArray levelArray , cudaMipmappedArray mipmappedArray , int level ) { } }
|
return checkResult ( cudaGetMipmappedArrayLevelNative ( levelArray , mipmappedArray , level ) ) ;
|
public class Branch { /** * < p > Redeems the specified number of credits from the " default " bucket , if there are sufficient
* credits within it . If the number to redeem exceeds the number available in the bucket , all of
* the available credits will be redeemed instead . < / p >
* @ param count A { @ link Integer } specifying the number of credits to attempt to redeem from
* the bucket .
* @ param callback A { @ link BranchReferralStateChangedListener } callback instance that will
* trigger actions defined therein upon a executing redeem rewards . */
public void redeemRewards ( int count , BranchReferralStateChangedListener callback ) { } }
|
redeemRewards ( Defines . Jsonkey . DefaultBucket . getKey ( ) , count , callback ) ;
|
public class RomanticCron4jNativeTaskExecutor { @ Override public void start ( boolean daemon ) { } }
|
setupLinkedLockIfNeeds ( ) ; synchronized ( linkedLock ) { registerStartTimeCurrentTime ( ) ; setupLinkedGuidIfNeeds ( ) ; final String threadName = buildThreadName ( linkedScheduler . getGuid ( ) , linkedGuid ) ; registerThreadNewCreated ( ) ; prepareThread ( daemon , threadName ) ; actuallyThreadStart ( ) ; }
|
public class DatatypeFactory { /** * < p > Create a < code > Duration < / code > of type < code > xdt : dayTimeDuration < / code > by parsing its < code > String < / code > representation ,
* " < em > PnDTnHnMnS < / em > " , < a href = " http : / / www . w3 . org / TR / xpath - datamodel # dt - dayTimeDuration " >
* XQuery 1.0 and XPath 2.0 Data Model , xdt : dayTimeDuration < / a > . < / p >
* < p > The datatype < code > xdt : dayTimeDuration < / code > is a subtype of < code > xs : duration < / code >
* whose lexical representation contains only day , hour , minute , and second components .
* This datatype resides in the namespace < code > http : / / www . w3 . org / 2003/11 / xpath - datatypes < / code > . < / p >
* < p > All four values are set and available from the created { @ link Duration } < / p >
* < p > The XML Schema specification states that values can be of an arbitrary size .
* Implementations may chose not to or be incapable of supporting arbitrarily large and / or small values .
* An { @ link UnsupportedOperationException } will be thrown with a message indicating implementation limits
* if implementation capacities are exceeded . < / p >
* @ param lexicalRepresentation Lexical representation of a duration .
* @ return New < code > Duration < / code > created using the specified < code > lexicalRepresentation < / code > .
* @ throws IllegalArgumentException If the given string does not conform to the aforementioned specification .
* @ throws UnsupportedOperationException If implementation cannot support requested values .
* @ throws NullPointerException If < code > lexicalRepresentation < / code > is < code > null < / code > . */
public Duration newDurationDayTime ( final String lexicalRepresentation ) { } }
|
if ( lexicalRepresentation == null ) { throw new NullPointerException ( "lexicalRepresentation == null" ) ; } // The lexical representation must match the pattern [ ^ YM ] * ( T . * ) ?
int pos = lexicalRepresentation . indexOf ( 'T' ) ; int length = ( pos >= 0 ) ? pos : lexicalRepresentation . length ( ) ; for ( int i = 0 ; i < length ; ++ i ) { char c = lexicalRepresentation . charAt ( i ) ; if ( c == 'Y' || c == 'M' ) { throw new IllegalArgumentException ( "Invalid dayTimeDuration value: " + lexicalRepresentation ) ; } } return newDuration ( lexicalRepresentation ) ;
|
public class DocumentImpl { /** * Returns a copy of the given node or subtree with this document as its
* owner .
* @ param operation either { @ link UserDataHandler # NODE _ CLONED } or
* { @ link UserDataHandler # NODE _ IMPORTED } .
* @ param node a node belonging to any document or DOM implementation .
* @ param deep true to recursively copy any child nodes ; false to do no such
* copying and return a node with no children . */
Node cloneOrImportNode ( short operation , Node node , boolean deep ) { } }
|
NodeImpl copy = shallowCopy ( operation , node ) ; if ( deep ) { NodeList list = node . getChildNodes ( ) ; for ( int i = 0 ; i < list . getLength ( ) ; i ++ ) { copy . appendChild ( cloneOrImportNode ( operation , list . item ( i ) , deep ) ) ; } } notifyUserDataHandlers ( operation , node , copy ) ; return copy ;
|
public class AmazonElastiCacheClient { /** * Lists all available node types that you can scale your Redis cluster ' s or replication group ' s current node type
* up to .
* When you use the < code > ModifyCacheCluster < / code > or < code > ModifyReplicationGroup < / code > operations to scale up
* your cluster or replication group , the value of the < code > CacheNodeType < / code > parameter must be one of the node
* types returned by this operation .
* @ param listAllowedNodeTypeModificationsRequest
* The input parameters for the < code > ListAllowedNodeTypeModifications < / code > operation .
* @ return Result of the ListAllowedNodeTypeModifications operation returned by the service .
* @ throws CacheClusterNotFoundException
* The requested cluster ID does not refer to an existing cluster .
* @ throws ReplicationGroupNotFoundException
* The specified replication group does not exist .
* @ throws InvalidParameterCombinationException
* Two or more incompatible parameters were specified .
* @ throws InvalidParameterValueException
* The value for a parameter is invalid .
* @ sample AmazonElastiCache . ListAllowedNodeTypeModifications
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / elasticache - 2015-02-02 / ListAllowedNodeTypeModifications "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public ListAllowedNodeTypeModificationsResult listAllowedNodeTypeModifications ( ListAllowedNodeTypeModificationsRequest request ) { } }
|
request = beforeClientExecution ( request ) ; return executeListAllowedNodeTypeModifications ( request ) ;
|
public class InsertExtractUtils { /** * Extract read and write part values to an object for SCALAR , SPECTRUM and IMAGE
* @ param da
* @ return array of primitives for SCALAR , array of primitives for SPECTRUM , array of primitives array of primitives
* for IMAGE
* @ throws DevFailed */
public static Object extract ( final DeviceAttribute da ) throws DevFailed { } }
|
if ( da == null ) { throw DevFailedUtils . newDevFailed ( ERROR_MSG_DA ) ; } return InsertExtractFactory . getAttributeExtractor ( da . getType ( ) ) . extract ( da ) ;
|
public class MailSessionDefinitionInjectionBinding { /** * ( non - Javadoc )
* @ see com . ibm . wsspi . injectionengine . InjectionBinding # merge ( java . lang . annotation . Annotation , java . lang . Class , java . lang . reflect . Member ) */
@ Override public void merge ( @ Sensitive MailSessionDefinition annotation , Class < ? > instanceClass , Member member ) throws InjectionException { } }
|
final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "merge: name=" + getJndiName ( ) + ", " + super . toStringSecure ( annotation ) ) ; if ( member != null ) { // MailSessionDefinition is a class - level annotation only .
throw new IllegalArgumentException ( member . toString ( ) ) ; } description = mergeAnnotationValue ( description , XMLDescription , annotation . description ( ) , KEY_DESCRIPTION , "" ) ; user = mergeAnnotationValue ( user , XMLUser , annotation . user ( ) , KEY_USER , "" ) ; if ( password != null ) password = ( SerializableProtectedString ) mergeAnnotationValue ( password . getChars ( ) , XMLPassword , annotation . password ( ) . toCharArray ( ) , KEY_PASSWORD , "" ) ; host = mergeAnnotationValue ( host , XMLHost , annotation . host ( ) , KEY_HOST , "" ) ; from = mergeAnnotationValue ( from , XMLFrom , annotation . from ( ) , KEY_FROM , "" ) ; properties = mergeAnnotationProperties ( properties , XMLProperties , annotation . properties ( ) ) ; storeProtocol = mergeAnnotationValue ( storeProtocol , XMLStoreProtocol , annotation . storeProtocol ( ) , KEY_STORE_PROTOCOL , "" ) ; storeProtocolClassName = mergeAnnotationValue ( storeProtocolClassName , XMLStoreProtocolClassName , annotation . storeProtocol ( ) , KEY_STORE_PROTOCOL_CLASS_NAME , "" ) ; transportProtocol = mergeAnnotationValue ( transportProtocol , XMLTransportProtocol , annotation . transportProtocol ( ) , KEY_TRANSPORT_PROTOCOL , "" ) ; transportProtocolClassName = mergeAnnotationValue ( transportProtocolClassName , XMLTransportProtocolClassName , annotation . storeProtocol ( ) , KEY_TRANSPORT_PROTOCOL_CLASS_NAME , "" ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "merge" ) ;
|
public class EventRepository { /** * Save { @ link Event } to DB
* @ param event { @ link Event } to save */
@ Transactional public void save ( Event event ) { } }
|
Event merged = em . merge ( event ) ; em . flush ( ) ; event . setId ( merged . getId ( ) ) ;
|
public class FileSize { /** * Format a integer or long value as file size . Returns empty string if < code > value < / code > argument is null .
* @ param value numeric value .
* @ return numeric value represented as file size , possible empty if < code > value < / code > argument is null .
* @ throws IllegalArgumentException if < code > value < / code > argument is not integer or long . */
@ Override public String format ( Object value ) { } }
|
if ( value == null ) { return "" ; } double fileSize = 0 ; if ( value instanceof Integer ) { fileSize = ( Integer ) value ; } else if ( value instanceof Long ) { fileSize = ( Long ) value ; } else { throw new IllegalArgumentException ( String . format ( "Invalid argument type |%s|." , value . getClass ( ) ) ) ; } if ( fileSize == 0 ) { return format ( 0 , Units . B ) ; } Units units = Units . B ; for ( Units u : Units . values ( ) ) { if ( fileSize < u . value ) { break ; } units = u ; } return format ( fileSize / units . value , units ) ;
|
public class ReflectUtils { /** * invokes the getter on the filed
* @ param object
* @ param field
* @ return */
@ SuppressWarnings ( "unchecked" ) public static < S extends Serializable > S invokeGetter ( Object object , Field field ) { } }
|
Method m = ReflectionUtils . findMethod ( object . getClass ( ) , ReflectUtils . toGetter ( field . getName ( ) ) ) ; if ( null == m ) { for ( String prefix : PREFIXES ) { m = ReflectionUtils . findMethod ( object . getClass ( ) , ReflectUtils . toGetter ( field . getName ( ) , prefix ) ) ; if ( null != m ) { break ; } } } return ( S ) ReflectionUtils . invokeMethod ( m , object ) ;
|
public class FastItemAdapter { /** * add a list of items at the given position within the existing items
* @ param position the global position
* @ param items the items to add */
public FastItemAdapter < Item > add ( int position , List < Item > items ) { } }
|
getItemAdapter ( ) . add ( position , items ) ; return this ;
|
public class NodeImpl { /** * { @ inheritDoc } */
public void update ( String srcWorkspaceName ) throws NoSuchWorkspaceException , AccessDeniedException , InvalidItemStateException , LockException , RepositoryException { } }
|
checkValid ( ) ; // Check pending changes
if ( session . hasPendingChanges ( ) ) { throw new InvalidItemStateException ( "Session has pending changes " ) ; } // Check locking
if ( ! checkLocking ( ) ) { throw new LockException ( "Node " + getPath ( ) + " is locked " ) ; } SessionChangesLog changes = new SessionChangesLog ( session ) ; String srcPath ; try { srcPath = getCorrespondingNodePath ( srcWorkspaceName ) ; ItemDataRemoveVisitor remover = new ItemDataRemoveVisitor ( session . getTransientNodesManager ( ) , null , session . getWorkspace ( ) . getNodeTypesHolder ( ) , session . getAccessManager ( ) , session . getUserState ( ) ) ; nodeData ( ) . accept ( remover ) ; changes . addAll ( remover . getRemovedStates ( ) ) ; } catch ( ItemNotFoundException e ) { LOG . debug ( "No corresponding node in workspace: " + srcWorkspaceName ) ; return ; } TransactionableDataManager pmanager = session . getTransientNodesManager ( ) . getTransactManager ( ) ; session . getWorkspace ( ) . clone ( srcWorkspaceName , srcPath , this . getPath ( ) , true , changes ) ; pmanager . save ( changes ) ; NodeData thisParent = ( NodeData ) session . getTransientNodesManager ( ) . getItemData ( getParentIdentifier ( ) ) ; QPathEntry [ ] qpath = getInternalPath ( ) . getEntries ( ) ; NodeData thisNew = ( NodeData ) pmanager . getItemData ( thisParent , qpath [ qpath . length - 1 ] , ItemType . NODE ) ; // reload node impl with old uuid to a new one data
session . getTransientNodesManager ( ) . getItemsPool ( ) . reload ( getInternalIdentifier ( ) , thisNew ) ;
|
public class InMemoryChunkAccumulator { /** * Returns the number of chunks
* accumulated for a given id so far
* @ param id the id to get the
* number of chunks for
* @ return the number of chunks accumulated
* for a given id so far */
@ Override public int numChunksSoFar ( String id ) { } }
|
if ( ! chunks . containsKey ( id ) ) return 0 ; return chunks . get ( id ) . size ( ) ;
|
public class DebugSqlFilter { /** * { @ inheritDoc }
* @ see jp . co . future . uroborosql . filter . AbstractSqlFilter # doUpdate ( jp . co . future . uroborosql . context . SqlContext , java . sql . PreparedStatement , int ) */
@ Override public int doUpdate ( final SqlContext sqlContext , final PreparedStatement preparedStatement , final int result ) { } }
|
LOG . debug ( "SQL:{} executed. Count:{} items." , sqlContext . getSqlName ( ) , result ) ; return result ;
|
public class JoinGraph { /** * Builds { @ link JoinGraph } containing { @ code plan } node . */
public static JoinGraph buildShallowFrom ( PlanNode plan , Lookup lookup ) { } }
|
JoinGraph graph = plan . accept ( new Builder ( true , lookup ) , new Context ( ) ) ; return graph ;
|
public class CastorMarshaller { /** * Template method that allows for customizing of the given Castor { @ link Unmarshaller } . */
protected void customizeUnmarshaller ( Unmarshaller unmarshaller ) { } }
|
unmarshaller . setValidation ( this . validating ) ; unmarshaller . setWhitespacePreserve ( this . whitespacePreserve ) ; unmarshaller . setIgnoreExtraAttributes ( this . ignoreExtraAttributes ) ; unmarshaller . setIgnoreExtraElements ( this . ignoreExtraElements ) ; unmarshaller . setObject ( this . rootObject ) ; unmarshaller . setReuseObjects ( this . reuseObjects ) ; unmarshaller . setClearCollections ( this . clearCollections ) ; if ( this . namespaceToPackageMapping != null ) { for ( Map . Entry < String , String > mapping : this . namespaceToPackageMapping . entrySet ( ) ) { unmarshaller . addNamespaceToPackageMapping ( mapping . getKey ( ) , mapping . getValue ( ) ) ; } } if ( this . entityResolver != null ) { unmarshaller . setEntityResolver ( this . entityResolver ) ; } if ( this . classDescriptorResolver != null ) { unmarshaller . setResolver ( this . classDescriptorResolver ) ; } if ( this . idResolver != null ) { unmarshaller . setIDResolver ( this . idResolver ) ; } if ( this . objectFactory != null ) { unmarshaller . setObjectFactory ( this . objectFactory ) ; } if ( this . beanClassLoader != null ) { unmarshaller . setClassLoader ( this . beanClassLoader ) ; }
|
public class GuideTree { /** * Returns the similarity matrix used to construct this guide tree . The scores have not been normalized .
* @ return the similarity matrix used to construct this guide tree */
public double [ ] [ ] getScoreMatrix ( ) { } }
|
double [ ] [ ] matrix = new double [ sequences . size ( ) ] [ sequences . size ( ) ] ; for ( int i = 0 , n = 0 ; i < matrix . length ; i ++ ) { matrix [ i ] [ i ] = scorers . get ( i ) . getMaxScore ( ) ; for ( int j = i + 1 ; j < matrix . length ; j ++ ) { matrix [ i ] [ j ] = matrix [ j ] [ i ] = scorers . get ( n ++ ) . getScore ( ) ; } } return matrix ;
|
public class SQLiteEvent { /** * Creates the insert .
* @ param result
* the result
* @ return the SQ lite event */
public static SQLiteEvent createInsertWithUid ( String result ) { } }
|
return new SQLiteEvent ( SqlModificationType . INSERT , null , null , result ) ;
|
public class LogRepositoryBaseImpl { /** * Retrieves the timestamp from the name of the file .
* @ param file to retrieve timestamp from .
* @ return timestamp in millis or - 1 if name ' s pattern does not correspond
* to the one used for files in the repository . */
public long getLogFileTimestamp ( File file ) { } }
|
if ( file == null ) { return - 1L ; } String name = file . getName ( ) ; // Check name for extension
if ( name == null || name . length ( ) == 0 || ! name . endsWith ( EXTENSION ) ) { return - 1L ; } try { return Long . parseLong ( name . substring ( 0 , name . indexOf ( EXTENSION ) ) ) ; } catch ( NumberFormatException ex ) { return - 1L ; }
|
public class MongoDBUtils { /** * Create a MongoDB collection .
* @ param colectionName
* @ param options */
public void createMongoDBCollection ( String colectionName , DataTable options ) { } }
|
BasicDBObject aux = new BasicDBObject ( ) ; // Recorremos las options para castearlas y añadirlas a la collection
List < List < String > > rowsOp = options . raw ( ) ; for ( int i = 0 ; i < rowsOp . size ( ) ; i ++ ) { List < String > rowOp = rowsOp . get ( i ) ; if ( rowOp . get ( 0 ) . equals ( "size" ) || rowOp . get ( 0 ) . equals ( "max" ) ) { int intproperty = Integer . parseInt ( rowOp . get ( 1 ) ) ; aux . append ( rowOp . get ( 0 ) , intproperty ) ; } else { Boolean boolProperty = Boolean . parseBoolean ( rowOp . get ( 1 ) ) ; aux . append ( rowOp . get ( 0 ) , boolProperty ) ; } } dataBase . createCollection ( colectionName , aux ) ;
|
public class SimpleIOHandler { /** * Serializes a ( not too large ) BioPAX model to the RDF / XML ( OWL ) formatted string .
* @ param model a BioPAX object model to convert to the RDF / XML format
* @ return the BioPAX data in the RDF / XML format
* @ throws IllegalArgumentException if model is null
* @ throws OutOfMemoryError when it cannot be stored in a byte array ( max 2Gb ) . */
public static String convertToOwl ( Model model ) { } }
|
if ( model == null ) throw new IllegalArgumentException ( ) ; ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( ) ; ( new SimpleIOHandler ( model . getLevel ( ) ) ) . convertToOWL ( model , outputStream ) ; try { return outputStream . toString ( "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { log . error ( "convertToOwl, outputStream.toString failed" , e ) ; return outputStream . toString ( ) ; }
|
public class PrettyTime { /** * Format the given { @ link Duration } and return a non - relative ( not decorated with past or future tense )
* { @ link String } for the approximate duration of the difference between the reference { @ link Date } and the given
* { @ link Duration } . If the given { @ link Duration } is < code > null < / code > , the current value of
* { @ link System # currentTimeMillis ( ) } will be used instead .
* @ param duration the duration to be formatted
* @ return A formatted string of the given { @ link Duration } */
public String formatDuration ( Duration duration ) { } }
|
if ( duration == null ) return format ( now ( ) ) ; TimeFormat timeFormat = getFormat ( duration . getUnit ( ) ) ; return timeFormat . format ( duration ) ;
|
public class IndexActionRegisterServiceImpl { /** * Retrieves all { @ link EntityType } s . Queryies in pages of size ENTITY _ FETCH _ PAGE _ SIZE so that
* results can be cached . Uses a { @ link Fetch } that specifies all fields needed to determine the
* necessary index actions .
* @ return List containing all { @ link EntityType } s . */
private List < EntityType > getEntityTypes ( ) { } }
|
QueryImpl < EntityType > query = new QueryImpl < > ( ) ; query . setPageSize ( ENTITY_FETCH_PAGE_SIZE ) ; query . setFetch ( ENTITY_TYPE_FETCH ) ; List < EntityType > result = newArrayList ( ) ; for ( int pageNum = 0 ; result . size ( ) == pageNum * ENTITY_FETCH_PAGE_SIZE ; pageNum ++ ) { query . offset ( pageNum * ENTITY_FETCH_PAGE_SIZE ) ; dataService . findAll ( ENTITY_TYPE_META_DATA , query , EntityType . class ) . forEach ( result :: add ) ; } return result ;
|
public class HSQLDBHandler { /** * executes a query on the queries inside the cld fusion enviroment
* @ param pc Page Context
* @ param sql
* @ param maxrows
* @ return result as Query
* @ throws PageException
* @ throws PageException */
public Query execute ( PageContext pc , SQL sql , int maxrows , int fetchsize , TimeSpan timeout ) throws PageException { } }
|
Stopwatch stopwatch = new Stopwatch ( Stopwatch . UNIT_NANO ) ; stopwatch . start ( ) ; String prettySQL = null ; Selects selects = null ; // First Chance
try { SelectParser parser = new SelectParser ( ) ; selects = parser . parse ( sql . getSQLString ( ) ) ; Query q = qoq . execute ( pc , sql , selects , maxrows ) ; q . setExecutionTime ( stopwatch . time ( ) ) ; return q ; } catch ( SQLParserException spe ) { // lucee . print . printST ( spe ) ;
// sp
// lucee . print . out ( " sql parser crash at : " ) ;
// lucee . print . out ( " - - - - - " ) ;
// lucee . print . out ( sql . getSQLString ( ) . trim ( ) ) ;
// lucee . print . out ( " - - - - - " ) ;
// print . e ( " 1 : " + sql . getSQLString ( ) ) ;
prettySQL = SQLPrettyfier . prettyfie ( sql . getSQLString ( ) ) ; // print . e ( " 2 : " + prettySQL ) ;
try { Query query = executer . execute ( pc , sql , prettySQL , maxrows ) ; query . setExecutionTime ( stopwatch . time ( ) ) ; return query ; } catch ( PageException ex ) { // lucee . print . printST ( ex ) ;
// lucee . print . out ( " old executor / zql crash at : " ) ;
// lucee . print . out ( " - - - - - " ) ;
// lucee . print . out ( sql . getSQLString ( ) . trim ( ) ) ;
// lucee . print . out ( " - - - - - " ) ;
} } catch ( PageException e ) { // throw e ;
// print . out ( " new executor crash at : " ) ;
// print . out ( " - - - - - " ) ;
// print . out ( sql . getSQLString ( ) . trim ( ) ) ;
// print . out ( " - - - - - " ) ;
} // if ( true ) throw new RuntimeException ( ) ;
// SECOND Chance with hsqldb
try { boolean isUnion = false ; Set < String > tables = null ; if ( selects != null ) { HSQLUtil2 hsql2 = new HSQLUtil2 ( selects ) ; isUnion = hsql2 . isUnion ( ) ; tables = hsql2 . getInvokedTables ( ) ; } else { if ( prettySQL == null ) prettySQL = SQLPrettyfier . prettyfie ( sql . getSQLString ( ) ) ; HSQLUtil hsql = new HSQLUtil ( prettySQL ) ; tables = hsql . getInvokedTables ( ) ; isUnion = hsql . isUnion ( ) ; } String strSQL = StringUtil . replace ( sql . getSQLString ( ) , "[" , "" , false ) ; strSQL = StringUtil . replace ( strSQL , "]" , "" , false ) ; sql . setSQLString ( strSQL ) ; return _execute ( pc , sql , maxrows , fetchsize , timeout , stopwatch , tables , isUnion ) ; } catch ( ParseException e ) { throw new DatabaseException ( e . getMessage ( ) , null , sql , null ) ; }
|
public class Part { /** * Sets the label which first char identifies this part .
* @ param labelValue
* The label that identifies this part .
* @ throws IllegalArgumentException if label is 0 - length */
public void setLabel ( String labelValue ) throws IllegalArgumentException { } }
|
if ( ( labelValue == null ) || ( labelValue . length ( ) == 0 ) ) throw new IllegalArgumentException ( "Part's label can't be null or empty!" ) ; m_label = labelValue ; m_music . setPartLabel ( m_label ) ;
|
public class ErrorCodesMobile { /** * Returns the exception type that corresponds to the given { @ code message } or { @ code null } if
* there are no matching mobile exceptions .
* @ param message message An error message returned by Appium server
* @ return The exception type that corresponds to the provided error message or { @ code null } if
* there are no matching mobile exceptions . */
public Class < ? extends WebDriverException > getExceptionType ( String message ) { } }
|
for ( Map . Entry < Integer , String > entry : statusToState . entrySet ( ) ) { if ( message . contains ( entry . getValue ( ) ) ) { return getExceptionType ( entry . getKey ( ) ) ; } } return null ;
|
public class GetAuthorizationTokenResult { /** * A list of authorization token data objects that correspond to the < code > registryIds < / code > values in the request .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setAuthorizationData ( java . util . Collection ) } or { @ link # withAuthorizationData ( java . util . Collection ) } if
* you want to override the existing values .
* @ param authorizationData
* A list of authorization token data objects that correspond to the < code > registryIds < / code > values in the
* request .
* @ return Returns a reference to this object so that method calls can be chained together . */
public GetAuthorizationTokenResult withAuthorizationData ( AuthorizationData ... authorizationData ) { } }
|
if ( this . authorizationData == null ) { setAuthorizationData ( new java . util . ArrayList < AuthorizationData > ( authorizationData . length ) ) ; } for ( AuthorizationData ele : authorizationData ) { this . authorizationData . add ( ele ) ; } return this ;
|
public class SVGUtil { /** * Create a SVG element in appropriate namespace
* @ param document containing document
* @ param name node name
* @ return new SVG element . */
public static Element svgElement ( Document document , String name ) { } }
|
return document . createElementNS ( SVGConstants . SVG_NAMESPACE_URI , name ) ;
|
public class PathTemplate { private static ImmutableList < Segment > parseTemplate ( String template ) { } }
|
// Skip useless leading slash .
if ( template . startsWith ( "/" ) ) { template = template . substring ( 1 ) ; } // Extract trailing custom verb .
Matcher matcher = CUSTOM_VERB_PATTERN . matcher ( template ) ; String customVerb = null ; if ( matcher . find ( ) ) { customVerb = matcher . group ( 1 ) ; template = template . substring ( 0 , matcher . start ( 0 ) ) ; } ImmutableList . Builder < Segment > builder = ImmutableList . builder ( ) ; String varName = null ; int freeWildcardCounter = 0 ; int pathWildCardBound = 0 ; for ( String seg : Splitter . on ( '/' ) . trimResults ( ) . split ( template ) ) { // If segment starts with ' { ' , a binding group starts .
boolean bindingStarts = seg . startsWith ( "{" ) ; boolean implicitWildcard = false ; if ( bindingStarts ) { if ( varName != null ) { throw new ValidationException ( "parse error: nested binding in '%s'" , template ) ; } seg = seg . substring ( 1 ) ; int i = seg . indexOf ( '=' ) ; if ( i <= 0 ) { // Possibly looking at something like " { name } " with implicit wildcard .
if ( seg . endsWith ( "}" ) ) { // Remember to add an implicit wildcard later .
implicitWildcard = true ; varName = seg . substring ( 0 , seg . length ( ) - 1 ) . trim ( ) ; seg = seg . substring ( seg . length ( ) - 1 ) . trim ( ) ; } else { throw new ValidationException ( "parse error: invalid binding syntax in '%s'" , template ) ; } } else { // Looking at something like " { name = wildcard } " .
varName = seg . substring ( 0 , i ) . trim ( ) ; seg = seg . substring ( i + 1 ) . trim ( ) ; } builder . add ( Segment . create ( SegmentKind . BINDING , varName ) ) ; } // If segment ends with ' } ' , a binding group ends . Remove the brace and remember .
boolean bindingEnds = seg . endsWith ( "}" ) ; if ( bindingEnds ) { seg = seg . substring ( 0 , seg . length ( ) - 1 ) . trim ( ) ; } // Process the segment , after stripping off " { name = . . " and " . . } " .
switch ( seg ) { case "**" : case "*" : if ( "**" . equals ( seg ) ) { pathWildCardBound ++ ; } Segment wildcard = seg . length ( ) == 2 ? Segment . PATH_WILDCARD : Segment . WILDCARD ; if ( varName == null ) { // Not in a binding , turn wildcard into implicit binding .
builder . add ( Segment . create ( SegmentKind . BINDING , "$" + freeWildcardCounter ) ) ; freeWildcardCounter ++ ; builder . add ( wildcard ) ; builder . add ( Segment . END_BINDING ) ; } else { builder . add ( wildcard ) ; } break ; case "" : if ( ! bindingEnds ) { throw new ValidationException ( "parse error: empty segment not allowed in '%s'" , template ) ; } // If the wildcard is implicit , seg will be empty . Just continue .
break ; default : builder . add ( Segment . create ( SegmentKind . LITERAL , seg ) ) ; } // End a binding .
if ( bindingEnds ) { // Reset varName to null for next binding .
varName = null ; if ( implicitWildcard ) { // Looking at something like " { var } " . Insert an implicit wildcard , as it is the same
// as " { var = * } " .
builder . add ( Segment . WILDCARD ) ; } builder . add ( Segment . END_BINDING ) ; } if ( pathWildCardBound > 1 ) { // Report restriction on number of ' * * ' in the pattern . There can be only one , which
// enables non - backtracking based matching .
throw new ValidationException ( "parse error: pattern must not contain more than one path wildcard ('**') in '%s'" , template ) ; } } if ( customVerb != null ) { builder . add ( Segment . create ( SegmentKind . CUSTOM_VERB , customVerb ) ) ; } return builder . build ( ) ;
|
public class Ocpp15RequestHandler { /** * { @ inheritDoc } */
@ Override public void handle ( StopTransactionRequestedEvent event , CorrelationToken correlationToken ) { } }
|
LOG . info ( "StopTransactionRequestedEvent" ) ; if ( event . getTransactionId ( ) instanceof NumberedTransactionId ) { NumberedTransactionId transactionId = ( NumberedTransactionId ) event . getTransactionId ( ) ; boolean stopTransactionAccepted = chargingStationOcpp15Client . stopTransaction ( event . getChargingStationId ( ) , transactionId . getNumber ( ) ) ; if ( stopTransactionAccepted ) { domainService . informRequestStopTransactionAccepted ( event . getChargingStationId ( ) , event . getTransactionId ( ) , event . getIdentityContext ( ) , correlationToken ) ; } else { domainService . informRequestStopTransactionRejected ( event . getChargingStationId ( ) , event . getTransactionId ( ) , event . getIdentityContext ( ) , correlationToken ) ; } } else { LOG . warn ( "StopTransactionRequestedEvent does not contain a NumberedTransactionId. Event: {}" , event ) ; }
|
public class Matrix { /** * Computes an orthographic projection matrix .
* @ param m returns the result
* @ param mOffset
* @ param left
* @ param right
* @ param bottom
* @ param top
* @ param near
* @ param far */
public static void orthoM ( float [ ] m , int mOffset , float left , float right , float bottom , float top , float near , float far ) { } }
|
if ( left == right ) { throw new IllegalArgumentException ( "left == right" ) ; } if ( bottom == top ) { throw new IllegalArgumentException ( "bottom == top" ) ; } if ( near == far ) { throw new IllegalArgumentException ( "near == far" ) ; } final float r_width = 1.0f / ( right - left ) ; final float r_height = 1.0f / ( top - bottom ) ; final float r_depth = 1.0f / ( far - near ) ; final float x = 2.0f * ( r_width ) ; final float y = 2.0f * ( r_height ) ; final float z = - 2.0f * ( r_depth ) ; final float tx = - ( right + left ) * r_width ; final float ty = - ( top + bottom ) * r_height ; final float tz = - ( far + near ) * r_depth ; m [ mOffset + 0 ] = x ; m [ mOffset + 5 ] = y ; m [ mOffset + 10 ] = z ; m [ mOffset + 12 ] = tx ; m [ mOffset + 13 ] = ty ; m [ mOffset + 14 ] = tz ; m [ mOffset + 15 ] = 1.0f ; m [ mOffset + 1 ] = 0.0f ; m [ mOffset + 2 ] = 0.0f ; m [ mOffset + 3 ] = 0.0f ; m [ mOffset + 4 ] = 0.0f ; m [ mOffset + 6 ] = 0.0f ; m [ mOffset + 7 ] = 0.0f ; m [ mOffset + 8 ] = 0.0f ; m [ mOffset + 9 ] = 0.0f ; m [ mOffset + 11 ] = 0.0f ;
|
public class Elements { /** * Inserts the specified element into the parent of the before element . */
public static void insertBefore ( Element newElement , Element before ) { } }
|
before . parentNode . insertBefore ( newElement , before ) ;
|
public class HomographyInducedStereo2Line { /** * Computes the homography based on two unique lines on the plane
* @ param line0 Line on the plane
* @ param line1 Line on the plane */
public boolean process ( PairLineNorm line0 , PairLineNorm line1 ) { } }
|
// Find plane equations of second lines in the first view
double a0 = GeometryMath_F64 . dot ( e2 , line0 . l2 ) ; double a1 = GeometryMath_F64 . dot ( e2 , line1 . l2 ) ; GeometryMath_F64 . multTran ( A , line0 . l2 , Al0 ) ; GeometryMath_F64 . multTran ( A , line1 . l2 , Al1 ) ; // find the intersection of the planes created by each view of each line
// first line
planeA . set ( line0 . l1 . x , line0 . l1 . y , line0 . l1 . z , 0 ) ; planeB . set ( Al0 . x , Al0 . y , Al0 . z , a0 ) ; if ( ! Intersection3D_F64 . intersect ( planeA , planeB , intersect0 ) ) return false ; intersect0 . slope . normalize ( ) ; // maybe this will reduce overflow problems ?
// second line
planeA . set ( line1 . l1 . x , line1 . l1 . y , line1 . l1 . z , 0 ) ; planeB . set ( Al1 . x , Al1 . y , Al1 . z , a1 ) ; if ( ! Intersection3D_F64 . intersect ( planeA , planeB , intersect1 ) ) return false ; intersect1 . slope . normalize ( ) ; // compute the plane defined by these two lines
from0to1 . x = intersect1 . p . x - intersect0 . p . x ; from0to1 . y = intersect1 . p . y - intersect0 . p . y ; from0to1 . z = intersect1 . p . z - intersect0 . p . z ; // the plane ' s normal will be the cross product of one of the slopes and a line connecting the two lines
GeometryMath_F64 . cross ( intersect0 . slope , from0to1 , pi . n ) ; pi . p . set ( intersect0 . p ) ; // convert this plane description into general format
UtilPlane3D_F64 . convert ( pi , pi_gen ) ; v . set ( pi_gen . A / pi_gen . D , pi_gen . B / pi_gen . D , pi_gen . C / pi_gen . D ) ; // H = A - e2 * v ^ T
GeometryMath_F64 . outerProd ( e2 , v , av ) ; CommonOps_DDRM . subtract ( A , av , H ) ; // pick a good scale and sign for H
adjust . adjust ( H , line0 ) ; return true ;
|
public class DefaultGroovyMethods { /** * Create a Set as a union of a Set and a Collection .
* This operation will always create a new object for the result ,
* while the operands remain unchanged .
* @ param left the left Set
* @ param right the right Collection
* @ return the merged Set
* @ since 2.4.0
* @ see # plus ( Collection , Collection ) */
public static < T > Set < T > plus ( Set < T > left , Collection < T > right ) { } }
|
return ( Set < T > ) plus ( ( Collection < T > ) left , right ) ;
|
public class JavaAgent { /** * an agent can be started in its own VM as the main class */
public static void main ( String [ ] args ) { } }
|
try { start ( args ) ; } catch ( Exception e ) { System . err . println ( "Hawkular Java Agent failed at startup" ) ; e . printStackTrace ( System . err ) ; return ; } // so main doesn ' t exit
synchronized ( JavaAgent . class ) { try { JavaAgent . class . wait ( ) ; } catch ( InterruptedException e ) { } }
|
public class OMMapManagerOld { /** * Search for a buffer in the ordered list .
* @ param fileEntries
* to search necessary record .
* @ param iBeginOffset
* file offset to start search from it .
* @ param iSize
* that will be contained in founded entries .
* @ return negative number means not found . The position to insert is the ( return value + 1 ) * - 1 . Zero or positive number is the
* found position . */
private static int searchEntry ( final List < OMMapBufferEntry > fileEntries , final long iBeginOffset , final int iSize ) { } }
|
if ( fileEntries == null || fileEntries . size ( ) == 0 ) return - 1 ; int high = fileEntries . size ( ) - 1 ; if ( high < 0 ) // NOT FOUND
return - 1 ; int low = 0 ; int mid = - 1 ; // BINARY SEARCH
OMMapBufferEntry e ; while ( low <= high ) { mid = ( low + high ) >>> 1 ; e = fileEntries . get ( mid ) ; if ( iBeginOffset >= e . beginOffset && iBeginOffset + iSize <= e . beginOffset + e . size ) { // FOUND : USE IT
OProfiler . getInstance ( ) . updateCounter ( "OMMapManager.reusedPage" , 1 ) ; e . counter ++ ; return mid ; } if ( low == high ) { if ( iBeginOffset > e . beginOffset ) // NEXT POSITION
low ++ ; // NOT FOUND
return ( low + 2 ) * - 1 ; } if ( iBeginOffset >= e . beginOffset ) low = mid + 1 ; else high = mid ; } // NOT FOUND
return mid ;
|
public class ContextMap { /** * { @ inheritDoc } */
@ Override public Property setProperty ( String name , Object val ) { } }
|
return _context . setProperty ( name , val ) ;
|
public class Parameters { /** * Creates new Parameters from JSON object .
* @ param json a JSON string containing parameters .
* @ return a new Parameters object .
* @ see JsonConverter # toNullableMap ( String ) */
public static Parameters fromJson ( String json ) { } }
|
Map < String , Object > map = JsonConverter . toNullableMap ( json ) ; return map != null ? new Parameters ( map ) : new Parameters ( ) ;
|
public class OutRawH3Impl { /** * string */
@ Override public void writeString ( String value ) { } }
|
if ( value == null ) { writeNull ( ) ; return ; } int strlen = value . length ( ) ; writeLong ( ConstH3 . STRING , ConstH3 . STRING_BITS , strlen ) ; writeStringData ( value , 0 , strlen ) ;
|
public class CPAttachmentFileEntryPersistenceImpl { /** * Caches the cp attachment file entry in the entity cache if it is enabled .
* @ param cpAttachmentFileEntry the cp attachment file entry */
@ Override public void cacheResult ( CPAttachmentFileEntry cpAttachmentFileEntry ) { } }
|
entityCache . putResult ( CPAttachmentFileEntryModelImpl . ENTITY_CACHE_ENABLED , CPAttachmentFileEntryImpl . class , cpAttachmentFileEntry . getPrimaryKey ( ) , cpAttachmentFileEntry ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_UUID_G , new Object [ ] { cpAttachmentFileEntry . getUuid ( ) , cpAttachmentFileEntry . getGroupId ( ) } , cpAttachmentFileEntry ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_C_C_F , new Object [ ] { cpAttachmentFileEntry . getClassNameId ( ) , cpAttachmentFileEntry . getClassPK ( ) , cpAttachmentFileEntry . getFileEntryId ( ) } , cpAttachmentFileEntry ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_C_ERC , new Object [ ] { cpAttachmentFileEntry . getCompanyId ( ) , cpAttachmentFileEntry . getExternalReferenceCode ( ) } , cpAttachmentFileEntry ) ; cpAttachmentFileEntry . resetOriginalValues ( ) ;
|
public class QueryCompileErrorMarshaller { /** * Marshall the given parameter object . */
public void marshall ( QueryCompileError queryCompileError , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( queryCompileError == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( queryCompileError . getLocation ( ) , LOCATION_BINDING ) ; protocolMarshaller . marshall ( queryCompileError . getMessage ( ) , MESSAGE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class VoiceApi { /** * Answer a call
* Answer the specified call .
* @ param id The connection ID of the call . ( required )
* @ param answerData 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 answer ( String id , AnswerData answerData ) throws ApiException { } }
|
ApiResponse < ApiSuccessResponse > resp = answerWithHttpInfo ( id , answerData ) ; return resp . getData ( ) ;
|
public class Util { /** * Extracts the names of the attributes from the executable elements that represents them in the given map and
* returns a map keyed by those names .
* I . e . while representing annotation attributes on an annotation type by executable elements is technically
* correct
* it is more convenient to address them simply by their names , which , in case of annotation types , are unique
* ( i . e . you cannot overload an annotation attribute , because they cannot have method parameters ) .
* @ param attributes the attributes as obtained by
* { @ link javax . lang . model . element . AnnotationMirror # getElementValues ( ) }
* @ return the equivalent of the supplied map keyed by attribute names instead of the full - blown executable elements */
@ Nonnull public static Map < String , Map . Entry < ? extends ExecutableElement , ? extends AnnotationValue > > keyAnnotationAttributesByName ( @ Nonnull Map < ? extends ExecutableElement , ? extends AnnotationValue > attributes ) { } }
|
Map < String , Map . Entry < ? extends ExecutableElement , ? extends AnnotationValue > > result = new LinkedHashMap < > ( ) ; for ( Map . Entry < ? extends ExecutableElement , ? extends AnnotationValue > e : attributes . entrySet ( ) ) { result . put ( e . getKey ( ) . getSimpleName ( ) . toString ( ) , e ) ; } return result ;
|
public class DocumentCharacterIterator { /** * Increments the iterator ' s index by one and returns the character at the
* new index .
* @ return the character at the new position , or DONE if the new position is
* off the end */
@ Override public char next ( ) { } }
|
++ docPos ; if ( docPos < segmentEnd || segmentEnd >= doc . getLength ( ) ) { return text . next ( ) ; } try { doc . getText ( segmentEnd , doc . getLength ( ) - segmentEnd , text ) ; } catch ( BadLocationException e ) { throw new RuntimeException ( e ) ; } segmentEnd += text . count ; return text . current ( ) ;
|
public class AnnotatedFilterRouteBuilder { /** * Executed after the bean creation . */
@ PostConstruct public void process ( ) { } }
|
Collection < BeanDefinition < ? > > filterDefinitions = beanContext . getBeanDefinitions ( Qualifiers . byStereotype ( Filter . class ) ) ; for ( BeanDefinition < ? > beanDefinition : filterDefinitions ) { if ( HttpClientFilter . class . isAssignableFrom ( beanDefinition . getBeanType ( ) ) ) { // ignore http client filters
continue ; } String [ ] patterns = beanDefinition . getValue ( Filter . class , String [ ] . class ) . orElse ( null ) ; if ( ArrayUtils . isNotEmpty ( patterns ) ) { HttpMethod [ ] methods = beanDefinition . getValue ( Filter . class , "methods" , HttpMethod [ ] . class ) . orElse ( null ) ; String first = patterns [ 0 ] ; FilterRoute filterRoute = addFilter ( first , ( ) -> beanContext . getBean ( ( Class < HttpFilter > ) beanDefinition . getBeanType ( ) ) ) ; if ( patterns . length > 1 ) { for ( int i = 1 ; i < patterns . length ; i ++ ) { String pattern = patterns [ i ] ; filterRoute . pattern ( pattern ) ; } } if ( ArrayUtils . isNotEmpty ( methods ) ) { filterRoute . methods ( methods ) ; } } }
|
public class BigtableVeneerSettingsFactory { /** * Creates { @ link TransportChannelProvider } based on Channel Negotiation type . */
private static TransportChannelProvider buildChannelProvider ( String endpoint , BigtableOptions options ) { } }
|
return defaultGrpcTransportProviderBuilder ( ) . setEndpoint ( endpoint ) . setPoolSize ( options . getChannelCount ( ) ) . setChannelConfigurator ( new ApiFunction < ManagedChannelBuilder , ManagedChannelBuilder > ( ) { @ Override public ManagedChannelBuilder apply ( ManagedChannelBuilder channelBuilder ) { return channelBuilder . usePlaintext ( ) ; } } ) . build ( ) ;
|
public class AtomTypeModel { /** * Access to the number of lone - pairs ( specified as a property of the
* atom ) .
* @ param atom the atom to get the lone pairs from
* @ return number of lone pairs */
private static int lonePairCount ( IAtom atom ) { } }
|
// XXX : LONE _ PAIR _ COUNT is not currently set !
Integer count = atom . getProperty ( CDKConstants . LONE_PAIR_COUNT ) ; return count != null ? count : - 1 ;
|
public class ModelsImpl { /** * Gets the utterances for the given model in the given app version .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param modelId The ID ( GUID ) of the model .
* @ param examplesMethodOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the List & lt ; LabelTextObject & gt ; object */
public Observable < ServiceResponse < List < LabelTextObject > > > examplesMethodWithServiceResponseAsync ( UUID appId , String versionId , String modelId , ExamplesMethodOptionalParameter examplesMethodOptionalParameter ) { } }
|
if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } if ( appId == null ) { throw new IllegalArgumentException ( "Parameter appId is required and cannot be null." ) ; } if ( versionId == null ) { throw new IllegalArgumentException ( "Parameter versionId is required and cannot be null." ) ; } if ( modelId == null ) { throw new IllegalArgumentException ( "Parameter modelId is required and cannot be null." ) ; } final Integer skip = examplesMethodOptionalParameter != null ? examplesMethodOptionalParameter . skip ( ) : null ; final Integer take = examplesMethodOptionalParameter != null ? examplesMethodOptionalParameter . take ( ) : null ; return examplesMethodWithServiceResponseAsync ( appId , versionId , modelId , skip , take ) ;
|
public class Repository { /** * < p > newInstance . < / p >
* @ return a { @ link com . greenpepper . repository . DocumentRepository } object .
* @ throws java . lang . Exception if any . */
public DocumentRepository newInstance ( ) throws Exception { } }
|
Class < ? > klass = Class . forName ( type ) ; if ( ! DocumentRepository . class . isAssignableFrom ( klass ) ) throw new IllegalArgumentException ( "Not a " + DocumentRepository . class . getName ( ) + ": " + type ) ; Constructor < ? > constructor = klass . getConstructor ( String [ ] . class ) ; return ( DocumentRepository ) constructor . newInstance ( new Object [ ] { StringUtils . split ( root , ';' ) } ) ;
|
public class OxygenRelaxNGSchemaReader { /** * Create a schema from an input source and a property map . */
public Schema createSchema ( SAXSource source , PropertyMap properties ) throws IOException , SAXException , IncorrectSchemaException { } }
|
SchemaPatternBuilder spb = new SchemaPatternBuilder ( ) ; SAXResolver resolver = ResolverFactory . createResolver ( properties ) ; ErrorHandler eh = properties . get ( ValidateProperty . ERROR_HANDLER ) ; DatatypeLibraryFactory dlf = properties . get ( RngProperty . DATATYPE_LIBRARY_FACTORY ) ; if ( dlf == null ) { // Create a new Data Type Library Loader
dlf = new DatatypeLibraryLoader ( ) ; } try { Pattern start = SchemaBuilderImpl . parse ( createParseable ( source , resolver , eh , properties ) , eh , dlf , spb , properties . contains ( WrapProperty . ATTRIBUTE_OWNER ) ) ; // Wrap the pattern
return wrapPattern2 ( start , spb , properties ) ; } catch ( IllegalSchemaException e ) { throw new IncorrectSchemaException ( ) ; }
|
public class GeographyPointValue { /** * Deserializes a point from a ByteBuffer , at an absolute offset .
* @ param inBuffer The ByteBuffer from which to read the bytes for a point .
* @ param offset Absolute offset of point data in buffer .
* @ return A new instance of GeographyPointValue . */
public static GeographyPointValue unflattenFromBuffer ( ByteBuffer inBuffer , int offset ) { } }
|
double lng = inBuffer . getDouble ( offset ) ; double lat = inBuffer . getDouble ( offset + BYTES_IN_A_COORD ) ; if ( lat == 360.0 && lng == 360.0 ) { // This is a null point .
return null ; } return new GeographyPointValue ( lng , lat ) ;
|
public class TraitASTTransformation { /** * Copies annotation from the trait to the helper , excluding the trait annotation itself
* @ param cNode the trait class node
* @ param helper the helper class node */
private static void copyClassAnnotations ( final ClassNode cNode , final ClassNode helper ) { } }
|
List < AnnotationNode > annotations = cNode . getAnnotations ( ) ; for ( AnnotationNode annotation : annotations ) { if ( ! annotation . getClassNode ( ) . equals ( Traits . TRAIT_CLASSNODE ) ) { helper . addAnnotation ( annotation ) ; } }
|
public class CapacityManager { /** * Attempts to acquire a given amount of capacity .
* If acquired , capacity will be consumed from the available pool .
* @ param capacity capacity to acquire
* @ return true if capacity can be acquired , false if not
* @ throws IllegalArgumentException if given capacity is negative */
public boolean acquire ( int capacity ) { } }
|
if ( capacity < 0 ) { throw new IllegalArgumentException ( "capacity to acquire cannot be negative" ) ; } if ( availableCapacity < 0 ) { return true ; } synchronized ( lock ) { if ( availableCapacity - capacity >= 0 ) { availableCapacity -= capacity ; return true ; } else { return false ; } }
|
public class System { /** * ASSET _ DESIGN role can PUT in - memory config for running tests . */
public List < String > getRoles ( String path ) { } }
|
List < String > roles = super . getRoles ( path ) ; roles . add ( Role . ASSET_DESIGN ) ; return roles ;
|
public class LdapXPathTranslateHelper { /** * ( non - Javadoc )
* @ see com . ibm . ws . wim . xpath . util . XPathTranslateHelper # genSearchString ( java . lang . StringBuffer , com . ibm . ws . wim . xpath . mapping . datatype . ParenthesisNode ) */
private void genSearchString ( StringBuffer searchExpBuffer , ParenthesisNode parenNode ) throws WIMException { } }
|
XPathNode child = ( XPathNode ) parenNode . getChild ( ) ; genStringChild ( searchExpBuffer , child ) ;
|
public class ModelCacheManager { /** * 将数据ID , Model类类型组合成Key的对应Model从缓存中取出
* @ param dataKey
* @ param modelClassName
* @ return */
public void removeCache2 ( Object dataKey , String modelClassName ) { } }
|
CacheKey cachKey = cacheKeyFactory . createCacheKey ( dataKey . toString ( ) , modelClassName ) ; cacheManager . removeObect ( cachKey ) ;
|
public class Field { /** * Visualize the field using the given operation and entity
* @ param ctx the context
* @ param operation The operation
* @ param entity The entity
* @ return The string visualization
* @ throws PMException */
public Object visualize ( PMContext ctx , Operation operation , Entity entity ) throws PMException { } }
|
debug ( "Converting [" + operation . getId ( ) + "]" + entity . getId ( ) + "." + getId ( ) ) ; try { Converter c = null ; if ( getConverters ( ) != null ) { c = getConverter ( operation . getId ( ) ) ; } if ( c == null ) { c = getDefaultConverter ( ) ; } final Object instance = ctx . getEntityInstance ( ) ; ctx . setField ( this ) ; // We only set the field value if instance is not null .
// Some operations may use this value without an instance .
if ( instance != null ) { ctx . setEntityInstanceWrapper ( ctx . buildInstanceWrapper ( instance ) ) ; ctx . setFieldValue ( getPm ( ) . get ( instance , getProperty ( ) ) ) ; } return c . visualize ( ctx ) ; } catch ( ConverterException e ) { throw e ; } catch ( Exception e ) { getPm ( ) . error ( e ) ; throw new ConverterException ( "Unable to convert " + entity . getId ( ) + "." + getProperty ( ) ) ; }
|
public class NielsenConfigurationMarshaller { /** * Marshall the given parameter object . */
public void marshall ( NielsenConfiguration nielsenConfiguration , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( nielsenConfiguration == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( nielsenConfiguration . getBreakoutCode ( ) , BREAKOUTCODE_BINDING ) ; protocolMarshaller . marshall ( nielsenConfiguration . getDistributorId ( ) , DISTRIBUTORID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class CallServiceManager { /** * Build and send response messages after call request
* @ param message
* @ param client
* @ return */
@ Override public boolean sendMessageToClient ( MessageFromClient message , Session client ) { } }
|
MessageToClient mtc = messageToClientService . createMessageToClient ( message , client ) ; if ( mtc != null ) { client . getAsyncRemote ( ) . sendObject ( mtc ) ; return true ; } return false ;
|
public class Path { /** * Normalizes a path string .
* @ param path
* the path string to normalize
* @ return the normalized path string */
private String normalizePath ( String path ) { } }
|
// remove double slashes & backslashes
path = path . replace ( "//" , "/" ) ; path = path . replace ( "\\" , "/" ) ; return path ;
|
public class SequenceEntryUtils { /** * Delete duplicated qualfiier .
* @ param feature
* the feature
* @ param qualifierName
* the qualifier name */
public static boolean deleteDuplicatedQualfiier ( Feature feature , String qualifierName ) { } }
|
ArrayList < Qualifier > qualifiers = ( ArrayList < Qualifier > ) feature . getQualifiers ( qualifierName ) ; Set < String > qualifierValueSet = new HashSet < String > ( ) ; for ( Qualifier qual : qualifiers ) { if ( qual . getValue ( ) != null ) { if ( ! qualifierValueSet . add ( qual . getValue ( ) ) ) { feature . removeQualifier ( qual ) ; return true ; } } } return false ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.