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 JSONOb... | 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 = m... |
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" , "Bear... |
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 ( Interruption... | 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 ) ; } CmsLoca... |
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 character... | return listByWorkspaceWithServiceResponseAsync ( resourceGroupName , workspaceName , clustersListByWorkspaceOptions ) . map ( new Func1 < ServiceResponse < Page < ClusterInner > > , Page < ClusterInner > > ( ) { @ Override public Page < ClusterInner > call ( ServiceResponse < Page < ClusterInner > > response ) { return... |
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 ) ; } ... |
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 . T... |
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 . ... |
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 ... | // 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 an... |
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 all... |
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 ba... | 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 . expandCa... |
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 . l... |
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 ele... | 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 ( ) . getRe... |
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 Int... | // 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... |
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 SdkClie... |
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 Feed... | 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 CmsObje... | 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 ) ... |
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 contain... | 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 . toStr... |
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 sourc... | 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 ) ; } mEph... |
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 {... | 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 . o... |
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 ; inde... |
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... |
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 ) + (... |
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... | 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 ... |
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 ( Excep... | 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 .... |
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... | 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 >
* @ ... | 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 , ... |
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 . AmazonDy... | 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 ... |
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... |
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 ... |
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 . ... |
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 ) < / cod... | 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 setMarg... | 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 ( margin... |
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... | 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 ) .
* ... | 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 (... |
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 <... |
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 <... |
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 .... |
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 stat... | 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 (... |
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}" ) ; setCon... |
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... |
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 ( SessionCon... | 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 ; mThumbna... |
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 ... | 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... |
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 ... |
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 ) { aggregateSpeci... |
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 s... | 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... | 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... |
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 . getHeader... |
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 coor... | 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 perfo... |
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 ... | 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 .... |
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 < / ... | 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 = ... |
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 char... | 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 \... | 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 ... | // 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 r... |
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.