signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class MultiChoiceListPreference { /** * Persists a specific set in the shared preferences by using the preference ' s key .
* @ param set
* The set , which should be persisted , as an instance of the type { @ link Set }
* @ return True , if the given set has been persisted , false otherwise */
private boolean persistSet ( @ Nullable final Set < String > set ) { } } | if ( set != null && shouldPersist ( ) ) { if ( set . equals ( getPersistedSet ( null ) ) ) { return true ; } Editor editor = getPreferenceManager ( ) . getSharedPreferences ( ) . edit ( ) ; editor . putStringSet ( getKey ( ) , set ) ; editor . apply ( ) ; return true ; } return false ; |
public class WVideo { /** * When an video element is rendered to the client , the browser will make a second request to get the video content .
* The handleRequest method has been overridden to detect whether the request is the " content fetch " request by
* looking for the parameter that we encode in the content url .
* @ param request the request being responded to . */
@ Override public void handleRequest ( final Request request ) { } } | super . handleRequest ( request ) ; String targ = request . getParameter ( Environment . TARGET_ID ) ; boolean contentReqested = ( targ != null && targ . equals ( getTargetId ( ) ) ) ; if ( contentReqested && request . getParameter ( POSTER_REQUEST_PARAM_KEY ) != null ) { handlePosterRequest ( ) ; } if ( isDisabled ( ) ) { return ; } if ( contentReqested ) { if ( request . getParameter ( VIDEO_INDEX_REQUEST_PARAM_KEY ) != null ) { handleVideoRequest ( request ) ; } else if ( request . getParameter ( TRACK_INDEX_REQUEST_PARAM_KEY ) != null ) { handleTrackRequest ( request ) ; } } |
public class CharSequenceWrapper { /** * transform given value to a javascript parameter value
* @ param value The value to transform
* @ return value as string */
public static CharSequence toParameterValue ( final JavaScriptInlineFunction value ) { } } | return value != null ? value . build ( ) : Attr . nullValue ( ) ; |
public class CmsDateRestrictionParser { /** * Parses a date restriction of type ' FromToday ' . < p >
* @ param dateRestriction the location of the date restriction
* @ return the date restriction */
private I_CmsListDateRestriction parseFromToday ( CmsXmlContentValueLocation dateRestriction ) { } } | CmsXmlContentValueLocation location = dateRestriction . getSubValue ( N_FROM_TODAY ) ; if ( location == null ) { return null ; } CmsXmlContentValueLocation countLoc = location . getSubValue ( N_COUNT ) ; CmsXmlContentValueLocation unitLoc = location . getSubValue ( N_UNIT ) ; CmsXmlContentValueLocation directionLoc = location . getSubValue ( N_DIRECTION ) ; TimeDirection direction = parseDirection ( directionLoc ) ; Integer count = parsePositiveNumber ( countLoc ) ; TimeUnit unit = parseUnit ( unitLoc ) ; if ( count == null ) { return null ; } return new CmsListDateFromTodayRestriction ( count . intValue ( ) , unit , direction ) ; |
public class FileOutputCommitter { /** * Move all of the files from the work directory to the final output
* @ param context the task context
* @ param fs the output file system
* @ param jobOutputDir the final output direcotry
* @ param taskOutput the work path
* @ throws IOException */
private void moveTaskOutputs ( TaskAttemptContext context , FileSystem fs , Path jobOutputDir , Path taskOutput ) throws IOException { } } | TaskAttemptID attemptId = context . getTaskAttemptID ( ) ; context . progress ( ) ; if ( fs . isFile ( taskOutput ) ) { Path finalOutputPath = getFinalPath ( jobOutputDir , taskOutput , workPath ) ; if ( ! fs . rename ( taskOutput , finalOutputPath ) ) { if ( ! fs . delete ( finalOutputPath , true ) ) { throw new IOException ( "Failed to delete earlier output of task: " + attemptId ) ; } if ( ! fs . rename ( taskOutput , finalOutputPath ) ) { throw new IOException ( "Failed to save output of task: " + attemptId ) ; } } LOG . debug ( "Moved " + taskOutput + " to " + finalOutputPath ) ; } else if ( fs . getFileStatus ( taskOutput ) . isDir ( ) ) { FileStatus [ ] paths = fs . listStatus ( taskOutput ) ; Path finalOutputPath = getFinalPath ( jobOutputDir , taskOutput , workPath ) ; fs . mkdirs ( finalOutputPath ) ; if ( paths != null ) { for ( FileStatus path : paths ) { moveTaskOutputs ( context , fs , jobOutputDir , path . getPath ( ) ) ; } } } |
public class DockPaneController { /** * { @ inheritDoc } */
@ Override protected void initEventHandlers ( ) throws CoreException { } } | node ( ) . addEventHandler ( DragEvent . DRAG_OVER , getHandler ( DragEvent . DRAG_OVER ) ) ; node ( ) . addEventHandler ( DragEvent . DRAG_ENTERED_TARGET , getHandler ( DragEvent . DRAG_ENTERED_TARGET ) ) ; node ( ) . addEventHandler ( DragEvent . DRAG_EXITED_TARGET , getHandler ( DragEvent . DRAG_EXITED_TARGET ) ) ; node ( ) . addEventHandler ( DragEvent . DRAG_DROPPED , getHandler ( DragEvent . DRAG_DROPPED ) ) ; node ( ) . addEventHandler ( DragEvent . DRAG_DONE , getHandler ( DragEvent . DRAG_DONE ) ) ; // node ( ) . addEventFilter ( DragEvent . DRAG _ OVER , getHandler ( DragEvent . DRAG _ OVER ) ) ;
// node ( ) . addEventFilter ( DragEvent . DRAG _ ENTERED _ TARGET , getHandler ( DragEvent . DRAG _ ENTERED _ TARGET ) ) ;
// node ( ) . addEventFilter ( DragEvent . DRAG _ EXITED _ TARGET , getHandler ( DragEvent . DRAG _ EXITED _ TARGET ) ) ;
// node ( ) . addEventFilter ( DragEvent . DRAG _ DROPPED , getHandler ( DragEvent . DRAG _ DROPPED ) ) ;
// node ( ) . addEventFilter ( DragEvent . DRAG _ DONE , getHandler ( DragEvent . DRAG _ DONE ) ) ;
// node ( ) . setOnDragOver ( getHandler ( DragEvent . DRAG _ OVER ) ) ;
// node ( ) . setOnDragEntered ( getHandler ( DragEvent . DRAG _ ENTERED ) ) ;
// node ( ) . setOnDragExited ( getHandler ( DragEvent . DRAG _ EXITED ) ) ;
// node ( ) . setOnDragDropped ( getHandler ( DragEvent . DRAG _ DROPPED ) ) ;
// node ( ) . setOnDragDone ( getHandler ( DragEvent . DRAG _ DONE ) ) ;
// node ( ) . setOnMousePressed ( e - > System . out . println ( " Pressed = > " + model ( ) . key ( ) . toString ( ) ) ) ;
// node ( ) . setOnMouseMoved ( e - > System . out . println ( " Moved = > " + model ( ) . key ( ) . toString ( ) ) ) ; |
public class HashAlgorithmOptions { /** * The set of accepted hash algorithms allowed in an AWS Signer job .
* @ param allowedValues
* The set of accepted hash algorithms allowed in an AWS Signer job .
* @ return Returns a reference to this object so that method calls can be chained together .
* @ see HashAlgorithm */
public HashAlgorithmOptions withAllowedValues ( HashAlgorithm ... allowedValues ) { } } | java . util . ArrayList < String > allowedValuesCopy = new java . util . ArrayList < String > ( allowedValues . length ) ; for ( HashAlgorithm value : allowedValues ) { allowedValuesCopy . add ( value . toString ( ) ) ; } if ( getAllowedValues ( ) == null ) { setAllowedValues ( allowedValuesCopy ) ; } else { getAllowedValues ( ) . addAll ( allowedValuesCopy ) ; } return this ; |
public class FrameworkEventAdapter { /** * Determine the appropriate topic to use for the Framework Event .
* @ param frameworkEvent
* the framework event that is being adapted
* @ return the topic or null if the event is not supported */
private String getTopic ( FrameworkEvent frameworkEvent ) { } } | StringBuilder topic = new StringBuilder ( FRAMEWORK_EVENT_TOPIC_PREFIX ) ; switch ( frameworkEvent . getType ( ) ) { case FrameworkEvent . STARTED : topic . append ( "STARTED" ) ; break ; case FrameworkEvent . ERROR : topic . append ( "ERROR" ) ; break ; case FrameworkEvent . PACKAGES_REFRESHED : topic . append ( "PACKAGES_REFRESHED" ) ; break ; case FrameworkEvent . STARTLEVEL_CHANGED : topic . append ( "STARTLEVEL_CHANGED" ) ; break ; case FrameworkEvent . WARNING : topic . append ( "WARNING" ) ; break ; case FrameworkEvent . INFO : topic . append ( "INFO" ) ; break ; default : return null ; } return topic . toString ( ) ; |
public class AWSGreengrassClient { /** * Deletes a resource definition .
* @ param deleteResourceDefinitionRequest
* @ return Result of the DeleteResourceDefinition operation returned by the service .
* @ throws BadRequestException
* invalid request
* @ sample AWSGreengrass . DeleteResourceDefinition
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / greengrass - 2017-06-07 / DeleteResourceDefinition "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DeleteResourceDefinitionResult deleteResourceDefinition ( DeleteResourceDefinitionRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDeleteResourceDefinition ( request ) ; |
public class HostMessenger { /** * Take the new connection ( member of the mesh ) and create a foreign host for it
* and put it in the map of foreign hosts */
@ Override public void notifyOfJoin ( int hostId , SocketChannel socket , SSLEngine sslEngine , InetSocketAddress listeningAddress , JSONObject jo ) { } } | networkLog . info ( getHostId ( ) + " notified of " + hostId ) ; prepSocketChannel ( socket ) ; ForeignHost fhost = null ; try { fhost = new ForeignHost ( this , hostId , socket , m_config . deadHostTimeout , listeningAddress , createPicoNetwork ( sslEngine , socket , false ) ) ; putForeignHost ( hostId , fhost ) ; fhost . enableRead ( VERBOTEN_THREADS ) ; } catch ( java . io . IOException e ) { org . voltdb . VoltDB . crashLocalVoltDB ( "" , true , e ) ; } m_acceptor . accrue ( hostId , jo ) ; |
public class AbstractKeyedObjectPool { /** * Default Single Key to Single Object implementation . Advanced Pools extending this class can override this behavior . If the key does not exist then
* an entry should be created and returned . If the key exists and is not borrowed then the entry should be returned .
* If the key exists and is already borrowed then null should be returned .
* It is up to the implementation of this method to update the borrowed queue
* @ param key the Pool lookup key
* @ return Entry if available */
protected E createOrAttemptToBorrow ( final PoolKey < K > key ) { } } | E entry = null ; if ( ! pool . containsKey ( key ) ) { entry = create ( key ) . initialize ( key , this ) ; pool . put ( key , entry ) ; borrowed . add ( entry ) ; return entry ; } entry = pool . get ( key ) ; if ( borrowed . add ( entry ) ) { factory . activate ( entry . get ( ) ) ; return entry ; } return entry . isCurrentOwner ( ) ? entry : null ; |
public class FormatDateSupport { /** * Private utility methods */
private DateFormat createFormatter ( Locale loc , String pattern ) throws JspException { } } | // Apply pattern , if present
if ( pattern != null ) { return new SimpleDateFormat ( pattern , loc ) ; } if ( ( type == null ) || DATE . equalsIgnoreCase ( type ) ) { int style = Util . getStyle ( dateStyle , "FORMAT_DATE_INVALID_DATE_STYLE" ) ; return DateFormat . getDateInstance ( style , loc ) ; } else if ( TIME . equalsIgnoreCase ( type ) ) { int style = Util . getStyle ( timeStyle , "FORMAT_DATE_INVALID_TIME_STYLE" ) ; return DateFormat . getTimeInstance ( style , loc ) ; } else if ( DATETIME . equalsIgnoreCase ( type ) ) { int style1 = Util . getStyle ( dateStyle , "FORMAT_DATE_INVALID_DATE_STYLE" ) ; int style2 = Util . getStyle ( timeStyle , "FORMAT_DATE_INVALID_TIME_STYLE" ) ; return DateFormat . getDateTimeInstance ( style1 , style2 , loc ) ; } else { throw new JspException ( Resources . getMessage ( "FORMAT_DATE_INVALID_TYPE" , type ) ) ; } |
public class CORBA_Utils { /** * PM46698 */
private static boolean isCORBAObject ( Class < ? > valueClass , int rmicCompatible ) { } } | if ( JITDeploy . isRMICCompatibleValues ( rmicCompatible ) && org . omg . CORBA . Object . class . isAssignableFrom ( valueClass ) ) { return true ; } return false ; |
public class InvalidFormulaInContextException { /** * Converts a Throwable to a InvalidFormulaInContextException . If the Throwable is a
* InvalidFormulaInContextException , it will be passed through unmodified ; otherwise , it will be wrapped
* in a new InvalidFormulaInContextException .
* @ param cause the Throwable to convert
* @ return a InvalidFormulaInContextException */
public static InvalidFormulaInContextException fromThrowable ( Throwable cause ) { } } | return ( cause instanceof InvalidFormulaInContextException ) ? ( InvalidFormulaInContextException ) cause : new InvalidFormulaInContextException ( cause ) ; |
public class VaadinMessageSource { /** * Tries to resolve the message based on the provided Local . Returns message
* code if fitting message could not be found .
* @ param local
* to determinate the Language .
* @ param code
* the code to lookup up .
* @ param args
* Array of arguments that will be filled in for params within
* the message .
* @ return the resolved message , or the message code if the lookup fails . */
public String getMessage ( final Locale local , final String code , final Object ... args ) { } } | try { return source . getMessage ( code , args , local ) ; } catch ( final NoSuchMessageException ex ) { LOG . error ( "Failed to retrieve message!" , ex ) ; return code ; } |
public class SteppingThreadGroupGui { /** * Initialise the gui field values */
private void initGui ( ) { } } | totalThreads . setText ( "100" ) ; initialDelay . setText ( "0" ) ; incUserCount . setText ( "10" ) ; incUserCountBurst . setText ( "0" ) ; incUserPeriod . setText ( "30" ) ; flightTime . setText ( "60" ) ; decUserCount . setText ( "5" ) ; decUserPeriod . setText ( "1" ) ; rampUp . setText ( "5" ) ; |
public class BufferedMirage { /** * documentation inherited from interface */
public void paint ( Graphics2D gfx , int x , int y ) { } } | gfx . drawImage ( _image , x , y , null ) ; |
public class ComparedFaceMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ComparedFace comparedFace , ProtocolMarshaller protocolMarshaller ) { } } | if ( comparedFace == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( comparedFace . getBoundingBox ( ) , BOUNDINGBOX_BINDING ) ; protocolMarshaller . marshall ( comparedFace . getConfidence ( ) , CONFIDENCE_BINDING ) ; protocolMarshaller . marshall ( comparedFace . getLandmarks ( ) , LANDMARKS_BINDING ) ; protocolMarshaller . marshall ( comparedFace . getPose ( ) , POSE_BINDING ) ; protocolMarshaller . marshall ( comparedFace . getQuality ( ) , QUALITY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class GrapesClient { /** * Send a get artifacts request
* @ param hasLicense
* @ return list of artifact
* @ throws GrapesCommunicationException */
public List < Artifact > getArtifacts ( final Boolean hasLicense ) throws GrapesCommunicationException { } } | final Client client = getClient ( ) ; final WebResource resource = client . resource ( serverURL ) . path ( RequestUtils . getArtifactsPath ( ) ) ; final ClientResponse response = resource . queryParam ( ServerAPI . HAS_LICENSE_PARAM , hasLicense . toString ( ) ) . accept ( MediaType . APPLICATION_JSON ) . get ( ClientResponse . class ) ; client . destroy ( ) ; if ( ClientResponse . Status . OK . getStatusCode ( ) != response . getStatus ( ) ) { final String message = "Failed to get artifacts" ; if ( LOG . isErrorEnabled ( ) ) { LOG . error ( String . format ( HTTP_STATUS_TEMPLATE_MSG , message , response . getStatus ( ) ) ) ; } throw new GrapesCommunicationException ( message , response . getStatus ( ) ) ; } return response . getEntity ( ArtifactList . class ) ; |
public class CPDefinitionLocalServiceBaseImpl { /** * Returns all the cp definitions matching the UUID and company .
* @ param uuid the UUID of the cp definitions
* @ param companyId the primary key of the company
* @ return the matching cp definitions , or an empty list if no matches were found */
@ Override public List < CPDefinition > getCPDefinitionsByUuidAndCompanyId ( String uuid , long companyId ) { } } | return cpDefinitionPersistence . findByUuid_C ( uuid , companyId ) ; |
public class StructTypeID { /** * generic reader : reads the next TypeID object from stream and returns it */
private TypeID genericReadTypeID ( RecordInput rin , String tag ) throws IOException { } } | byte typeVal = rin . readByte ( tag ) ; switch ( typeVal ) { case TypeID . RIOType . BOOL : return TypeID . BoolTypeID ; case TypeID . RIOType . BUFFER : return TypeID . BufferTypeID ; case TypeID . RIOType . BYTE : return TypeID . ByteTypeID ; case TypeID . RIOType . DOUBLE : return TypeID . DoubleTypeID ; case TypeID . RIOType . FLOAT : return TypeID . FloatTypeID ; case TypeID . RIOType . INT : return TypeID . IntTypeID ; case TypeID . RIOType . LONG : return TypeID . LongTypeID ; case TypeID . RIOType . MAP : { TypeID tIDKey = genericReadTypeID ( rin , tag ) ; TypeID tIDValue = genericReadTypeID ( rin , tag ) ; return new MapTypeID ( tIDKey , tIDValue ) ; } case TypeID . RIOType . STRING : return TypeID . StringTypeID ; case TypeID . RIOType . STRUCT : { StructTypeID stID = new StructTypeID ( ) ; int numElems = rin . readInt ( tag ) ; for ( int i = 0 ; i < numElems ; i ++ ) { stID . add ( genericReadTypeInfo ( rin , tag ) ) ; } return stID ; } case TypeID . RIOType . VECTOR : { TypeID tID = genericReadTypeID ( rin , tag ) ; return new VectorTypeID ( tID ) ; } default : // shouldn ' t be here
throw new IOException ( "Unknown type read" ) ; } |
public class PageParametersExtensions { /** * Gets a map with all parameters . Looks in the query , request and post parameters .
* @ param request
* the request
* @ return a map with all parameters . */
public static Map < String , List < StringValue > > getPageParametersMap ( final Request request ) { } } | final Map < String , List < StringValue > > map = new HashMap < > ( ) ; addToParameters ( request . getRequestParameters ( ) , map ) ; addToParameters ( request . getQueryParameters ( ) , map ) ; addToParameters ( request . getPostParameters ( ) , map ) ; return map ; |
public class sslcrl { /** * Use this API to add sslcrl . */
public static base_response add ( nitro_service client , sslcrl resource ) throws Exception { } } | sslcrl addresource = new sslcrl ( ) ; addresource . crlname = resource . crlname ; addresource . crlpath = resource . crlpath ; addresource . inform = resource . inform ; addresource . refresh = resource . refresh ; addresource . cacert = resource . cacert ; addresource . method = resource . method ; addresource . server = resource . server ; addresource . url = resource . url ; addresource . port = resource . port ; addresource . basedn = resource . basedn ; addresource . scope = resource . scope ; addresource . interval = resource . interval ; addresource . day = resource . day ; addresource . time = resource . time ; addresource . binddn = resource . binddn ; addresource . password = resource . password ; addresource . binary = resource . binary ; return addresource . add_resource ( client ) ; |
public class CmsXmlMessages { /** * Returns the localized resource String from the configuration file , if not found or set from the resource bundle . < p >
* @ see org . opencms . i18n . CmsMessages # key ( java . lang . String , java . lang . Object [ ] ) */
@ Override public String key ( String key , Object [ ] args ) { } } | if ( hasConfigValue ( key ) ) { return getConfigValue ( key , args ) ; } return m_messages . key ( key , args ) ; |
public class CreateClusterRequest { /** * Configure optional application for the cluster . BMR provides applications such as Hive ใ Pig ใ HBase for the cluster .
* @ param application An ApplicationConfig instance .
* @ return CreateClusterRequest */
public CreateClusterRequest withApplication ( ApplicationConfig application ) { } } | if ( this . applications == null ) { this . applications = new ArrayList < ApplicationConfig > ( ) ; } this . applications . add ( application ) ; return this ; |
public class SqlModifyBuilder { /** * generate sql log .
* @ param method
* the method
* @ param methodBuilder
* the method builder */
public static void generateLogForModifiers ( final SQLiteModelMethod method , MethodSpec . Builder methodBuilder ) { } } | JQLChecker jqlChecker = JQLChecker . getInstance ( ) ; final One < Boolean > usedInWhere = new One < Boolean > ( false ) ; methodBuilder . addCode ( "\n// display log\n" ) ; String sqlForLog = jqlChecker . replace ( method , method . jql , new JQLReplacerListenerImpl ( method ) { @ Override public String onColumnNameToUpdate ( String columnName ) { // only entity ' s columns
return currentEntity . findPropertyByName ( columnName ) . columnName ; } @ Override public String onColumnName ( String columnName ) { // return entity . findByName ( columnName ) . columnName ;
return currentSchema . findColumnNameByPropertyName ( method , columnName ) ; } @ Override public String onBindParameter ( String bindParameterName , boolean inStatement ) { if ( usedInWhere . value0 ) { return "?" ; } else { String paramName = bindParameterName ; if ( paramName . contains ( "." ) ) { String [ ] a = paramName . split ( "\\." ) ; if ( a . length == 2 ) { paramName = a [ 1 ] ; } } SQLProperty property = currentEntity . findPropertyByName ( paramName ) ; AssertKripton . assertTrueOrUnknownPropertyInJQLException ( property != null , method , bindParameterName ) ; return ":" + property . columnName ; } } @ Override public void onWhereStatementBegin ( Where_stmtContext ctx ) { usedInWhere . value0 = true ; } @ Override public void onWhereStatementEnd ( Where_stmtContext ctx ) { usedInWhere . value0 = false ; } } ) ; if ( method . jql . dynamicReplace . containsKey ( JQLDynamicStatementType . DYNAMIC_WHERE ) ) { methodBuilder . addStatement ( "$T.info($S, $L)" , Logger . class , sqlForLog . replace ( method . jql . dynamicReplace . get ( JQLDynamicStatementType . DYNAMIC_WHERE ) , "%s" ) , "StringUtils.ifNotEmptyAppend(_sqlDynamicWhere,\" AND \")" ) ; } else { methodBuilder . addStatement ( "$T.info($S)" , Logger . class , sqlForLog ) ; } |
public class AbcParserAbstract { /** * Parse the { @ link Reader } and get the parsing tree by its root
* { @ link AbcNode } .
* @ param reader
* @ see # getParseTree ( String ) the whole content of the reader is read as
* String
* @ throws IOException */
protected AbcNode getParseTree ( Reader reader ) throws IOException { } } | StringWriter writer = new StringWriter ( ) ; char [ ] buffer = new char [ 32 * 1024 ] ; int n ; while ( ( n = reader . read ( buffer ) ) != - 1 ) { writer . write ( buffer , 0 , n ) ; } return getParseTree ( writer . toString ( ) ) ; |
public class PortletDescriptorImpl { /** * Returns all < code > custom - window - state < / code > elements
* @ return list of < code > custom - window - state < / code > */
public List < CustomWindowStateType < PortletDescriptor > > getAllCustomWindowState ( ) { } } | List < CustomWindowStateType < PortletDescriptor > > list = new ArrayList < CustomWindowStateType < PortletDescriptor > > ( ) ; List < Node > nodeList = model . get ( "custom-window-state" ) ; for ( Node node : nodeList ) { CustomWindowStateType < PortletDescriptor > type = new CustomWindowStateTypeImpl < PortletDescriptor > ( this , "custom-window-state" , model , node ) ; list . add ( type ) ; } return list ; |
public class ErrorCollector { /** * Adds an error to the message set , but does not cause a failure . The message is not required to have a source
* line and column specified , but it is best practice to try and include that information . */
public void addErrorAndContinue ( Message message ) { } } | if ( this . errors == null ) { this . errors = new LinkedList ( ) ; } this . errors . add ( message ) ; |
public class RequestContextExportingAppender { /** * Adds the specified { @ link AttributeKey } to the export list .
* @ param alias the alias of the attribute to export
* @ param attrKey the key of the attribute to export */
public void addAttribute ( String alias , AttributeKey < ? > attrKey ) { } } | ensureNotStarted ( ) ; builder . addAttribute ( alias , attrKey ) ; |
public class CharsetToolkit { /** * Gets a < code > BufferedReader < / code > ( indeed a < code > LineNumberReader < / code > ) from the < code > File < / code >
* specified in the constructor of < code > CharsetToolkit < / code > using the charset discovered or the default
* charset if an 8 - bit < code > Charset < / code > is encountered .
* @ return a < code > BufferedReader < / code >
* @ throws FileNotFoundException if the file is not found . */
public BufferedReader getReader ( ) throws FileNotFoundException { } } | LineNumberReader reader = new LineNumberReader ( new InputStreamReader ( new FileInputStream ( file ) , getCharset ( ) ) ) ; if ( hasUTF8Bom ( ) || hasUTF16LEBom ( ) || hasUTF16BEBom ( ) ) { try { reader . read ( ) ; } catch ( IOException e ) { // should never happen , as a file with no content
// but with a BOM has at least one char
} } return reader ; |
public class DZcs_maxtrans { /** * find an augmenting path starting at column k and extend the match if found */
private static void cs_augment ( int k , DZcs A , int [ ] jmatch , int jmatch_offset , int [ ] cheap , int cheap_offset , int [ ] w , int w_offset , int [ ] js , int js_offset , int [ ] is , int is_offset , int [ ] ps , int ps_offset ) { } } | int p , i = - 1 , Ap [ ] = A . p , Ai [ ] = A . i , head = 0 , j ; boolean found = false ; js [ js_offset + 0 ] = k ; /* start with just node k in jstack */
while ( head >= 0 ) { /* - - - Start ( or continue ) depth - first - search at node j - - - - - */
j = js [ js_offset + head ] ; /* get j from top of jstack */
if ( w [ w_offset + j ] != k ) /* 1st time j visited for kth path */
{ w [ w_offset + j ] = k ; /* mark j as visited for kth path */
for ( p = cheap [ cheap_offset + j ] ; p < Ap [ j + 1 ] && ! found ; p ++ ) { i = Ai [ p ] ; /* try a cheap assignment ( i , j ) */
found = ( jmatch [ jmatch_offset + i ] == - 1 ) ; } cheap [ cheap_offset + j ] = p ; /* start here next time j is traversed */
if ( found ) { is [ is_offset + head ] = i ; /* column j matched with row i */
break ; /* end of augmenting path */
} ps [ ps_offset + head ] = Ap [ j ] ; /* no cheap match : start dfs for j */
} /* - - - Depth - first - search of neighbors of j - - - - - */
for ( p = ps [ ps_offset + head ] ; p < Ap [ j + 1 ] ; p ++ ) { i = Ai [ p ] ; /* consider row i */
if ( w [ w_offset + jmatch [ jmatch_offset + i ] ] == k ) continue ; /* skip jmatch [ i ] if marked */
ps [ ps_offset + head ] = p + 1 ; /* pause dfs of node j */
is [ is_offset + head ] = i ; /* i will be matched with j if found */
js [ js_offset + ( ++ head ) ] = jmatch [ jmatch_offset + i ] ; /* start dfs at column jmatch [ i ] */
break ; } if ( p == Ap [ j + 1 ] ) head -- ; /* node j is done ; pop from stack */
} /* augment the match if path found : */
if ( found ) for ( p = head ; p >= 0 ; p -- ) jmatch [ jmatch_offset + is [ is_offset + p ] ] = js [ js_offset + p ] ; |
public class ClassInfo { /** * ใใฃใผใซใใๅใๆๅฎใใฆใใฃใผใซใใๆ
ๅ ฑใๅๅพใใ ใ
* @ param fieldName ใใฃใผใซใใๅ ใ
* @ return ๆๅฎใใใใฃใผใซใใๅใใๅญๅจใใชใๅ ดๅใฏ ใ nullใ่ฟใ ใ */
public FieldInfo getFieldInfo ( final String fieldName ) { } } | for ( FieldInfo item : fieldInfos ) { if ( item . getFieldName ( ) . equals ( fieldName ) ) { return item ; } } return null ; |
public class MultiUserChatManager { /** * Returns a List of the rooms where the requested user has joined . The Iterator will contain Strings where each
* String represents a room ( e . g . room @ muc . jabber . org ) .
* @ param user the user to check . A fully qualified xmpp ID , e . g . jdoe @ example . com .
* @ return a List of the rooms where the requested user has joined .
* @ throws XMPPErrorException
* @ throws NoResponseException
* @ throws NotConnectedException
* @ throws InterruptedException */
public List < EntityBareJid > getJoinedRooms ( EntityFullJid user ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } } | // Send the disco packet to the user
DiscoverItems result = serviceDiscoveryManager . discoverItems ( user , DISCO_NODE ) ; List < DiscoverItems . Item > items = result . getItems ( ) ; List < EntityBareJid > answer = new ArrayList < > ( items . size ( ) ) ; // Collect the entityID for each returned item
for ( DiscoverItems . Item item : items ) { EntityBareJid muc = item . getEntityID ( ) . asEntityBareJidIfPossible ( ) ; if ( muc == null ) { LOGGER . warning ( "Not a bare JID: " + item . getEntityID ( ) ) ; continue ; } answer . add ( muc ) ; } return answer ; |
public class ModelsImpl { /** * Update an entity role for a given entity .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param hEntityId The hierarchical entity extractor ID .
* @ param roleId The entity role ID .
* @ param updateHierarchicalEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the OperationStatus object if successful . */
public OperationStatus updateHierarchicalEntityRole ( UUID appId , String versionId , UUID hEntityId , UUID roleId , UpdateHierarchicalEntityRoleOptionalParameter updateHierarchicalEntityRoleOptionalParameter ) { } } | return updateHierarchicalEntityRoleWithServiceResponseAsync ( appId , versionId , hEntityId , roleId , updateHierarchicalEntityRoleOptionalParameter ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class Log { /** * Truncates the log up to the given index .
* @ param index The index at which to truncate the log .
* @ return The updated log .
* @ throws IllegalStateException If the log is not open .
* @ throws IndexOutOfBoundsException If the given index is not within the bounds of the log . */
public Log truncate ( long index ) { } } | assertIsOpen ( ) ; if ( index > 0 ) assertValidIndex ( index ) ; Assert . index ( index >= segments . commitIndex ( ) , "cannot truncate committed entries" ) ; if ( lastIndex ( ) == index ) return this ; for ( Segment segment : segments . reverseSegments ( ) ) { if ( segment . validIndex ( index ) ) { segment . truncate ( index ) ; break ; } else if ( segment . index ( ) > index ) { segments . removeSegment ( segment ) ; } } entryBuffer . clear ( ) ; return this ; |
public class JobPreconditions { /** * Check the requested flags , throwing if any requested flags are outside
* the allowed set . */
public static void checkFlagsArgument ( final int requestedFlags , final int allowedFlags ) { } } | if ( ( requestedFlags & allowedFlags ) != requestedFlags ) { throw new IllegalArgumentException ( "Requested flags 0x" + Integer . toHexString ( requestedFlags ) + ", but only 0x" + Integer . toHexString ( allowedFlags ) + " are allowed" ) ; } |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcSegmentIndexSelect ( ) { } } | if ( ifcSegmentIndexSelectEClass == null ) { ifcSegmentIndexSelectEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 1156 ) ; } return ifcSegmentIndexSelectEClass ; |
public class BufferBitSetUtil { /** * word */
private static MappeableArrayContainer arrayContainerOf ( final int from , final int to , final int cardinality , final long [ ] words ) { } } | // precondition : cardinality is max 4096
final short [ ] content = new short [ cardinality ] ; int index = 0 ; for ( int i = from , socket = 0 ; i < to ; ++ i , socket += Long . SIZE ) { long word = words [ i ] ; while ( word != 0 ) { content [ index ++ ] = ( short ) ( socket + numberOfTrailingZeros ( word ) ) ; word &= ( word - 1 ) ; } } return new MappeableArrayContainer ( ShortBuffer . wrap ( content ) , cardinality ) ; |
public class NameSpace { /** * Import a class name . Subsequent imports override earlier ones
* @ param name the name */
public void importClass ( final String name ) { } } | this . importedClasses . put ( Name . suffix ( name , 1 ) , name ) ; this . nameSpaceChanged ( ) ; |
public class Subtypes2 { /** * Add an application class , and its transitive supertypes , to the
* inheritance graph .
* @ param appXClass
* application XClass to add to the inheritance graph */
public void addApplicationClass ( XClass appXClass ) { } } | for ( XMethod m : appXClass . getXMethods ( ) ) { if ( m . isStub ( ) ) { return ; } } ClassVertex vertex = addClassAndGetClassVertex ( appXClass ) ; vertex . markAsApplicationClass ( ) ; |
public class StorableGenerator { /** * Loads the property value of the current storable onto the stack . If the
* property is derived the read method is used , otherwise it just loads the
* value from the appropriate field .
* entry stack : [
* exit stack : [ value
* @ param b - { @ link CodeBuilder } to which to add the load code
* @ param property - property to load
* @ param type - type of the property */
private void loadThisProperty ( CodeBuilder b , StorableProperty property , TypeDesc type ) { } } | b . loadThis ( ) ; if ( property . isDerived ( ) ) { b . invoke ( property . getReadMethod ( ) ) ; } else { b . loadField ( property . getName ( ) , type ) ; } |
public class EJBThreadData { /** * Sets the thread context class loader for the specified bean metadata , and
* saves the current thread context class loader . */
public void pushClassLoader ( BeanMetaData bmd ) { } } | ClassLoader classLoader = bmd . ivContextClassLoader ; // F85059
Object origCL = svThreadContextAccessor . pushContextClassLoaderForUnprivileged ( classLoader ) ; ivClassLoaderStack . push ( origCL ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "pushClassLoader: " + ( origCL == ThreadContextAccessor . UNCHANGED ? "already " + Util . identity ( classLoader ) : Util . identity ( origCL ) + " -> " + Util . identity ( classLoader ) ) ) ; |
public class BaseDaoEnabled { /** * A call through to the { @ link Dao # delete ( Object ) } . */
public int delete ( ) throws SQLException { } } | checkForDao ( ) ; @ SuppressWarnings ( "unchecked" ) T t = ( T ) this ; return dao . delete ( t ) ; |
public class DatabaseException { /** * Return the error message . */
public String getMessage ( Task task ) { } } | String strError = null ; switch ( m_iErrorCode ) { case DBConstants . NORMAL_RETURN : strError = "Normal return" ; break ; // Never
case DBConstants . END_OF_FILE : strError = "End of file" ; break ; case DBConstants . KEY_NOT_FOUND : strError = "Key not found" ; break ; case DBConstants . DUPLICATE_KEY : strError = "Duplicate key" ; break ; case DBConstants . FILE_NOT_OPEN : strError = "File not open" ; break ; case DBConstants . FILE_ALREADY_OPEN : strError = "File already open" ; break ; case DBConstants . FILE_TABLE_FULL : strError = "File table full" ; break ; case DBConstants . FILE_INCONSISTENCY : strError = "File inconsistency" ; break ; case DBConstants . INVALID_RECORD : strError = "Invalid record" ; break ; case DBConstants . FILE_NOT_FOUND : strError = "File not found" ; break ; case DBConstants . INVALID_KEY : strError = "Invalid Key" ; break ; case DBConstants . FILE_ALREADY_EXISTS : strError = "File Already Exists" ; break ; case DBConstants . NULL_FIELD : strError = "Null field" ; break ; case DBConstants . READ_NOT_NEW : strError = "Read not new" ; break ; case DBConstants . NO_ACTIVE_QUERY : strError = "No active query" ; break ; case DBConstants . RECORD_NOT_LOCKED : strError = "Record not locked" ; break ; case DBConstants . RETRY_ERROR : strError = "Retry error" ; break ; case DBConstants . ERROR_READ_ONLY : strError = "Can't update read only file" ; break ; case DBConstants . ERROR_APPEND_ONLY : strError = "Can't update append only file" ; break ; case DBConstants . RECORD_LOCKED : strError = "Record locked" ; break ; case DBConstants . BROKEN_PIPE : strError = "Broken Pipe" ; break ; case DBConstants . DUPLICATE_COUNTER : strError = "Duplicate counter" ; break ; case DBConstants . DB_NOT_FOUND : strError = "Database not found" ; break ; case DBConstants . NEXT_ERROR_CODE : case DBConstants . ERROR_RETURN : case DBConstants . ERROR_STRING : default : strError = super . getMessage ( ) ; // See if there is a built - in message
if ( ( strError == null ) || ( strError . length ( ) == 0 ) || ( strError . startsWith ( "null" ) ) ) if ( task != null ) { // Unknown error code , see if it was the last error
strError = task . getLastError ( m_iErrorCode ) ; if ( ( strError != null ) && ( strError . length ( ) > 0 ) ) break ; // Yes , return the error message
} break ; } return strError ; |
public class LongPipeline { /** * Stateful intermediate ops from LongStream */
@ Override public final LongStream limit ( long maxSize ) { } } | if ( maxSize < 0 ) throw new IllegalArgumentException ( Long . toString ( maxSize ) ) ; return SliceOps . makeLong ( this , 0 , maxSize ) ; |
public class SpringSecurityXmAuthenticationContext { /** * { @ inheritDoc } */
@ Override public boolean isAnonymous ( ) { } } | return getAuthentication ( ) . filter ( auth -> ANONYMOUS_AUTH_CLASS . isAssignableFrom ( auth . getClass ( ) ) ) . isPresent ( ) ; |
public class ScriptRuntime { /** * Prepare for calling name ( . . . ) : return function corresponding to
* name and make current top scope available
* as ScriptRuntime . lastStoredScriptable ( ) for consumption as thisObj .
* The caller must call ScriptRuntime . lastStoredScriptable ( ) immediately
* after calling this method . */
public static Callable getNameFunctionAndThis ( String name , Context cx , Scriptable scope ) { } } | Scriptable parent = scope . getParentScope ( ) ; if ( parent == null ) { Object result = topScopeName ( cx , scope , name ) ; if ( ! ( result instanceof Callable ) ) { if ( result == Scriptable . NOT_FOUND ) { throw notFoundError ( scope , name ) ; } throw notFunctionError ( result , name ) ; } // Top scope is not NativeWith or NativeCall = > thisObj = = scope
Scriptable thisObj = scope ; storeScriptable ( cx , thisObj ) ; return ( Callable ) result ; } // name will call storeScriptable ( cx , thisObj ) ;
return ( Callable ) nameOrFunction ( cx , scope , parent , name , true ) ; |
public class CmsPublishRelationFinder { /** * Fetches the directly related resources for a given resource . < p >
* @ param currentResource the resource for which to get the related resources
* @ return the directly related resources */
private Set < CmsResource > getDirectlyRelatedResources ( CmsResource currentResource ) { } } | Set < CmsResource > directlyRelatedResources = Sets . newHashSet ( ) ; List < CmsRelation > relations = getRelationsFromResource ( currentResource ) ; for ( CmsRelation relation : relations ) { LOG . info ( "Trying to read resource for relation " + relation . getTargetPath ( ) ) ; CmsResource target = getResource ( relation . getTargetId ( ) ) ; if ( target != null ) { if ( relation . getType ( ) . isStrong ( ) || shouldAddWeakRelationTarget ( target ) ) { directlyRelatedResources . add ( target ) ; } } } try { CmsResource parentFolder = m_cms . readParentFolder ( currentResource . getStructureId ( ) ) ; if ( parentFolder != null ) { // parent folder of root folder is null
if ( parentFolder . getState ( ) . isNew ( ) || currentResource . isFile ( ) ) { directlyRelatedResources . add ( parentFolder ) ; } } } catch ( CmsException e ) { LOG . error ( "Error processing parent folder for " + currentResource . getRootPath ( ) + ": " + e . getLocalizedMessage ( ) , e ) ; } try { directlyRelatedResources . addAll ( m_relatedResourceProvider . getAdditionalRelatedResources ( m_cms , currentResource ) ) ; } catch ( Exception e ) { LOG . error ( "Error processing additional related resource for " + currentResource . getRootPath ( ) + ": " + e . getLocalizedMessage ( ) , e ) ; } return directlyRelatedResources ; |
public class CmsUploadHookDialog { /** * Opens a new upload property dialog . < p >
* @ param title the title for the dialog popup
* @ param hookUri the URI of the upload hook page
* @ param uploadedFiles the uploaded files
* @ param closeHandler the dialog close handler */
public static void openDialog ( String title , String hookUri , List < String > uploadedFiles , final CloseHandler < PopupPanel > closeHandler ) { } } | if ( hookUri . startsWith ( "#" ) ) { List < CmsUUID > resourceIds = new ArrayList < CmsUUID > ( ) ; if ( uploadedFiles != null ) { for ( String id : uploadedFiles ) { resourceIds . add ( new CmsUUID ( id ) ) ; } } CmsEmbeddedDialogHandler handler = new CmsEmbeddedDialogHandler ( new I_CmsActionHandler ( ) { public void leavePage ( String targetUri ) { // TODO Auto - generated method stub
} public void onSiteOrProjectChange ( String sitePath , String serverLink ) { // TODO Auto - generated method stub
} public void refreshResource ( CmsUUID structureId ) { closeHandler . onClose ( null ) ; } } ) ; String dialogId = hookUri . substring ( 1 ) ; handler . openDialog ( dialogId , CmsGwtConstants . CONTEXT_TYPE_FILE_TABLE , resourceIds ) ; } else { Map < String , String > parameters = new HashMap < String , String > ( ) ; parameters . put ( I_CmsUploadConstants . PARAM_RESOURCES , Joiner . on ( "," ) . join ( uploadedFiles ) ) ; CmsPopup popup = CmsFrameDialog . showFrameDialog ( title , CmsCoreProvider . get ( ) . link ( hookUri ) , parameters , closeHandler ) ; popup . setHeight ( DIALOG_HEIGHT ) ; popup . setWidth ( CmsPopup . DEFAULT_WIDTH ) ; popup . center ( ) ; } |
public class EntityDataModelUtil { /** * Checks if the specified OData type is a complex type and throws an exception if it is not .
* @ param type The OData type .
* @ return The OData type .
* @ throws ODataSystemException If the OData type is not a complex type . */
public static ComplexType checkIsComplexType ( Type type ) { } } | if ( ! isComplexType ( type ) ) { throw new ODataSystemException ( "A complex type is required, but '" + type . getFullyQualifiedName ( ) + "' is not a complex type: " + type . getMetaType ( ) ) ; } return ( ComplexType ) type ; |
public class MenuExtensions { /** * Sets the accelerator for the given menuitem and the given key char and the given modifiers .
* @ param jmi
* The JMenuItem .
* @ param keyChar
* the key char
* @ param modifiers
* the modifiers */
public static void setAccelerator ( final JMenuItem jmi , final Character keyChar , final int modifiers ) { } } | jmi . setAccelerator ( KeyStroke . getKeyStroke ( keyChar , modifiers ) ) ; |
public class LogManager { /** * readConfiguration , and other methods . */
Logger demandLogger ( String name , String resourceBundleName , Class < ? > caller ) { } } | Logger result = getLogger ( name ) ; if ( result == null ) { // only allocate the new logger once
Logger newLogger = new Logger ( name , resourceBundleName , caller ) ; do { if ( addLogger ( newLogger ) ) { // We successfully added the new Logger that we
// created above so return it without refetching .
return newLogger ; } // We didn ' t add the new Logger that we created above
// because another thread added a Logger with the same
// name after our null check above and before our call
// to addLogger ( ) . We have to refetch the Logger because
// addLogger ( ) returns a boolean instead of the Logger
// reference itself . However , if the thread that created
// the other Logger is not holding a strong reference to
// the other Logger , then it is possible for the other
// Logger to be GC ' ed after we saw it in addLogger ( ) and
// before we can refetch it . If it has been GC ' ed then
// we ' ll just loop around and try again .
result = getLogger ( name ) ; } while ( result == null ) ; } return result ; |
public class A_CmsLoginField { /** * @ see com . vaadin . client . ui . VTextField # updateFieldContent ( java . lang . String )
* We have to override this method to prevent its value being overwritten by Vaadin and to make
* sure that the real value is sent to the server . */
@ Override public void updateFieldContent ( String text ) { } } | if ( ! m_initialUpdateCalled ) { m_initialUpdateCalled = true ; if ( "" . equals ( text ) ) { valueChange ( false ) ; Scheduler . get ( ) . scheduleFixedDelay ( new RepeatingCommand ( ) { public boolean execute ( ) { if ( isAttached ( ) ) { valueChange ( false ) ; return true ; } else { return false ; } } } , 100 ) ; return ; } } super . updateFieldContent ( text ) ; |
public class LocaleFactoryProvider { /** * Create the resource using the Locale provided . If the locale is null , the locale is retrieved from the
* LocaleProvider in LocaleProxy .
* @ param cls localization interface class
* @ param < T > localization interface class
* @ param locale locale string
* @ return object implementing specified class */
public < T extends LocalizableResource > T create ( Class < T > cls , String locale ) { } } | Locale l = null ; if ( locale != null ) { String [ ] parts = locale . split ( "_" , 3 ) ; l = new Locale ( parts [ 0 ] , parts . length > 1 ? parts [ 1 ] : "" , parts . length > 2 ? parts [ 2 ] : "" ) ; } return LocaleProxy . create ( cls , l ) ; |
public class DataExpressionHandler { /** * { @ inheritDoc } */
@ Override public List < ConfigMessage > init ( Processor processor , ProcessorAction action , boolean predicate ) { } } | DataExpression expr = ( DataExpression ) getExpression ( ) ; source = expr . getSource ( ) ; key = expr . getKey ( ) ; if ( source == DataSource . Content ) { index = Integer . parseInt ( key ) ; } return new ArrayList < > ( ) ; |
public class Reader { /** * Method to read our client ' s plain text
* @ param file _ name
* @ return the filereader to translate client ' s plain text into our files
* @ throws BeastException
* if any problem is found whit the file */
protected static BufferedReader createFileReader ( String file_name ) throws BeastException { } } | try { return new BufferedReader ( new FileReader ( file_name ) ) ; } catch ( FileNotFoundException e ) { Logger logger = Logger . getLogger ( MASReader . class . getName ( ) ) ; logger . severe ( "ERROR: " + e . toString ( ) ) ; throw new BeastException ( "ERROR: " + e . toString ( ) , e ) ; } |
public class YarnSubmissionParametersFileGenerator { /** * Writes driver configuration to disk .
* @ param yarnClusterSubmissionFromCS the information needed to submit encode YARN parameters and create the
* YARN job for submission from the cluster .
* @ throws IOException */
public void writeConfiguration ( final YarnClusterSubmissionFromCS yarnClusterSubmissionFromCS , final JobFolder jobFolderOnDFS ) throws IOException { } } | final File yarnAppParametersFile = new File ( yarnClusterSubmissionFromCS . getDriverFolder ( ) , fileNames . getYarnBootstrapAppParamFilePath ( ) ) ; final File yarnJobParametersFile = new File ( yarnClusterSubmissionFromCS . getDriverFolder ( ) , fileNames . getYarnBootstrapJobParamFilePath ( ) ) ; try ( final FileOutputStream appFileOutputStream = new FileOutputStream ( yarnAppParametersFile ) ) { try ( final FileOutputStream jobFileOutputStream = new FileOutputStream ( yarnJobParametersFile ) ) { // this is mainly a test hook .
writeAvroYarnAppSubmissionParametersToOutputStream ( yarnClusterSubmissionFromCS , appFileOutputStream ) ; writeAvroYarnJobSubmissionParametersToOutputStream ( yarnClusterSubmissionFromCS , jobFolderOnDFS . getPath ( ) . toString ( ) , jobFileOutputStream ) ; } } |
public class MapperComplex { /** * Convert an item from a list into a class using the classes constructor .
* REFACTOR : Can ' t this just be from collection ?
* REFACTOR
* @ param argList list if arguments
* @ param clazz the type of the object we are creating
* @ param < T > generics
* @ return the new object that we just created . */
@ Override public < T > T fromList ( List < ? > argList , Class < T > clazz ) { } } | /* Size of the arguments . */
int size = argList . size ( ) ; /* Meta data holder of the class . */
ClassMeta < T > classMeta = ClassMeta . classMeta ( clazz ) ; /* The constructor to match . */
ConstructorAccess < T > constructorToMatch = null ; /* The final arguments . */
Object [ ] finalArgs = null ; boolean [ ] flag = new boolean [ 1 ] ; List < Object > convertedArguments = null ; try { /* List to hold items that we coerce into parameter types . */
convertedArguments = new ArrayList < > ( argList ) ; constructorToMatch = lookupConstructorMeta ( size , convertedArguments , classMeta , constructorToMatch , flag , false ) ; /* List to hold items that we coerce into parameter types . */
if ( constructorToMatch == null ) { convertedArguments = new ArrayList < > ( argList ) ; constructorToMatch = lookupConstructorMeta ( size , convertedArguments , classMeta , constructorToMatch , flag , true ) ; } /* If we were not able to match then we bail . */
if ( constructorToMatch != null ) { finalArgs = convertedArguments . toArray ( new Object [ argList . size ( ) ] ) ; return constructorToMatch . create ( finalArgs ) ; } else { return ( T ) Exceptions . die ( Object . class , "Unable to convert list" , convertedArguments , "into" , clazz ) ; } /* Catch all of the exceptions and try to report why this failed .
* Since we are doing reflection and a bit of " magic " , we have to be clear as to why / how things failed . */
} catch ( Exception e ) { if ( constructorToMatch != null ) { CharBuf buf = CharBuf . create ( 200 ) ; buf . addLine ( ) ; buf . multiply ( '-' , 10 ) . add ( "FINAL ARGUMENTS" ) . multiply ( '-' , 10 ) . addLine ( ) ; if ( finalArgs != null ) { for ( Object o : finalArgs ) { buf . puts ( "argument type " , ClassMeta . className ( o ) ) ; } } buf . multiply ( '-' , 10 ) . add ( "CONSTRUCTOR" ) . add ( constructorToMatch ) . multiply ( '-' , 10 ) . addLine ( ) ; buf . multiply ( '-' , 10 ) . add ( "CONSTRUCTOR PARAMS" ) . multiply ( '-' , 10 ) . addLine ( ) ; for ( Class < ? > c : constructorToMatch . parameterTypes ( ) ) { buf . puts ( "constructor type " , c ) ; } buf . multiply ( '-' , 35 ) . addLine ( ) ; buf . addLine ( "PARAMETER TYPES" ) ; buf . add ( Lists . list ( constructorToMatch . parameterTypes ( ) ) ) . addLine ( ) ; buf . addLine ( "ORIGINAL TYPES PASSED" ) ; buf . add ( gatherTypes ( convertedArguments ) ) . addLine ( ) ; buf . add ( gatherActualTypes ( convertedArguments ) ) . addLine ( ) ; buf . addLine ( "CONVERTED ARGUMENT TYPES" ) ; buf . add ( gatherTypes ( convertedArguments ) ) . addLine ( ) ; buf . add ( gatherActualTypes ( convertedArguments ) ) . addLine ( ) ; // Boon . error ( e , " unable to create object based on constructor " , buf ) ;
return ( T ) handle ( Object . class , e , buf . toString ( ) ) ; } else { return ( T ) handle ( Object . class , e , "\nlist args after conversion" , convertedArguments , "types" , gatherTypes ( convertedArguments ) , "\noriginal args" , argList , "original types" , gatherTypes ( argList ) ) ; } } |
public class JCalRawWriter { /** * Writes a property to the current component .
* @ param propertyName the property name ( e . g . " version " )
* @ param dataType the property ' s data type ( e . g . " text " )
* @ param value the property value
* @ throws IllegalStateException if there are no open components (
* { @ link # writeStartComponent ( String ) } must be called first ) or if the last
* method called was { @ link # writeEndComponent ( ) } .
* @ throws IOException if there ' s an I / O problem */
public void writeProperty ( String propertyName , ICalDataType dataType , JCalValue value ) throws IOException { } } | writeProperty ( propertyName , new ICalParameters ( ) , dataType , value ) ; |
public class FaultManager { /** * Notify the fault manager of a new node .
* @ param name The node name .
* @ param resourceTypes The types of resource on this node . */
public void addNode ( String name , Set < ResourceType > resourceTypes ) { } } | List < FaultStatsForType > faultStats = new ArrayList < FaultStatsForType > ( resourceTypes . size ( ) ) ; for ( ResourceType type : resourceTypes ) { faultStats . add ( new FaultStatsForType ( type ) ) ; } nodeToFaultStats . put ( name , faultStats ) ; |
class RepresentableAsPowers { /** * A function to verify if the supplied number can be expressed as the sum of non - zero powers of 2.
* Examples :
* RepresentableAsPowers . isRepresentableAsPowersOfTwo ( 10 ) - > true
* RepresentableAsPowers . isRepresentableAsPowersOfTwo ( 7 ) - > false
* RepresentableAsPowers . isRepresentableAsPowersOfTwo ( 14 ) - > true
* @ param num : A number which needs to be checked .
* @ return : Returns True if the number can be represented as sum of non - zero powers of 2 , otherwise False . */
public static boolean isRepresentableAsPowersOfTwo ( int num ) { } } | return num % 2 == 0 ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link QuantityExtentType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link QuantityExtentType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "QuantityExtent" ) public JAXBElement < QuantityExtentType > createQuantityExtent ( QuantityExtentType value ) { } } | return new JAXBElement < QuantityExtentType > ( _QuantityExtent_QNAME , QuantityExtentType . class , null , value ) ; |
public class LdapIdentityStoreDefinitionWrapper { /** * Evaluate and return the callerBaseDn .
* @ param immediateOnly If true , only return a non - null value if the setting is either an
* immediate EL expression or not set by an EL expression . If false , return the
* value regardless of where it is evaluated .
* @ return The callerBaseDn or null if immediateOnly = = true AND the value is not evaluated
* from a deferred EL expression . */
@ FFDCIgnore ( IllegalArgumentException . class ) private String evaluateCallerBaseDn ( boolean immediateOnly ) { } } | try { return elHelper . processString ( "callerBaseDn" , this . idStoreDefinition . callerBaseDn ( ) , immediateOnly ) ; } catch ( IllegalArgumentException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isWarningEnabled ( ) ) { Tr . warning ( tc , "JAVAEESEC_WARNING_IDSTORE_CONFIG" , new Object [ ] { "callerBaseDn" , "" } ) ; } return "" ; /* Default value from spec . */
} |
public class SchemaService { /** * Check that this tenant , its applications , and storage managers are available . */
private void checkTenantApps ( Tenant tenant ) { } } | m_logger . info ( " Tenant: {}" , tenant . getName ( ) ) ; try { Iterator < DRow > rowIter = DBService . instance ( tenant ) . getAllRows ( SchemaService . APPS_STORE_NAME ) . iterator ( ) ; if ( ! rowIter . hasNext ( ) ) { m_logger . info ( " <no applications>" ) ; } while ( rowIter . hasNext ( ) ) { DRow row = rowIter . next ( ) ; ApplicationDefinition appDef = loadAppRow ( tenant , getColumnMap ( row . getAllColumns ( 1024 ) . iterator ( ) ) ) ; if ( appDef != null ) { String appName = appDef . getAppName ( ) ; String ssName = getStorageServiceOption ( appDef ) ; m_logger . info ( " Application '{}': StorageService={}; keyspace={}" , new Object [ ] { appName , ssName , tenant . getName ( ) } ) ; if ( DoradusServer . instance ( ) . findStorageService ( ssName ) == null ) { m_logger . warn ( " >>>Application '{}' uses storage service '{}' which has not been " + "initialized; application will not be accessible via this server" , appDef . getAppName ( ) , ssName ) ; } } } } catch ( Exception e ) { m_logger . warn ( "Could not check tenant '" + tenant . getName ( ) + "'. Applications may be unavailable." , e ) ; } |
public class Where { /** * Add a IN clause which makes sure the column is in one of the columns returned from a sub - query inside of
* parenthesis . The QueryBuilder must return 1 and only one column which can be set with the
* { @ link QueryBuilder # selectColumns ( String . . . ) } method calls . That 1 argument must match the SQL type of the
* column - name passed to this method .
* < b > NOTE : < / b > The sub - query will be prepared at the same time that the outside query is . */
public Where < T , ID > in ( String columnName , QueryBuilder < ? , ? > subQueryBuilder ) throws SQLException { } } | return in ( true , columnName , subQueryBuilder ) ; |
public class CommonExprTransformer { /** * < p > options . < / p >
* @ param operator a { @ link java . lang . String } object .
* @ param args an array of { @ link ameba . db . dsl . QueryExprMeta . Val } objects .
* @ param parent a { @ link ameba . db . dsl . QueryExprMeta } object .
* @ return a { @ link io . ebean . Expression } object . */
public static Expression options ( String operator , Val < Expression > [ ] args , QueryExprMeta parent ) { } } | if ( args . length < 1 ) { throw new QuerySyntaxException ( Messages . get ( "dsl.arguments.error2" , operator , 0 ) ) ; } if ( parent == null ) { throw new QuerySyntaxException ( Messages . get ( "dsl.arguments.error5" , operator ) ) ; } TextOptionsExpression op = new TextOptionsExpression ( ) ; for ( Val v : args ) { if ( v . object ( ) instanceof MapExpression ) { MapExpression map = ( ( MapExpression ) v . expr ( ) ) ; op . options . put ( map . key , map . value ) ; } else { op . options . put ( v . string ( ) , null ) ; } } return op ; |
public class CommerceShippingMethodLocalServiceBaseImpl { /** * Adds the commerce shipping method to the database . Also notifies the appropriate model listeners .
* @ param commerceShippingMethod the commerce shipping method
* @ return the commerce shipping method that was added */
@ Indexable ( type = IndexableType . REINDEX ) @ Override public CommerceShippingMethod addCommerceShippingMethod ( CommerceShippingMethod commerceShippingMethod ) { } } | commerceShippingMethod . setNew ( true ) ; return commerceShippingMethodPersistence . update ( commerceShippingMethod ) ; |
public class WebCrawler { /** * Classes that extends WebCrawler should overwrite this function to tell the
* crawler whether the given url should be crawled or not . The following
* default implementation indicates that all urls should be included in the crawl
* except those with a nofollow flag .
* @ param url
* the url which we are interested to know whether it should be
* included in the crawl or not .
* @ param referringPage
* The Page in which this url was found .
* @ return if the url should be included in the crawl it returns true ,
* otherwise false is returned . */
public boolean shouldVisit ( Page referringPage , WebURL url ) { } } | if ( myController . getConfig ( ) . isRespectNoFollow ( ) ) { return ! ( ( referringPage != null && referringPage . getContentType ( ) != null && referringPage . getContentType ( ) . contains ( "html" ) && ( ( HtmlParseData ) referringPage . getParseData ( ) ) . getMetaTagValue ( "robots" ) . contains ( "nofollow" ) ) || url . getAttribute ( "rel" ) . contains ( "nofollow" ) ) ; } return true ; |
public class CBCBlockCipher { /** * Encrypting data
* @ param iv initialization vector
* @ param data data for encryption
* @ return encrypted data */
public byte [ ] encrypt ( byte [ ] iv , byte [ ] data ) throws IntegrityException { } } | if ( data . length % blockSize != 0 ) { throw new IntegrityException ( "Incorrect data size" ) ; } if ( iv . length != blockSize ) { throw new IntegrityException ( "Incorrect iv size" ) ; } byte [ ] res = new byte [ data . length ] ; encrypt ( iv , data , res ) ; return res ; |
public class AbstractEventSource { /** * This method sends the given { @ code event } to all { @ link # addListener ( EventListener ) registered } listeners .
* @ param event the event to set . */
protected void fireEvent ( E event ) { } } | for ( L listener : this . listeners ) { try { fireEvent ( event , listener ) ; } catch ( RuntimeException e ) { handleListenerError ( listener , event , e ) ; } } |
public class Barrier { /** * Returns the entity group parent of a Barrier of the specified type .
* According to our < a href = " http : / / goto / java - pipeline - model " > transactional
* model < / a > : If B is the finalize barrier of a Job J , then the entity group
* parent of B is J . Run barriers do not have an entity group parent . */
private static Key getEgParentKey ( Type type , Key jobKey ) { } } | switch ( type ) { case RUN : return null ; case FINALIZE : if ( null == jobKey ) { throw new IllegalArgumentException ( "jobKey is null" ) ; } break ; } return jobKey ; |
public class ImplicitDenyMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ImplicitDeny implicitDeny , ProtocolMarshaller protocolMarshaller ) { } } | if ( implicitDeny == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( implicitDeny . getPolicies ( ) , POLICIES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class BsonConvert { /** * - - - - - convertFrom - - - - - */
public < T > T convertFrom ( final Type type , final byte [ ] bytes ) { } } | if ( bytes == null ) return null ; return convertFrom ( type , bytes , 0 , bytes . length ) ; |
public class ImageUtils { /** * A convenience method for setting ARGB pixels in an image . This tries to avoid the performance
* penalty of BufferedImage . setRGB unmanaging the image .
* @ param image a BufferedImage object
* @ param x the left edge of the pixel block
* @ param y the right edge of the pixel block
* @ param width the width of the pixel arry
* @ param height the height of the pixel arry
* @ param pixels the array of pixels to set
* @ see # getRGB */
public static void setRGB ( BufferedImage image , int x , int y , int width , int height , int [ ] pixels ) { } } | int type = image . getType ( ) ; if ( type == BufferedImage . TYPE_INT_ARGB || type == BufferedImage . TYPE_INT_RGB ) image . getRaster ( ) . setDataElements ( x , y , width , height , pixels ) ; else image . setRGB ( x , y , width , height , pixels , 0 , width ) ; |
public class Resolver { public File resolve ( Node classpathBase , Resource resource ) throws IOException { } } | Base base ; Node baseResolved ; Node normal ; String minimizedPath ; Node minimized ; base = resource . getBase ( ) ; if ( base == Base . CLASSPATH ) { baseResolved = classpathBase ; } else { baseResolved = bases . get ( base ) ; } if ( baseResolved == null ) { throw new IllegalStateException ( "unknown base: " + base . toString ( ) ) ; } normal = resolve ( baseResolved , resource . getPath ( ) ) ; minimizedPath = resource . getMinPath ( ) ; minimized = minimizedPath == null ? null : resolve ( baseResolved , minimizedPath ) ; return new File ( normal , minimized , resource . getType ( ) , resource . getVariant ( ) ) ; |
public class SynchronizableRegistryImpl { /** * { @ inheritDoc } */
@ Override public void notifySynchronization ( ) { } } | try { synchronisationObservable . notifyObservers ( System . currentTimeMillis ( ) ) ; } catch ( CouldNotPerformException ex ) { ExceptionPrinter . printHistory ( new CouldNotPerformException ( "Could not notify observer about synchronization" , ex ) , logger ) ; } |
public class XMLSerializer { /** * simple utility method - - good for debugging .
* @ param s the s
* @ return the string */
protected static final String printable ( String s ) { } } | if ( s == null ) return "null" ; StringBuffer retval = new StringBuffer ( s . length ( ) + 16 ) ; retval . append ( "'" ) ; @ SuppressWarnings ( "unused" ) char ch ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { addPrintable ( retval , s . charAt ( i ) ) ; } retval . append ( "'" ) ; return retval . toString ( ) ; |
public class LhsBuilder { /** * If the type of the column is either FieldType . SINGLE _ FIELD or FieldType . OPERATOR _ FIELD we have
* added quotation - marks around the template parameter . Consequentially if a cell value included the
* quotation - marks ( i . e . for an empty - string or white - space ) we need to remove the additional
* quotation - marks .
* @ param value
* @ return */
private String fixValue ( final int column , final String value ) { } } | String _value = value ; final FieldType fieldType = this . fieldTypes . get ( column ) ; if ( fieldType == FieldType . NORMAL_FIELD || ! isMultipleConstraints ( ) || isForAll ( ) ) { return value ; } if ( isDelimitedString ( _value ) ) { _value = _value . substring ( 1 , _value . length ( ) - 1 ) ; } return _value ; |
public class Lists { /** * Convenience method for building a list from an array
* @ param array
* @ param < T > list type
* @ return a new list created from var args */
public static < T > List < T > arrayToList ( T [ ] array ) { } } | return new ArrayList < T > ( Arrays . asList ( array ) ) ; |
public class FullDTDReader { /** * Internal methods , conditional blocks : */
private void checkInclusion ( ) throws XMLStreamException { } } | String keyword ; // INCLUDE / IGNORE not allowed in internal subset . . .
/* 18 - Jul - 2004 , TSa : Except if it ' s in an expanded parsed external
* entity . . . */
if ( ! mIsExternal && mInput == mRootInput ) { _reportWFCViolation ( "Internal DTD subset can not use (INCLUDE/IGNORE) directives (except via external entities)" ) ; } char c = skipDtdWs ( true ) ; if ( c != 'I' ) { // let ' s obtain the keyword for error reporting purposes :
keyword = readDTDKeyword ( String . valueOf ( c ) ) ; } else { c = dtdNextFromCurr ( ) ; if ( c == 'G' ) { keyword = checkDTDKeyword ( "NORE" ) ; if ( keyword == null ) { handleIgnored ( ) ; return ; } keyword = "IG" + keyword ; } else if ( c == 'N' ) { keyword = checkDTDKeyword ( "CLUDE" ) ; if ( keyword == null ) { handleIncluded ( ) ; return ; } keyword = "IN" + keyword ; } else { -- mInputPtr ; keyword = readDTDKeyword ( "I" ) ; } } // If we get here , it was an error . . .
_reportWFCViolation ( "Unrecognized directive '" + keyword + "'; expected either 'IGNORE' or 'INCLUDE'" ) ; |
public class ExtendedProperties { /** * Returns a new { @ link java . util . Properties } instance representing the properties .
* @ return The properties */
public Properties toProperties ( ) { } } | Properties props = new Properties ( ) ; // We need to iterate over the keys calling
// getProperty in order to consider defaults .
for ( String key : keySet ( ) ) { props . put ( key , get ( key ) ) ; } return props ; |
public class EhcacheManager { /** * adjusts the config to reflect new classloader & serialization provider */
private < K , V > CacheConfiguration < K , V > adjustConfigurationWithCacheManagerDefaults ( String alias , CacheConfiguration < K , V > config ) { } } | ClassLoader cacheClassLoader = config . getClassLoader ( ) ; List < ServiceConfiguration < ? > > configurationList = new ArrayList < > ( ) ; configurationList . addAll ( config . getServiceConfigurations ( ) ) ; CacheLoaderWriterConfiguration loaderWriterConfiguration = findSingletonAmongst ( CacheLoaderWriterConfiguration . class , config . getServiceConfigurations ( ) ) ; if ( loaderWriterConfiguration == null ) { CacheLoaderWriterProvider loaderWriterProvider = serviceLocator . getService ( CacheLoaderWriterProvider . class ) ; ServiceConfiguration < CacheLoaderWriterProvider > preConfiguredCacheLoaderWriterConfig = loaderWriterProvider . getPreConfiguredCacheLoaderWriterConfig ( alias ) ; if ( preConfiguredCacheLoaderWriterConfig != null ) { configurationList . add ( preConfiguredCacheLoaderWriterConfig ) ; } if ( loaderWriterProvider . isLoaderJsrProvided ( alias ) ) { configurationList . add ( new CacheLoaderWriterConfiguration ( ) { } ) ; } } ServiceConfiguration < ? > [ ] serviceConfigurations = new ServiceConfiguration < ? > [ configurationList . size ( ) ] ; configurationList . toArray ( serviceConfigurations ) ; if ( cacheClassLoader == null ) { cacheClassLoader = cacheManagerClassLoader ; } if ( cacheClassLoader != config . getClassLoader ( ) ) { config = new BaseCacheConfiguration < > ( config . getKeyType ( ) , config . getValueType ( ) , config . getEvictionAdvisor ( ) , cacheClassLoader , config . getExpiryPolicy ( ) , config . getResourcePools ( ) , serviceConfigurations ) ; } else { config = new BaseCacheConfiguration < > ( config . getKeyType ( ) , config . getValueType ( ) , config . getEvictionAdvisor ( ) , config . getClassLoader ( ) , config . getExpiryPolicy ( ) , config . getResourcePools ( ) , serviceConfigurations ) ; } return config ; |
public class ListModelUpdateBehavior { /** * Factory method to create a new { @ link ListModelUpdateBehavior } object .
* @ param < T >
* the generic type of the model
* @ param model
* the list model
* @ return the new { @ link ListModelUpdateBehavior } object */
public static < T extends Serializable > ListModelUpdateBehavior < T > of ( final ListModel < T > model ) { } } | return new ListModelUpdateBehavior < > ( model ) ; |
public class RemoveAttributesFromFindingsRequest { /** * The ARNs that specify the findings that you want to remove attributes from .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setFindingArns ( java . util . Collection ) } or { @ link # withFindingArns ( java . util . Collection ) } if you want to
* override the existing values .
* @ param findingArns
* The ARNs that specify the findings that you want to remove attributes from .
* @ return Returns a reference to this object so that method calls can be chained together . */
public RemoveAttributesFromFindingsRequest withFindingArns ( String ... findingArns ) { } } | if ( this . findingArns == null ) { setFindingArns ( new java . util . ArrayList < String > ( findingArns . length ) ) ; } for ( String ele : findingArns ) { this . findingArns . add ( ele ) ; } return this ; |
public class AWSApplicationDiscoveryClient { /** * Deletes one or more import tasks , each identified by their import ID . Each import task has a number of records
* that can identify servers or applications .
* AWS Application Discovery Service has built - in matching logic that will identify when discovered servers match
* existing entries that you ' ve previously discovered , the information for the already - existing discovered server is
* updated . When you delete an import task that contains records that were used to match , the information in those
* matched records that comes from the deleted records will also be deleted .
* @ param batchDeleteImportDataRequest
* @ return Result of the BatchDeleteImportData operation returned by the service .
* @ throws AuthorizationErrorException
* The AWS user account does not have permission to perform the action . Check the IAM policy associated with
* this account .
* @ throws InvalidParameterValueException
* The value of one or more parameters are either invalid or out of range . Verify the parameter values and
* try again .
* @ throws ServerInternalErrorException
* The server experienced an internal error . Try again .
* @ sample AWSApplicationDiscovery . BatchDeleteImportData */
@ Override public BatchDeleteImportDataResult batchDeleteImportData ( BatchDeleteImportDataRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeBatchDeleteImportData ( request ) ; |
public class Expressive { /** * Wait until a polled sample of the feature is { @ code true } .
* Uses a default ticker . */
public < S > void waitUntil ( S subject , Feature < ? super S , Boolean > feature ) { } } | waitUntil ( subject , feature , eventually ( ) , isQuietlyTrue ( ) ) ; |
public class UTF16 { /** * Returns a new UTF16 format Unicode string resulting from replacing all occurrences of
* oldChar32 in source with newChar32 . If the character oldChar32 does not occur in the UTF16
* format Unicode string source , then source will be returned . Otherwise , a new String object is
* created that represents a codepoint sequence identical to the codepoint sequence represented
* by source , except that every occurrence of oldChar32 is replaced by an occurrence of
* newChar32.
* Examples : < br >
* UTF16 . replace ( " mesquite in your cellar " , ' e ' , ' o ' ) ; < br >
* returns " mosquito in your collar " < br >
* UTF16 . replace ( " JonL " , ' q ' , ' x ' ) ; < br >
* returns " JonL " ( no change ) < br >
* UTF16 . replace ( " Supplementary character \ ud800 \ udc00 " , 0x10000 , ' ! ' ) ; < br >
* returns " Supplementary character ! " < br >
* UTF16 . replace ( " Supplementary character \ ud800 \ udc00 " , 0xd800 , ' ! ' ) ; < br >
* returns " Supplementary character \ ud800 \ udc00 " < br >
* Note this method is provided as support to jdk 1.3 , which does not support supplementary
* characters to its fullest .
* @ param source UTF16 format Unicode string which the codepoint replacements will be based on .
* @ param oldChar32 Non - zero old codepoint to be replaced .
* @ param newChar32 The new codepoint to replace oldChar32
* @ return new String derived from source by replacing every occurrence of oldChar32 with
* newChar32 , unless when no oldChar32 is found in source then source will be returned . */
public static String replace ( String source , int oldChar32 , int newChar32 ) { } } | if ( oldChar32 <= 0 || oldChar32 > CODEPOINT_MAX_VALUE ) { throw new IllegalArgumentException ( "Argument oldChar32 is not a valid codepoint" ) ; } if ( newChar32 <= 0 || newChar32 > CODEPOINT_MAX_VALUE ) { throw new IllegalArgumentException ( "Argument newChar32 is not a valid codepoint" ) ; } int index = indexOf ( source , oldChar32 ) ; if ( index == - 1 ) { return source ; } String newChar32Str = toString ( newChar32 ) ; int oldChar32Size = 1 ; int newChar32Size = newChar32Str . length ( ) ; StringBuffer result = new StringBuffer ( source ) ; int resultIndex = index ; if ( oldChar32 >= SUPPLEMENTARY_MIN_VALUE ) { oldChar32Size = 2 ; } while ( index != - 1 ) { int endResultIndex = resultIndex + oldChar32Size ; result . replace ( resultIndex , endResultIndex , newChar32Str ) ; int lastEndIndex = index + oldChar32Size ; index = indexOf ( source , oldChar32 , lastEndIndex ) ; resultIndex += newChar32Size + index - lastEndIndex ; } return result . toString ( ) ; |
public class AbcGrammar { /** * xcom - vskip : : = " vskip " 1 * WSP xcom - number xcom - unit */
Rule XcomVskip ( ) { } } | return Sequence ( String ( "vskip" ) , OneOrMore ( WSP ( ) ) , XcomNumber ( ) , XcomUnit ( ) ) . label ( XcomVskip ) ; |
public class EffectUtils { /** * < p > Blurs the source pixels into the destination pixels . The force of the
* blur is specified by the radius which must be greater than 0 . < / p >
* < p > The source and destination pixels arrays are expected to be in the
* INT _ ARGB format . < / p >
* < p > After this method is executed , dstPixels contains a transposed and
* filtered copy of srcPixels . < / p >
* @ param srcPixels the source pixels
* @ param dstPixels the destination pixels
* @ param width the width of the source picture
* @ param height the height of the source picture
* @ param kernel the kernel of the blur effect
* @ param radius the radius of the blur effect */
private static void blur ( int [ ] srcPixels , int [ ] dstPixels , int width , int height , float [ ] kernel , int radius ) { } } | float a ; float r ; float g ; float b ; int ca ; int cr ; int cg ; int cb ; for ( int y = 0 ; y < height ; y ++ ) { int index = y ; int offset = y * width ; for ( int x = 0 ; x < width ; x ++ ) { a = r = g = b = 0.0f ; for ( int i = - radius ; i <= radius ; i ++ ) { int subOffset = x + i ; if ( subOffset < 0 || subOffset >= width ) { subOffset = ( x + width ) % width ; } int pixel = srcPixels [ offset + subOffset ] ; float blurFactor = kernel [ radius + i ] ; a += blurFactor * ( ( pixel >> 24 ) & 0xFF ) ; r += blurFactor * ( ( pixel >> 16 ) & 0xFF ) ; g += blurFactor * ( ( pixel >> 8 ) & 0xFF ) ; b += blurFactor * ( ( pixel ) & 0xFF ) ; } ca = ( int ) ( a + 0.5f ) ; cr = ( int ) ( r + 0.5f ) ; cg = ( int ) ( g + 0.5f ) ; cb = ( int ) ( b + 0.5f ) ; dstPixels [ index ] = ( ( ca > 255 ? 255 : ca ) << 24 ) | ( ( cr > 255 ? 255 : cr ) << 16 ) | ( ( cg > 255 ? 255 : cg ) << 8 ) | ( cb > 255 ? 255 : cb ) ; index += height ; } } |
public class Counters { /** * Returns the product of c1 and c2.
* @ return The product of c1 and c2. */
public static < E > double dotProduct ( Counter < E > c1 , Counter < E > c2 ) { } } | double dotProd = 0.0 ; if ( c1 . size ( ) > c2 . size ( ) ) { Counter < E > tmpCnt = c1 ; c1 = c2 ; c2 = tmpCnt ; } for ( E key : c1 . keySet ( ) ) { double count1 = c1 . getCount ( key ) ; if ( Double . isNaN ( count1 ) || Double . isInfinite ( count1 ) ) { throw new RuntimeException ( "Counters.dotProduct infinite or NaN value for key: " + key + '\t' + c1 . getCount ( key ) + '\t' + c2 . getCount ( key ) ) ; } if ( count1 != 0.0 ) { double count2 = c2 . getCount ( key ) ; if ( Double . isNaN ( count2 ) || Double . isInfinite ( count2 ) ) { throw new RuntimeException ( "Counters.dotProduct infinite or NaN value for key: " + key + '\t' + c1 . getCount ( key ) + '\t' + c2 . getCount ( key ) ) ; } if ( count2 != 0.0 ) { // this is the inner product
dotProd += ( count1 * count2 ) ; } } } return dotProd ; |
public class TimerTrace { /** * Create and start a performance profiling with the < code > name < / code > given . Deal with
* profile hierarchy automatically , so caller don ' t have to be concern about it .
* @ param name profile name */
public static void start ( String name ) { } } | if ( ! active ) return ; TimerNode root = new TimerNode ( name , System . currentTimeMillis ( ) ) ; TimerStack stack = ( TimerStack ) curStack . get ( ) ; if ( null == stack ) curStack . set ( new TimerStack ( root ) ) ; else stack . push ( root ) ; |
public class FrenchRepublicanCalendar { /** * / * [ deutsch ]
* < p > Erh & auml ; lt eine alternative Datumssicht spezifisch f & uuml ; r den angegebenen Algorithmus . < / p >
* @ param algorithm calendar computation
* @ return French republican date ( possibly modified )
* @ throws IllegalArgumentException in case of date overflow
* @ since 3.33/4.28 */
public Date getDate ( FrenchRepublicanAlgorithm algorithm ) { } } | if ( algorithm == DEFAULT_ALGORITHM ) { return new Date ( this , DEFAULT_ALGORITHM ) ; } long utcDays = DEFAULT_ALGORITHM . transform ( this ) ; return new Date ( algorithm . transform ( utcDays ) , algorithm ) ; |
public class IMatrix { /** * Multiplikation from two matrices */
public void mul ( IMatrix b , IMatrix result ) { } } | if ( ( b == null ) || ( columns != b . rows ) ) return ; if ( ( result . rows != rows ) || ( result . columns != b . columns ) ) result . reshape ( rows , b . columns ) ; int i , j , k ; double realsum , imagsum ; for ( i = 0 ; i < rows ; i ++ ) for ( k = 0 ; k < b . columns ; k ++ ) { realsum = 0 ; imagsum = 0 ; for ( j = 0 ; j < columns ; j ++ ) { realsum += realmatrix [ i ] [ j ] * b . realmatrix [ j ] [ k ] - imagmatrix [ i ] [ j ] * b . imagmatrix [ j ] [ k ] ; imagsum += realmatrix [ i ] [ j ] * b . imagmatrix [ j ] [ k ] + imagmatrix [ i ] [ j ] * b . realmatrix [ j ] [ k ] ; } result . realmatrix [ i ] [ k ] = realsum ; result . imagmatrix [ i ] [ k ] = imagsum ; } |
public class ChainImpl { /** * { @ inheritDoc } */
@ Override public Group getGroupByPDB ( ResidueNumber resNum ) throws StructureException { } } | String pdbresnum = resNum . toString ( ) ; if ( pdbResnumMap . containsKey ( pdbresnum ) ) { Integer pos = pdbResnumMap . get ( pdbresnum ) ; return groups . get ( pos ) ; } else { throw new StructureException ( "unknown PDB residue number " + pdbresnum + " in chain " + authId ) ; } |
public class Converter { /** * / / / / Revision */
static Revision convert ( com . linecorp . centraldogma . common . Revision rev ) { } } | return RevisionConverter . TO_DATA . convert ( rev ) ; |
public class UserRecordTeamAssociation { /** * Gets the defaultTeamAccessType value for this UserRecordTeamAssociation .
* @ return defaultTeamAccessType * The default team access type { @ link Team # teamAccessType } . This
* field is
* read - only and is populated by Google . */
public com . google . api . ads . admanager . axis . v201808 . TeamAccessType getDefaultTeamAccessType ( ) { } } | return defaultTeamAccessType ; |
public class FileIoUtil { /** * Reads a file and returns it ' s content as string .
* @ param _ file
* @ return */
public static String readFileToString ( String _file ) { } } | List < String > localText = getTextfileFromUrl ( _file ) ; if ( localText == null ) { return null ; } return StringUtil . join ( guessLineTerminatorOfFile ( _file ) , localText ) ; |
public class EncodingUtilsImpl { /** * Extract the locales from a passed in language list .
* @ param allLangs
* @ return List < Locale > */
private List < Locale > extractLocales ( List < List < String > > allLangs ) { } } | List < Locale > rc = new ArrayList < Locale > ( ) ; for ( List < String > langList : allLangs ) { for ( String language : langList ) { String country = "" ; String variant = "" ; int countryIndex = language . indexOf ( '-' ) ; if ( countryIndex > - 1 ) { int variantIndex = language . indexOf ( '-' , ( countryIndex + 1 ) ) ; if ( variantIndex > - 1 ) { variant = language . substring ( variantIndex + 1 ) . trim ( ) ; country = language . substring ( countryIndex , variantIndex ) . trim ( ) ; } else { country = language . substring ( countryIndex + 1 ) . trim ( ) ; } language = language . substring ( 0 , countryIndex ) . trim ( ) ; } rc . add ( new Locale ( language , country , variant ) ) ; } } return rc ; |
public class FileChooserAdaptor { /** * You must provide fileFilter , idFolderStart and title to invoke it ! */
@ Override public void showAndChoose ( IConsumer < File > consumer ) { } } | this . consumer = consumer ; initSrvNodeFile ( ) ; Intent activityTreeIntent = new Intent ( activity , ActivityTreeChooser . class ) ; activityTreeIntent . putExtra ( FragmentNodes . ARG_ID_NODE_SRVNODES , new String [ ] { idFolderStart , idSrvGetNodeFile , idCommand , title } ) ; activity . startActivityForResult ( activityTreeIntent , REQUEST_NODE_FILE ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.