signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ZipBuilder { /** * Adds a file to the archive . The archive must not be closed .
* Example : < br >
* < pre >
* sourceFile = C : \ opt \ work \ deps \ foo . jar
* targetDir = WEB - INF / lib / foo . jar
* < / pre >
* @ param sourceFile
* File to be added
* @ param targetFile
* Relative pa... | FileInputStream fis = new FileInputStream ( sourceFile ) ; ZipEntry jarEntry = new ZipEntry ( targetFile ) ; jarOutputStream . putNextEntry ( jarEntry ) ; StreamUtils . copyStream ( fis , jarOutputStream , false ) ; fis . close ( ) ; return this ; |
public class AbcGrammar { /** * \ n in name = linefeed
* voice - subname : : = ( " subname = " / " snm = " ) % x22 * non - quote % x22 */
Rule VoiceSubname ( ) { } } | return SequenceS ( FirstOfS ( IgnoreCase ( "subname=" ) , IgnoreCase ( "sname=" ) , IgnoreCase ( "snm=" ) ) , String ( "\"" ) , ZeroOrMore ( NonQuote ( ) ) . label ( VoiceSubname ) . suppressSubnodes ( ) , String ( "\"" ) ) ; |
public class SchemaUsageAnalyzer { /** * Create a directory at the given path if it does not exist yet .
* @ param path
* the path to the directory
* @ throws IOException
* if it was not possible to create a directory at the given
* path */
private static void createDirectory ( Path path ) throws IOException ... | try { Files . createDirectory ( path ) ; } catch ( FileAlreadyExistsException e ) { if ( ! Files . isDirectory ( path ) ) { throw e ; } } |
public class KaplanMeierFigure { /** * The data will set the max time which will result in off time points for
* tick marks
* @ param title
* @ param survivalData
* @ param useWeighted
* @ throws Exception */
public void setSurvivalData ( ArrayList < String > title , LinkedHashMap < String , ArrayList < Censo... | this . setSurvivalData ( title , survivalData , null , useWeighted ) ; |
public class ObjectSinkNodeList { /** * Returns a list iterator
* @ return */
public Iterator iterator ( ) { } } | return new Iterator ( ) { private ObjectSinkNode currentNode = null ; private ObjectSinkNode nextNode = getFirst ( ) ; public boolean hasNext ( ) { return ( this . nextNode != null ) ; } public Object next ( ) { this . currentNode = this . nextNode ; if ( this . currentNode != null ) { this . nextNode = this . currentN... |
public class DatatypeConverter { /** * Parse a duration .
* @ param file parent file
* @ param defaultUnits default time units for the resulting duration
* @ param value duration value
* @ return Duration instance */
public static final Duration parseDuration ( ProjectFile file , TimeUnit defaultUnits , String ... | Duration result = null ; XsdDuration xsd = null ; if ( value != null && value . length ( ) != 0 ) { try { xsd = new XsdDuration ( value ) ; } catch ( IllegalArgumentException ex ) { // The duration is malformed .
// MS Project simply ignores values like this .
} } if ( xsd != null ) { TimeUnit units = TimeUnit . DAYS ;... |
public class ChunkTopicParser { /** * flush the buffer to file after processing is finished */
private void writeToContentChunk ( final String tmpContent , final URI outputFileName , final boolean needWriteDitaTag ) throws IOException { } } | assert outputFileName . isAbsolute ( ) ; logger . info ( "Writing " + outputFileName ) ; try ( OutputStreamWriter ditaFileOutput = new OutputStreamWriter ( new FileOutputStream ( new File ( outputFileName ) ) , StandardCharsets . UTF_8 ) ) { if ( outputFileName . equals ( changeTable . get ( outputFileName ) ) ) { // i... |
public class Collections { /** * Randomly permutes the specified list using a default source of
* randomness . All permutations occur with approximately equal
* likelihood .
* < p > The hedge " approximately " is used in the foregoing description because
* default source of randomness is only approximately an u... | Random rnd = r ; if ( rnd == null ) r = rnd = new Random ( ) ; // harmless race .
shuffle ( list , rnd ) ; |
public class StreamEx { /** * Returns a sequential { @ code StreamEx } containing the results of applying
* the given function to the corresponding pairs of values in given two
* lists .
* The list values are accessed using { @ link List # get ( int ) } , so the lists
* should provide fast random access . The l... | return of ( new RangeBasedSpliterator . ZipRef < > ( 0 , checkLength ( first . size ( ) , second . size ( ) ) , mapper , first , second ) ) ; |
public class AptEventSet { /** * Returns the name of the generated notifier class for this ControlEventSet */
public String getNotifierClass ( ) { } } | StringBuffer sb = new StringBuffer ( getShortName ( ) ) ; sb . append ( "Notifier" ) ; // If the event set declaration has any parameterized types , then include them on
// the notifier class as well . Currently , these can only be parameterized types
// from the outer ( control interface ) , since there is no other me... |
public class BluetoothController { /** * Register for bluetooth headset connection states and Sco audio states .
* Try to connect to bluetooth headset audio by calling startBluetoothSco ( ) .
* This is a work around for API < 11 to detect if a headset is connected before
* the application starts .
* The officia... | Log . d ( TAG , "startBluetooth" ) ; // Device support bluetooth
if ( mBluetoothAdapter != null ) { if ( mAudioManager . isBluetoothScoAvailableOffCall ( ) ) { mContext . registerReceiver ( mBroadcastReceiver , new IntentFilter ( BluetoothDevice . ACTION_ACL_CONNECTED ) ) ; mContext . registerReceiver ( mBroadcastRecei... |
public class AsynchronousExecution { /** * Set the executor without notifying it about task completion .
* The caller < b > must < / b > also call { @ link # maybeComplete ( ) }
* after releasing any problematic locks . */
@ Restricted ( NoExternalUse . class ) public synchronized final void setExecutorWithoutCompl... | assert this . executor == null ; this . executor = executor ; |
public class FileURLConnection { /** * Note : the semantics of FileURLConnection object is that the
* results of the various URLConnection calls , such as
* getContentType , getInputStream or getContentLength reflect
* whatever was true when connect was called . */
public void connect ( ) throws IOException { } } | if ( ! connected ) { try { filename = file . toString ( ) ; isDirectory = file . isDirectory ( ) ; if ( isDirectory ) { String [ ] fileList = file . list ( ) ; if ( fileList == null ) throw new FileNotFoundException ( filename + " exists, but is not accessible" ) ; files = Arrays . < String > asList ( fileList ) ; } el... |
public class CmsSynchronize { /** * Deletes a resource in the VFS and updates the synchronisation lists . < p >
* @ param res The resource to be deleted
* @ throws CmsException if something goes wrong */
private void deleteFromVfs ( CmsResource res ) throws CmsException { } } | String resourcename = m_cms . getSitePath ( res ) ; m_report . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_SUCCESSION_1 , String . valueOf ( m_count ++ ) ) , I_CmsReport . FORMAT_NOTE ) ; if ( res . isFile ( ) ) { m_report . print ( Messages . get ( ) . cont... |
public class JTSSurfaceExpression { /** * A Point guaranteed to be on this Surface .
* @ return point on surface */
public JTSPointExpression < Point > pointOnSurface ( ) { } } | if ( pointOnSurface == null ) { pointOnSurface = JTSGeometryExpressions . pointOperation ( SpatialOps . POINT_ON_SURFACE , mixin ) ; } return pointOnSurface ; |
public class SimpleBitSet { /** * Sets the bit specified by the index to < code > false < / code > .
* @ param bitIndex the index of the bit to be cleared .
* @ exception IndexOutOfBoundsException if the specified index is negative .
* @ since JDK1.0 */
public void clear ( int bitIndex ) { } } | if ( bitIndex < 0 ) throw new IndexOutOfBoundsException ( "bitIndex < 0: " + bitIndex ) ; int wordIndex = wordIndex ( bitIndex ) ; if ( wordIndex >= wordsInUse ) return ; words [ wordIndex ] &= ~ ( 1L << bitIndex ) ; recalculateWordsInUse ( ) ; checkInvariants ( ) ; |
public class RequestHelper { /** * Returns whether the request is a new session .
* The method retrieves the new value from the input request ' s session , which indicates if it ' s a new session or
* not . More information can be found here :
* https : / / developer . amazon . com / docs / custom - skills / requ... | Session session = handlerInput . getRequestEnvelope ( ) . getSession ( ) ; if ( session == null ) { throw new IllegalArgumentException ( "The provided request doesn't contain a session" ) ; } return session . getNew ( ) ; |
public class TxtStorer { /** * Parses a single line from the file . This method is never invoked for
* magic sequence . The line includes path to file and hash . Subclasses may
* include more fields .
* This method returns null if the line is of no interest . This can be used
* by subclasses to implement differ... | // Note . Initial this method was using String . split , but that method
// seems to be much more expensive than playing with indexOf and
// substring .
int sepIndex = line . indexOf ( SEPARATOR ) ; String urlExternalForm = line . substring ( 0 , sepIndex ) ; String hash = line . substring ( sepIndex + SEPARATOR_LEN ) ... |
public class SignatureFileVerifier { /** * Examines a signature timestamp token to generate a timestamp object .
* Examines the signer ' s unsigned attributes for a
* < tt > signatureTimestampToken < / tt > attribute . If present ,
* then it is parsed to extract the date and time at which the
* timestamp was ge... | Timestamp timestamp = null ; // Extract the signer ' s unsigned attributes
PKCS9Attributes unsignedAttrs = info . getUnauthenticatedAttributes ( ) ; if ( unsignedAttrs != null ) { PKCS9Attribute timestampTokenAttr = unsignedAttrs . getAttribute ( "signatureTimestampToken" ) ; if ( timestampTokenAttr != null ) { PKCS7 t... |
public class AbstractIoBufferEx { /** * { @ inheritDoc } */
@ Override public AbstractIoBufferEx capacity ( int newCapacity , IoBufferAllocatorEx < ? > reallocator ) { } } | if ( ! recapacityAllowed ) { throw new IllegalStateException ( "Derived buffers and their parent can't be expanded." ) ; } // Allocate a new buffer and transfer all settings to it .
if ( newCapacity > capacity ( ) ) { // Expand :
// / / Save the state .
int pos = position ( ) ; int limit = limit ( ) ; ByteOrder bo = or... |
public class MessagingSecurityServiceImpl { /** * Print the Destination Permissions , it will be used for debugging purpose */
private void printDestinationPermissions ( Map < String , ? > destinationPermissions ) { } } | Set < String > destinations = destinationPermissions . keySet ( ) ; for ( String destination : destinations ) { SibTr . debug ( tc , CLASS_NAME + " Destination: " + destination ) ; Permission permission = ( Permission ) destinationPermissions . get ( destination ) ; SibTr . debug ( tc , " Users having permissions!!!" ... |
public class ValueMapImpl { /** * Add a MapItemValue to the map .
* @ param miv map value item . */
public void add ( MapItemValue miv ) { } } | if ( len >= items . length ) { items = LazyMap . grow ( items ) ; } items [ len ] = miv ; len ++ ; |
public class JsonDBTemplate { /** * / * ( non - Javadoc )
* @ see io . jsondb . JsonDBOperations # getCollection ( java . lang . Class ) */
@ SuppressWarnings ( "unchecked" ) @ Override public < T > List < T > getCollection ( Class < T > entityClass ) { } } | String collectionName = Util . determineCollectionName ( entityClass ) ; Map < Object , T > collection = ( Map < Object , T > ) collectionsRef . get ( ) . get ( collectionName ) ; if ( null == collection ) { createCollection ( collectionName ) ; collection = ( Map < Object , T > ) collectionsRef . get ( ) . get ( colle... |
public class DataSourceMetaDataFactory { /** * Create new instance of data source meta data .
* @ param databaseType database type
* @ param url data source URL
* @ return data source meta data */
public static DataSourceMetaData newInstance ( final DatabaseType databaseType , final String url ) { } } | switch ( databaseType ) { case H2 : return new H2DataSourceMetaData ( url ) ; case MySQL : return new MySQLDataSourceMetaData ( url ) ; case Oracle : return new OracleDataSourceMetaData ( url ) ; case PostgreSQL : return new PostgreSQLDataSourceMetaData ( url ) ; case SQLServer : return new SQLServerDataSourceMetaData ... |
public class SigarAgent { /** * Contract : starting agents after JVM startup .
* @ param options
* Agent command line options .
* @ param instrumentation
* Injected JVM instrumentation instance .
* @ throws Exception
* the exception */
public static void agentmain ( final String options , final Instrumentat... | logger . info ( "Sigar loader via agent-main." ) ; configure ( options , instrumentation ) ; |
public class ConfigurationMetadataBuilder { /** * Visit a configuration property .
* @ param owningType The type that owns the property
* @ param declaringType The declaring type of the property
* @ param propertyType The property type
* @ param name The property name
* @ param description A description for t... | PropertyMetadata metadata = new PropertyMetadata ( ) ; metadata . declaringType = getTypeString ( declaringType ) ; metadata . name = name ; metadata . path = NameUtils . hyphenate ( buildPropertyPath ( owningType , declaringType , name ) , true ) ; metadata . type = propertyType ; metadata . description = description ... |
public class MarkLogicRepositoryConnection { /** * convert bindings
* @ param iter
* @ param subj
* @ param pred
* @ param obj
* @ return iterator */
private Iteration < Statement , QueryEvaluationException > toStatementIteration ( TupleQueryResult iter , final Resource subj , final URI pred , final Value obj... | return new ConvertingIteration < BindingSet , Statement , QueryEvaluationException > ( iter ) { @ Override protected Statement convert ( BindingSet b ) throws QueryEvaluationException { Resource s = subj == null ? ( Resource ) b . getValue ( "s" ) : subj ; URI p = pred == null ? ( URI ) b . getValue ( "p" ) : pred ; Va... |
public class StyleCache { /** * Set the feature row style into the polygon options
* @ param polygonOptions polygon options
* @ param featureRow feature row
* @ return true if style was set into the polygon options */
public boolean setFeatureStyle ( PolygonOptions polygonOptions , FeatureRow featureRow ) { } } | return StyleUtils . setFeatureStyle ( polygonOptions , featureStyleExtension , featureRow , density ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcCompositeProfileDef ( ) { } } | if ( ifcCompositeProfileDefEClass == null ) { ifcCompositeProfileDefEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 114 ) ; } return ifcCompositeProfileDefEClass ; |
public class ConditionalOptional { /** * Returns the set of constained ids . This Set contains all ids of the embedded constraint plus
* its own if this is set . */
@ Override public Set < String > getContainedIds ( ) { } } | Set < String > s = super . getContainedIds ( ) ; s . addAll ( constraint . getContainedIds ( ) ) ; return s ; |
public class Type { /** * Tests , if this type is kind of the type in the parameter ( question is , is
* this type a child of the parameter type ) .
* @ param _ type type to test for parent
* @ return true if this type is a child , otherwise false */
public boolean isKindOf ( final Type _type ) { } } | boolean ret = false ; Type type = this ; while ( type != null && type . getId ( ) != _type . getId ( ) ) { type = type . getParentType ( ) ; } if ( type != null && type . getId ( ) == _type . getId ( ) ) { ret = true ; } return ret ; |
public class AbstrCFMLExprTransformer { /** * Transfomiert eine Modulus Operation . Im Gegensatz zu CFMX , wird das " % " Zeichen auch als Modulus
* Operator anerkannt . < br / >
* EBNF : < br / >
* < code > divMultiOp { ( " mod " | " % " ) spaces divMultiOp } ; ( * modulus operator , " % " Existiert in CFMX nich... | Expression expr = divMultiOp ( data ) ; // Modulus Operation
while ( data . srcCode . forwardIfCurrent ( '%' ) || data . srcCode . forwardIfCurrentAndNoWordAfter ( "mod" ) ) { expr = _modOp ( data , expr ) ; // comments ( data ) ;
// expr = OpDouble . toExprDouble ( expr , divMultiOp ( ) , OpDouble . MODULUS ) ;
} retu... |
public class ConverterFactory { /** * Return convert from S to T */
@ SuppressWarnings ( "unchecked" ) public < T extends R > Converter < S , T > getConverter ( Class < T > targetType ) { } } | return ( Converter < S , T > ) converters . get ( targetType ) ; |
public class HttpUtil { /** * Returns the length of the content or the specified default value if the message does not have the { @ code
* " Content - Length " header } . Please note that this value is not retrieved from { @ link HttpContent # content ( ) } but
* from the { @ code " Content - Length " } header , an... | String value = message . headers ( ) . get ( HttpHeaderNames . CONTENT_LENGTH ) ; if ( value != null ) { return Long . parseLong ( value ) ; } // We know the content length if it ' s a Web Socket message even if
// Content - Length header is missing .
long webSocketContentLength = getWebSocketContentLength ( message ) ... |
public class DropinMonitor { /** * Set the properties for the _ coreMonitor that are modifiable . All others
* are set when this component activates ( { @ link DropinMonitor # activate ( ) } ) .
* @ param config */
private void configureCoreMonitor ( ApplicationMonitorConfig config ) { } } | _coreMonitor . setProperty ( FileMonitor . MONITOR_INTERVAL , config . getPollingRate ( ) ) ; _coreMonitor . setProperty ( FileMonitor . MONITOR_DIRECTORIES , new String [ ] { monitoredDirectory . get ( ) . getAbsolutePath ( ) } ) ; |
public class Cob2XsdMain { /** * Translates a single COBOL source file .
* @ param cobolFile COBOL source file
* @ param cobolFileEncoding the COBOL file character encoding
* @ param target target file or folder
* @ param targetNamespacePrefix the output XML schemas target namespace
* prefix
* @ param xsltF... | try { Cob2XsdIO cob2XsdIO = new Cob2XsdIO ( getConfig ( ) ) ; cob2XsdIO . translate ( cobolFile , cobolFileEncoding , target , targetNamespacePrefix , xsltFileName ) ; } catch ( RecognizerException e ) { throw new XsdGenerationException ( e ) ; } |
public class SubscriptionDescription { /** * Sets The amount of time that the message is locked by a given receiver
* so that no other receiver receives the same message .
* @ param lockDuration - The duration of a peek lock . Max value is 5 minutes . */
public void setLockDuration ( Duration lockDuration ) { } } | this . lockDuration = lockDuration ; if ( this . lockDuration . compareTo ( ManagementClientConstants . MAX_DURATION ) > 0 ) { this . lockDuration = ManagementClientConstants . MAX_DURATION ; } |
public class CommandRunner { /** * 移除数组的第一个元素 < / br >
* @ param args
* 数组
* @ return 移除后的数组 */
public static String [ ] removeFirst ( String [ ] args ) { } } | String [ ] args2 = new String [ args . length - 1 ] ; System . arraycopy ( args , 1 , args2 , 0 , args2 . length ) ; return args2 ; |
public class GaliosFieldTableOps { /** * Continue evaluating a polynomial which has been broken up into multiple arrays .
* @ param previousOutput Output from the evaluation of the prior part of the polynomial
* @ param part Additional segment of the polynomial
* @ param x Point it ' s being evaluated at
* @ re... | int y = previousOutput ; for ( int i = 0 ; i < part . size ; i ++ ) { y = multiply ( y , x ) ^ ( part . data [ i ] & 0xFF ) ; } return y ; |
public class StringMap { /** * Get a map entry by substring key .
* @ param key String containing the key
* @ param offset Offset of the key within the String .
* @ param length The length of the key
* @ return The Map . Entry for the key or null if the key is not in
* the map . */
public Map . Entry getEntry... | if ( key == null ) return _nullEntry ; Node node = _root ; int ni = - 1 ; // look for best match
charLoop : for ( int i = 0 ; i < length ; i ++ ) { char c = key . charAt ( offset + i ) ; // Advance node
if ( ni == - 1 ) { ni = 0 ; node = ( node . _children == null ) ? null : node . _children [ c % _width ] ; } // Look ... |
public class HttpDataFetcher { /** * Allows fetching and saving a bunch of objects to the specified directory from a server that uses a REST or REST - like API
* where each object is retrieved from the URL formed appending the object ' s identifier to the path of the the base URL , and
* optionally from a server th... | // check mandatory parameters
requireNonNull ( baseUrl , "A valid URL expected" ) ; final FecthFuture toBeCompleted = new FecthFuture ( requireNonNull ( ids , "A valid list of identifiers expected" ) . stream ( ) . map ( StringUtils :: trimToNull ) . filter ( Objects :: nonNull ) . distinct ( ) . collect ( Collectors .... |
public class PowerAdapters { /** * Returns the specified { @ link PowerAdapter } as a { @ link SpinnerAdapter } .
* < strong > Note that the supplied adapter must only ever use a single view type < / strong > , due to constraints
* imposed by { @ link Spinner # setAdapter ( SpinnerAdapter ) } .
* @ param powerAda... | // SpinnerAdapter adds additional constraints to the ListAdapter contract : getViewTypeCount must return 1.
// See android . widget . Spinner . setAdapter ( )
return new ListAdapterConverterAdapter ( checkNotNull ( powerAdapter , "powerAdapter" ) , 1 ) ; |
public class AbstractBcX509ExtensionBuilder { /** * Add an extension .
* @ param oid the extension oid .
* @ param critical true if the extension is critical .
* @ param value the value of the extension .
* @ return this extensions builder to allow chaining . */
public X509ExtensionBuilder addExtension ( ASN1Ob... | try { this . extensions . addExtension ( oid , critical , value . toASN1Primitive ( ) . getEncoded ( ASN1Encoding . DER ) ) ; } catch ( IOException e ) { // Very unlikely
throw new IllegalArgumentException ( "Invalid extension value, it could not be properly DER encoded." ) ; } return this ; |
public class Dag { /** * Update the final dag status .
* @ param failed true if any of the jobs has failed */
private void updateDagStatusInternal ( final boolean failed ) { } } | if ( this . status == Status . KILLING ) { /* It ' s possible that some nodes have failed when the dag is killed .
Since killing a dag signals an intent from an operator , it is more important to make
the dag status reflect the result of that explict intent . e . g . if the killing is a
result of handing a job fa... |
public class AnnotationConfigServletWebApplicationContext { /** * { @ inheritDoc }
* Delegates given environment to underlying { @ link AnnotatedBeanDefinitionReader } and
* { @ link ClassPathBeanDefinitionScanner } members . */
@ Override public void setEnvironment ( ConfigurableEnvironment environment ) { } } | super . setEnvironment ( environment ) ; this . reader . setEnvironment ( environment ) ; this . scanner . setEnvironment ( environment ) ; |
public class MessagePattern { /** * Parses a MessageFormat pattern string .
* @ param pattern a MessageFormat pattern string
* @ return this
* @ throws IllegalArgumentException for syntax errors in the pattern string
* @ throws IndexOutOfBoundsException if certain limits are exceeded
* ( e . g . , argument nu... | preParse ( pattern ) ; parseMessage ( 0 , 0 , 0 , ArgType . NONE ) ; postParse ( ) ; return this ; |
public class AbstractVirtualHostBuilder { /** * Binds the specified annotated service object under the path prefix { @ code " / " } .
* @ param exceptionHandlersAndConverters instances of { @ link ExceptionHandlerFunction } ,
* { @ link RequestConverterFunction } and / or
* { @ link ResponseConverterFunction } */... | return annotatedService ( "/" , service , decorator , ImmutableList . copyOf ( requireNonNull ( exceptionHandlersAndConverters , "exceptionHandlersAndConverters" ) ) ) ; |
public class Cracker { /** * Used for IsSimple . */
static boolean needsCracking ( boolean allowCoincident , EditShape shape , double tolerance , NonSimpleResult result , ProgressTracker progress_tracker ) { } } | if ( ! canBeCracked ( shape ) ) return false ; Cracker cracker = new Cracker ( progress_tracker ) ; cracker . m_shape = shape ; cracker . m_tolerance = tolerance ; cracker . m_bAllowCoincident = allowCoincident ; if ( cracker . needsCrackingImpl_ ( ) ) { if ( result != null ) result . Assign ( cracker . m_non_simple_re... |
public class ns_conf_upgrade_history { /** * < pre >
* Use this operation to get ns . conf file upgrade history .
* < / pre > */
public static ns_conf_upgrade_history [ ] get ( nitro_service client ) throws Exception { } } | ns_conf_upgrade_history resource = new ns_conf_upgrade_history ( ) ; resource . validate ( "get" ) ; return ( ns_conf_upgrade_history [ ] ) resource . get_resources ( client ) ; |
public class HelperBase { /** * Gets a substring between the begin and end boundaries
* @ param string
* original string
* @ param begin
* start boundary
* @ param end
* end boundary
* @ return substring between boundaries */
public String substringBetween ( String string , String begin , String end ) { }... | return substringBetween ( string , begin , end , false ) ; |
public class Qualifier { /** * Extracts qualifier namespace part from given qualifier string .
* @ param qualifierAsString qualifier string .
* @ return qualifier namespace . */
public static String getQualifierNamespace ( String qualifierAsString ) { } } | int pos = qualifierAsString . indexOf ( DELIMITER , 1 ) ; if ( pos == - 1 ) { throw new IllegalArgumentException ( "Wrong qualifier format: '" + qualifierAsString + "'" ) ; } return qualifierAsString . substring ( 1 , pos ) ; |
public class MountTable { /** * Get the associated ufs client with the mount id .
* @ param mountId mount id to look up ufs client
* @ return ufsClient */
public UfsManager . UfsClient getUfsClient ( long mountId ) { } } | try { return mUfsManager . get ( mountId ) ; } catch ( NotFoundException | UnavailableException e ) { LOG . warn ( "failed to get ufsclient for mountid {}, exception {}" , mountId , e ) ; } return null ; |
public class AbstractReady { /** * { @ inheritDoc } */
@ Override public final < M extends Model > M getModel ( final Class < M > clazz , final Object ... keyPart ) { } } | localFacade ( ) . globalFacade ( ) . trackEvent ( JRebirthEventType . ACCESS_MODEL , this . getClass ( ) , clazz ) ; return localFacade ( ) . globalFacade ( ) . uiFacade ( ) . retrieve ( clazz , keyPart ) ; |
public class MessagePattern { /** * Parses a number from the specified message substring .
* @ param start start index into the message string
* @ param limit limit index into the message string , must be start < limit
* @ param allowInfinity true if U + 221E is allowed ( for ChoiceFormat ) */
private void parseD... | assert start < limit ; // fake loop for easy exit and single throw statement
for ( ; ; ) { // fast path for small integers and infinity
int value = 0 ; int isNegative = 0 ; // not boolean so that we can easily add it to value
int index = start ; char c = msg . charAt ( index ++ ) ; if ( c == '-' ) { isNegative = 1 ; if... |
public class TriangulateMetricLinearDLT { /** * Given two observations of the same point from two views and a known motion between the
* two views , triangulate the point ' s position in camera ' b ' reference frame .
* Modification of [ 1 ] to be less generic and use calibrated cameras .
* @ param a Observation ... | A . reshape ( 4 , 4 ) ; int index = addView ( fromAtoB , b , 0 ) ; // third row
A . data [ index ++ ] = - 1 ; A . data [ index ++ ] = 0 ; A . data [ index ++ ] = a . x ; A . data [ index ++ ] = 0 ; // fourth row
A . data [ index ++ ] = 0 ; A . data [ index ++ ] = - 1 ; A . data [ index ++ ] = a . y ; A . data [ index ]... |
public class DroolsStreamUtils { /** * This method reads the contents from the given input stream and returns the object . It is expected that
* the contents in the given stream was not compressed , and it was written by the corresponding
* streamOut methods of this class .
* @ param in
* @ return
* @ throws ... | return streamIn ( in , null , false ) ; |
public class Environment { /** * Returns the Java command to use .
* @ param javaHome the Java Home , if { @ code null } an attempt to determine the command will be done
* @ return the Java executable command */
public static String getJavaCommand ( final Path javaHome ) { } } | final Path resolvedJavaHome = javaHome == null ? findJavaHome ( ) : javaHome ; final String exe ; if ( resolvedJavaHome == null ) { exe = "java" ; } else { exe = resolvedJavaHome . resolve ( "bin" ) . resolve ( "java" ) . toString ( ) ; } if ( exe . contains ( " " ) ) { return "\"" + exe + "\"" ; } if ( WINDOWS ) { ret... |
public class BeaconParser { /** * Adds a < code > BeaconParser < / code > used for parsing extra BLE beacon advertisement packets for
* beacons that send multiple different advertisement packets ( for example , Eddystone - TLM )
* @ param extraDataParser a parser that must be configured with an " extra layout " pre... | // add an extra data parser only if it is not null and it is an extra frame parser
return extraDataParser != null && extraDataParser . mExtraFrame && extraParsers . add ( extraDataParser ) ; |
public class SerializedFormBuilder { /** * Returns true if the given TypeElement should be included
* in the serialized form .
* @ param te the TypeElement object to check for serializability . */
private static boolean serialClassInclude ( Utils utils , TypeElement te ) { } } | if ( utils . isEnum ( te ) ) { return false ; } if ( utils . isSerializable ( te ) ) { if ( ! utils . getSerialTrees ( te ) . isEmpty ( ) ) { return serialDocInclude ( utils , te ) ; } else if ( utils . isPublic ( te ) || utils . isProtected ( te ) ) { return true ; } else { return false ; } } return false ; |
public class CmsEditorBase { /** * Re - renders the form with the given entity data . < p >
* @ param newContent the entity data */
public void rerenderForm ( CmsEntity newContent ) { } } | m_validationHandler . setPaused ( true , m_entity ) ; m_entityBackend . changeEntityContentValues ( m_entity , newContent ) ; CmsType type = m_entityBackend . getType ( m_entity . getTypeName ( ) ) ; if ( ( m_tabInfos != null ) && ! m_tabInfos . isEmpty ( ) ) { int currentTab = m_formTabs . getSelectedIndex ( ) ; m_for... |
public class SQLLexer { /** * Get the DDL token , if any , at the start of this statement .
* @ return returns token , or null if it wasn ' t DDL */
public static String extractDDLToken ( String sql ) { } } | String ddlToken = null ; Matcher ddlMatcher = PAT_ANY_DDL_FIRST_TOKEN . matcher ( sql ) ; if ( ddlMatcher . find ( ) ) { ddlToken = ddlMatcher . group ( 1 ) . toLowerCase ( ) ; } return ddlToken ; |
public class DescribeConfigurationAggregatorSourcesStatusRequest { /** * Filters the status type .
* < ul >
* < li >
* Valid value FAILED indicates errors while moving data .
* < / li >
* < li >
* Valid value SUCCEEDED indicates the data was successfully moved .
* < / li >
* < li >
* Valid value OUTDA... | if ( updateStatus == null ) { this . updateStatus = null ; return ; } this . updateStatus = new com . amazonaws . internal . SdkInternalList < String > ( updateStatus ) ; |
public class JSONObject { /** * Get the BigDecimal value associated with a key .
* @ param key A key string .
* @ return The numeric value .
* @ throws JSONException if the key is not found or if the value cannot be
* converted to BigDecimal . */
public BigDecimal getBigDecimal ( String key ) throws JSONExcepti... | Object object = this . get ( key ) ; try { return new BigDecimal ( object . toString ( ) ) ; } catch ( Exception e ) { throw new JSONException ( "JSONObject[" + quote ( key ) + "] could not be converted to BigDecimal." ) ; } |
public class CleverTapAPI { /** * Sends the GCM registration ID to CleverTap .
* @ param gcmId The GCM registration ID
* @ param register Boolean indicating whether to register
* or not for receiving push messages from CleverTap .
* Set this to true to receive push messages from CleverTap ,
* and false to not... | pushDeviceToken ( gcmId , register , PushType . GCM ) ; |
public class Key { /** * Write the raw bytes of this key to the specified output stream .
* @ param outputStream
* the target
* @ throws IOException
* if the underlying I / O device cannot be written to */
public void writeTo ( final OutputStream outputStream ) throws IOException { } } | outputStream . write ( getSigningKey ( ) ) ; outputStream . write ( getEncryptionKey ( ) ) ; |
public class PlayEngine { /** * Seek to a given position
* @ param position
* Position
* @ throws IllegalStateException
* If stream is in stopped state
* @ throws OperationNotSupportedException
* If this object doesn ' t support the operation . */
public void seek ( int position ) throws IllegalStateExcepti... | // add this pending seek operation to the list
pendingOperations . add ( new SeekRunnable ( position ) ) ; cancelDeferredStop ( ) ; ensurePullAndPushRunning ( ) ; |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public OBPYoaOrent createOBPYoaOrentFromString ( EDataType eDataType , String initialValue ) { } } | OBPYoaOrent result = OBPYoaOrent . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class UIRegistryAmicableImpl { /** * Retrieves the user interface that was registered with the given key . If the UI has not been registered , this
* attempts to load the UI using the key as a class name .
* @ param key The registration key .
* @ return the UI for the given key . The UI may be newly create... | WComponent ui = registry . get ( key ) ; if ( ui == null ) { // Looks like we haven ' t tried loading this UI yet , so do it now .
ui = loadUI ( key ) ; ui . setLocked ( true ) ; // Cache the result only if the UI was successfully loaded .
if ( ui instanceof ErrorPage ) { LOG . debug ( "Returning non-cached ErrorPage W... |
public class EventSubscriber { /** * if returns null , returnCode and errorMessage already set */
protected Response createNotifyResponse ( RequestEvent request , int status , String reason , List < Header > additionalHeaders ) { } } | // when used internally - WATCH OUT - retcode , errorMessage initialized here
initErrorInfo ( ) ; if ( ( request == null ) || ( request . getRequest ( ) == null ) ) { setReturnCode ( SipSession . INVALID_ARGUMENT ) ; setErrorMessage ( "Null request given for creating NOTIFY response" ) ; return null ; } Request req = r... |
public class FeatureWebSecurityConfigImpl { /** * { @ inheritDoc } */
@ Override public boolean isTrackLoggedOutSSOCookiesEnabled ( ) { } } | WebAppSecurityConfig globalConfig = WebAppSecurityCollaboratorImpl . getGlobalWebAppSecurityConfig ( ) ; if ( globalConfig != null ) return WebAppSecurityCollaboratorImpl . getGlobalWebAppSecurityConfig ( ) . isTrackLoggedOutSSOCookiesEnabled ( ) ; else return trackLoggedOutSSOCookies ; |
public class ExtendedSIFWriter { /** * Writes down the interaction participants ' ( nodes ) details
* to the given output stream . Closes the stream at the end .
* @ param inters binary interactions
* @ param out stream to write
* @ return true if any output produced successfully */
public static boolean writeP... | if ( ! inters . isEmpty ( ) ) { try { OutputStreamWriter writer = new OutputStreamWriter ( out ) ; writeSourceAndTargetDetails ( inters , writer ) ; writer . close ( ) ; return true ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return false ; |
public class SchemaManager { /** * Returns index of a table or view in the HashMappedList that
* contains the table objects for this Database .
* @ param table the Table object
* @ return the index of the specified table or view , or - 1 if not found */
int getTableIndex ( Table table ) { } } | Schema schema = ( Schema ) schemaMap . get ( table . getSchemaName ( ) . name ) ; if ( schema == null ) { return - 1 ; } HsqlName name = table . getName ( ) ; return schema . tableList . getIndex ( name . name ) ; |
public class JSON { /** * 解析为指定对象
* @ param text json字符串
* @ param clazz 指定类
* @ param < T > 指定对象
* @ return 指定对象 */
public static < T > T parseObject ( String text , Class < T > clazz ) { } } | Object obj = JSONSerializer . deserialize ( text ) ; return BeanSerializer . deserializeByType ( obj , clazz ) ; |
public class ValidationObjUtil { /** * Obj deep copy object .
* @ param from the from
* @ param to the to
* @ param copyFields the copy fields
* @ return the object */
public static Object objDeepCopy ( Object from , Object to , String ... copyFields ) { } } | if ( from == null || to == null ) { log . error ( "object deep copy from or to is null " ) ; return to ; } for ( String field : copyFields ) { copyFromTo ( from , to , field ) ; } return to ; |
public class AbstractKMeans { /** * Returns the mean vectors of the given clusters in the given database .
* @ param clusters the clusters to compute the means
* @ param means the recent means
* @ param relation the database containing the vectors
* @ return the mean vectors of the given clusters in the given d... | final int k = means . length ; double [ ] [ ] newMeans = new double [ k ] [ ] ; for ( int i = 0 ; i < k ; i ++ ) { DBIDs list = clusters . get ( i ) ; if ( list . isEmpty ( ) ) { // Keep degenerated means as - is for now .
newMeans [ i ] = means [ i ] ; continue ; } DBIDIter iter = list . iter ( ) ; // Initialize with ... |
public class DefaultEventbus { /** * - - - ADD LOCAL LISTENER - - - */
@ Override public void addListeners ( String serviceName , Service service ) { } } | // Service name with version
String name = ( serviceName == null || serviceName . isEmpty ( ) ) ? service . getName ( ) : serviceName ; Class < ? extends Service > clazz = service . getClass ( ) ; Field [ ] fields = clazz . getFields ( ) ; boolean hasListener = false ; writeLock . lock ( ) ; try { // Initialize listene... |
public class ServiceDiscoveryManager { /** * Queries the remote entity for it ' s features and returns true if the given feature is found .
* @ param jid the JID of the remote entity
* @ param feature
* @ return true if the entity supports the feature , false otherwise
* @ throws XMPPErrorException
* @ throws... | return supportsFeatures ( jid , feature ) ; |
public class ScopeImpl { /** * Resets the state of the scope .
* Useful for automation testing when we want to reset the scope used to install test modules . */
@ Override protected void reset ( ) { } } | super . reset ( ) ; mapClassesToNamedBoundProviders . clear ( ) ; mapClassesToUnNamedBoundProviders . clear ( ) ; hasTestModules = false ; installBindingForScope ( ) ; |
public class TemplateDelegateNodeBuilder { /** * Private helper for both setCmdText ( ) and setCmdTextInfo ( ) to generate and set the internal - use
* partial template name and template name . */
private void genInternalTemplateNameHelper ( ) { } } | Preconditions . checkState ( id != null ) ; // encode all the deltemplate information into the name to get a unique string
// though . . . it might make more sense for this to not have a user visible name given that the
// calling convention is indirect .
String variant = "" ; if ( delTemplateVariantExpr != null ) { //... |
public class KeyVaultClientBaseImpl { /** * Restores a backed up certificate to a vault .
* Restores a backed up certificate , and all its versions , to a vault . This operation requires the certificates / restore permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure .... | return ServiceFuture . fromResponse ( restoreCertificateWithServiceResponseAsync ( vaultBaseUrl , certificateBundleBackup ) , serviceCallback ) ; |
public class ArrayMap { /** * Sets the value at the given index , overriding any existing value mapping .
* @ return previous value or { @ code null } for none
* @ throws IndexOutOfBoundsException if index is negative or { @ code > = } size */
public final V set ( int index , V value ) { } } | int size = this . size ; if ( index < 0 || index >= size ) { throw new IndexOutOfBoundsException ( ) ; } int valueDataIndex = 1 + ( index << 1 ) ; V result = valueAtDataIndex ( valueDataIndex ) ; this . data [ valueDataIndex ] = value ; return result ; |
public class AuthorizationImpl { /** * Answers if the principal has permission to RENDER this Channel . This implementation currently
* delegates to the SUBSCRIBE permission .
* @ return boolean
* @ param principal IAuthorizationPrincipal
* @ param portletDefinitionId
* @ exception AuthorizationException indi... | // This code simply assumes that anyone who can subscribe to a channel
// should be able to render it . In the future , we ' d like to update this
// implementation to use a separate permission for rendering .
return canPrincipalSubscribe ( principal , portletDefinitionId ) ; |
public class DescribeActivityRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeActivityRequest describeActivityRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeActivityRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeActivityRequest . getActivityArn ( ) , ACTIVITYARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JS... |
public class Computer { /** * Really deletes the agent . */
@ RequirePOST public HttpResponse doDoDelete ( ) throws IOException { } } | checkPermission ( DELETE ) ; Node node = getNode ( ) ; if ( node != null ) { Jenkins . getInstance ( ) . removeNode ( node ) ; } else { AbstractCIBase app = Jenkins . getInstance ( ) ; app . removeComputer ( this ) ; } return new HttpRedirect ( ".." ) ; |
public class Op { /** * Creates a set with the specified elements and an < i > operation expression < / i > on it .
* @ param elements the elements of the set being created
* @ return an operator , ready for chaining */
public static < T > Level0SetOperator < Set < T > , T > onSetFor ( final T ... elements ) { } } | return new Level0SetOperator < Set < T > , T > ( ExecutionTarget . forOp ( VarArgsUtil . asRequiredObjectSet ( elements ) , Normalisation . SET ) ) ; |
public class ClassIndexProcessor { /** * Adds given classes for subclass indexing . */
protected final void indexSubclasses ( Class < ? > ... classes ) { } } | for ( Class < ? > klass : classes ) { indexedSuperclasses . add ( klass . getCanonicalName ( ) ) ; } annotationDriven = false ; |
public class AsyncAuditOutputStream { /** * { @ inheritDoc }
* @ see org . audit4j . core . io . AuditOutputStream # write ( org . audit4j . core . dto . Event ) */
@ Override public AsyncAuditOutputStream write ( AuditEvent event ) { } } | if ( event instanceof AnnotationAuditEvent ) { annotationStream . write ( ( AnnotationAuditEvent ) event ) ; } else { deferred . accept ( event ) ; b . await ( ) ; } return this ; |
public class RedactClient { /** * Submit a request to the Redact API to redact a transaction .
* @ param id The transaction id to redact .
* @ param product The { @ link com . nexmo . client . redact . RedactRequest . Product } which corresponds to the transaction .
* @ throws IOException if a network error occur... | this . redactTransaction ( new RedactRequest ( id , product ) ) ; |
public class SelectParametersMarshaller { /** * Marshall the given parameter object . */
public void marshall ( SelectParameters selectParameters , ProtocolMarshaller protocolMarshaller ) { } } | if ( selectParameters == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( selectParameters . getInputSerialization ( ) , INPUTSERIALIZATION_BINDING ) ; protocolMarshaller . marshall ( selectParameters . getExpressionType ( ) , EXPRESSIONTYPE_... |
public class ConfigResolver { /** * Resolve the specified map and store it in the specified target .
* @ param root
* @ param target
* @ return */
public static Map < String , Object > resolveTo ( Map < String , Object > root , Map < String , Object > target ) { } } | resolve ( target , root , "" ) ; return target ; |
public class StyleUtil { /** * Create a non - filtered rule with the specified title , name and symbolizer .
* @ param title the title
* @ param name the name
* @ param symbolizer the symbolizer
* @ return the rule */
public static RuleInfo createRule ( String title , String name , SymbolizerTypeInfo symbolizer... | RuleInfo rule = new RuleInfo ( ) ; rule . setTitle ( title ) ; rule . setName ( name ) ; rule . getSymbolizerList ( ) . add ( symbolizer ) ; return rule ; |
public class DateContext { /** * Create a { @ link Date } instance from the given string using the default
* input format < code > yyyyMMdd < / code > .
* @ param dateString The string from which to create a date
* @ return The { @ link Date } instance representing date string
* @ throws ParseException if the d... | Date result = null ; synchronized ( cFormatter ) { result = cFormatter . parse ( dateString ) ; } return result ; |
public class FileParser { /** * In order to determine the correct file parser , you can provide the URI and this method
* will find the appropriate parser to use
* @ param uri The Uri of the file you are parsing
* @ param identifier This interface can be generated in order to handle different actions
* based on... | if ( uri . startsWith ( "file://" ) ) identifier . onLocalFile ( ) ; else if ( uri . startsWith ( "http://" ) ) identifier . onHttpFile ( ) ; else if ( uri . startsWith ( "android.resource://" ) ) identifier . onAsset ( ) ; |
public class RtcpHandler { /** * Disconnects and closes the datagram channel used to send and receive RTCP traffic . */
private void closeChannel ( ) { } } | if ( this . channel != null ) { if ( this . channel . isConnected ( ) ) { try { this . channel . disconnect ( ) ; } catch ( IOException e ) { logger . warn ( e . getMessage ( ) , e ) ; } } if ( this . channel . isOpen ( ) ) { try { this . channel . close ( ) ; } catch ( IOException e ) { logger . warn ( e . getMessage ... |
public class SpiderService { /** * Create a DBObject from the given scalar / link column values . */
private DBObject createObject ( TableDefinition tableDef , String objID , Iterator < DColumn > colIter ) { } } | DBObject dbObj = new DBObject ( ) ; dbObj . setObjectID ( objID ) ; dbObj . setTableName ( tableDef . getTableName ( ) ) ; while ( colIter . hasNext ( ) ) { DColumn col = colIter . next ( ) ; Pair < String , String > linkCol = extractLinkValue ( tableDef , col . getName ( ) ) ; if ( linkCol == null ) { String fieldName... |
public class NamedVersion { /** * People use all sorts of whack characters in version . We are just excluding
* the smallest set that we can . */
public boolean isValidNamedVersion ( final String s ) { } } | if ( SEMANTIC_RANGE_SPECIAL_CHARS . matcher ( s ) . find ( ) || SET_RANGE_SPECIAL_CHARS . matcher ( s ) . find ( ) || INVALID_VERSION_CHARS . matcher ( s ) . find ( ) ) { return false ; } return true ; |
public class Anvil { /** * Returns currently rendered View . It allows to access the real view from
* inside the Renderable .
* @ return currently rendered View */
@ SuppressWarnings ( "unchecked" ) public static < T extends View > T currentView ( ) { } } | if ( currentMount == null ) { return null ; } return ( T ) currentMount . iterator . currentView ( ) ; |
public class Logger { /** * Issue a formatted log message with a level of ERROR .
* @ param t the throwable
* @ param format the format string , as per { @ link String # format ( String , Object . . . ) }
* @ param params the parameters */
public void errorf ( Throwable t , String format , Object ... params ) { }... | doLogf ( Level . ERROR , FQCN , format , params , t ) ; |
public class CmsClientSitemapEntry { /** * Sets the children . < p >
* @ param children the children to set
* @ param controller a sitemap controller instance */
public void setSubEntries ( List < CmsClientSitemapEntry > children , I_CmsSitemapController controller ) { } } | m_childrenLoadedInitially = true ; m_subEntries . clear ( ) ; if ( children != null ) { m_subEntries . addAll ( children ) ; for ( CmsClientSitemapEntry child : children ) { child . updateSitePath ( CmsStringUtil . joinPaths ( m_sitePath , child . getName ( ) ) , controller ) ; } } |
public class UpdateCertificateOptionsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdateCertificateOptionsRequest updateCertificateOptionsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( updateCertificateOptionsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateCertificateOptionsRequest . getCertificateArn ( ) , CERTIFICATEARN_BINDING ) ; protocolMarshaller . marshall ( updateCertificateOptionsRequest . ge... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.