signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class MainScene { /** * Scale all widgets in Main Scene hierarchy
* @ param scale */
public void setScale ( final float scale ) { } } | if ( equal ( mScale , scale ) != true ) { Log . d ( TAG , "setScale(): old: %.2f, new: %.2f" , mScale , scale ) ; mScale = scale ; setScale ( mSceneRootObject , scale ) ; setScale ( mMainCameraRootObject , scale ) ; setScale ( mLeftCameraRootObject , scale ) ; setScale ( mRightCameraRootObject , scale ) ; for ( OnScale... |
public class ControlMessageFactoryImpl { /** * Create a new , empty ControlNotFlushed Message
* @ return The new ControlNotFlushed
* @ exception MessageCreateFailedException Thrown if such a message can not be created */
public final ControlNotFlushed createNewControlNotFlushed ( ) throws MessageCreateFailedExcepti... | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "createNewControlNotFlushed" ) ; ControlNotFlushed msg = null ; try { msg = new ControlNotFlushedImpl ( MfpConstants . CONSTRUCTOR_NO_OP ) ; } catch ( MessageDecodeFailedException e ) { /* No need to FFDC this as JsMsgObject... |
public class DefaultCloseUpAlgorithm { /** * { @ inheritDoc } */
@ Override public int getFlingFinalY ( ScrollableLayout layout , boolean isScrollingBottom , int nowY , int suggestedY , int maxY ) { } } | return isScrollingBottom ? 0 : maxY ; |
public class AmazonLightsailClient { /** * Deletes a specific static IP from your account .
* @ param releaseStaticIpRequest
* @ return Result of the ReleaseStaticIp operation returned by the service .
* @ throws ServiceException
* A general service exception .
* @ throws InvalidInputException
* Lightsail t... | request = beforeClientExecution ( request ) ; return executeReleaseStaticIp ( request ) ; |
public class PipeInterceptor { /** * 对于jsp , 则这个代码不会生效 ( isStarted会返回true ) */
@ Override public void afterCompletion ( Invocation inv , Throwable ex ) throws Exception { } } | if ( ex != null ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "close the pipe and returen because of exception previous." ) ; } return ; } PipeImpl pipe = ( PipeImpl ) PortalUtils . getPipe ( inv ) ; if ( pipe == null ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "there's no pipe windows." ) ; }... |
public class Project { /** * Retrieves the total done for all workitems in this project optionally
* filtered .
* @ param filter Criteria to filter workitems on .
* @ param includeChildProjects If true , include open sub projects , otherwise
* only include this project .
* @ return total done for selected wor... | filter = ( filter != null ) ? filter : new WorkitemFilter ( ) ; return getRollup ( "Workitems" , "Actuals.Value" , filter , includeChildProjects ) ; |
public class JsonSerializationContext { /** * Trace the current writer state
* @ param value current value */
private void traceWriterInfo ( Object value , JsonWriter writer ) { } } | if ( getLogger ( ) . isLoggable ( Level . INFO ) ) { getLogger ( ) . log ( Level . INFO , "Error on value <" + value + ">. Current output : <" + writer . getOutput ( ) + ">" ) ; } |
public class FileUtilities { /** * Write text to a file in one line .
* @ param text the text to write .
* @ param file the file to write to .
* @ throws IOException */
public static void writeFile ( String text , File file ) throws IOException { } } | try ( BufferedWriter bw = new BufferedWriter ( new FileWriter ( file ) ) ) { bw . write ( text ) ; } |
public class Timestamp { /** * Prints to an { @ code Appendable } the string representation ( in Ion format )
* of this Timestamp in UTC .
* This method produces the same output as { @ link # toZString ( ) } .
* @ param out not { @ code null }
* @ throws IOException propagated when the { @ code Appendable } thr... | switch ( _precision ) { case YEAR : case MONTH : case DAY : { assert _offset == UNKNOWN_OFFSET ; // No need to adjust offset , we won ' t be using it .
print ( out ) ; break ; } case MINUTE : case SECOND : case FRACTION : { Timestamp ztime = this . clone ( ) ; ztime . _offset = UTC_OFFSET ; ztime . print ( out ) ; brea... |
public class SAMInputFormat { /** * Returns a { @ link SAMRecordReader } initialized with the parameters . */
@ Override public RecordReader < LongWritable , SAMRecordWritable > createRecordReader ( InputSplit split , TaskAttemptContext ctx ) throws InterruptedException , IOException { } } | final RecordReader < LongWritable , SAMRecordWritable > rr = new SAMRecordReader ( ) ; rr . initialize ( split , ctx ) ; return rr ; |
public class CmsSearchDialog { /** * Creates the select widget configuration for the index names . < p >
* @ return the select widget configuration for the index names */
private List < CmsSelectWidgetOption > getSortNamesIndex ( ) { } } | List < CmsSelectWidgetOption > retVal = new ArrayList < CmsSelectWidgetOption > ( ) ; try { List < String > names = OpenCms . getSearchManager ( ) . getIndexNames ( ) ; for ( int i = 0 ; i < names . size ( ) ; i ++ ) { String indexName = names . get ( i ) ; String wpIndexName = getSettings ( ) . getUserSettings ( ) . g... |
public class CmsMultiListDialog { /** * Display method for two list dialogs , executes actions , but only displays if needed . < p >
* @ param writeLater if < code > true < / code > no output is written ,
* you have to call manually the < code > { @ link # defaultActionHtml ( ) } < / code > method .
* @ throws Js... | // perform the active list actions
m_activeWp . actionDialog ( ) ; if ( m_activeWp . isForwarded ( ) ) { return ; } Iterator < A_CmsListDialog > i = m_wps . iterator ( ) ; while ( i . hasNext ( ) ) { A_CmsListDialog wp = i . next ( ) ; wp . refreshList ( ) ; } if ( writeLater ) { return ; } writeDialog ( ) ; |
public class ContainerDefImpl { /** * / * ( non - Javadoc )
* @ see org . jboss . arquillian . impl . configuration . api . ContainerDef # getProtcols ( ) */
@ Override public List < ProtocolDef > getProtocols ( ) { } } | List < ProtocolDef > protocols = new ArrayList < ProtocolDef > ( ) ; for ( Node proto : container . get ( "protocol" ) ) { protocols . add ( new ProtocolDefImpl ( getDescriptorName ( ) , getRootNode ( ) , container , proto ) ) ; } return protocols ; |
public class ParameterAveragingTrainingMaster { /** * Create a ParameterAveragingTrainingMaster instance by deserializing a YAML string that has been serialized with
* { @ link # toYaml ( ) }
* @ param yamlStr ParameterAveragingTrainingMaster configuration serialized as YAML */
public static ParameterAveragingTrain... | ObjectMapper om = getYamlMapper ( ) ; try { return om . readValue ( yamlStr , ParameterAveragingTrainingMaster . class ) ; } catch ( IOException e ) { throw new RuntimeException ( "Could not parse YAML" , e ) ; } |
public class SequenceFile { /** * Construct the preferred type of ' raw ' SequenceFile Writer .
* @ param conf The configuration .
* @ param out The stream on top which the writer is to be constructed .
* @ param keyClass The ' key ' type .
* @ param valClass The ' value ' type .
* @ param compressionType The... | if ( ( codec instanceof GzipCodec ) && ! NativeCodeLoader . isNativeCodeLoaded ( ) && ! ZlibFactory . isNativeZlibLoaded ( conf ) ) { throw new IllegalArgumentException ( "SequenceFile doesn't work with " + "GzipCodec without native-hadoop code!" ) ; } Writer writer = null ; if ( compressionType == CompressionType . NO... |
public class DispatcherServlet { /** * Handles all requests ( by default ) .
* @ param request HttpServletRequest object containing client request .
* @ param response HttpServletResponse object for the response . */
protected void doRequest ( HttpServletRequest request , HttpServletResponse response ) throws Servl... | InvocationContext context = null ; try { context = new InvocationContext ( request , response ) ; setContentType ( request , response ) ; Template template = handleRequest ( request , response , context ) ; if ( template != null ) { mergeTemplate ( template , context ) ; } } catch ( Exception e ) { log . warning ( "doR... |
public class SocketChannelListener { /** * @ see org . browsermob . proxy . jetty . http . HttpListener # getHost ( ) */
public String getHost ( ) { } } | if ( _address == null || _address . getAddress ( ) == null ) return null ; return _address . getHostName ( ) ; |
public class FreeMarkerTag { /** * Gets an object from context - by name .
* @ param name name of object
* @ return object or null if not found . */
protected Object getUnwrapped ( Object name ) { } } | try { return DeepUnwrap . unwrap ( get ( name ) ) ; } catch ( TemplateException e ) { throw new ViewException ( e ) ; } |
public class XPathUtils { /** * Creates a new { @ link XPathUtils } instance .
* @ param is The { @ link InputStream } with XML data .
* @ return A new { @ link XPathUtils } instance .
* @ throws SAXException If there ' s a SAX error in the XML .
* @ throws IOException If there ' s an IO error reading the strea... | final XPathFactory xpfactory = XPathFactory . newInstance ( ) ; final XPath xPath = xpfactory . newXPath ( ) ; final Document doc = XmlUtils . toDoc ( is ) ; return new XPathUtils ( xPath , doc ) ; |
public class DRL5Expressions { /** * src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 614:1 : innerCreator : { . . . } ? = > ID classCreatorRest ; */
public final void innerCreator ( ) throws RecognitionException { } } | try { // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 615:5 : ( { . . . } ? = > ID classCreatorRest )
// src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 615:7 : { . . . } ? = > ID classCreatorRest
{ if ( ! ( ( ! ( helper . validateIdentifierKey ( Drools... |
public class DualInputSemanticProperties { /** * Adds , to the existing information , field ( s ) that are read in
* the source record ( s ) from the first input .
* @ param input the input of the read fields
* @ param readFields the position ( s ) in the source record ( s ) */
public void addReadFields ( int inp... | if ( input != 0 && input != 1 ) { throw new IndexOutOfBoundsException ( ) ; } else if ( input == 0 ) { this . readFields1 = ( this . readFields1 == null ) ? readFields . clone ( ) : this . readFields1 . addFields ( readFields ) ; } else { this . readFields2 = ( this . readFields2 == null ) ? readFields . clone ( ) : th... |
public class MaterialRippleLayout { /** * Drawing */
@ Override public void draw ( @ NonNull Canvas canvas ) { } } | final boolean positionChanged = adapterPositionChanged ( ) ; if ( rippleOverlay ) { super . draw ( canvas ) ; if ( ! positionChanged ) { if ( rippleRoundedCornersPx != 0 ) { Path clipPath = new Path ( ) ; RectF rect = new RectF ( 0 , 0 , canvas . getWidth ( ) , canvas . getHeight ( ) ) ; clipPath . addRoundRect ( rect ... |
public class CEMIFactory { /** * Creates a new cEMI message with information provided by < code > original < / code > , and adjusts it
* to match the supplied < code > msgCode < / code > and < code > data < / code > .
* The message code has to correspond to the type of cEMI frame supplied with
* < code > original... | switch ( msgCode ) { case CEMILData . MC_LDATA_REQ : case CEMILData . MC_LDATA_CON : case CEMILData . MC_LDATA_IND : return create ( msgCode , null , null , data , ( CEMILData ) original , false , ( ( CEMILData ) original ) . isRepetition ( ) ) ; case CEMIDevMgmt . MC_PROPREAD_REQ : case CEMIDevMgmt . MC_PROPREAD_CON :... |
public class CompressionUtil { /** * Compress a file using the given { @ link CompressionMethod } .
* @ param _ method
* @ param _ sourceFile
* @ param _ outputFileName
* @ return file object which represents the compressed file or null on error */
public static File compress ( CompressionMethod _method , Strin... | if ( _method == null || _sourceFile == null ) { return null ; } File inputFile = new File ( _sourceFile ) ; if ( ! inputFile . exists ( ) ) { return null ; } byte [ ] buffer = new byte [ 1024 ] ; try { Constructor < ? extends DeflaterOutputStream > constructor = _method . getOutputStreamClass ( ) . getConstructor ( Out... |
public class AmqpMessageDispatcherService { /** * Method to send a message to a RabbitMQ Exchange after a Target was
* deleted .
* @ param deleteEvent
* the TargetDeletedEvent which holds the necessary data for
* sending a target delete message . */
@ EventListener ( classes = TargetDeletedEvent . class ) prote... | if ( isNotFromSelf ( deleteEvent ) ) { return ; } sendDeleteMessage ( deleteEvent . getTenant ( ) , deleteEvent . getControllerId ( ) , deleteEvent . getTargetAddress ( ) ) ; |
public class MiscUtil { /** * Can be used to append a String to a formatter .
* @ param formatter
* The { @ link java . util . Formatter Formatter }
* @ param width
* Minimum width to meet , filled with space if needed
* @ param precision
* Maximum amount of characters to append
* @ param leftJustified
... | try { Appendable appendable = formatter . out ( ) ; if ( precision > - 1 && out . length ( ) > precision ) { appendable . append ( Helpers . truncate ( out , precision ) ) ; return ; } if ( leftJustified ) appendable . append ( Helpers . rightPad ( out , width ) ) ; else appendable . append ( Helpers . leftPad ( out , ... |
public class HSBColor { /** * Convert HSB ( Hue , Saturation , Brightness ) to RGB values .
* @ param hue
* @ param saturation
* @ param brightness
* @ return
* RGB values . */
private static final double [ ] getRGB ( double hue , double saturation , double brightness ) { } } | double [ ] rgb = { 0.0 , 0.0 , 0.0 } ; double tmpHue = hue * 360.0 ; int hi ; double f ; double p , q , t ; hi = ( int ) Math . floor ( tmpHue / 60.0 ) % 6 ; f = tmpHue / 60.0 - hi ; p = ( brightness * ( 1.0 - saturation ) ) ; q = ( brightness * ( 1.0 - saturation * f ) ) ; t = ( brightness * ( 1.0 - saturation * ( 1.0... |
public class WeekResultsPartitioner { /** * / * ( non - Javadoc )
* @ see org . archive . wayback . resultspartitioner . ResultsPartitioner # alignStart ( java . util . Calendar ) */
protected void alignStart ( Calendar start ) { } } | start . set ( Calendar . HOUR_OF_DAY , 1 ) ; start . set ( Calendar . MINUTE , 1 ) ; start . set ( Calendar . SECOND , 1 ) ; |
public class RedisCache { /** * Replaces the entry for a key only if currently mapped to some value .
* This is equivalent to
* < pre >
* if ( map . containsKey ( key ) ) {
* return map . put ( key , value ) ;
* } else return null ; < / pre >
* except that the action is performed atomically .
* @ param ke... | return rMap . replace ( key , value ) ; |
public class BinarySet { /** * { @ inheritDoc }
* @ param e
* @ return */
@ Override public E lower ( E e ) { } } | int idx = indexOf ( e ) ; if ( idx >= 1 ) { return list . get ( idx - 1 ) ; } else { int ip = insertPoint ( idx ) ; if ( ip >= 1 ) { return list . get ( ip - 1 ) ; } else { return null ; } } |
public class CmsGalleryField { /** * Sets the image preview . < p >
* @ param realPath the actual image path
* @ param imagePath the image path */
protected void setImagePreview ( String realPath , String imagePath ) { } } | if ( ( m_croppingParam == null ) || ! getFormValueAsString ( ) . contains ( m_croppingParam . toString ( ) ) ) { m_croppingParam = CmsCroppingParamBean . parseImagePath ( getFormValueAsString ( ) ) ; } CmsCroppingParamBean restricted ; int marginTop = 0 ; if ( m_croppingParam . getScaleParam ( ) . isEmpty ( ) ) { image... |
public class UpgradeProcess { /** * Deploys a bundle .
* @ param bundleLocation
* Location of a jar file or a maven project where target / classes contains every necessary entries .
* @ param startBundle
* Whether to try calling start on the installed bundle or not . If the bundle is a fragment bundle , start
... | stateChanged = true ; if ( startLevel != null && startLevel < currentFrameworkStartLevelValue ) { setFrameworkStartLevel ( startLevel ) ; } File bundleFile = convertURIToFile ( bundleLocation ) ; String bundleLocationString = bundleLocation . toString ( ) ; Bundle installedBundle = null ; BundleData bundleData = getBun... |
public class TrailingHeaders { /** * Adds an HTTP trailing header with the passed { @ code name } and { @ code value } to this request .
* @ param name Name of the header .
* @ param value Value for the header .
* @ return { @ code this } . */
public TrailingHeaders addHeader ( CharSequence name , Object value ) ... | lastHttpContent . trailingHeaders ( ) . add ( name , value ) ; return this ; |
public class WebStatFilter { /** * < p > isExclusion . < / p >
* @ param requestURI a { @ link java . lang . String } object .
* @ return a boolean . */
public boolean isExclusion ( String requestURI ) { } } | if ( excludesPattern == null ) { return false ; } if ( contextPath != null && requestURI . startsWith ( contextPath ) ) { requestURI = requestURI . substring ( contextPath . length ( ) ) ; if ( ! requestURI . startsWith ( "/" ) ) { requestURI = "/" + requestURI ; } } for ( String pattern : excludesPattern ) { if ( path... |
public class ImgUtil { /** * 给图片添加文字水印 < br >
* 此方法并不关闭流
* @ param srcImage 源图像
* @ param destFile 目标流
* @ param pressText 水印文字
* @ param color 水印的字体颜色
* @ param font { @ link Font } 字体相关信息 , 如果默认则为 { @ code null }
* @ param x 修正值 。 默认在中间 , 偏移量相对于中间偏移
* @ param y 修正值 。 默认在中间 , 偏移量相对于中间偏移
* @ param alp... | write ( pressText ( srcImage , pressText , color , font , x , y , alpha ) , destFile ) ; |
public class mps_network_config { /** * Use this API to fetch filtered set of mps _ network _ config resources .
* filter string should be in JSON format . eg : " vm _ state : DOWN , name : [ a - z ] + " */
public static mps_network_config [ ] get_filtered ( nitro_service service , String filter ) throws Exception { ... | mps_network_config obj = new mps_network_config ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; mps_network_config [ ] response = ( mps_network_config [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class Base64Serializer { /** * Serialize object to an encoded base64 string . */
public String serialize ( Object object ) { } } | ObjectOutputStream oos = null ; ByteArrayOutputStream bos = null ; try { bos = new ByteArrayOutputStream ( ) ; oos = new ObjectOutputStream ( bos ) ; oos . writeObject ( object ) ; return new String ( Base64 . encodeBase64 ( bos . toByteArray ( ) ) ) ; } catch ( IOException e ) { LOGGER . error ( "Can't serialize data ... |
public class ClassBuilder { /** * Add the static inner Binder wrapper */
private TypeSpec getBinderWrapper ( ) { } } | TypeSpec . Builder staticBinderWrapperClassBuilder = TypeSpec . classBuilder ( "BinderWrapper" ) . addModifiers ( Modifier . PRIVATE ) . addModifiers ( Modifier . STATIC ) . addField ( ClassName . get ( "android.os" , "IBinder" ) , "binder" , Modifier . PRIVATE ) . addMethod ( MethodSpec . constructorBuilder ( ) . addP... |
public class CmsCoreService { /** * Returns the workplace link . < p >
* @ param cms the cms context
* @ param structureId the structure id of the current resource
* @ return the workplace link */
public static String getVaadinWorkplaceLink ( CmsObject cms , CmsUUID structureId ) { } } | String resourceRootFolder = null ; if ( structureId != null ) { try { resourceRootFolder = CmsResource . getFolderPath ( cms . readResource ( structureId , CmsResourceFilter . ONLY_VISIBLE_NO_DELETED ) . getRootPath ( ) ) ; } catch ( CmsException e ) { LOG . debug ( "Error reading resource for workplace link." , e ) ; ... |
public class ParadataManager { /** * Return all paradata for a resource of all types from all submitters for the resource
* @ param resourceUrl
* @ return
* @ throws Exception */
public List < ISubmission > getSubmissions ( String resourceUrl ) throws Exception { } } | ParadataFetcher fetcher = new ParadataFetcher ( node , resourceUrl ) ; return fetcher . getSubmissions ( ) ; |
public class CodedInputStream { /** * Reads a varint from the input one byte at a time , so that it does not
* read any bytes after the end of the varint . If you simply wrapped the
* stream in a CodedInputStream and used { @ link # readRawVarint32 ( InputStream ) }
* then you would probably end up reading past t... | final int firstByte = input . read ( ) ; if ( firstByte == - 1 ) { throw InvalidProtocolBufferException . truncatedMessage ( ) ; } return readRawVarint32 ( firstByte , input ) ; |
public class JCudnn { /** * < pre >
* Retrieve the settings currently stored in an LRN layer descriptor
* Any of the provided pointers can be NULL ( no corresponding value will be returned )
* < / pre > */
public static int cudnnGetLRNDescriptor ( cudnnLRNDescriptor normDesc , int [ ] lrnN , double [ ] lrnAlpha ,... | return checkResult ( cudnnGetLRNDescriptorNative ( normDesc , lrnN , lrnAlpha , lrnBeta , lrnK ) ) ; |
public class SameDiff { /** * Update the opName for the variable
* with the given vertex id
* @ param varName the vertex id to update
* @ param withName thew new opName */
public void updateVariableName ( String varName , String withName ) { } } | SDVariable oldVarNameRef = getVariable ( varName ) ; Variable v = variables . remove ( varName ) ; String oldVarName = varName ; oldVarNameRef . setVarName ( withName ) ; v . setName ( withName ) ; variables . put ( withName , v ) ; for ( SameDiffOp op : ops . values ( ) ) { List < String > outputsOfOp = op . getOutput... |
public class JdkLog { /** * 打印对应等级的日志
* @ param callerFQCN
* @ param level 等级
* @ param throwable 异常对象
* @ param format 消息模板
* @ param arguments 参数 */
private void logIfEnabled ( String callerFQCN , Level level , Throwable throwable , String format , Object [ ] arguments ) { } } | if ( logger . isLoggable ( level ) ) { LogRecord record = new LogRecord ( level , StrUtil . format ( format , arguments ) ) ; record . setLoggerName ( getName ( ) ) ; record . setThrown ( throwable ) ; fillCallerData ( callerFQCN , record ) ; logger . log ( record ) ; } |
public class NoxItemCatalog { /** * Returns the ImageLoader . Listener associated to a NoxItem given a position . If the
* ImageLoader . Listener wasn ' t previously created , creates a new instance . */
private ImageLoader . Listener getImageLoaderListener ( final int position ) { } } | if ( listeners [ position ] == null ) { listeners [ position ] = new NoxItemCatalogImageLoaderListener ( position , this ) ; } return listeners [ position ] ; |
public class FileSystem { /** * Returns a reference to the { @ link FileSystem } instance for accessing the
* file system identified by the given { @ link URI } .
* @ param uri
* the { @ link URI } identifying the file system
* @ return a reference to the { @ link FileSystem } instance for accessing the file sy... | FileSystem fs = null ; synchronized ( SYNCHRONIZATION_OBJECT ) { if ( uri . getScheme ( ) == null ) { try { uri = new URI ( "file" , null , uri . getPath ( ) , null ) ; } catch ( URISyntaxException e ) { // we tried to repair it , but could not . report the scheme error
throw new IOException ( "FileSystem: Scheme is nu... |
public class Interval { /** * Return the number of semitones between 2 notes spaced by
* this Interval */
public int getSemitones ( ) { } } | int semitones = 0 ; switch ( getLabel ( ) % OCTAVE ) { case UNISON : semitones = 0 ; break ; // unison
case SECOND : semitones = 2 ; break ; // major 2nd
case THIRD : semitones = 4 ; break ; // major 3rd
case FOURTH : semitones = 5 ; break ; // perfect 4th
case FIFTH : semitones = 7 ; break ; // perfect 5th
case SIXTH ... |
public class ClientExecutorServiceProxy { /** * submit to key */
@ Override public < T > Future < T > submitToKeyOwner ( Callable < T > task , Object key ) { } } | return submitToKeyOwnerInternal ( task , key , null , false ) ; |
public class AutomationExecutionMetadata { /** * The specified key - value mapping of document parameters to target resources .
* @ param targetMaps
* The specified key - value mapping of document parameters to target resources .
* @ return Returns a reference to this object so that method calls can be chained to... | setTargetMaps ( targetMaps ) ; return this ; |
public class WaCkypediaDocumentIterator { /** * Returns the next document from the file . */
public synchronized Document next ( ) { } } | Document next = new StringDocument ( nextLine ) ; try { nextLine = advance ( ) ; } catch ( IOException ioe ) { throw new IOError ( ioe ) ; } return next ; |
public class ScreenshotUtils { /** * Returns a double between 0 and 1.0 */
private static double similarity ( BufferedImage var , BufferedImage cont ) { } } | double [ ] varArr = new double [ var . getWidth ( ) * var . getHeight ( ) * 3 ] ; double [ ] contArr = new double [ cont . getWidth ( ) * cont . getHeight ( ) * 3 ] ; if ( varArr . length != contArr . length ) throw new IllegalStateException ( "The pictures are different sizes!" ) ; // unroll pixels
for ( int i = 0 ; i... |
public class BunyanLayout { /** * Format the event as a Bunyan style JSON object . */
private String format ( LogEvent event ) { } } | JsonObject jsonEvent = new JsonObject ( ) ; jsonEvent . addProperty ( "v" , 0 ) ; jsonEvent . addProperty ( "level" , BUNYAN_LEVEL . get ( event . getLevel ( ) ) ) ; jsonEvent . addProperty ( "levelStr" , event . getLevel ( ) . toString ( ) ) ; jsonEvent . addProperty ( "name" , event . getLoggerName ( ) ) ; try { json... |
public class FunctionExpression { /** * Function range . Generate a list spanning a range of values
* @ param formatter
* current CSS output
* @ return The operation representing a list of values */
private Operation range ( CssFormatter formatter ) { } } | type = LIST ; double start = get ( 0 ) . doubleValue ( formatter ) ; double end ; if ( parameters . size ( ) >= 2 ) { end = get ( 1 ) . doubleValue ( formatter ) ; } else { end = start ; start = 1 ; } double step ; if ( parameters . size ( ) >= 3 ) { step = get ( 2 ) . doubleValue ( formatter ) ; } else { step = 1 ; } ... |
public class ChineseUtils { /** * 转换成中文拼音字符串 。
* @ param str
* 输入的字符串 。
* @ param format
* 输出拼音的格式 。
* @ return 转换后的中文拼音字符串 。 */
public static String toPinyin ( String str , PinyinFormat format ) { } } | return Pinyin . INSTANCE . convert ( str , format ) ; |
public class Months { /** * Subtracts this amount from the specified temporal object .
* This returns a temporal object of the same observable type as the input
* with this amount subtracted .
* In most cases , it is clearer to reverse the calling pattern by using
* { @ link Temporal # minus ( TemporalAmount ) ... | if ( months != 0 ) { temporal = temporal . minus ( months , MONTHS ) ; } return temporal ; |
public class Scanners { /** * A scanner that matches the input against the specified string case insensitively .
* @ param str the string to match
* @ return the scanner . */
public static Parser < Void > stringCaseInsensitive ( String str ) { } } | return Patterns . stringCaseInsensitive ( str ) . toScanner ( str ) ; |
public class KeyVaultClientBaseImpl { /** * Permanently deletes the specified storage account .
* The purge deleted storage account operation removes the secret permanently , without the possibility of recovery . This operation can only be performed on a soft - delete enabled vault . This operation requires the stora... | if ( vaultBaseUrl == null ) { throw new IllegalArgumentException ( "Parameter vaultBaseUrl is required and cannot be null." ) ; } if ( storageAccountName == null ) { throw new IllegalArgumentException ( "Parameter storageAccountName is required and cannot be null." ) ; } if ( this . apiVersion ( ) == null ) { throw new... |
public class ImportOrderParser { /** * Parse import order string and create appropriate { @ link ImportOrganizer } .
* @ param importOrder the import order , either static - first or static - last .
* @ return the { @ link ImportOrganizer } */
public static ImportOrganizer getImportOrganizer ( String importOrder ) ... | switch ( importOrder ) { case "static-first" : return ImportOrganizer . STATIC_FIRST_ORGANIZER ; case "static-last" : return ImportOrganizer . STATIC_LAST_ORGANIZER ; case "android-static-first" : return ImportOrganizer . ANDROID_STATIC_FIRST_ORGANIZER ; case "android-static-last" : return ImportOrganizer . ANDROID_STA... |
public class EmailData { /** * Utility method for converting different fields to a single
* { @ link IMutableEmailData } .
* @ param eEmailType
* The type of the email .
* @ param aSender
* The sender address .
* @ param aReceiver
* The receiver address .
* @ param sSubject
* The subject line .
* @ ... | final EmailData aEmailData = new EmailData ( eEmailType ) ; aEmailData . setFrom ( aSender ) ; aEmailData . setTo ( aReceiver ) ; aEmailData . setSubject ( sSubject ) ; aEmailData . setBody ( sBody ) ; aEmailData . setAttachments ( aAttachments ) ; return aEmailData ; |
public class VocabularyHolder { /** * This methods reset counters for all words in vocabulary */
public void resetWordCounters ( ) { } } | for ( VocabularyWord word : getVocabulary ( ) ) { word . setHuffmanNode ( null ) ; word . setFrequencyShift ( null ) ; word . setCount ( 0 ) ; } |
public class StatementDMQL { /** * For the creation of the statement */
@ Override public void setGeneratedColumnInfo ( int generate , ResultMetaData meta ) { } } | // can support INSERT _ SELECT also
if ( type != StatementTypes . INSERT ) { return ; } int colIndex = baseTable . getIdentityColumnIndex ( ) ; if ( colIndex == - 1 ) { return ; } switch ( generate ) { case ResultConstants . RETURN_NO_GENERATED_KEYS : return ; case ResultConstants . RETURN_GENERATED_KEYS_COL_INDEXES : ... |
public class ServerFactory { /** * Create a Server configured for Grakn Core .
* @ return a Server instance configured for Grakn Core */
public static Server createServer ( boolean benchmark ) { } } | // Grakn Server configuration
ServerID serverID = ServerID . me ( ) ; Config config = Config . create ( ) ; JanusGraphFactory janusGraphFactory = new JanusGraphFactory ( config ) ; // locks
LockManager lockManager = new ServerLockManager ( ) ; KeyspaceManager keyspaceStore = new KeyspaceManager ( janusGraphFactory , co... |
public class BaseMenuParser { /** * Process this XML Tag . */
public boolean parseHtmlTag ( PrintWriter out , String strTag , String strParams , String strData ) { } } | strTag = strTag . toUpperCase ( ) ; if ( strTag . equalsIgnoreCase ( "MENUTITLE" ) ) this . printHtmlTitle ( out , strTag , strParams , strData ) ; else if ( strTag . equalsIgnoreCase ( "MENUDESC" ) ) this . printHtmlMenuDesc ( out , strTag , strParams , strData ) ; else if ( strTag . equalsIgnoreCase ( "ITEMS" ) ) thi... |
public class ModelsImpl { /** * Creates a single child in an existing hierarchical entity model .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param hEntityId The hierarchical entity extractor ID .
* @ param addHierarchicalEntityChildOptionalParameter the object representing the... | return addHierarchicalEntityChildWithServiceResponseAsync ( appId , versionId , hEntityId , addHierarchicalEntityChildOptionalParameter ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class AbstractStreamEx { /** * Returns an immutable { @ link List } containing the elements of this stream .
* There ' s no guarantees on exact type of the returned { @ code List } . The
* returned { @ code List } is guaranteed to be serializable if all its
* elements are serializable .
* This is a termi... | Object [ ] array = toArray ( Object [ ] :: new ) ; switch ( array . length ) { case 0 : return Collections . emptyList ( ) ; case 1 : return Collections . singletonList ( ( T ) array [ 0 ] ) ; default : return Collections . unmodifiableList ( Arrays . asList ( ( T [ ] ) array ) ) ; } |
public class LoadBalancingRxClient { /** * Resolve the final property value from ,
* 1 . Request specific configuration
* 2 . Default configuration
* 3 . Default value
* @ param key
* @ param requestConfig
* @ param defaultValue
* @ return */
protected < S > S getProperty ( IClientConfigKey < S > key , @ ... | if ( requestConfig != null && requestConfig . get ( key ) != null ) { return requestConfig . get ( key ) ; } else { return clientConfig . get ( key , defaultValue ) ; } |
public class BinaryTreeNode { /** * Replies the child node at the specified position .
* @ param index is the position of the child to reply .
* @ return the child or < code > null < / code > */
@ Pure public final N getChildAt ( BinaryTreeZone index ) { } } | switch ( index ) { case LEFT : return this . left ; case RIGHT : return this . right ; default : throw new IndexOutOfBoundsException ( ) ; } |
public class BitMatrix { /** * Exclusive - or ( XOR ) : Flip the bit in this { @ code BitMatrix } if the corresponding
* mask bit is set .
* @ param mask XOR mask */
public void xor ( BitMatrix mask ) { } } | if ( width != mask . getWidth ( ) || height != mask . getHeight ( ) || rowSize != mask . getRowSize ( ) ) { throw new IllegalArgumentException ( "input matrix dimensions do not match" ) ; } BitArray rowArray = new BitArray ( width ) ; for ( int y = 0 ; y < height ; y ++ ) { int offset = y * rowSize ; int [ ] row = mask... |
public class MediaTable { /** * Get the required columns
* @ param idColumnName
* id column name
* @ return required columns */
public static List < String > requiredColumns ( String idColumnName ) { } } | if ( idColumnName == null ) { idColumnName = COLUMN_ID ; } List < String > requiredColumns = new ArrayList < > ( ) ; requiredColumns . add ( idColumnName ) ; requiredColumns . add ( COLUMN_DATA ) ; requiredColumns . add ( COLUMN_CONTENT_TYPE ) ; return requiredColumns ; |
public class PHPSud { /** * { @ inheritDoc } */
@ Override public void onStartDocument ( Document document ) { } } | LOGGER . info ( "Start document" ) ; super . onStartDocument ( document ) ; LOGGER . debug ( "Create new PHP SUD" ) ; try { container = PHPContainerFactory . createContainer ( phpExec , workingDirectory , phpInitFile ) ; } catch ( PHPException e ) { LOGGER . error ( "Unable to create PHPContainer " + e . toString ( ) )... |
public class BufferedWriter { /** * Writes a portion of a String .
* < p > If the value of the < tt > len < / tt > parameter is negative then no
* characters are written . This is contrary to the specification of this
* method in the { @ linkplain java . io . Writer # write ( java . lang . String , int , int )
... | synchronized ( lock ) { ensureOpen ( ) ; int b = off , t = off + len ; while ( b < t ) { int d = min ( nChars - nextChar , t - b ) ; s . getChars ( b , b + d , cb , nextChar ) ; b += d ; nextChar += d ; if ( nextChar >= nChars ) flushBuffer ( ) ; } } |
public class Rule { /** * / * - - - - - [ String Related ] - - - - - */
public void insertStringBefore ( Node node , String str ) { } } | boolean startingNode = this . node == node ; int cp [ ] = StringUtil . toCodePoints ( str ) ; for ( int i = cp . length - 1 ; i >= 0 ; i -- ) { Node newNode = new Node ( ) ; for ( Edge edge : node . incoming ( ) ) { if ( ! edge . loop ( ) ) edge . setTarget ( newNode ) ; } newNode . addEdgeTo ( node ) . matcher = new A... |
public class FacesConfigType { /** * This method is only called from jsf 2.2 */
@ Override public List < String > getManagedObjects ( ) { } } | ArrayList < String > managedObjects = new ArrayList < String > ( ) ; if ( this . application != null ) { managedObjects . addAll ( application . getManagedObjects ( ) ) ; } if ( this . factory != null ) { managedObjects . addAll ( factory . getManagedObjects ( ) ) ; } if ( this . lifecycle != null ) { managedObjects . ... |
public class Cache { /** * Cache a value for the given hostname that will automatically expire once the TTL is reached . */
final void cache ( String hostname , E value , int ttl , EventLoop loop ) { } } | Entries entries = resolveCache . get ( hostname ) ; if ( entries == null ) { entries = new Entries ( hostname ) ; Entries oldEntries = resolveCache . putIfAbsent ( hostname , entries ) ; if ( oldEntries != null ) { entries = oldEntries ; } } entries . add ( value , ttl , loop ) ; |
public class OrderedTaskQueue { /** * Retrieves the task with earliest dead line and removes it from queue .
* @ return task which has earliest dead line */
public Task poll ( ) { } } | Task result = null ; if ( activeIndex == 0 ) { result = taskList [ 0 ] . poll ( ) ; if ( result != null ) result . removeFromQueue0 ( ) ; } else { result = taskList [ 1 ] . poll ( ) ; if ( result != null ) result . removeFromQueue1 ( ) ; } return result ; |
public class AmazonEC2Client { /** * Describes the running instances for the specified EC2 Fleet .
* @ param describeFleetInstancesRequest
* @ return Result of the DescribeFleetInstances operation returned by the service .
* @ sample AmazonEC2 . DescribeFleetInstances
* @ see < a href = " http : / / docs . aws ... | request = beforeClientExecution ( request ) ; return executeDescribeFleetInstances ( request ) ; |
public class InvocationException { /** * Requires that the specified client have the specified permissions .
* @ throws InvocationException if they do not . */
public static void requireAccess ( ClientObject clobj , Permission perm , Object context ) throws InvocationException { } } | String errmsg = clobj . checkAccess ( perm , context ) ; if ( errmsg != null ) { throw new InvocationException ( errmsg ) ; } |
public class DeletePipelineRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeletePipelineRequest deletePipelineRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deletePipelineRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deletePipelineRequest . getPipelineId ( ) , PIPELINEID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " ... |
public class AbstractCrosstabResultReducer { /** * Helper method to get the minimum of all values ( must be numbers )
* @ param slaveValues
* @ return */
protected static Number minimum ( List < ? > slaveValues ) { } } | Number min = null ; for ( Object slaveValue : slaveValues ) { if ( min == null ) { min = ( Number ) slaveValue ; } else { Comparable < Object > comparable = NumberComparator . getComparable ( min ) ; if ( comparable . compareTo ( slaveValue ) > 0 ) { min = ( Number ) slaveValue ; } } } return min ; |
public class CmsInternalLinkValidationDialog { /** * Initializes the session object to work with depending on the dialog state and request parameters . < p > */
protected void initSessionObject ( ) { } } | try { if ( ! CmsStringUtil . isEmpty ( getParamAction ( ) ) && ! CmsDialog . DIALOG_INITIAL . equals ( getParamAction ( ) ) ) { m_resources = ( List ) getDialogObject ( ) ; // test
m_resources . size ( ) ; } } catch ( Exception e ) { // ignore
} if ( m_resources == null ) { // create a new project object
m_resources = ... |
public class MakeUniqueClassName { /** * When the class name is not unique we will use two underscore ' _ _ ' and a digit representing the number of time
* this class was found */
public static String makeUnique ( String className ) { } } | final Matcher m = UNIQUE_NAMING_PATTERN . matcher ( className ) ; if ( m . matches ( ) ) { // get the current number
final Integer number = Integer . parseInt ( m . group ( 2 ) ) ; // replace the current number in the string with the number + 1
return m . group ( 1 ) + ( number + 1 ) ; } else { return className + "__1"... |
public class BaseSimpleReact { /** * Start a reactive dataflow from a stream .
* @ param stream that will be used to drive the reactive dataflow
* @ return Next stage in the reactive flow */
public < U > BaseSimpleReactStream < U > from ( final IntStream stream ) { } } | return ( BaseSimpleReactStream < U > ) from ( stream . boxed ( ) ) ; |
public class CmsXMLSearchConfigurationParser { /** * Returns the configured sort options , or the empty list if no such options are configured .
* @ return The configured sort options , or the empty list if no such options are configured . */
private List < I_CmsSearchConfigurationSortOption > getSortOptions ( ) { } ... | final List < I_CmsSearchConfigurationSortOption > options = new ArrayList < I_CmsSearchConfigurationSortOption > ( ) ; final CmsXmlContentValueSequence sortOptions = m_xml . getValueSequence ( XML_ELEMENT_SORTOPTIONS , m_locale ) ; if ( sortOptions == null ) { return null ; } else { for ( int i = 0 ; i < sortOptions . ... |
public class CasWebApplication { /** * Main entry point of the CAS web application .
* @ param args the args */
public static void main ( final String [ ] args ) { } } | val properties = CasEmbeddedContainerUtils . getRuntimeProperties ( Boolean . TRUE ) ; val banner = CasEmbeddedContainerUtils . getCasBannerInstance ( ) ; new SpringApplicationBuilder ( CasWebApplication . class ) . banner ( banner ) . web ( WebApplicationType . SERVLET ) . properties ( properties ) . logStartupInfo ( ... |
public class Converters { /** * Uses buffer . flip ( ) and then buffer . clear ( )
* @ param sendingNodeId short
* @ param buffer ByteBuffer
* @ return RawMessage */
public static RawMessage toRawMessage ( final short sendingNodeId , final ByteBuffer buffer ) { } } | buffer . flip ( ) ; final RawMessage message = new RawMessage ( buffer . limit ( ) ) ; message . put ( buffer , false ) ; buffer . clear ( ) ; final RawMessageHeader header = new RawMessageHeader ( sendingNodeId , ( short ) 0 , ( short ) message . length ( ) ) ; message . header ( header ) ; return message ; |
public class UserProfile { /** * Returns extra information of the profile that is not part of the normalized profile
* @ return a map with user ' s extra information found in the profile */
public Map < String , Object > getExtraInfo ( ) { } } | return extraInfo != null ? new HashMap < > ( extraInfo ) : Collections . < String , Object > emptyMap ( ) ; |
public class SignatureEncoding { /** * Converts an ASN . 1 DER encoded ECDSA signature to a raw signature in the form R | S
* @ param asn1DerSignature An ASN . 1 DER encoded signature
* @ param algorithm The algorithm used to produce the given ASN . 1 DER encoded signature
* @ return The raw format of the given A... | try { return Asn1DerSignatureEncoding . decode ( asn1DerSignature , algorithm ) ; } catch ( IllegalArgumentException ex ) { throw ( IllegalArgumentException ) new IllegalArgumentException ( ex . getMessage ( ) + " " + Hex . encodeHexString ( asn1DerSignature ) ) . initCause ( ex ) ; } |
public class RequestParam { /** * Returns a request parameter as double .
* @ param request Request .
* @ param param Parameter name .
* @ return Parameter value or 0 if it does not exist or is not a number . */
public static double getDouble ( @ NotNull ServletRequest request , @ NotNull String param ) { } } | return getDouble ( request , param , 0d ) ; |
public class BinaryReader { /** * Read binary data from stream .
* @ param out The output buffer to read into .
* @ throws IOException if unable to read from stream . */
public void expect ( byte [ ] out ) throws IOException { } } | int i , off = 0 ; while ( off < out . length && ( i = in . read ( out , off , out . length - off ) ) > 0 ) { off += i ; } if ( off < out . length ) { throw new IOException ( "Not enough data available on stream: " + off + " < " + out . length ) ; } |
public class MappedField { /** * Adds the annotation , if it exists on the field .
* @ param clazz type of the annotation
* @ param ann the annotation */
public void addAnnotation ( final Class < ? extends Annotation > clazz , final Annotation ann ) { } } | foundAnnotations . put ( clazz , ann ) ; discoverNames ( ) ; |
public class ValueExpressionHelper { /** * return the type for the " value " attribute of the given component , if it exists . Return null otherwise .
* @ param context
* @ param comp
* @ return */
public static Class < ? > getValueType ( FacesContext context , UIComponent comp ) { } } | ValueExpression expr = comp . getValueExpression ( "value" ) ; Class < ? > valueType = expr == null ? null : expr . getType ( context . getELContext ( ) ) ; return valueType ; |
public class DownloadProperties { /** * Builds a new DownloadProperties for downloading Galaxy at the given revision .
* @ param destination The destination directory to store Galaxy , null if a directory
* should be chosen by default .
* @ return A new DownloadProperties for downloading Galaxy at the given revis... | return new DownloadProperties ( GALAXY_CENTRAL_REPOSITORY_URL , BRANCH_STABLE , revision , destination ) ; |
public class BaseFont { /** * Creates a new font . This font can be one of the 14 built in types ,
* a Type1 font referred to by an AFM or PFM file , a TrueType font ( simple or collection ) or a CJK font from the
* Adobe Asian Font Pack . TrueType fonts and CJK fonts can have an optional style modifier
* appende... | String nameBase = getBaseName ( name ) ; encoding = normalizeEncoding ( encoding ) ; boolean isBuiltinFonts14 = BuiltinFonts14 . containsKey ( name ) ; boolean isCJKFont = isBuiltinFonts14 ? false : CJKFont . isCJKFont ( nameBase , encoding ) ; if ( isBuiltinFonts14 || isCJKFont ) embedded = false ; else if ( encoding ... |
public class UpdateUsageResult { /** * The usage data , as daily logs of used and remaining quotas , over the specified time interval indexed over the API
* keys in a usage plan . For example ,
* < code > { . . . , " values " : { " { api _ key } " : [ [ 0 , 100 ] , [ 10 , 90 ] , [ 100 , 10 ] ] } < / code > , where ... | return items ; |
public class KeyRange { /** * Returns a key range from { @ code start } inclusive to { @ code end } inclusive . */
public static KeyRange closedClosed ( Key start , Key end ) { } } | return new KeyRange ( checkNotNull ( start ) , Endpoint . CLOSED , checkNotNull ( end ) , Endpoint . CLOSED ) ; |
public class RelatedTablesCoreExtension { /** * Get or create the extension
* @ param mappingTable
* mapping table name
* @ return extension */
private Extensions getOrCreate ( String mappingTable ) { } } | getOrCreate ( ) ; Extensions extension = getOrCreate ( EXTENSION_NAME , mappingTable , null , EXTENSION_DEFINITION , ExtensionScopeType . READ_WRITE ) ; return extension ; |
public class ClustersInner { /** * Executes script actions on the specified HDInsight cluster .
* @ param resourceGroupName The name of the resource group .
* @ param clusterName The name of the cluster .
* @ param parameters The parameters for executing script actions .
* @ throws IllegalArgumentException thro... | return executeScriptActionsWithServiceResponseAsync ( resourceGroupName , clusterName , parameters ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ; |
public class Get { /** * Executes a provided script on the element , and returns the output of that
* script . If the element doesn ' t exist , or there is an error executing this
* script , a null value will be returned .
* @ param javascriptFunction - the javascript function that is going to be executed
* @ r... | if ( ! element . is ( ) . present ( ) ) { return null ; } try { WebElement webElement = element . getWebElement ( ) ; JavascriptExecutor js = ( JavascriptExecutor ) driver ; return js . executeScript ( javascriptFunction , webElement ) ; } catch ( NoSuchMethodError | Exception e ) { log . warn ( e ) ; return null ; } |
public class GraphComparator { /** * Apply the Delta commands to the source object graph , making
* the requested changes to the source graph . The source of the
* commands is typically generated from the output of the ' compare ( ) '
* API , where this source graph was compared to another target
* graph , and ... | // Index all objects in source graph
final Map srcMap = new HashMap ( ) ; Traverser . traverse ( source , new Traverser . Visitor ( ) { public void process ( Object o ) { if ( isIdObject ( o , idFetcher ) ) { srcMap . put ( idFetcher . getId ( o ) , o ) ; } } } ) ; List < DeltaError > errors = new ArrayList < > ( ) ; b... |
public class StreamingSheetReader { /** * Read through a number of rows equal to the rowCacheSize field or until there is no more data to read
* @ return true if data was read */
private boolean getRow ( ) { } } | try { rowCache . clear ( ) ; while ( rowCache . size ( ) < rowCacheSize && parser . hasNext ( ) ) { handleEvent ( parser . nextEvent ( ) ) ; } rowCacheIterator = rowCache . iterator ( ) ; return rowCacheIterator . hasNext ( ) ; } catch ( XMLStreamException e ) { throw new ParseException ( "Error reading XML stream" , e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.