signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class JSONHelpers { /** * Returns the value mapped by enum if it exists and is a { @ link JSONObject } . If the value does
* not exist by that enum , and { @ code emptyForNull } is { @ code true } , returns
* { @ link # EMPTY _ OBJECT } . Otherwise , returns { @ code null } .
* @ param json { @ link JSONObject } to get data from
* @ param e { @ link Enum } labeling the data to get
* @ param emptyForNull { @ code True } to return { @ code EMPTY _ OBJECT } if there is no mapped data ,
* { @ code false } to return { @ code null } in that case
* @ return A { @ code JSONObject } if the mapping exists ; { @ code EMPTY _ OBJECT } if it doesn ' t and
* { @ code emptyForNull } is { @ code true } ; { @ code null } otherwise */
public static < P extends Enum < P > > JSONObject optJSONObject ( final JSONObject json , P e , boolean emptyForNull ) { } } | JSONObject jsonObject = optJSONObject ( json , e ) ; if ( jsonObject == null && emptyForNull ) { jsonObject = EMPTY_OBJECT ; } return jsonObject ; |
public class OcniExtractor { /** * Finds the signatures of methods defined in the native code . */
private static void findMethodSignatures ( String code , Set < String > signatures ) { } } | if ( code == null ) { return ; } Matcher matcher = OBJC_METHOD_DECL_PATTERN . matcher ( code ) ; while ( matcher . find ( ) ) { StringBuilder signature = new StringBuilder ( ) ; signature . append ( matcher . group ( 1 ) ) ; if ( matcher . group ( 2 ) != null ) { signature . append ( ':' ) ; String additionalParams = matcher . group ( 3 ) ; if ( additionalParams != null ) { Matcher paramsMatcher = ADDITIONAL_PARAM_PATTERN . matcher ( additionalParams ) ; while ( paramsMatcher . find ( ) ) { signature . append ( paramsMatcher . group ( 1 ) ) . append ( ':' ) ; } } } signatures . add ( signature . toString ( ) ) ; } |
public class UsersEntity { /** * Create a User .
* A token with scope create : users is needed .
* See https : / / auth0 . com / docs / api / management / v2 # ! / Users / post _ users
* @ param user the user data to set
* @ return a Request to execute . */
public Request < User > create ( User user ) { } } | Asserts . assertNotNull ( user , "user" ) ; String url = baseUrl . newBuilder ( ) . addPathSegments ( "api/v2/users" ) . build ( ) . toString ( ) ; CustomRequest < User > request = new CustomRequest < > ( this . client , url , "POST" , new TypeReference < User > ( ) { } ) ; request . addHeader ( "Authorization" , "Bearer " + apiToken ) ; request . setBody ( user ) ; return request ; |
public class StyleUtil { /** * 创建默认普通单元格样式
* < pre >
* 1 . 文字上下左右居中
* 2 . 细边框 , 黑色
* < / pre >
* @ param workbook { @ link Workbook } 工作簿
* @ return { @ link CellStyle } */
public static CellStyle createDefaultCellStyle ( Workbook workbook ) { } } | final CellStyle cellStyle = workbook . createCellStyle ( ) ; setAlign ( cellStyle , HorizontalAlignment . CENTER , VerticalAlignment . CENTER ) ; setBorder ( cellStyle , BorderStyle . THIN , IndexedColors . BLACK ) ; return cellStyle ; |
public class ANRWatchDog { /** * Sets an interface for when the watchdog thread is interrupted .
* If not set , the default behavior is to just log the interruption message .
* @ param listener The new listener or null .
* @ return itself for chaining . */
public ANRWatchDog setInterruptionListener ( InterruptionListener listener ) { } } | if ( listener == null ) { _interruptionListener = DEFAULT_INTERRUPTION_LISTENER ; } else { _interruptionListener = listener ; } return this ; |
public class MapModel { /** * Add feature selection handler .
* @ param handler
* The handler to be registered .
* @ return handler registration
* @ since 1.6.0 */
@ Api public final HandlerRegistration addFeatureSelectionHandler ( final FeatureSelectionHandler handler ) { } } | return handlerManager . addHandler ( FeatureSelectionHandler . TYPE , handler ) ; |
public class TeaToolsUtils { /** * Returns the full class name of the specified class . This method
* provides special formatting for inner classes . */
public String getFullClassName ( String fullClassName ) { } } | String [ ] parts = parseClassName ( fullClassName ) ; String className = getInnerClassName ( parts [ 1 ] ) ; if ( parts [ 0 ] != null ) { // Return the package name plus the converted class name
return parts [ 0 ] + '.' + className ; } else { return className ; } |
public class CmsSitemapTreeNodeData { /** * Initializes the bean . < p >
* @ param cms the CMS context to use
* @ throws CmsException if something goes wrong */
public void initialize ( CmsObject cms ) throws CmsException { } } | CmsUUID id = m_entry . getId ( ) ; CmsResource resource = cms . readResource ( id , CmsResourceFilter . IGNORE_EXPIRATION ) ; m_resource = resource ; CmsResource defaultFile = resource ; if ( resource . isFolder ( ) ) { defaultFile = cms . readDefaultFile ( resource , CmsResourceFilter . IGNORE_EXPIRATION ) ; } CmsLocaleGroup localeGroup = cms . getLocaleGroupService ( ) . readLocaleGroup ( defaultFile ) ; CmsResource primary = localeGroup . getPrimaryResource ( ) ; CmsProperty noTranslationProp = cms . readPropertyObject ( primary , CmsPropertyDefinition . PROPERTY_LOCALE_NOTRANSLATION , false ) ; m_noTranslation = noTranslationProp . getValue ( ) ; CmsUUID defaultFileId = ( defaultFile != null ) ? defaultFile . getStructureId ( ) : null ; m_isCopyable = ( defaultFile != null ) && CmsResourceTypeXmlContainerPage . isContainerPage ( defaultFile ) ; Collection < CmsResource > resourcesForTargetLocale = localeGroup . getResourcesForLocale ( m_otherLocale ) ; if ( ! resourcesForTargetLocale . isEmpty ( ) ) { m_linkedResource = resourcesForTargetLocale . iterator ( ) . next ( ) ; if ( primary . getStructureId ( ) . equals ( m_resource . getStructureId ( ) ) || primary . getStructureId ( ) . equals ( defaultFileId ) || primary . getStructureId ( ) . equals ( m_linkedResource . getStructureId ( ) ) ) { m_isDirectLink = true ; } } |
public class ClassDescriptorDef { /** * Returns the index descriptor definition of the given name if it exists .
* @ param name The name of the index
* @ return The index descriptor definition or < code > null < / code > if there is no such index */
public IndexDescriptorDef getIndexDescriptor ( String name ) { } } | IndexDescriptorDef indexDef = null ; for ( Iterator it = _indexDescriptors . iterator ( ) ; it . hasNext ( ) ; ) { indexDef = ( IndexDescriptorDef ) it . next ( ) ; if ( indexDef . getName ( ) . equals ( name ) ) { return indexDef ; } } return null ; |
public class ClustersInner { /** * Gets information about Clusters associated with the given Workspace .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param workspaceName The name of the workspace . Workspace names can only contain a combination of alphanumeric characters along with dash ( - ) and underscore ( _ ) . The name must be from 1 through 64 characters long .
* @ param clustersListByWorkspaceOptions Additional parameters for the operation
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; ClusterInner & gt ; object */
public Observable < Page < ClusterInner > > listByWorkspaceAsync ( final String resourceGroupName , final String workspaceName , final ClustersListByWorkspaceOptions clustersListByWorkspaceOptions ) { } } | return listByWorkspaceWithServiceResponseAsync ( resourceGroupName , workspaceName , clustersListByWorkspaceOptions ) . map ( new Func1 < ServiceResponse < Page < ClusterInner > > , Page < ClusterInner > > ( ) { @ Override public Page < ClusterInner > call ( ServiceResponse < Page < ClusterInner > > response ) { return response . body ( ) ; } } ) ; |
public class SortedArrayStringMap { /** * Reconstitute the { @ code SortedArrayStringMap } instance from a stream ( i . e . ,
* deserialize it ) . */
private void readObject ( final java . io . ObjectInputStream s ) throws IOException , ClassNotFoundException { } } | // Read in the threshold ( ignored ) , and any hidden stuff
s . defaultReadObject ( ) ; // set other fields that need values
keys = EMPTY ; values = EMPTY ; // Read in number of buckets
final int capacity = s . readInt ( ) ; if ( capacity < 0 ) { throw new InvalidObjectException ( "Illegal capacity: " + capacity ) ; } // Read number of mappings
final int mappings = s . readInt ( ) ; if ( mappings < 0 ) { throw new InvalidObjectException ( "Illegal mappings count: " + mappings ) ; } // allocate the bucket array ;
if ( mappings > 0 ) { inflateTable ( capacity ) ; } else { threshold = capacity ; } // Read the keys and values , and put the mappings in the arrays
for ( int i = 0 ; i < mappings ; i ++ ) { keys [ i ] = ( String ) s . readObject ( ) ; try { final byte [ ] marshalledObject = ( byte [ ] ) s . readObject ( ) ; values [ i ] = marshalledObject == null ? null : unmarshall ( marshalledObject ) ; } catch ( final Exception | LinkageError error ) { handleSerializationException ( error , i , keys [ i ] ) ; values [ i ] = null ; } } size = mappings ; |
public class AeronNDArrayPublisher { /** * Publish an ndarray
* to an aeron channel
* @ param message
* @ throws Exception */
public void publish ( NDArrayMessage message ) throws Exception { } } | if ( ! init ) init ( ) ; // Create a context , needed for client connection to media driver
// A separate media driver process needs to be running prior to starting this application
// Create an Aeron instance with client - provided context configuration and connect to the
// media driver , and create a Publication . The Aeron and Publication classes implement
// AutoCloseable , and will automatically clean up resources when this try block is finished .
boolean connected = false ; if ( aeron == null ) { try { while ( ! connected ) { aeron = Aeron . connect ( ctx ) ; connected = true ; } } catch ( Exception e ) { log . warn ( "Reconnecting on publisher...failed to connect" ) ; } } int connectionTries = 0 ; while ( publication == null && connectionTries < NUM_RETRIES ) { try { publication = aeron . addPublication ( channel , streamId ) ; log . info ( "Created publication on channel " + channel + " and stream " + streamId ) ; } catch ( DriverTimeoutException e ) { Thread . sleep ( 1000 * ( connectionTries + 1 ) ) ; log . warn ( "Failed to connect due to driver time out on channel " + channel + " and stream " + streamId + "...retrying in " + connectionTries + " seconds" ) ; connectionTries ++ ; } } if ( ! connected && connectionTries >= 3 || publication == null ) { throw new IllegalStateException ( "Publisher unable to connect to channel " + channel + " and stream " + streamId ) ; } // Allocate enough buffer size to hold maximum message length
// The UnsafeBuffer class is part of the Agrona library and is used for efficient buffer management
log . info ( "Publishing to " + channel + " on stream Id " + streamId ) ; // ensure default values are set
INDArray arr = message . getArr ( ) ; if ( isCompress ( ) ) while ( ! message . getArr ( ) . isCompressed ( ) ) Nd4j . getCompressor ( ) . compressi ( arr , "GZIP" ) ; // array is large , need to segment
if ( NDArrayMessage . byteBufferSizeForMessage ( message ) >= publication . maxMessageLength ( ) ) { NDArrayMessageChunk [ ] chunks = NDArrayMessage . chunks ( message , publication . maxMessageLength ( ) / 128 ) ; for ( int i = 0 ; i < chunks . length ; i ++ ) { ByteBuffer sendBuff = NDArrayMessageChunk . toBuffer ( chunks [ i ] ) ; sendBuff . rewind ( ) ; DirectBuffer buffer = new UnsafeBuffer ( sendBuff ) ; sendBuffer ( buffer ) ; } } else { // send whole array
DirectBuffer buffer = NDArrayMessage . toBuffer ( message ) ; sendBuffer ( buffer ) ; } |
public class TimeStatisticImpl { /** * Can just invoke super ( ) , but for casting purposes , reimplement .
* @ see com . ibm . websphere . pmi . stat . WSStatistic # rateOfChange ( com . ibm . websphere . pmi . stat . WSStatistic ) */
public WSStatistic rateOfChange ( WSStatistic otherStat ) { } } | if ( ! validate ( otherStat ) ) { return null ; } TimeStatisticImpl other = ( TimeStatisticImpl ) otherStat ; TimeStatisticImpl newData = new TimeStatisticImpl ( id ) ; long timeDiff = lastSampleTime - other . lastSampleTime ; if ( timeDiff == 0 ) { return null ; } // rate of change
newData . count = ( count - other . getCount ( ) ) / timeDiff ; newData . sumOfSquares = ( sumOfSquares - other . sumOfSquares ) / timeDiff ; newData . total = ( total - other . getTotal ( ) ) / timeDiff ; newData . startTime = startTime ; newData . lastSampleTime = lastSampleTime ; newData . max = max ; newData . min = min ; return newData ; |
public class NewSarlProjectWizard { /** * Create the default Maven pom file for the project .
* < p > Even if the project has not the Maven nature when it is created with this wizard ,
* the pom file is created in order to let the developer to switch to the Maven nature easily .
* @ param project the new project .
* @ param compilerCompliance the Java version that is supported by the project . */
protected void createDefaultMavenPom ( IJavaProject project , String compilerCompliance ) { } } | // Get the template resource .
final URL templateUrl = getPomTemplateLocation ( ) ; if ( templateUrl != null ) { final String compliance = Strings . isNullOrEmpty ( compilerCompliance ) ? SARLVersion . MINIMAL_JDK_VERSION : compilerCompliance ; final String groupId = getDefaultMavenGroupId ( ) ; // Read the template and do string replacement .
final StringBuilder content = new StringBuilder ( ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( templateUrl . openStream ( ) ) ) ) { String line = reader . readLine ( ) ; while ( line != null ) { line = line . replaceAll ( Pattern . quote ( "@GROUP_ID@" ) , groupId ) ; // $ NON - NLS - 1 $
line = line . replaceAll ( Pattern . quote ( "@PROJECT_NAME@" ) , project . getElementName ( ) ) ; // $ NON - NLS - 1 $
line = line . replaceAll ( Pattern . quote ( "@PROJECT_VERSION@" ) , DEFAULT_MAVEN_PROJECT_VERSION ) ; // $ NON - NLS - 1 $
line = line . replaceAll ( Pattern . quote ( "@SARL_VERSION@" ) , SARLVersion . SARL_RELEASE_VERSION_MAVEN ) ; // $ NON - NLS - 1 $
line = line . replaceAll ( Pattern . quote ( "@JAVA_VERSION@" ) , compliance ) ; // $ NON - NLS - 1 $
line = line . replaceAll ( Pattern . quote ( "@FILE_ENCODING@" ) , Charset . defaultCharset ( ) . displayName ( ) ) ; // $ NON - NLS - 1 $
content . append ( line ) . append ( "\n" ) ; // $ NON - NLS - 1 $
line = reader . readLine ( ) ; } } catch ( IOException exception ) { throw new RuntimeIOException ( exception ) ; } // Write the pom
final IFile pomFile = project . getProject ( ) . getFile ( "pom.xml" ) ; // $ NON - NLS - 1 $
try ( StringInputStream is = new StringInputStream ( content . toString ( ) ) ) { pomFile . create ( is , true , new NullProgressMonitor ( ) ) ; } catch ( CoreException exception ) { throw new RuntimeException ( exception ) ; } catch ( IOException exception ) { throw new RuntimeIOException ( exception ) ; } } |
public class RqOnce { /** * Wrap the request .
* @ param req Request
* @ return New request */
private static Request wrap ( final Request req ) { } } | final AtomicBoolean seen = new AtomicBoolean ( false ) ; return new Request ( ) { @ Override public Iterable < String > head ( ) throws IOException { return req . head ( ) ; } @ Override public InputStream body ( ) throws IOException { if ( ! seen . getAndSet ( true ) ) { throw new IllegalStateException ( "It's not allowed to call body() more than once" ) ; } return req . body ( ) ; } } ; |
public class AddressArrayFactory { /** * Creates a dynamic { @ link AddressArray } which grows its capacity as needed .
* @ param homeDir - the home directory where the < code > indexes . dat < / code > is located .
* @ param initialLength - the initial length of the created { @ link AddressArray } .
* @ param batchSize - the number of updates per update batch .
* @ param numSyncBatches - the number of update batches required for updating the underlying indexes .
* @ return an instance of { @ link AddressArray } .
* @ throws Exception if an instance of { @ link AddressArray } cannot be created . */
public AddressArray createDynamicAddressArray ( File homeDir , int initialLength , int batchSize , int numSyncBatches ) throws Exception { } } | AddressArray addrArray ; if ( _indexesCached ) { addrArray = new DynamicLongArray ( batchSize , numSyncBatches , homeDir ) ; } else { addrArray = new IOTypeLongArray ( Array . Type . DYNAMIC , initialLength , batchSize , numSyncBatches , homeDir ) ; } if ( addrArray . length ( ) < initialLength ) { addrArray . expandCapacity ( initialLength - 1 ) ; } return addrArray ; |
public class Base64Util { /** * Base64 encoding methods of Authentication
* Taken from http : / / iharder . sourceforge . net / current / java / base64 / ( public domain )
* and adapted for our needs here . */
public static byte [ ] decode ( String s ) { } } | if ( s == null ) { throw new IllegalArgumentException ( "Input string was null." ) ; } byte [ ] inBytes ; try { inBytes = s . getBytes ( "US-ASCII" ) ; } catch ( java . io . UnsupportedEncodingException uee ) { inBytes = s . getBytes ( ) ; } if ( inBytes . length == 0 ) { return new byte [ 0 ] ; } else if ( inBytes . length < 4 ) { throw new IllegalArgumentException ( "Base64-encoded string must have at least four characters, but length specified was " + inBytes . length ) ; } // end if
return decodeBytes ( inBytes ) ; |
public class SpannableStringBuilder { /** * Return the flags of the end of the specified
* markup object , or 0 if it is not attached to this buffer . */
public int getSpanFlags ( Object what ) { } } | int count = mSpanCount ; Object [ ] spans = mSpans ; for ( int i = count - 1 ; i >= 0 ; i -- ) { if ( spans [ i ] == what ) { return mSpanFlags [ i ] ; } } return 0 ; |
import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; public class Main { public static List < Double > normalize ( List < Double > numberList ) { /** * Transforms a list of numbers such that the smallest becomes 0 and the largest becomes 1.
* Given a list of at least two elements , this function applies a linear transformation ,
* assigning 0 to the smallest element and 1 to the largest element .
* @ param numberList The list of at least two numbers to be rescaled .
* @ return A list with the rescaled numbers .
* Example :
* > > > normalize ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 ] )
* [ 0.0 , 0.25 , 0.5 , 0.75 , 1.0] */
double min = Collections . min ( numberList ) ; double max = Collections . max ( numberList ) ; double scale = max - min ; List < Double > result = new ArrayList < > ( ) ; for ( Double num : numberList ) { } return result ; } public static void main ( String [ ] args ) { // TODO code application logic here
} } | result . add ( ( num - min ) / scale ) ; |
public class Music { /** * Fade this music to the volume specified
* @ param duration Fade time in milliseconds .
* @ param endVolume The target volume
* @ param stopAfterFade True if music should be stopped after fading in / out */
public void fade ( int duration , float endVolume , boolean stopAfterFade ) { } } | this . stopAfterFade = stopAfterFade ; fadeStartGain = volume ; fadeEndGain = endVolume ; fadeDuration = duration ; fadeTime = duration ; |
public class CheckNonNumericListener { /** * Field must be non - numeric . */
public int fieldChanged ( boolean bDisplayOption , int iMoveMode ) { } } | String string = this . getOwner ( ) . toString ( ) ; if ( Utility . isNumeric ( string ) ) { Task task = null ; if ( this . getOwner ( ) != null ) if ( this . getOwner ( ) . getRecord ( ) != null ) if ( this . getOwner ( ) . getRecord ( ) . getRecordOwner ( ) != null ) task = this . getOwner ( ) . getRecord ( ) . getRecordOwner ( ) . getTask ( ) ; if ( task == null ) task = BaseApplet . getSharedInstance ( ) ; return task . setLastError ( "Must be non-numeric" ) ; } return super . fieldChanged ( bDisplayOption , iMoveMode ) ; |
public class JsonObject { /** * Retrieves the value from the field name and casts it to { @ link Integer } .
* Note that if value was stored as another numerical type , some truncation or rounding may occur .
* @ param name the name of the field .
* @ return the result or null if it does not exist . */
public Integer getInt ( String name ) { } } | // let it fail in the more general case where it isn ' t actually a number
Number number = ( Number ) content . get ( name ) ; if ( number == null ) { return null ; } else if ( number instanceof Integer ) { return ( Integer ) number ; } else { return number . intValue ( ) ; // autoboxing to Integer
} |
public class CommitLogSegment { /** * Recycle processes an unneeded segment file for reuse .
* @ return a new CommitLogSegment representing the newly reusable segment . */
CommitLogSegment recycle ( ) { } } | try { sync ( ) ; } catch ( FSWriteError e ) { logger . error ( "I/O error flushing {} {}" , this , e . getMessage ( ) ) ; throw e ; } close ( ) ; return new CommitLogSegment ( getPath ( ) ) ; |
public class BaseDataJsonFieldBo { /** * Get a " data " ' s sub - attribute using d - path .
* @ param dPath
* @ param clazz
* @ return */
public < T > Optional < T > getDataAttrOptional ( String dPath , Class < T > clazz ) { } } | return Optional . ofNullable ( getDataAttr ( dPath , clazz ) ) ; |
public class Types { /** * Returns the internal name of { @ code clazz } ( also known as the descriptor ) . */
@ ObjectiveCName ( "getSignature:" ) public static String getSignature ( Class < ? > clazz ) { } } | String primitiveSignature = PRIMITIVE_TO_SIGNATURE . get ( clazz ) ; if ( primitiveSignature != null ) { return primitiveSignature ; } else if ( clazz . isArray ( ) ) { return "[" + getSignature ( clazz . getComponentType ( ) ) ; } else { // TODO : this separates packages with ' . ' rather than ' / '
return "L" + clazz . getName ( ) + ";" ; } |
public class PredecessorMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Predecessor predecessor , ProtocolMarshaller protocolMarshaller ) { } } | if ( predecessor == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( predecessor . getJobName ( ) , JOBNAME_BINDING ) ; protocolMarshaller . marshall ( predecessor . getRunId ( ) , RUNID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class FeedbackSummary { /** * Create a FeedbackSummaryCreator to execute create .
* @ param pathAccountSid The unique sid that identifies this account
* @ param startDate Only include feedback given on or after this date
* @ param endDate Only include feedback given on or before this date
* @ return FeedbackSummaryCreator capable of executing the create */
public static FeedbackSummaryCreator creator ( final String pathAccountSid , final LocalDate startDate , final LocalDate endDate ) { } } | return new FeedbackSummaryCreator ( pathAccountSid , startDate , endDate ) ; |
public class CmsJlanRepository { /** * Creates a CmsObjectWrapper for the current session . < p >
* @ param session the current session
* @ param connection the tree connection
* @ return the correctly configured CmsObjectWrapper for this session
* @ throws CmsException if something goes wrong */
public CmsObjectWrapper getCms ( SrvSession session , TreeConnection connection ) throws CmsException { } } | String userName = session . getClientInformation ( ) . getUserName ( ) ; userName = CmsJlanUsers . translateUser ( userName ) ; CmsContextInfo contextInfo = new CmsContextInfo ( m_cms . getRequestContext ( ) ) ; contextInfo . setUserName ( userName ) ; CmsObject newCms = OpenCms . initCmsObject ( m_cms , contextInfo ) ; newCms . getRequestContext ( ) . setSiteRoot ( getRoot ( ) ) ; newCms . getRequestContext ( ) . setCurrentProject ( getProject ( ) ) ; CmsObjectWrapper result = new CmsObjectWrapper ( newCms , getWrappers ( ) ) ; result . setAddByteOrderMark ( m_addByteOrderMark ) ; result . getRequestContext ( ) . setAttribute ( CmsXmlContent . AUTO_CORRECTION_ATTRIBUTE , Boolean . TRUE ) ; return result ; |
public class FontData { /** * Derive a new version of this font based on a new size
* @ param size The size of the new font
* @ param style The style of the new font
* @ return The new font data */
public FontData deriveFont ( float size , int style ) { } } | FontData original = getStyled ( getFamilyName ( ) , style ) ; FontData data = new FontData ( ) ; data . size = size ; data . javaFont = original . javaFont . deriveFont ( style , size ) ; data . upem = upem ; data . ansiKerning = ansiKerning ; data . charWidth = charWidth ; return data ; |
public class JSTypeRegistry { /** * Creates a function type .
* @ param returnType the function ' s return type
* @ param parameterTypes the parameters ' types */
public FunctionType createFunctionType ( JSType returnType , JSType ... parameterTypes ) { } } | return createFunctionType ( returnType , createParameters ( parameterTypes ) ) ; |
public class ParameterizedInstanceType { /** * Instance type itself can ; t be used to properly guess generics , but external logic , knowing actual context , could
* resolve generic types using deeper instance analysis . For example , it is possible in case of
* { @ link java . util . List } ( or any other container ) : contained object types must be checked .
* This method must be called if external logic could improve generic typings so all logic , already holding
* reference to this instance could immediately benefit from more accurate type .
* After improving accuracy , type assumed to be complete ( { @ link # isCompleteType ( ) } ) .
* @ param arguments more accurate types
* @ throws IllegalArgumentException if provided types are not correct ( count ) or contains less accurate types
* then already contained
* @ see # isMoreSpecificGenerics ( Type . . . ) to test arguments before */
public void improveAccuracy ( final Type ... arguments ) { } } | if ( ! isMoreSpecificGenerics ( arguments ) ) { throw new IllegalArgumentException ( String . format ( "Provided generics for type %s [%s] are less specific then current [%s]" , rawType . getSimpleName ( ) , TypeToStringUtils . toStringTypes ( arguments , EmptyGenericsMap . getInstance ( ) ) , TypeToStringUtils . toStringTypes ( actualArguments , EmptyGenericsMap . getInstance ( ) ) ) ) ; } this . actualArguments = arguments ; this . completeType = true ; |
public class CustomerSession { /** * Set the default source of the current customer object .
* @ param sourceId the ID of the source to be set
* @ param listener a { @ link CustomerRetrievalListener } to be notified about an update to the
* customer */
public void setCustomerDefaultSource ( @ NonNull String sourceId , @ NonNull @ Source . SourceType String sourceType , @ Nullable CustomerRetrievalListener listener ) { } } | final Map < String , Object > arguments = new HashMap < > ( ) ; arguments . put ( KEY_SOURCE , sourceId ) ; arguments . put ( KEY_SOURCE_TYPE , sourceType ) ; final String operationId = UUID . randomUUID ( ) . toString ( ) ; if ( listener != null ) { mCustomerRetrievalListeners . put ( operationId , listener ) ; } mEphemeralKeyManager . retrieveEphemeralKey ( operationId , ACTION_SET_DEFAULT_SOURCE , arguments ) ; |
public class AbstractComponent { /** * { @ inheritDoc } */
@ Override public final void sendWave ( final Wave wave ) { } } | // Define the from class if it didn ' t been done before ( manually )
if ( wave . fromClass ( ) == null ) { wave . fromClass ( this . getClass ( ) ) ; } sendWaveIntoJit ( wave ) ; |
public class ChannelZeroBuffer { /** * Sets the provided { @ code value } to current { @ code value } ,
* then sets { @ code put } as a new { @ link SettablePromise }
* and returns it .
* If { @ code take } isn ' t { @ code null } , the { @ code value }
* will be set to it .
* Current { @ code put } must be { @ code null } . If current
* { @ code exception } is not { @ code null } , provided
* { @ code value } will be recycled and a promise of the
* exception will be returned .
* @ param value a value passed to the buffer
* @ return { @ code put } if current { @ code take } is { @ code null } ,
* otherwise returns a successfully completed promise . If
* current { @ code exception } is not { @ code null } , a promise of
* the { @ code exception } will be returned . */
@ Override public Promise < Void > put ( @ Nullable T value ) { } } | assert put == null ; if ( exception == null ) { if ( take != null ) { SettablePromise < T > take = this . take ; this . take = null ; take . set ( value ) ; return Promise . complete ( ) ; } this . value = value ; this . put = new SettablePromise < > ( ) ; return put ; } else { tryRecycle ( value ) ; return Promise . ofException ( exception ) ; } |
public class Database { /** * Executes a block of code with given isolation . */
public void withVoidTransaction ( @ NotNull Isolation isolation , @ NotNull VoidTransactionCallback callback ) { } } | withVoidTransaction ( Propagation . REQUIRED , isolation , callback ) ; |
public class EntityCapsManager { /** * Get the Node version ( node # ver ) of a JID . Returns a String or null if
* EntiyCapsManager does not have any information .
* @ param jid
* the user ( Full JID )
* @ return the node version ( node # ver ) or null */
public static String getNodeVersionByJid ( Jid jid ) { } } | NodeVerHash nvh = JID_TO_NODEVER_CACHE . lookup ( jid ) ; if ( nvh != null ) { return nvh . nodeVer ; } else { return null ; } |
public class PermutationRotationIterator { /** * Remove permutations , if present . */
public void removePermutations ( List < Integer > removed ) { } } | int [ ] permutations = new int [ this . permutations . length ] ; int index = 0 ; permutations : for ( int j : this . permutations ) { for ( int i = 0 ; i < removed . size ( ) ; i ++ ) { if ( removed . get ( i ) == j ) { // skip this
removed . remove ( i ) ; continue permutations ; } } permutations [ index ] = j ; index ++ ; } int [ ] effectivePermutations = new int [ index ] ; System . arraycopy ( permutations , 0 , effectivePermutations , 0 , index ) ; this . rotations = new int [ permutations . length ] ; this . reset = new int [ permutations . length ] ; this . permutations = effectivePermutations ; Arrays . sort ( permutations ) ; // ascending order to make the permutation logic work |
public class JodaSampleActivity { /** * You can mix / match most flags for the desired output format */
private void sampleDateRange ( ) { } } | List < String > text = new ArrayList < String > ( ) ; DateTime start = DateTime . now ( ) ; DateTime end = start . plusMinutes ( 30 ) . plusHours ( 2 ) . plusDays ( 56 ) ; text . add ( "Range: " + DateUtils . formatDateRange ( this , start , end , 0 ) ) ; text . add ( "Range (with year): " + DateUtils . formatDateRange ( this , start , end , DateUtils . FORMAT_SHOW_YEAR ) ) ; text . add ( "Range (abbreviated): " + DateUtils . formatDateRange ( this , start , end , DateUtils . FORMAT_ABBREV_ALL ) ) ; text . add ( "Range (with time): " + DateUtils . formatDateRange ( this , start , end , DateUtils . FORMAT_SHOW_TIME ) ) ; addSample ( "DateUtils.formatDateRange()" , text ) ; |
public class ReadStreamOld { /** * Reads a 4 - byte network encoded integer */
public int readInt ( ) throws IOException { } } | if ( _readOffset + 4 < _readLength ) { return ( ( ( _readBuffer [ _readOffset ++ ] & 0xff ) << 24 ) + ( ( _readBuffer [ _readOffset ++ ] & 0xff ) << 16 ) + ( ( _readBuffer [ _readOffset ++ ] & 0xff ) << 8 ) + ( ( _readBuffer [ _readOffset ++ ] & 0xff ) ) ) ; } else { return ( ( read ( ) << 24 ) + ( read ( ) << 16 ) + ( read ( ) << 8 ) + ( read ( ) ) ) ; } |
public class ProxyMetaClass { /** * Call invokeConstructor on adaptee with logic like in MetaClass unless we have an Interceptor .
* With Interceptor the call is nested in its beforeInvoke and afterInvoke methods .
* The method call is suppressed if Interceptor . doInvoke ( ) returns false .
* See Interceptor for details . */
public Object invokeConstructor ( final Object [ ] arguments ) { } } | return doCall ( theClass , "ctor" , arguments , interceptor , new Callable ( ) { public Object call ( ) { return adaptee . invokeConstructor ( arguments ) ; } } ) ; |
public class ScenarioImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setInherits ( String newInherits ) { } } | String oldInherits = inherits ; inherits = newInherits ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , BpsimPackage . SCENARIO__INHERITS , oldInherits , inherits ) ) ; |
public class DoubleRadixAddressableHeap { /** * { @ inheritDoc } */
@ Override protected int compare ( Double o1 , Double o2 ) { } } | /* * Convert to IEEE and compare as unsigned */
long x = Double . doubleToLongBits ( o1 ) ^ Long . MIN_VALUE ; long y = Double . doubleToLongBits ( o2 ) ^ Long . MIN_VALUE ; // assert
if ( o1 . doubleValue ( ) < o2 . doubleValue ( ) ) { assert x < y ; } else if ( o1 . doubleValue ( ) == o2 . doubleValue ( ) ) { assert x == y ; } else { assert x > y ; } return ( x < y ) ? - 1 : ( ( x == y ) ? 0 : 1 ) ; |
public class AbstractJPAProviderIntegration { /** * Log version information about the specified persistence provider , if it can be determined .
* @ param providerName fully qualified class name of JPA persistence provider
* @ param loader class loader with access to the JPA provider classes */
@ FFDCIgnore ( Exception . class ) private void logProviderInfo ( String providerName , ClassLoader loader ) { } } | try { if ( PROVIDER_ECLIPSELINK . equals ( providerName ) ) { // org . eclipse . persistence . Version . getVersion ( ) : 2.6.4 . v20160829-44060b6
Class < ? > Version = loadClass ( loader , "org.eclipse.persistence.Version" ) ; String version = ( String ) Version . getMethod ( "getVersionString" ) . invoke ( Version . newInstance ( ) ) ; Tr . info ( tc , "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I" , "EclipseLink" , version ) ; } else if ( PROVIDER_HIBERNATE . equals ( providerName ) ) { // org . hibernate . Version . getVersionString ( ) : 5.2.6 . Final
Class < ? > Version = loadClass ( loader , "org.hibernate.Version" ) ; String version = ( String ) Version . getMethod ( "getVersionString" ) . invoke ( null ) ; Tr . info ( tc , "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I" , "Hibernate" , version ) ; } else if ( PROVIDER_OPENJPA . equals ( providerName ) ) { // OpenJPAVersion . appendOpenJPABanner ( sb ) : OpenJPA # . # . # \ n version id : openjpa - # . # . # - r # \ n Apache svn revision : #
StringBuilder version = new StringBuilder ( ) ; Class < ? > OpenJPAVersion = loadClass ( loader , "org.apache.openjpa.conf.OpenJPAVersion" ) ; OpenJPAVersion . getMethod ( "appendOpenJPABanner" , StringBuilder . class ) . invoke ( OpenJPAVersion . newInstance ( ) , version ) ; Tr . info ( tc , "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I" , "OpenJPA" , version ) ; } else { Tr . info ( tc , "JPA_THIRD_PARTY_PROV_NAME_CWWJP0052I" , providerName ) ; } } catch ( Exception x ) { Tr . info ( tc , "JPA_THIRD_PARTY_PROV_NAME_CWWJP0052I" , providerName ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "unable to determine provider info" , x ) ; } |
public class ClusteringService { /** * Adds a new message consumer to this service .
* @ param consumer a { @ link MessageConsumer } instance . */
@ SuppressWarnings ( "unchecked" ) public synchronized void addConsumer ( MessageConsumer < ? extends Serializable > consumer ) { } } | consumers . add ( ( MessageConsumer < Serializable > ) consumer ) ; |
public class CmsObject { /** * Gets all URL names for a given structure id . < p >
* @ param id the structure id
* @ return the list of all URL names for that structure id
* @ throws CmsException if something goes wrong */
public List < String > getAllUrlNames ( CmsUUID id ) throws CmsException { } } | return m_securityManager . readAllUrlNameMappingEntries ( m_context , id ) ; |
public class TypeUtils { /** * Look up { @ code var } in { @ code typeVarAssigns } < em > transitively < / em > ,
* i . e . keep looking until the value found is < em > not < / em > a type variable .
* @ param var the type variable to look up
* @ param typeVarAssigns the map used for the look up
* @ return Type or { @ code null } if some variable was not in the map
* @ since 3.2 */
private static Type unrollVariableAssignments ( TypeVariable < ? > var , final Map < TypeVariable < ? > , Type > typeVarAssigns ) { } } | Type result ; do { result = typeVarAssigns . get ( var ) ; if ( result instanceof TypeVariable < ? > && ! result . equals ( var ) ) { var = ( TypeVariable < ? > ) result ; continue ; } break ; } while ( true ) ; return result ; |
public class FastJsonKit { /** * json string to map
* @ param json
* @ return */
@ SuppressWarnings ( "unchecked" ) public static < K , V > Map < K , V > jsonToMap ( String json ) { } } | return FastJsonKit . parse ( json , HashMap . class ) ; |
public class OKPacket { /** * < pre >
* VERSION 4.1
* Bytes Name
* 1 ( Length Coded Binary ) field _ count , always = 0
* 1-9 ( Length Coded Binary ) affected _ rows
* 1-9 ( Length Coded Binary ) insert _ id
* 2 server _ status
* 2 warning _ count
* n ( until end of packet ) message
* < / pre >
* @ throws IOException */
public void fromBytes ( byte [ ] data ) throws IOException { } } | int index = 0 ; // 1 . read field count
this . fieldCount = data [ 0 ] ; index ++ ; // 2 . read affected rows
this . affectedRows = ByteHelper . readBinaryCodedLengthBytes ( data , index ) ; index += this . affectedRows . length ; // 3 . read insert id
this . insertId = ByteHelper . readBinaryCodedLengthBytes ( data , index ) ; index += this . insertId . length ; // 4 . read server status
this . serverStatus = ByteHelper . readUnsignedShortLittleEndian ( data , index ) ; index += 2 ; // 5 . read warning count
this . warningCount = ByteHelper . readUnsignedShortLittleEndian ( data , index ) ; index += 2 ; // 6 . read message .
this . message = new String ( ByteHelper . readFixedLengthBytes ( data , index , data . length - index ) ) ; // end read |
public class GeometryExpression { /** * Exports this geometric object to a specific Well - known Binary Representation of
* Geometry .
* @ return binary representation */
public SimpleExpression < byte [ ] > asBinary ( ) { } } | if ( binary == null ) { binary = Expressions . operation ( byte [ ] . class , SpatialOps . AS_BINARY , mixin ) ; } return binary ; |
public class DynamoDBTableMapper { /** * Creates the table and ignores the { @ code ResourceInUseException } if it
* ialready exists .
* @ param throughput The provisioned throughput .
* @ return True if created , or false if the table already existed .
* @ see com . amazonaws . services . dynamodbv2 . AmazonDynamoDB # createTable
* @ see com . amazonaws . services . dynamodbv2 . model . CreateTableRequest */
public boolean createTableIfNotExists ( ProvisionedThroughput throughput ) { } } | try { createTable ( throughput ) ; } catch ( final ResourceInUseException e ) { if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "Table already exists, no need to create" , e ) ; } return false ; } return true ; |
public class DataObject { /** * Convenience method to support ServletRequest .
* @ param map */
public void populate ( Map < String , String [ ] > map ) { } } | for ( Entry < String , String [ ] > entry : map . entrySet ( ) ) { String property = entry . getKey ( ) ; if ( model . typeMap . containsKey ( property ) ) { String [ ] values = entry . getValue ( ) ; if ( values . length > 1 ) { throw new UnsupportedOperationException ( property + " has multivalue " + values ) ; } if ( values . length == 1 ) { set ( property , values [ 0 ] ) ; } } } |
public class DatabaseFieldConfigLoader { /** * Load a configuration in from a text file .
* @ return A config if any of the fields were set otherwise null on EOF . */
public static DatabaseFieldConfig fromReader ( BufferedReader reader ) throws SQLException { } } | DatabaseFieldConfig config = new DatabaseFieldConfig ( ) ; boolean anything = false ; while ( true ) { String line ; try { line = reader . readLine ( ) ; } catch ( IOException e ) { throw SqlExceptionUtil . create ( "Could not read DatabaseFieldConfig from stream" , e ) ; } if ( line == null ) { break ; } // we do this so we can support multiple class configs per file
if ( line . equals ( CONFIG_FILE_END_MARKER ) ) { break ; } // skip empty lines or comments
if ( line . length ( ) == 0 || line . startsWith ( "#" ) || line . equals ( CONFIG_FILE_START_MARKER ) ) { continue ; } String [ ] parts = line . split ( "=" , - 2 ) ; if ( parts . length != 2 ) { throw new SQLException ( "DatabaseFieldConfig reading from stream cannot parse line: " + line ) ; } readField ( config , parts [ 0 ] , parts [ 1 ] ) ; anything = true ; } // if we got any config lines then we return the config
if ( anything ) { return config ; } else { // otherwise we return null for none
return null ; } |
public class Jenkins { /** * Gets the label that exists on this system by the name .
* @ return null if name is null .
* @ see Label # parseExpression ( String ) ( String ) */
public Label getLabel ( String expr ) { } } | if ( expr == null ) return null ; expr = hudson . util . QuotedStringTokenizer . unquote ( expr ) ; while ( true ) { Label l = labels . get ( expr ) ; if ( l != null ) return l ; // non - existent
try { labels . putIfAbsent ( expr , Label . parseExpression ( expr ) ) ; } catch ( ANTLRException e ) { // laxly accept it as a single label atom for backward compatibility
return getLabelAtom ( expr ) ; } } |
public class ConnectionImpl { /** * ( non - Javadoc )
* @ see com . ibm . wsspi . sib . core . SICoreConnection # removeConnectionListener ( com . ibm . wsspi . sib . core . SICoreConnectionListener ) */
@ Override public void removeConnectionListener ( SICoreConnectionListener listener ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && CoreSPIConnection . tc . isEntryEnabled ( ) ) SibTr . entry ( CoreSPIConnection . tc , "removeConnectionListener" , new Object [ ] { this , listener } ) ; // Synchronize on the _ connectionListeners object ,
synchronized ( _connectionListeners ) { _connectionListeners . remove ( listener ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && CoreSPIConnection . tc . isEntryEnabled ( ) ) SibTr . exit ( CoreSPIConnection . tc , "removeConnectionListener" ) ; |
public class Matrix4f { /** * Apply a projection transformation to this matrix that projects onto the plane specified via the general plane equation
* < code > x * a + y * b + z * c + d = 0 < / code > as if casting a shadow from a given light position / direction < code > ( lightX , lightY , lightZ , lightW ) < / code > .
* If < code > lightW < / code > is < code > 0.0 < / code > the light is being treated as a directional light ; if it is < code > 1.0 < / code > it is a point light .
* If < code > M < / code > is < code > this < / code > matrix and < code > S < / code > the shadow matrix ,
* then the new matrix will be < code > M * S < / code > . So when transforming a
* vector < code > v < / code > with the new matrix by using < code > M * S * v < / code > , the
* reflection will be applied first !
* Reference : < a href = " ftp : / / ftp . sgi . com / opengl / contrib / blythe / advanced99 / notes / node192 . html " > ftp . sgi . com < / a >
* @ param lightX
* the x - component of the light ' s vector
* @ param lightY
* the y - component of the light ' s vector
* @ param lightZ
* the z - component of the light ' s vector
* @ param lightW
* the w - component of the light ' s vector
* @ param a
* the x factor in the plane equation
* @ param b
* the y factor in the plane equation
* @ param c
* the z factor in the plane equation
* @ param d
* the constant in the plane equation
* @ return a matrix holding the result */
public Matrix4f shadow ( float lightX , float lightY , float lightZ , float lightW , float a , float b , float c , float d ) { } } | return shadow ( lightX , lightY , lightZ , lightW , a , b , c , d , thisOrNew ( ) ) ; |
public class Document { /** * Sets the margins .
* @ param marginLeft
* the margin on the left
* @ param marginRight
* the margin on the right
* @ param marginTop
* the margin on the top
* @ param marginBottom
* the margin on the bottom
* @ returna < CODE > boolean < / CODE > */
public boolean setMargins ( float marginLeft , float marginRight , float marginTop , float marginBottom ) { } } | this . marginLeft = marginLeft ; this . marginRight = marginRight ; this . marginTop = marginTop ; this . marginBottom = marginBottom ; DocListener listener ; for ( Iterator iterator = listeners . iterator ( ) ; iterator . hasNext ( ) ; ) { listener = ( DocListener ) iterator . next ( ) ; listener . setMargins ( marginLeft , marginRight , marginTop , marginBottom ) ; } return true ; |
public class DBFKRelationPropertySheet { /** * GEN - LAST : event _ cbAutoUpdateActionPerformed */
private void cbAutoRetrieveActionPerformed ( java . awt . event . ActionEvent evt ) // GEN - FIRST : event _ cbAutoRetrieveActionPerformed
{ } } | // GEN - HEADEREND : event _ cbAutoRetrieveActionPerformed
// Add your handling code here :
aRelation . setAutoRetrieve ( cbAutoRetrieve . isSelected ( ) ) ; |
public class ValueEnforcer { /** * Check that the passed Array is neither < code > null < / code > nor empty and that
* no < code > null < / code > value is contained .
* @ param < T >
* Type to be checked and returned
* @ param aValue
* The Array to check .
* @ param aName
* The name of the value ( e . g . the parameter name )
* @ return The passed value .
* @ throws IllegalArgumentException
* if the passed value is empty or a < code > null < / code > value is
* contained */
public static < T > T [ ] notEmptyNoNullValue ( final T [ ] aValue , @ Nonnull final Supplier < ? extends String > aName ) { } } | notEmpty ( aValue , aName ) ; noNullValue ( aValue , aName ) ; return aValue ; |
public class MessagingBuilder { /** * Apply all registered configurers on this builder instance .
* When using { @ link # standard ( ) } and { @ link # minimal ( ) } factory methods ,
* this method is automatically called . */
public void configure ( ) { } } | Collections . sort ( configurers , new PriorityComparator ( ) ) ; for ( PrioritizedConfigurer configurer : configurers ) { configurer . getConfigurer ( ) . configure ( this ) ; } |
public class OneStepIterator { /** * Count backwards one proximity position .
* @ param i The predicate index . */
protected void countProximityPosition ( int i ) { } } | if ( ! isReverseAxes ( ) ) super . countProximityPosition ( i ) ; else if ( i < m_proximityPositions . length ) m_proximityPositions [ i ] -- ; |
public class CmsContentDefinition { /** * Returns the entity id according to the given UUID . < p >
* @ param uuid the UUID
* @ param locale the content locale
* @ return the entity id */
public static String uuidToEntityId ( CmsUUID uuid , String locale ) { } } | return ENTITY_ID_PREFIX + locale + "/" + uuid . toString ( ) ; |
public class JCalRawReader { /** * Reads the next iCalendar object from the jCal data stream .
* @ param listener handles the iCalendar data as it is read off the wire
* @ throws JCalParseException if the jCal syntax is incorrect ( the JSON
* syntax may be valid , but it is not in the correct jCal format ) .
* @ throws JsonParseException if the JSON syntax is incorrect
* @ throws IOException if there is a problem reading from the data stream */
public void readNext ( JCalDataStreamListener listener ) throws IOException { } } | if ( parser == null ) { JsonFactory factory = new JsonFactory ( ) ; parser = factory . createParser ( reader ) ; } if ( parser . isClosed ( ) ) { return ; } this . listener = listener ; // find the next iCalendar object
JsonToken prev = parser . getCurrentToken ( ) ; JsonToken cur ; while ( ( cur = parser . nextToken ( ) ) != null ) { if ( prev == JsonToken . START_ARRAY && cur == JsonToken . VALUE_STRING && VCALENDAR_COMPONENT_NAME . equals ( parser . getValueAsString ( ) ) ) { // found
break ; } if ( strict ) { // the parser was expecting the jCal to be there
if ( prev != JsonToken . START_ARRAY ) { throw new JCalParseException ( JsonToken . START_ARRAY , prev ) ; } if ( cur != JsonToken . VALUE_STRING ) { throw new JCalParseException ( JsonToken . VALUE_STRING , cur ) ; } throw new JCalParseException ( "Invalid value for first token: expected \"vcalendar\" , was \"" + parser . getValueAsString ( ) + "\"" , JsonToken . VALUE_STRING , cur ) ; } prev = cur ; } if ( cur == null ) { // EOF
eof = true ; return ; } parseComponent ( new ArrayList < String > ( ) ) ; |
public class RegionOperationId { /** * Returns a region operation identity given the region identity and the operation name . */
public static RegionOperationId of ( RegionId regionId , String operation ) { } } | return new RegionOperationId ( regionId . getProject ( ) , regionId . getRegion ( ) , operation ) ; |
public class ModelExtractors { /** * This method is used internally to load markup engines . Markup engines are found using descriptor files on
* classpath , so adding an engine is as easy as adding a jar on classpath with the descriptor file included . */
private void loadEngines ( ) { } } | try { ClassLoader cl = ModelExtractors . class . getClassLoader ( ) ; Enumeration < URL > resources = cl . getResources ( PROPERTIES ) ; while ( resources . hasMoreElements ( ) ) { URL url = resources . nextElement ( ) ; Properties props = new Properties ( ) ; props . load ( url . openStream ( ) ) ; for ( Map . Entry < Object , Object > entry : props . entrySet ( ) ) { String className = ( String ) entry . getKey ( ) ; String [ ] extensions = ( ( String ) entry . getValue ( ) ) . split ( "," ) ; loadAndRegisterEngine ( className , extensions ) ; } } } catch ( IOException e ) { e . printStackTrace ( ) ; } |
public class ScannerImpl { /** * Determine the list of scanner plugins that handle the given type .
* @ param type
* The type .
* @ return The list of plugins . */
private List < ScannerPlugin < ? , ? > > getScannerPluginsForType ( final Class < ? > type ) { } } | List < ScannerPlugin < ? , ? > > plugins = scannerPluginsPerType . get ( type ) ; if ( plugins == null ) { // The list of all scanner plugins which accept the given type
final List < ScannerPlugin < ? , ? > > candidates = new LinkedList < > ( ) ; // The map of scanner plugins which produce a descriptor type
final Map < Class < ? extends Descriptor > , Set < ScannerPlugin < ? , ? > > > pluginsByDescriptor = new HashMap < > ( ) ; for ( ScannerPlugin < ? , ? > scannerPlugin : scannerPlugins . values ( ) ) { Class < ? > scannerPluginType = scannerPlugin . getType ( ) ; if ( scannerPluginType . isAssignableFrom ( type ) ) { Class < ? extends Descriptor > descriptorType = scannerPlugin . getDescriptorType ( ) ; Set < ScannerPlugin < ? , ? > > pluginsForDescriptorType = pluginsByDescriptor . get ( descriptorType ) ; if ( pluginsForDescriptorType == null ) { pluginsForDescriptorType = new HashSet < > ( ) ; pluginsByDescriptor . put ( descriptorType , pluginsForDescriptorType ) ; } pluginsForDescriptorType . add ( scannerPlugin ) ; candidates . add ( scannerPlugin ) ; } } // Order plugins by the values of their optional @ Requires
// annotation
plugins = DependencyResolver . newInstance ( candidates , new DependencyProvider < ScannerPlugin < ? , ? > > ( ) { @ Override public Set < ScannerPlugin < ? , ? > > getDependencies ( ScannerPlugin < ? , ? > dependent ) { Set < ScannerPlugin < ? , ? > > dependencies = new HashSet < > ( ) ; Requires annotation = dependent . getClass ( ) . getAnnotation ( Requires . class ) ; if ( annotation != null ) { for ( Class < ? extends Descriptor > descriptorType : annotation . value ( ) ) { Set < ScannerPlugin < ? , ? > > pluginsByDescriptorType = pluginsByDescriptor . get ( descriptorType ) ; if ( pluginsByDescriptorType != null ) { for ( ScannerPlugin < ? , ? > scannerPlugin : pluginsByDescriptorType ) { if ( ! scannerPlugin . equals ( dependent ) ) { dependencies . add ( scannerPlugin ) ; } } } } } return dependencies ; } } ) . resolve ( ) ; scannerPluginsPerType . put ( type , plugins ) ; } return plugins ; |
public class Default { protected void sendData ( HttpServletRequest request , HttpServletResponse response , String pathInContext , Resource resource ) throws IOException { } } | long resLength = resource . length ( ) ; boolean include = request . getAttribute ( Dispatcher . __INCLUDE_REQUEST_URI ) != null ; // Get the output stream ( or writer )
OutputStream out = null ; try { out = response . getOutputStream ( ) ; } catch ( IllegalStateException e ) { out = new WriterOutputStream ( response . getWriter ( ) ) ; } // see if there are any range headers
Enumeration reqRanges = include ? null : request . getHeaders ( HttpFields . __Range ) ; if ( reqRanges == null || ! reqRanges . hasMoreElements ( ) ) { // if there were no ranges , send entire entity
Resource data = resource ; if ( ! include ) { // look for a gziped content .
if ( _minGzipLength > 0 ) { String accept = request . getHeader ( HttpFields . __AcceptEncoding ) ; if ( accept != null && resLength > _minGzipLength && ! pathInContext . endsWith ( ".gz" ) ) { Resource gz = getResource ( pathInContext + ".gz" ) ; if ( gz . exists ( ) && accept . indexOf ( "gzip" ) >= 0 && request . getAttribute ( Dispatcher . __INCLUDE_REQUEST_URI ) == null ) { response . setHeader ( HttpFields . __ContentEncoding , "gzip" ) ; data = gz ; resLength = data . length ( ) ; } } } writeHeaders ( response , resource , resLength ) ; } data . writeTo ( out , 0 , resLength ) ; return ; } // Parse the satisfiable ranges
List ranges = InclusiveByteRange . satisfiableRanges ( reqRanges , resLength ) ; // if there are no satisfiable ranges , send 416 response
if ( ranges == null || ranges . size ( ) == 0 ) { writeHeaders ( response , resource , resLength ) ; response . setStatus ( HttpResponse . __416_Requested_Range_Not_Satisfiable ) ; response . setHeader ( HttpFields . __ContentRange , InclusiveByteRange . to416HeaderRangeString ( resLength ) ) ; resource . writeTo ( out , 0 , resLength ) ; return ; } // if there is only a single valid range ( must be satisfiable
// since were here now ) , send that range with a 216 response
if ( ranges . size ( ) == 1 ) { InclusiveByteRange singleSatisfiableRange = ( InclusiveByteRange ) ranges . get ( 0 ) ; long singleLength = singleSatisfiableRange . getSize ( resLength ) ; writeHeaders ( response , resource , singleLength ) ; response . setStatus ( HttpResponse . __206_Partial_Content ) ; response . setHeader ( HttpFields . __ContentRange , singleSatisfiableRange . toHeaderRangeString ( resLength ) ) ; resource . writeTo ( out , singleSatisfiableRange . getFirst ( resLength ) , singleLength ) ; return ; } // multiple non - overlapping valid ranges cause a multipart
// 216 response which does not require an overall
// content - length header
writeHeaders ( response , resource , - 1 ) ; ResourceCache . ResourceMetaData metaData = _httpContext . getResourceMetaData ( resource ) ; String encoding = metaData . getMimeType ( ) ; MultiPartResponse multi = new MultiPartResponse ( response . getOutputStream ( ) ) ; response . setStatus ( HttpResponse . __206_Partial_Content ) ; // If the request has a " Request - Range " header then we need to
// send an old style multipart / x - byteranges Content - Type . This
// keeps Netscape and acrobat happy . This is what Apache does .
String ctp ; if ( request . getHeader ( HttpFields . __RequestRange ) != null ) ctp = "multipart/x-byteranges; boundary=" ; else ctp = "multipart/byteranges; boundary=" ; response . setContentType ( ctp + multi . getBoundary ( ) ) ; InputStream in = ( resource instanceof CachedResource ) ? null : resource . getInputStream ( ) ; long pos = 0 ; for ( int i = 0 ; i < ranges . size ( ) ; i ++ ) { InclusiveByteRange ibr = ( InclusiveByteRange ) ranges . get ( i ) ; String header = HttpFields . __ContentRange + ": " + ibr . toHeaderRangeString ( resLength ) ; multi . startPart ( encoding , new String [ ] { header } ) ; long start = ibr . getFirst ( resLength ) ; long size = ibr . getSize ( resLength ) ; if ( in != null ) { // Handle non cached resource
if ( start < pos ) { in . close ( ) ; in = resource . getInputStream ( ) ; pos = 0 ; } if ( pos < start ) { in . skip ( start - pos ) ; pos = start ; } IO . copy ( in , out , size ) ; pos += size ; } else // Handle cached resource
( resource ) . writeTo ( out , start , size ) ; } if ( in != null ) in . close ( ) ; multi . close ( ) ; return ; |
public class PropsVectors { /** * Always returns 0 if called after compact ( ) . */
public int getValue ( int c , int column ) { } } | if ( isCompacted || c < 0 || c > MAX_CP || column < 0 || column >= ( columns - 2 ) ) { return 0 ; } int index = findRow ( c ) ; return v [ index + 2 + column ] ; |
public class CredentialsUtils { /** * Serializes a private key to an output stream following the pkcs8 encoding .
* This method just delegates to canl , but provides a much more understandable
* signature .
* @ param os
* @ param key
* @ throws IllegalArgumentException
* @ throws IOException */
private static void savePrivateKeyPKCS8 ( OutputStream os , PrivateKey key ) throws IllegalArgumentException , IOException { } } | CertificateUtils . savePrivateKey ( os , key , Encoding . PEM , null , null ) ; |
public class ThingGroupPropertiesMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ThingGroupProperties thingGroupProperties , ProtocolMarshaller protocolMarshaller ) { } } | if ( thingGroupProperties == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( thingGroupProperties . getThingGroupDescription ( ) , THINGGROUPDESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( thingGroupProperties . getAttributePayload ( ) , ATTRIBUTEPAYLOAD_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class GatewayMicroService { /** * The registry . */
protected void configureRegistry ( ) { } } | setConfigProperty ( GatewayConfigProperties . REGISTRY_CLASS , PollCachingESRegistry . class . getName ( ) ) ; setConfigProperty ( GatewayConfigProperties . REGISTRY_CLASS + ".client.type" , "jest" ) ; setConfigProperty ( GatewayConfigProperties . REGISTRY_CLASS + ".client.protocol" , "${apiman.es.protocol}" ) ; setConfigProperty ( GatewayConfigProperties . REGISTRY_CLASS + ".client.host" , "${apiman.es.host}" ) ; setConfigProperty ( GatewayConfigProperties . REGISTRY_CLASS + ".client.port" , "${apiman.es.port}" ) ; setConfigProperty ( GatewayConfigProperties . REGISTRY_CLASS + ".client.username" , "${apiman.es.username}" ) ; setConfigProperty ( GatewayConfigProperties . REGISTRY_CLASS + ".client.password" , "${apiman.es.password}" ) ; |
public class MultiTable { /** * Add this record ( Always called from the record class ) .
* @ exception DBException File exception . */
public void add ( Rec fieldList ) throws DBException { } } | this . syncCurrentToBase ( ) ; boolean [ ] rgbListenerState = this . getRecord ( ) . setEnableListeners ( false ) ; this . getRecord ( ) . handleRecordChange ( DBConstants . ADD_TYPE ) ; // Fake the call for the grid table
this . getRecord ( ) . setEnableListeners ( rgbListenerState ) ; super . add ( fieldList ) ; this . syncCurrentToBase ( ) ; rgbListenerState = this . getRecord ( ) . setEnableListeners ( false ) ; this . getRecord ( ) . handleRecordChange ( DBConstants . AFTER_ADD_TYPE ) ; // Fake the call for the grid table
this . getRecord ( ) . setEnableListeners ( rgbListenerState ) ; |
public class CJarLoaderURLStreamHandler { /** * add a class byte representation in the preload map
* @ param path
* path to the class inside the jar
* @ param array
* byte representation */
public void addClassPreload ( final String path , final byte array [ ] ) { } } | try { this . preload . put ( path , new SoftReference ( new CGCCleaner ( path , array ) ) ) ; } catch ( Exception ignore ) { } |
public class CertificatePolicySet { /** * Encode the policy set to the output stream .
* @ param out the DerOutputStream to encode the data to . */
public void encode ( DerOutputStream out ) throws IOException { } } | DerOutputStream tmp = new DerOutputStream ( ) ; for ( int i = 0 ; i < ids . size ( ) ; i ++ ) { ids . elementAt ( i ) . encode ( tmp ) ; } out . write ( DerValue . tag_Sequence , tmp ) ; |
public class CameraEncoder { /** * Resets per - recording state . This excludes { @ link io . kickflip . sdk . av . EglStateSaver } ,
* which should be re - used across recordings made by this CameraEncoder instance .
* @ param config the desired parameters for the next recording . */
private void init ( SessionConfig config ) { } } | mEncodedFirstFrame = false ; mReadyForFrames = false ; mRecording = false ; mEosRequested = false ; mCurrentCamera = - 1 ; mDesiredCamera = Camera . CameraInfo . CAMERA_FACING_BACK ; mCurrentFlash = Parameters . FLASH_MODE_OFF ; mDesiredFlash = null ; mCurrentFilter = - 1 ; mNewFilter = Filters . FILTER_NONE ; mThumbnailRequested = false ; mThumbnailRequestedOnFrame = - 1 ; mSessionConfig = checkNotNull ( config ) ; |
public class EventMapper { /** * Convert event type .
* @ param eventType the event type
* @ return the event enum type */
private static EventEnumType convertEventType ( org . talend . esb . sam . common . event . EventTypeEnum eventType ) { } } | if ( eventType == null ) { return null ; } return EventEnumType . valueOf ( eventType . name ( ) ) ; |
public class KabschAlignment { /** * Rotates the { @ link IAtomContainer } coordinates by the rotation matrix .
* In general if you align a subset of atoms in a AtomContainer
* this function can be applied to the whole AtomContainer to rotate all
* atoms . This should be called with the second AtomContainer ( or Atom [ ] )
* that was passed to the constructor .
* Note that the AtomContainer coordinates also get translated such that the
* center of mass of the original fragment used to calculate the alignment is at the origin .
* @ param ac The { @ link IAtomContainer } whose coordinates are to be rotated */
public void rotateAtomContainer ( IAtomContainer ac ) { } } | Point3d [ ] p = getPoint3dArray ( ac ) ; for ( int i = 0 ; i < ac . getAtomCount ( ) ; i ++ ) { // translate the the origin we have calculated
p [ i ] . x = p [ i ] . x - this . cm2 . x ; p [ i ] . y = p [ i ] . y - this . cm2 . y ; p [ i ] . z = p [ i ] . z - this . cm2 . z ; // do the actual rotation
ac . getAtom ( i ) . setPoint3d ( new Point3d ( U [ 0 ] [ 0 ] * p [ i ] . x + U [ 0 ] [ 1 ] * p [ i ] . y + U [ 0 ] [ 2 ] * p [ i ] . z , U [ 1 ] [ 0 ] * p [ i ] . x + U [ 1 ] [ 1 ] * p [ i ] . y + U [ 1 ] [ 2 ] * p [ i ] . z , U [ 2 ] [ 0 ] * p [ i ] . x + U [ 2 ] [ 1 ] * p [ i ] . y + U [ 2 ] [ 2 ] * p [ i ] . z ) ) ; } |
public class TokenAttrProcessor { protected void throwThymeleafTokenNotHiddenTypeException ( ActionRuntime runtime , String inputType ) { } } | final ExceptionMessageBuilder br = new ExceptionMessageBuilder ( ) ; br . addNotice ( "Cannot use the token attribute except hidden type." ) ; br . addItem ( "Advice" ) ; br . addElement ( "The la:token attribute should be used at hidden type like this:" ) ; br . addElement ( " (x):" ) ; br . addElement ( " <input type=\"text\" th:token=\"true\"/> // *Bad" ) ; br . addElement ( " (o):" ) ; br . addElement ( " <input type=\"hidden\" th:token=\"true\"/> // Good" ) ; br . addItem ( "Action" ) ; br . addElement ( runtime ) ; br . addItem ( "Input Type" ) ; br . addElement ( inputType ) ; final String msg = br . buildExceptionMessage ( ) ; throw new ThymeleafTokenNotHiddenTypeException ( msg ) ; |
public class OlsonTimeZone { /** * / * ( non - Javadoc )
* @ see android . icu . util . TimeZone # inDaylightTime ( java . util . Date ) */
@ Override public boolean inDaylightTime ( Date date ) { } } | int [ ] temp = new int [ 2 ] ; getOffset ( date . getTime ( ) , false , temp ) ; return temp [ 1 ] != 0 ; |
public class IndexNode { /** * Gets cursors .
* @ return the cursors */
public Stream < Cursor > getCursors ( ) { } } | return LongStream . range ( 0 , getData ( ) . cursorCount ) . mapToObj ( i -> { return new Cursor ( ( CharTrieIndex ) this . trie , ( ( CharTrieIndex ) this . trie ) . cursors . get ( ( int ) ( i + getData ( ) . firstCursorIndex ) ) , getDepth ( ) ) ; } ) ; |
public class AbstractObjDynamicHistogram { /** * Put fresh data into the histogram ( or into the cache ) .
* @ param coord Coordinate
* @ param value Value */
public void putData ( double coord , T value ) { } } | // Store in cache
if ( cachefill >= 0 && cachefill < cacheposs . length ) { cacheposs [ cachefill ] = coord ; cachevals [ cachefill ++ ] = cloneForCache ( value ) ; return ; } if ( coord == Double . NEGATIVE_INFINITY ) { aggregateSpecial ( value , 0 ) ; } else if ( coord == Double . POSITIVE_INFINITY ) { aggregateSpecial ( value , 1 ) ; } else if ( Double . isNaN ( coord ) ) { aggregateSpecial ( value , 2 ) ; } else { // super class will handle histogram resizing / shifting
T exist = get ( coord ) ; data [ getBinNr ( coord ) ] = aggregate ( exist , value ) ; } |
public class AbstractSegment3F { /** * Tests if the capsule is intersecting a segment .
* @ param sx1 x coordinate of the first point of the segment .
* @ param sy1 y coordinate of the first point of the segment .
* @ param sz1 z coordinate of the first point of the segment .
* @ param sx2 x coordinate of the second point of the segment .
* @ param sy2 y coordinate of the second point of the segment .
* @ param sz2 z coordinate of the second point of the segment .
* @ param mx1 x coordinate of the first point of the capsule ' s segment .
* @ param my1 y coordinate of the first point of the capsule ' s segment .
* @ param mz1 z coordinate of the first point of the capsule ' s segment .
* @ param mx2 x coordinate of the second point of the capsule ' s segment .
* @ param my2 y coordinate of the second point of the capsule ' s segment .
* @ param mz2 z coordinate of the second point of the capsule ' s segment .
* @ param radius radius of the capsule .
* @ return < code > true < / code > if the two shapes intersect each
* other ; < code > false < / code > otherwise .
* @ see " http : / / books . google . ca / books ? id = fvA7zLEFWZgC " */
@ Pure public static boolean intersectsSegmentCapsule ( double sx1 , double sy1 , double sz1 , double sx2 , double sy2 , double sz2 , double mx1 , double my1 , double mz1 , double mx2 , double my2 , double mz2 , double radius ) { } } | double d = distanceSquaredSegmentSegment ( sx1 , sy1 , sz1 , sx2 , sy2 , sz2 , mx1 , my1 , mz1 , mx2 , my2 , mz2 ) ; return d < ( radius * radius ) ; |
public class UniqueAtomMatches { /** * Convert a mapping to a bitset .
* @ param mapping an atom mapping
* @ return a bit set of the mapped vertices ( values in array ) */
private BitSet toBitSet ( int [ ] mapping ) { } } | BitSet hits = new BitSet ( ) ; for ( int v : mapping ) hits . set ( v ) ; return hits ; |
public class SubscriptionDefinitionImpl { /** * Returns the noLocal .
* @ return boolean */
public boolean isNoLocal ( ) { } } | if ( tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "isNoLocal" ) ; SibTr . exit ( tc , "isNoLocal" , new Boolean ( noLocal ) ) ; } return noLocal ; |
public class InProcessTransport { /** * Returns a new status with the same code and description , but stripped of any other information
* ( i . e . cause ) .
* < p > This is , so that the InProcess transport behaves in the same way as the other transports ,
* when exchanging statuses between client and server and vice versa . */
private static Status stripCause ( Status status ) { } } | if ( status == null ) { return null ; } return Status . fromCodeValue ( status . getCode ( ) . value ( ) ) . withDescription ( status . getDescription ( ) ) ; |
public class JDBCUtil { /** * Helper function for { @ link # getColumnType } , etc . */
protected static ResultSet getColumnMetaData ( Connection conn , String table , String column ) throws SQLException { } } | ResultSet rs = conn . getMetaData ( ) . getColumns ( "" , "" , table , column ) ; while ( rs . next ( ) ) { String tname = rs . getString ( "TABLE_NAME" ) ; String cname = rs . getString ( "COLUMN_NAME" ) ; if ( tname . equals ( table ) && cname . equals ( column ) ) { return rs ; } } throw new SQLException ( "Table or Column not defined. [table=" + table + ", col=" + column + "]." ) ; |
public class TileColumn { /** * Create a tile data column
* @ param index
* index
* @ return tile column */
public static TileColumn createTileDataColumn ( int index ) { } } | return new TileColumn ( index , TileTable . COLUMN_TILE_DATA , GeoPackageDataType . BLOB , null , true , null , false ) ; |
public class FedoraBaseResource { /** * Set the baseURL for JMS events .
* @ param uriInfo the uri info
* @ param headers HTTP headers */
protected void setUpJMSInfo ( final UriInfo uriInfo , final HttpHeaders headers ) { } } | try { String baseURL = getBaseUrlProperty ( uriInfo ) ; if ( baseURL . length ( ) == 0 ) { baseURL = uriInfo . getBaseUri ( ) . toString ( ) ; } LOGGER . debug ( "setting baseURL = " + baseURL ) ; session . getFedoraSession ( ) . addSessionData ( BASE_URL , baseURL ) ; if ( ! StringUtils . isBlank ( headers . getHeaderString ( "user-agent" ) ) ) { session . getFedoraSession ( ) . addSessionData ( USER_AGENT , headers . getHeaderString ( "user-agent" ) ) ; } } catch ( final Exception ex ) { LOGGER . warn ( "Error setting baseURL" , ex . getMessage ( ) ) ; } |
public class RuleImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EList < Parameter > getParameters ( ) { } } | if ( parameters == null ) { parameters = new EObjectContainmentEList < Parameter > ( Parameter . class , this , SimpleAntlrPackage . RULE__PARAMETERS ) ; } return parameters ; |
public class Matrix3f { /** * Apply rotation of < code > angles . x < / code > radians about the X axis , followed by a rotation of < code > angles . y < / code > radians about the Y axis and
* followed by a rotation of < code > angles . z < / code > radians about the Z axis .
* When used with a right - handed coordinate system , the produced rotation will rotate a vector
* counter - clockwise around the rotation axis , when viewing along the negative axis direction towards the origin .
* When used with a left - handed coordinate system , the rotation is clockwise .
* If < code > M < / code > is < code > this < / code > matrix and < code > R < / code > the rotation matrix ,
* then the new matrix will be < code > M * R < / code > . So when transforming a
* vector < code > v < / code > with the new matrix by using < code > M * R * v < / code > , the
* rotation will be applied first !
* This method is equivalent to calling : < code > rotateX ( angles . x ) . rotateY ( angles . y ) . rotateZ ( angles . z ) < / code >
* @ param angles
* the Euler angles
* @ return this */
public Matrix3f rotateXYZ ( Vector3f angles ) { } } | return rotateXYZ ( angles . x , angles . y , angles . z ) ; |
public class Element { /** * Use the Java Xpath API to determine if the element is present or not
* @ return boolean true or false as the case is
* @ throws Exception */
private boolean isElementPresentJavaXPath ( ) throws Exception { } } | String xpath = ( ( StringLocatorAwareBy ) getByLocator ( ) ) . getLocator ( ) ; try { xpath = formatXPathForJavaXPath ( xpath ) ; NodeList nodes = getNodeListUsingJavaXPath ( xpath ) ; if ( nodes . getLength ( ) > 0 ) { return true ; } else { return false ; } } catch ( Exception e ) { throw new Exception ( "Error performing isElement present using Java XPath: " + xpath , e ) ; } |
public class JodaBeanBinWriter { /** * Writes the bean to the { @ code OutputStream } .
* @ param bean the bean to output , not null
* @ param rootType true to output the root type
* @ param output the output stream , not null
* @ throws IOException if an error occurs */
public void write ( Bean bean , boolean rootType , OutputStream output ) throws IOException { } } | if ( bean == null ) { throw new NullPointerException ( "bean" ) ; } if ( output == null ) { throw new NullPointerException ( "output" ) ; } if ( referencing ) { if ( ! ( bean instanceof ImmutableBean ) ) { throw new IllegalArgumentException ( "Referencing binary format can only write ImmutableBean instances: " + bean . getClass ( ) . getName ( ) ) ; } new JodaBeanReferencingBinWriter ( settings , output ) . write ( ( ImmutableBean ) bean ) ; } else { new JodaBeanStandardBinWriter ( settings , output ) . write ( bean , rootType ) ; } |
public class GuaranteedTargetStream { /** * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . gd . TargetStream # getLastKnownTick ( ) */
@ Override public long getLastKnownTick ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( this , tc , "getLastKnownTick" ) ; SibTr . exit ( tc , "getLastKnownTick" , Long . valueOf ( unknownHorizon ) ) ; } return unknownHorizon ; |
public class CouchbaseExecutor { /** * The id in the specified < code > jsonDocument < / code > will be set to the returned object if and only if the id is not null or empty and the content in < code > jsonDocument < / code > doesn ' t contain any " id " property , and it ' s acceptable to the < code > targetClass < / code > .
* @ param targetClass an entity class with getter / setter method or < code > Map . class < / code >
* @ param jsonDocument
* @ return */
public static < T > T toEntity ( final Class < T > targetClass , final JsonDocument jsonDocument ) { } } | final T result = toEntity ( targetClass , jsonDocument . content ( ) ) ; final String id = jsonDocument . id ( ) ; if ( N . notNullOrEmpty ( id ) && result != null ) { if ( Map . class . isAssignableFrom ( targetClass ) ) { ( ( Map < String , Object > ) result ) . put ( _ID , id ) ; } else { final Method idSetMethod = getObjectIdSetMethod ( targetClass ) ; if ( idSetMethod != null ) { ClassUtil . setPropValue ( result , idSetMethod , id ) ; } } } return result ; |
public class FilePath { /** * Creates a temporary file in this directory ( or the system temporary
* directory ) and set the contents to the given text ( encoded in the
* platform default encoding )
* @ param prefix
* The prefix string to be used in generating the file ' s name ; must be
* at least three characters long
* @ param suffix
* The suffix string to be used in generating the file ' s name ; may be
* null , in which case the suffix " . tmp " will be used
* @ param contents
* The initial contents of the temporary file .
* @ param inThisDirectory
* If true , then create this temporary in the directory pointed to by
* this .
* If false , then the temporary file is created in the system temporary
* directory ( java . io . tmpdir )
* @ return
* The new FilePath pointing to the temporary file
* @ see File # createTempFile ( String , String ) */
public FilePath createTextTempFile ( final String prefix , final String suffix , final String contents , final boolean inThisDirectory ) throws IOException , InterruptedException { } } | try { return new FilePath ( channel , act ( new CreateTextTempFile ( inThisDirectory , prefix , suffix , contents ) ) ) ; } catch ( IOException e ) { throw new IOException ( "Failed to create a temp file on " + remote , e ) ; } |
public class AssetDeliveryPolicy { /** * Create an operation that will retrieve the given asset delivery policy
* @ param assetDeliveryPolicyId
* id of asset delivery policy to retrieve
* @ return the operation */
public static EntityGetOperation < AssetDeliveryPolicyInfo > get ( String assetDeliveryPolicyId ) { } } | return new DefaultGetOperation < AssetDeliveryPolicyInfo > ( ENTITY_SET , assetDeliveryPolicyId , AssetDeliveryPolicyInfo . class ) ; |
public class HullWhiteModelWithConstantCoeff { /** * Calculates the variance \ ( \ mathop { Var } ( r ( t ) \ vert r ( s ) ) \ ) , that is
* \ int _ { s } ^ { t } \ sigma ^ { 2 } ( \ tau ) \ exp ( - 2 \ cdot a \ cdot ( t - \ tau ) ) \ \ mathrm { d } \ tau
* \ ) where \ ( a \ ) is the meanReversion and \ ( \ sigma \ ) is the short rate instantaneous volatility .
* @ param time The parameter s in \ ( \ int _ { s } ^ { t } \ sigma ^ { 2 } ( \ tau ) \ exp ( - 2 \ cdot a \ cdot ( t - \ tau ) ) \ \ mathrm { d } \ tau \ )
* @ param maturity The parameter t in \ ( \ int _ { s } ^ { t } \ sigma ^ { 2 } ( \ tau ) \ exp ( - 2 \ cdot a \ cdot ( t - \ tau ) ) \ \ mathrm { d } \ tau \ )
* @ return The integrated square volatility . */
public double getShortRateConditionalVariance ( double time , double maturity ) { } } | return volatility * volatility * ( 1 - Math . exp ( - 2 * meanReversion * ( maturity - time ) ) ) / ( 2 * meanReversion ) ; |
public class IconicsDrawable { /** * Set contour width for the icon .
* @ return The current IconicsDrawable for chaining . */
@ NonNull public IconicsDrawable contourWidthPx ( @ Dimension ( unit = PX ) int sizePx ) { } } | mContourWidth = sizePx ; mContourBrush . getPaint ( ) . setStrokeWidth ( sizePx ) ; drawContour ( true ) ; invalidateSelf ( ) ; return this ; |
public class RingBuffer { /** * Blocks until messages are available
* @ param num _ spins the number of times we should spin before acquiring a lock
* @ param wait _ strategy the strategy used to spin . The first parameter is the iteration count and the second
* parameter is the max number of spins */
public int waitForMessages ( int num_spins , final BiConsumer < Integer , Integer > wait_strategy ) throws InterruptedException { } } | // try spinning first ( experimental )
for ( int i = 0 ; i < num_spins && count == 0 ; i ++ ) { if ( wait_strategy != null ) wait_strategy . accept ( i , num_spins ) ; else Thread . yield ( ) ; } if ( count == 0 ) _waitForMessages ( ) ; return count ; // whatever is the last count ; could have been updated since lock release |
public class ARouter { /** * Init , it must be call before used router . */
public static void init ( Application application ) { } } | if ( ! hasInit ) { logger = _ARouter . logger ; _ARouter . logger . info ( Consts . TAG , "ARouter init start." ) ; hasInit = _ARouter . init ( application ) ; if ( hasInit ) { _ARouter . afterInit ( ) ; } _ARouter . logger . info ( Consts . TAG , "ARouter init over." ) ; } |
public class PersonAttrLibrary { /** * name _ freq */
private void init2 ( ) { } } | Map < String , int [ ] [ ] > personFreqMap = MyStaticValue . getPersonFreqMap ( ) ; Set < Entry < String , int [ ] [ ] > > entrySet = personFreqMap . entrySet ( ) ; PersonNatureAttr pna = null ; for ( Entry < String , int [ ] [ ] > entry : entrySet ) { pna = pnMap . get ( entry . getKey ( ) ) ; if ( pna == null ) { pna = new PersonNatureAttr ( ) ; pna . setlocFreq ( entry . getValue ( ) ) ; pnMap . put ( entry . getKey ( ) , pna ) ; } else { pna . setlocFreq ( entry . getValue ( ) ) ; } } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.