signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Message { /** * / * Returns true if the message could be rendered . */
private boolean toWire ( DNSOutput out , int maxLength ) { } } | if ( maxLength < Header . LENGTH ) return false ; Header newheader = null ; int tempMaxLength = maxLength ; if ( tsigkey != null ) tempMaxLength -= tsigkey . recordLength ( ) ; OPTRecord opt = getOPT ( ) ; byte [ ] optBytes = null ; if ( opt != null ) { optBytes = opt . toWire ( Section . ADDITIONAL ) ; tempMaxLength -= optBytes . length ; } int startpos = out . current ( ) ; header . toWire ( out ) ; Compression c = new Compression ( ) ; int flags = header . getFlagsByte ( ) ; int additionalCount = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) { int skipped ; if ( sections [ i ] == null ) continue ; skipped = sectionToWire ( out , i , c , tempMaxLength ) ; if ( skipped != 0 && i != Section . ADDITIONAL ) { flags = Header . setFlag ( flags , Flags . TC , true ) ; out . writeU16At ( header . getCount ( i ) - skipped , startpos + 4 + 2 * i ) ; for ( int j = i + 1 ; j < Section . ADDITIONAL ; j ++ ) out . writeU16At ( 0 , startpos + 4 + 2 * j ) ; break ; } if ( i == Section . ADDITIONAL ) additionalCount = header . getCount ( i ) - skipped ; } if ( optBytes != null ) { out . writeByteArray ( optBytes ) ; additionalCount ++ ; } if ( flags != header . getFlagsByte ( ) ) out . writeU16At ( flags , startpos + 2 ) ; if ( additionalCount != header . getCount ( Section . ADDITIONAL ) ) out . writeU16At ( additionalCount , startpos + 10 ) ; if ( tsigkey != null ) { TSIGRecord tsigrec = tsigkey . generate ( this , out . toByteArray ( ) , tsigerror , querytsig ) ; tsigrec . toWire ( out , Section . ADDITIONAL , c ) ; out . writeU16At ( additionalCount + 1 , startpos + 10 ) ; } return true ; |
public class StorePackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getFormatSerializerMap ( ) { } } | if ( formatSerializerMapEClass == null ) { formatSerializerMapEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( StorePackage . eNS_URI ) . getEClassifiers ( ) . get ( 113 ) ; } return formatSerializerMapEClass ; |
public class CmsExtendedWorkflowManager { /** * Generates the name for a new workflow project based on the user for whom it is created . < p >
* @ param userCms the user ' s current CMS context
* @ return the workflow project name */
protected String generateProjectName ( CmsObject userCms ) { } } | String projectName = generateProjectName ( userCms , true ) ; if ( existsProject ( projectName ) ) { projectName = generateProjectName ( userCms , false ) ; } return projectName ; |
public class ManagedBeanBuilder { /** * Checks if the scope of the property value is valid for a bean to be stored in targetScope .
* If one of the scopes is a custom scope ( since jsf 2.0 ) , this method only checks the
* references if the current ProjectStage is not Production .
* @ param facesContext
* @ param property the property to be checked
* @ param beanConfiguration the ManagedBean , which will be created */
private boolean isInValidScope ( FacesContext facesContext , ManagedProperty property , ManagedBean beanConfiguration ) { } } | if ( ! property . isValueReference ( ) ) { // no value reference but a literal value - > nothing to check
return true ; } // get the targetScope ( since 2.0 this could be an EL ValueExpression )
String targetScope = null ; if ( beanConfiguration . isManagedBeanScopeValueExpression ( ) ) { // the scope is a custom scope
// Spec says , that the developer has to take care about the references
// to and from managed - beans in custom scopes .
// However , we do check the references , if we are not in Production stage
if ( facesContext . isProjectStage ( ProjectStage . Production ) ) { return true ; } else { targetScope = getNarrowestScope ( facesContext , beanConfiguration . getManagedBeanScopeValueExpression ( facesContext ) . getExpressionString ( ) ) ; // if we could not obtain a targetScope , return true
if ( targetScope == null ) { return true ; } } } else { targetScope = beanConfiguration . getManagedBeanScope ( ) ; if ( targetScope == null ) { targetScope = NONE ; } } // optimization : ' request ' scope can reference any value scope
if ( targetScope . equalsIgnoreCase ( REQUEST ) ) { return true ; } String valueScope = getNarrowestScope ( facesContext , property . getValueBinding ( facesContext ) . getExpressionString ( ) ) ; // if we could not obtain a valueScope , return true
if ( valueScope == null ) { return true ; } // the target scope needs to have a shorter ( or equal ) lifetime than the value scope
return ( SCOPE_COMPARATOR . compare ( targetScope , valueScope ) <= 0 ) ; |
public class AWSCodeStarClient { /** * Gets the tags for a project .
* @ param listTagsForProjectRequest
* @ return Result of the ListTagsForProject operation returned by the service .
* @ throws ProjectNotFoundException
* The specified AWS CodeStar project was not found .
* @ throws ValidationException
* The specified input is either not valid , or it could not be validated .
* @ throws InvalidNextTokenException
* The next token is not valid .
* @ sample AWSCodeStar . ListTagsForProject
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / codestar - 2017-04-19 / ListTagsForProject " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public ListTagsForProjectResult listTagsForProject ( ListTagsForProjectRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListTagsForProject ( request ) ; |
public class TextPair { /** * Returns the deltas between beforeText and afterText as a line separated String .
* For more detailed diffs , use getPatch ( ) or getUnifiedDiffStrings ( )
* @ return diffs as line - separated String */
public String getLongDiffString ( ) { } } | StringBuilder deltas = new StringBuilder ( ) ; for ( Delta delta : getPatch ( ) . getDeltas ( ) ) { deltas . append ( "DeltaType: " + delta . getType ( ) . toString ( ) ) ; deltas . append ( System . getProperty ( "line.separator" ) ) ; deltas . append ( "Original (Non-Neutral):" ) ; deltas . append ( System . getProperty ( "line.separator" ) ) ; deltas . append ( delta . getOriginal ( ) ) ; deltas . append ( System . getProperty ( "line.separator" ) ) ; deltas . append ( System . getProperty ( "line.separator" ) ) ; deltas . append ( "Revised (Neutral):" ) ; deltas . append ( System . getProperty ( "line.separator" ) ) ; deltas . append ( delta . getRevised ( ) ) ; deltas . append ( System . getProperty ( "line.separator" ) ) ; } return deltas . toString ( ) ; |
public class StringUtility { /** * Word wraps a < code > String < / code > to be no longer than the provided number of characters wide .
* TODO : Make this more efficient by eliminating the internal use of substring . */
public static void wordWrap ( String string , int width , Appendable out ) throws IOException { } } | width ++ ; boolean useCR = false ; do { int pos = string . indexOf ( '\n' ) ; if ( ! useCR && pos > 0 && string . charAt ( pos - 1 ) == '\r' ) useCR = true ; int linelength = pos == - 1 ? string . length ( ) : pos + 1 ; if ( ( pos == - 1 ? linelength - 1 : pos ) <= width ) { // No wrap required
out . append ( string , 0 , linelength ) ; string = string . substring ( linelength ) ; } else { // Word wrap required
// Search for the beginning of the first word that is past the < code > width < / code > column
// The wrap character must be on the same line as the outputted line .
int lastBreakChar = 0 ; for ( int c = 0 ; c < width ; c ++ ) { // Check to see if it is a break character
char ch = string . charAt ( c ) ; boolean isBreak = false ; for ( int d = 0 ; d < wordWrapChars . length ; d ++ ) { if ( ch == wordWrapChars [ d ] ) { isBreak = true ; break ; } } if ( isBreak ) lastBreakChar = c + 1 ; } // If no break has been found , keep searching until a break is found
if ( lastBreakChar == 0 ) { for ( int c = width ; c < linelength ; c ++ ) { char ch = string . charAt ( c ) ; boolean isBreak = false ; for ( int d = 0 ; d < wordWrapChars . length ; d ++ ) { if ( ch == wordWrapChars [ d ] ) { isBreak = true ; break ; } } if ( isBreak ) { lastBreakChar = c + 1 ; break ; } } } if ( lastBreakChar == 0 ) { // Take the whole line
out . append ( string , 0 , linelength ) ; string = string . substring ( linelength ) ; } else { // Break out the section
out . append ( string , 0 , lastBreakChar ) ; if ( useCR ) out . append ( "\r\n" ) ; else out . append ( '\n' ) ; string = string . substring ( lastBreakChar ) ; } } } while ( string . length ( ) > 0 ) ; |
public class RevisionApi { /** * Returns the number of revisions for the specified article .
* @ param articleID
* ID of the article
* @ return number of revisions
* @ throws WikiApiException
* if an error occurs */
public int getNumberOfRevisions ( final int articleID ) throws WikiApiException { } } | try { if ( articleID < 1 ) { throw new IllegalArgumentException ( ) ; } PreparedStatement statement = null ; ResultSet result = null ; String revCounters ; try { // Retrieve the fullRevisionPK and calculate the limit
statement = this . connection . prepareStatement ( "SELECT RevisionCounter " + "FROM index_articleID_rc_ts " + "WHERE ArticleID=? LIMIT 1" ) ; statement . setInt ( 1 , articleID ) ; result = statement . executeQuery ( ) ; if ( result . next ( ) ) { revCounters = result . getString ( 1 ) ; } else { throw new WikiPageNotFoundException ( "The article with the ID " + articleID + " was not found." ) ; } } finally { if ( statement != null ) { statement . close ( ) ; } if ( result != null ) { result . close ( ) ; } } int index = revCounters . lastIndexOf ( ' ' ) ; if ( index == - 1 ) { throw new WikiApiException ( "Article data is inconsistent" ) ; } return Integer . parseInt ( revCounters . substring ( index + 1 , revCounters . length ( ) ) ) ; } catch ( WikiApiException e ) { throw e ; } catch ( Exception e ) { throw new WikiApiException ( e ) ; } |
public class Setup { /** * Creates a package if it doesn ' t exist . Only works from 6.1. */
public void mkPackage ( String name ) throws IOException { } } | File metaDir = new File ( getAssetLoc ( ) + "/" + name . replace ( '.' , '/' ) + "/.mdw" ) ; if ( ! metaDir . exists ( ) && ! metaDir . mkdirs ( ) ) throw new IOException ( "Cannot create directory: " + metaDir . getAbsolutePath ( ) ) ; File pkgFile = new File ( metaDir + "/package.yaml" ) ; if ( ! pkgFile . exists ( ) ) { JSONObject pkgJson = new JSONObject ( ) ; pkgJson . put ( "name" , name ) ; pkgJson . put ( "version" , "1.0.01" ) ; pkgJson . put ( "schemaVersion" , "6.1" ) ; Files . write ( Paths . get ( pkgFile . getPath ( ) ) , pkgJson . toString ( 2 ) . getBytes ( ) ) ; } |
public class CookieUtils { /** * 获取cookie中的value < br >
* 自动负责解码 < br >
* @ param request
* @ param cookieName
* @ return null when cannot find the cookie */
public static String getCookieValue ( HttpServletRequest request , String cookieName ) { } } | try { Cookie cookie = getCookie ( request , cookieName ) ; if ( null == cookie ) { return null ; } else { return URLDecoder . decode ( cookie . getValue ( ) , "utf-8" ) ; } } catch ( Exception e ) { return null ; } |
public class CommerceWishListPersistenceImpl { /** * Returns an ordered range of all the commerce wish lists where groupId = & # 63 ; and userId = & # 63 ; and defaultWishList = & # 63 ; .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CommerceWishListModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param groupId the group ID
* @ param userId the user ID
* @ param defaultWishList the default wish list
* @ param start the lower bound of the range of commerce wish lists
* @ param end the upper bound of the range of commerce wish lists ( not inclusive )
* @ param orderByComparator the comparator to order the results by ( optionally < code > null < / code > )
* @ return the ordered range of matching commerce wish lists */
@ Override public List < CommerceWishList > findByG_U_D ( long groupId , long userId , boolean defaultWishList , int start , int end , OrderByComparator < CommerceWishList > orderByComparator ) { } } | return findByG_U_D ( groupId , userId , defaultWishList , start , end , orderByComparator , true ) ; |
public class RedisInner { /** * Import data into Redis cache .
* @ param resourceGroupName The name of the resource group .
* @ param name The name of the Redis cache .
* @ param parameters Parameters for Redis import operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceResponse } object if successful . */
public Observable < Void > beginImportDataAsync ( String resourceGroupName , String name , ImportRDBParameters parameters ) { } } | return beginImportDataWithServiceResponseAsync ( resourceGroupName , name , parameters ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ; |
public class ComputeNodesImpl { /** * Deletes a user account from the specified compute node .
* You can delete a user account to a node only when it is in the idle or running state .
* @ param poolId The ID of the pool that contains the compute node .
* @ param nodeId The ID of the machine on which you want to delete a user account .
* @ param userName The name of the user account to delete .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < Void > deleteUserAsync ( String poolId , String nodeId , String userName , final ServiceCallback < Void > serviceCallback ) { } } | return ServiceFuture . fromHeaderResponse ( deleteUserWithServiceResponseAsync ( poolId , nodeId , userName ) , serviceCallback ) ; |
public class CheckConformance { /** * Gets requirements from all configs . Merges whitelists of requirements with ' extends ' equal to
* ' rule _ id ' of other rule . */
static List < Requirement > mergeRequirements ( AbstractCompiler compiler , List < ConformanceConfig > configs ) { } } | List < Requirement . Builder > builders = new ArrayList < > ( ) ; Map < String , Requirement . Builder > extendable = new HashMap < > ( ) ; for ( ConformanceConfig config : configs ) { for ( Requirement requirement : config . getRequirementList ( ) ) { Requirement . Builder builder = requirement . toBuilder ( ) ; if ( requirement . hasRuleId ( ) ) { if ( requirement . getRuleId ( ) . isEmpty ( ) ) { reportInvalidRequirement ( compiler , requirement , "empty rule_id" ) ; continue ; } if ( extendable . containsKey ( requirement . getRuleId ( ) ) ) { reportInvalidRequirement ( compiler , requirement , "two requirements with the same rule_id: " + requirement . getRuleId ( ) ) ; continue ; } extendable . put ( requirement . getRuleId ( ) , builder ) ; } if ( ! requirement . hasExtends ( ) ) { builders . add ( builder ) ; } } } for ( ConformanceConfig config : configs ) { for ( Requirement requirement : config . getRequirementList ( ) ) { if ( requirement . hasExtends ( ) ) { Requirement . Builder existing = extendable . get ( requirement . getExtends ( ) ) ; if ( existing == null ) { reportInvalidRequirement ( compiler , requirement , "no requirement with rule_id: " + requirement . getExtends ( ) ) ; continue ; } for ( Descriptors . FieldDescriptor field : requirement . getAllFields ( ) . keySet ( ) ) { if ( ! EXTENDABLE_FIELDS . contains ( field . getName ( ) ) ) { reportInvalidRequirement ( compiler , requirement , "extending rules allow only " + EXTENDABLE_FIELDS ) ; } } existing . addAllWhitelist ( requirement . getWhitelistList ( ) ) ; existing . addAllWhitelistRegexp ( requirement . getWhitelistRegexpList ( ) ) ; existing . addAllOnlyApplyTo ( requirement . getOnlyApplyToList ( ) ) ; existing . addAllOnlyApplyToRegexp ( requirement . getOnlyApplyToRegexpList ( ) ) ; existing . addAllWhitelistEntry ( requirement . getWhitelistEntryList ( ) ) ; } } } List < Requirement > requirements = new ArrayList < > ( builders . size ( ) ) ; for ( Requirement . Builder builder : builders ) { removeDuplicates ( builder ) ; requirements . add ( builder . build ( ) ) ; } return requirements ; |
public class UtilLepetitEPnP { /** * Computes the Jacobian given 3 control points . */
public static void jacobian_Control3 ( DMatrixRMaj L_full , double beta [ ] , DMatrixRMaj A ) { } } | int indexA = 0 ; double b0 = beta [ 0 ] ; double b1 = beta [ 1 ] ; double b2 = beta [ 2 ] ; final double ld [ ] = L_full . data ; for ( int i = 0 ; i < 3 ; i ++ ) { int li = L_full . numCols * i ; A . data [ indexA ++ ] = 2 * ld [ li + 0 ] * b0 + ld [ li + 1 ] * b1 + ld [ li + 2 ] * b2 ; A . data [ indexA ++ ] = ld [ li + 1 ] * b0 + 2 * ld [ li + 3 ] * b1 + ld [ li + 4 ] * b2 ; A . data [ indexA ++ ] = ld [ li + 2 ] * b0 + ld [ li + 4 ] * b1 + 2 * ld [ li + 5 ] * b2 ; } |
public class JbcSrcJavaValue { /** * Constructs a JbcSrcJavaValue specifically for ' constantNull ' , in which case the ' allowedType '
* is any valid type ( including specific proto or proto enum types ) . There ' s no SoyType we can use
* to indicate this , and we can ' t construct our own SoyType because the cxtor is package - private ,
* so we have a separate bool to indicate it . */
static JbcSrcJavaValue ofConstantNull ( JbcSrcValueErrorReporter reporter ) { } } | return new JbcSrcJavaValue ( SoyExpression . NULL , /* method = */
null , /* allowedType = */
null , /* constantNull = */
true , /* error = */
false , reporter ) ; |
public class ActionType { /** * The configuration properties for the action type .
* @ param actionConfigurationProperties
* The configuration properties for the action type . */
public void setActionConfigurationProperties ( java . util . Collection < ActionConfigurationProperty > actionConfigurationProperties ) { } } | if ( actionConfigurationProperties == null ) { this . actionConfigurationProperties = null ; return ; } this . actionConfigurationProperties = new java . util . ArrayList < ActionConfigurationProperty > ( actionConfigurationProperties ) ; |
public class CreateInputRequest { /** * Destination settings for PUSH type inputs .
* @ param destinations
* Destination settings for PUSH type inputs . */
public void setDestinations ( java . util . Collection < InputDestinationRequest > destinations ) { } } | if ( destinations == null ) { this . destinations = null ; return ; } this . destinations = new java . util . ArrayList < InputDestinationRequest > ( destinations ) ; |
public class ImgUtil { /** * 缩放图像 ( 按比例缩放 ) < br >
* 缩放后默认为jpeg格式 , 此方法并不关闭流
* @ param srcImg 源图像来源流
* @ param destFile 缩放后的图像写出到的流
* @ param scale 缩放比例 。 比例大于1时为放大 , 小于1大于0为缩小
* @ throws IORuntimeException IO异常
* @ since 3.2.2 */
public static void scale ( Image srcImg , File destFile , float scale ) throws IORuntimeException { } } | write ( scale ( srcImg , scale ) , destFile ) ; |
public class ListUserPoolClientsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListUserPoolClientsRequest listUserPoolClientsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listUserPoolClientsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listUserPoolClientsRequest . getUserPoolId ( ) , USERPOOLID_BINDING ) ; protocolMarshaller . marshall ( listUserPoolClientsRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( listUserPoolClientsRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MemberRemoval { /** * Specifies that any method or constructor that matches the specified matcher should be removed .
* @ param matcher The matcher that decides upon method and constructor removal .
* @ return A new member removal instance that removes all previously specified members and any method or constructor that matches the specified matcher . */
public MemberRemoval stripInvokables ( ElementMatcher < ? super MethodDescription > matcher ) { } } | return new MemberRemoval ( fieldMatcher , methodMatcher . or ( matcher ) ) ; |
public class ContentCryptoScheme { /** * Increment the rightmost 32 bits of a 16 - byte counter by the specified
* delta . Both the specified delta and the resultant value must stay within
* the capacity of 32 bits .
* ( Package private for testing purposes . )
* @ param counter
* a 16 - byte counter used in AES / CTR
* @ param blockDelta
* the number of blocks ( 16 - byte ) to increment */
static byte [ ] incrementBlocks ( byte [ ] counter , long blockDelta ) { } } | if ( blockDelta == 0 ) return counter ; if ( counter == null || counter . length != 16 ) throw new IllegalArgumentException ( ) ; // Can optimize this later . KISS for now .
if ( blockDelta > MAX_GCM_BLOCKS ) throw new IllegalStateException ( ) ; // Allocate 8 bytes for a long
ByteBuffer bb = ByteBuffer . allocate ( 8 ) ; // Copy the right - most 32 bits from the counter
for ( int i = 12 ; i <= 15 ; i ++ ) bb . put ( i - 8 , counter [ i ] ) ; long val = bb . getLong ( ) + blockDelta ; // increment by delta
if ( val > MAX_GCM_BLOCKS ) throw new IllegalStateException ( ) ; // overflow 2 ^ 32-2
bb . rewind ( ) ; // Get the incremented value ( result ) as an 8 - byte array
byte [ ] result = bb . putLong ( val ) . array ( ) ; // Copy the rightmost 32 bits from the resultant array to the input counter ;
for ( int i = 12 ; i <= 15 ; i ++ ) counter [ i ] = result [ i - 8 ] ; return counter ; |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getFNCResXUBase ( ) { } } | if ( fncResXUBaseEEnum == null ) { fncResXUBaseEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 29 ) ; } return fncResXUBaseEEnum ; |
public class MicrodataChecker { /** * Check itemref constraints .
* This mirrors the " the properties of an item " algorithm ,
* modified to recursively check sub - items .
* http : / / www . whatwg . org / specs / web - apps / current - work / multipage / microdata . html # the - properties - of - an - item */
private void checkItem ( Element root , Deque < Element > parents ) throws SAXException { } } | Deque < Element > pending = new ArrayDeque < Element > ( ) ; Set < Element > memory = new HashSet < Element > ( ) ; memory . add ( root ) ; for ( Element child : root . children ) { pending . push ( child ) ; } if ( root . itemRef != null ) { for ( String id : root . itemRef ) { Element refElm = idmap . get ( id ) ; if ( refElm != null ) { pending . push ( refElm ) ; } else { err ( "The \u201Citemref\u201D attribute referenced \u201C" + id + "\u201D, but there is no element with an \u201Cid\u201D attribute with that value." , root . locator ) ; } } } boolean memoryError = false ; while ( pending . size ( ) > 0 ) { Element current = pending . pop ( ) ; if ( memory . contains ( current ) ) { memoryError = true ; continue ; } memory . add ( current ) ; if ( ! current . itemScope ) { for ( Element child : current . children ) { pending . push ( child ) ; } } if ( current . itemProp != null ) { properties . remove ( current ) ; if ( current . itemScope ) { if ( ! parents . contains ( current ) ) { parents . push ( root ) ; checkItem ( current , parents ) ; parents . pop ( ) ; } else { err ( "The \u201Citemref\u201D attribute created a circular reference with another item." , current . locator ) ; } } } } if ( memoryError ) { err ( "The \u201Citemref\u201D attribute contained redundant references." , root . locator ) ; } |
public class MapELResolver { /** * If the base object is a map , returns whether a call to
* { @ link # setValue } will always fail .
* < p > If the base is a < code > Map < / code > , the < code > propertyResolved < / code >
* property of the < code > ELContext < / code > object must be set to
* < code > true < / code > by this resolver , before returning . If this property
* is not < code > true < / code > after this method is called , the caller
* should ignore the return value . < / p >
* < p > If this resolver was constructed in read - only mode , this method will
* always return < code > true < / code > . < / p >
* < p > If a < code > Map < / code > was created using
* { @ link java . util . Collections # unmodifiableMap } , this method must
* return < code > true < / code > . Unfortunately , there is no Collections API
* method to detect this . However , an implementation can create a
* prototype unmodifiable < code > Map < / code > and query its runtime type
* to see if it matches the runtime type of the base object as a
* workaround . < / p >
* @ param context The context of this evaluation .
* @ param base The map to analyze . Only bases of type < code > Map < / code >
* are handled by this resolver .
* @ param property The key to return the read - only status for .
* Ignored by this resolver .
* @ return If the < code > propertyResolved < / code > property of
* < code > ELContext < / code > was set to < code > true < / code > , then
* < code > true < / code > if calling the < code > setValue < / code > method
* will always fail or < code > false < / code > if it is possible that
* such a call may succeed ; otherwise undefined .
* @ throws NullPointerException if context is < code > null < / code >
* @ throws ELException if an exception was thrown while performing
* the property or variable resolution . The thrown exception
* must be included as the cause property of this exception , if
* available . */
public boolean isReadOnly ( ELContext context , Object base , Object property ) { } } | if ( context == null ) { throw new NullPointerException ( ) ; } if ( base != null && base instanceof Map ) { context . setPropertyResolved ( true ) ; Map map = ( Map ) base ; return isReadOnly || map . getClass ( ) == theUnmodifiableMapClass ; } return false ; |
public class DatabaseURIHelper { /** * Returns URI for { @ code _ changes } endpoint using passed
* { @ code query } . */
public URI changesUri ( String queryKey , Object queryValue ) { } } | if ( queryKey . equals ( "since" ) ) { if ( ! ( queryValue instanceof String ) ) { // json encode the seq number since it isn ' t a string
Gson gson = new Gson ( ) ; queryValue = gson . toJson ( queryValue ) ; } } return this . path ( "_changes" ) . query ( queryKey , queryValue ) . build ( ) ; |
public class XDSSourceAuditor { /** * Get an instance of the XDS Document Source Auditor from the
* global context
* @ return XDS Document Source Auditor instance */
public static XDSSourceAuditor getAuditor ( ) { } } | AuditorModuleContext ctx = AuditorModuleContext . getContext ( ) ; return ( XDSSourceAuditor ) ctx . getAuditor ( XDSSourceAuditor . class ) ; |
public class XVariableDeclarationImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setName ( String newName ) { } } | String oldName = name ; name = newName ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , XbasePackage . XVARIABLE_DECLARATION__NAME , oldName , name ) ) ; |
public class GetActivityTaskRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetActivityTaskRequest getActivityTaskRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getActivityTaskRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getActivityTaskRequest . getActivityArn ( ) , ACTIVITYARN_BINDING ) ; protocolMarshaller . marshall ( getActivityTaskRequest . getWorkerName ( ) , WORKERNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Groups { /** * 查询所有分组
* @ return */
public List < Group > list ( ) { } } | String url = WxEndpoint . get ( "url.group.list" ) ; String response = wxClient . get ( url ) ; logger . debug ( "list groups: {}" , response ) ; GroupList groupList = JsonMapper . defaultMapper ( ) . fromJson ( response , GroupList . class ) ; return groupList . getGroups ( ) ; |
public class MrVector { /** * Inflates a < vector > drawable , using framework implementation when available
* @ param resources
* Resources to use for inflation
* @ param resId
* < vector > drawable resource
* @ return
* < p > Framework { @ link android . graphics . drawable . VectorDrawable } if running lollipop or later . < / p >
* < p > { @ link com . telly . mrvector . VectorDrawable } otherwise . < / p >
* @ see # inflateCompatOnly ( android . content . res . Resources , int ) */
public static Drawable inflate ( Resources resources , @ DrawableRes int resId ) { } } | if ( LOLLIPOP_PLUS ) { return resources . getDrawable ( resId ) ; } else { return inflateCompatOnly ( resources , resId ) ; } |
public class Ix { /** * Calls the given function ( with per - iterator state ) to generate a value or terminate
* whenever the next ( ) is called on the resulting Ix . iterator ( ) .
* The result ' s iterator ( ) doesn ' t support remove ( ) .
* The action may call { @ code onNext } at most once to signal the next value per action invocation .
* The { @ code onCompleted } should be called to indicate no further values will be generated ( may be
* called with an onNext in the same action invocation ) . Calling { @ code onError } will immediately
* throw the given exception ( as is if it ' s a RuntimeException or Error ; or wrapped into a RuntimeException ) .
* @ param < T > the value type
* @ param < S > the state type supplied to and returned by the nextSupplier function
* @ param stateSupplier the function that returns a state for each invocation of iterator ( )
* @ param nextSupplier the action called with an IxEmitter API to receive value , not null
* @ return the new Ix instance
* @ throws NullPointerException if stateSupplier or nextSupplier is null
* @ since 1.0 */
public static < T , S > Ix < T > generate ( IxSupplier < S > stateSupplier , IxFunction2 < S , IxEmitter < T > , S > nextSupplier ) { } } | return generate ( stateSupplier , nextSupplier , IxEmptyAction . instance1 ( ) ) ; |
public class WeeklyAutoScalingSchedule { /** * The schedule for Thursday .
* @ param thursday
* The schedule for Thursday . */
public void setThursday ( java . util . Map < String , String > thursday ) { } } | this . thursday = thursday == null ? null : new com . amazonaws . internal . SdkInternalMap < String , String > ( thursday ) ; |
public class DroolsFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertPriorityTypeToString ( EDataType eDataType , Object instanceValue ) { } } | return XMLTypeFactory . eINSTANCE . convertToString ( XMLTypePackage . Literals . INTEGER , instanceValue ) ; |
public class StateController { /** * Updates state ( or resets state if reset was scheduled , see { @ link # resetState ( State ) } ) .
* @ param state State to be updated
* @ return { @ code true } if state was reset to initial state or { @ code false } if state was
* updated . */
boolean updateState ( State state ) { } } | if ( isResetRequired ) { // Applying initial state
state . set ( 0f , 0f , zoomBounds . set ( state ) . getFitZoom ( ) , 0f ) ; GravityUtils . getImagePosition ( state , settings , tmpRect ) ; state . translateTo ( tmpRect . left , tmpRect . top ) ; // We can correctly reset state only when we have both image size and viewport size
// but there can be a delay before we have all values properly set
// ( waiting for layout or waiting for image to be loaded )
isResetRequired = ! settings . hasImageSize ( ) || ! settings . hasViewportSize ( ) ; return ! isResetRequired ; } else { // Restricts state ' s translation and zoom bounds , disallowing overscroll / overzoom .
restrictStateBounds ( state , state , Float . NaN , Float . NaN , false , false , true ) ; return false ; } |
public class HardwareBinder { /** * A very simple main that prints out the machine UUID to the standard
* output .
* This code takes into account the hardware address ( Ethernet MAC ) when
* calculating the hardware UUID .
* @ param args not used in this version
* @ throws UnknownHostException in case some error happens
* @ throws SocketException in case some error happens
* @ throws NoSuchAlgorithmException in case some error happens */
public static void main ( final String [ ] args ) throws NoSuchAlgorithmException , SocketException , UnknownHostException { } } | final var hb = new HardwareBinder ( ) ; System . out . println ( "The UUID of the machine is:\n" + hb . getMachineIdString ( ) + "\n" ) ; |
public class ReplicatorBuilder { /** * Sets the username to use when authenticating with the server .
* Setting the username and password ( using the { @ link ReplicatorBuilder # password ( String ) } )
* method
* takes precedence over credentials passed via the URI .
* @ param username The username to use when authenticating .
* @ return The current instance of { @ link ReplicatorBuilder }
* @ throws IllegalArgumentException if { @ code username } is { @ code null } . */
public E username ( String username ) { } } | Misc . checkNotNull ( username , "username" ) ; this . username = username ; // noinspection unchecked
return ( E ) this ; |
public class CSSStyleRuleImpl { /** * Sets the selector text .
* @ param selectorText the new selector text
* @ throws DOMException in clase of error */
public void setSelectorText ( final String selectorText ) throws DOMException { } } | try { final CSSOMParser parser = new CSSOMParser ( ) ; selectors_ = parser . parseSelectors ( selectorText ) ; } catch ( final CSSException e ) { throw new DOMExceptionImpl ( DOMException . SYNTAX_ERR , DOMExceptionImpl . SYNTAX_ERROR , e . getMessage ( ) ) ; } catch ( final IOException e ) { throw new DOMExceptionImpl ( DOMException . SYNTAX_ERR , DOMExceptionImpl . SYNTAX_ERROR , e . getMessage ( ) ) ; } |
public class SemanticPredicates { /** * Distinguish between local variable declaration and method call , e . g . ` a b ` */
public static boolean isInvalidLocalVariableDeclaration ( TokenStream ts ) { } } | int index = 2 ; Token token ; int tokenType ; int tokenType2 = ts . LT ( index ) . getType ( ) ; int tokenType3 ; if ( DOT == tokenType2 ) { int tokeTypeN = tokenType2 ; do { index = index + 2 ; tokeTypeN = ts . LT ( index ) . getType ( ) ; } while ( DOT == tokeTypeN ) ; if ( LT == tokeTypeN || LBRACK == tokeTypeN ) { return false ; } index = index - 1 ; tokenType2 = ts . LT ( index + 1 ) . getType ( ) ; } else { index = 1 ; } token = ts . LT ( index ) ; tokenType = token . getType ( ) ; tokenType3 = ts . LT ( index + 2 ) . getType ( ) ; return // VOID = = tokenType | |
! ( BuiltInPrimitiveType == tokenType || MODIFIER_SET . contains ( tokenType ) ) && Character . isLowerCase ( token . getText ( ) . codePointAt ( 0 ) ) && ! ( ASSIGN == tokenType3 || ( LT == tokenType2 || LBRACK == tokenType2 ) ) ; |
public class AbstractGenericRowMapper { /** * Generate UPDATE statement to update an existing BO .
* The generated SQL will look like this
* { @ code UPDATE table SET col1 = ? , col2 = ? . . . WHERE pk - 1 = ? AND pk - 2 = ? . . . }
* @ param tableName
* @ return
* @ since 0.8.5 */
public String generateSqlUpdate ( String tableName ) { } } | try { return cacheSQLs . get ( "UPDATE:" + tableName , ( ) -> { return MessageFormat . format ( "UPDATE {0} SET {2} WHERE {1}" , tableName , strWherePkClause , strUpdateSetClause ) ; } ) ; } catch ( ExecutionException e ) { throw new RuntimeException ( e ) ; } |
public class ResourcesInner { /** * Checks by ID whether a resource exists .
* @ param resourceId The fully qualified ID of the resource , including the resource name and resource type . Use the format , / subscriptions / { guid } / resourceGroups / { resource - group - name } / { resource - provider - namespace } / { resource - type } / { resource - name }
* @ param apiVersion The API version to use for the operation .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < Boolean > checkExistenceByIdAsync ( String resourceId , String apiVersion , final ServiceCallback < Boolean > serviceCallback ) { } } | return ServiceFuture . fromResponse ( checkExistenceByIdWithServiceResponseAsync ( resourceId , apiVersion ) , serviceCallback ) ; |
public class CmsLruCache { /** * Removes an object from the list of all cached objects in this cache ,
* no matter what position it has inside the list . < p >
* @ param theCacheObject the object being removed from the list of all cached objects
* @ return a reference to the object that was removed */
public synchronized I_CmsLruCacheObject remove ( I_CmsLruCacheObject theCacheObject ) { } } | if ( ! isCached ( theCacheObject ) ) { // theCacheObject is null or not inside the cache
return null ; } // set the list pointers correct
boolean nextNull = ( theCacheObject . getNextLruObject ( ) == null ) ; boolean prevNull = ( theCacheObject . getPreviousLruObject ( ) == null ) ; if ( prevNull && nextNull ) { m_listHead = null ; m_listTail = null ; } else if ( nextNull ) { // remove the object from the head pos .
I_CmsLruCacheObject newHead = theCacheObject . getPreviousLruObject ( ) ; newHead . setNextLruObject ( null ) ; m_listHead = newHead ; } else if ( prevNull ) { // remove the object from the tail pos .
I_CmsLruCacheObject newTail = theCacheObject . getNextLruObject ( ) ; newTail . setPreviousLruObject ( null ) ; m_listTail = newTail ; } else { // remove the object from within the list
theCacheObject . getPreviousLruObject ( ) . setNextLruObject ( theCacheObject . getNextLruObject ( ) ) ; theCacheObject . getNextLruObject ( ) . setPreviousLruObject ( theCacheObject . getPreviousLruObject ( ) ) ; } // update cache stats . and notify the cached object
decreaseCache ( theCacheObject ) ; return theCacheObject ; |
public class RestFileManager { /** * Will create a unique sub folder in the temp directory . This is done so that we can name the file with the original file
* name without having to worry about file name collisions . The bh rest apis will name the attached file what the system File
* created in this method is named , which is why we are not using a randomly generated file name here .
* Will create a file in tempDir \ \ uniqueSubFolder \ \ filename . type
* @ param multipartFile
* @ return
* @ throws IOException */
public MultiValueMap < String , Object > addFileToMultiValueMap ( MultipartFile multipartFile ) throws IOException { } } | String newFolderPath = FileUtils . getTempDirectoryPath ( ) + "/" + System . currentTimeMillis ( ) ; File newFolder = new File ( newFolderPath ) ; FileUtils . forceMkdir ( newFolder ) ; String originalFileName = multipartFile . getOriginalFilename ( ) ; String filePath = newFolderPath + "/" + originalFileName ; File file = new File ( filePath ) ; FileCopyUtils . copy ( multipartFile . getBytes ( ) , file ) ; return addFileToMultiValueMap ( file ) ; |
public class MethodBase { /** * Parse the request body , and return the object .
* @ param is Input stream for content
* @ param cl The class we expect
* @ param resp for status
* @ return Object Parsed body or null for no body
* @ exception ServletException Some error occurred . */
protected Object readJson ( final InputStream is , final Class cl , final HttpServletResponse resp ) throws ServletException { } } | if ( is == null ) { return null ; } try { return getMapper ( ) . readValue ( is , cl ) ; } catch ( Throwable t ) { resp . setStatus ( HttpServletResponse . SC_INTERNAL_SERVER_ERROR ) ; if ( debug ( ) ) { error ( t ) ; } throw new ServletException ( t ) ; } |
public class SVDModelV99 { /** * Version & Schema - specific filling into the impl */
@ Override public SVDModel createImpl ( ) { } } | SVDModel . SVDParameters parms = parameters . createImpl ( ) ; return new SVDModel ( model_id . key ( ) , parms , null ) ; |
public class TransmissionData { /** * Resets the transmission data instance so that it can be reused . This is invoked
* as part of the TransmissionDataIterator . next ( ) method so that it can keep hold of
* only one instance of this class .
* @ param jfapBuffer
* @ param isUserRequest
* @ param isTerminal
* @ param connection */
protected void reset ( JFapByteBuffer jfapBuffer , boolean isTerminal , Connection connection ) { } } | if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "reset" , new Object [ ] { jfapBuffer , "" + isTerminal , connection } ) ; this . isTerminal = isTerminal ; this . connection = connection ; this . xmitDataBuffers = jfapBuffer . getBuffersForTransmission ( ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "reset" ) ; |
public class PropertiesCoreExtension { /** * Delete the property and all the property values
* @ param property
* property name
* @ return deleted values count */
public int deleteProperty ( String property ) { } } | int count = 0 ; if ( has ( ) ) { TDao dao = getDao ( ) ; String where = dao . buildWhere ( COLUMN_PROPERTY , property ) ; String [ ] whereArgs = dao . buildWhereArgs ( property ) ; count = dao . delete ( where , whereArgs ) ; } return count ; |
public class BaseNsStreamWriter { /** * Method that is called to ensure that we can start writing an
* element , both from structural point of view , and from syntactic
* ( close previously open start element , if any ) . */
protected void checkStartElement ( String localName , String prefix ) throws XMLStreamException { } } | // Need to finish an open start element ?
if ( mStartElementOpen ) { closeStartElement ( mEmptyElement ) ; } else if ( mState == STATE_PROLOG ) { verifyRootElement ( localName , prefix ) ; } else if ( mState == STATE_EPILOG ) { if ( mCheckStructure ) { String name = ( prefix == null || prefix . length ( ) == 0 ) ? localName : ( prefix + ":" + localName ) ; reportNwfStructure ( ErrorConsts . WERR_PROLOG_SECOND_ROOT , name ) ; } /* When outputting a fragment , need to reset this to the
* tree . No point in trying to verify the root element ? */
mState = STATE_TREE ; } |
public class BasicRequestExecutor { /** * < p > Executes an { @ link HttpRequestBase } using the endpoint ' s { @ link HttpClient } and handles the
* resulting { @ link HttpResponse } using this executor ' s { @ link ExecutionHandler } . < / p >
* < p > See { @ link # fetchResponse ( InvocationContext , HttpRequestBase ) } < / p >
* < p > See { @ link Is # successful ( HttpResponse ) } < / p >
* @ param context
* the { @ link InvocationContext } used to discover information about the proxy invocation
* < br > < br >
* @ param request
* the { @ link HttpRequestBase } to be executed using the endpoint ' s { @ link HttpClient }
* < br > < br >
* @ throws InvocationException
* if the HTTP request responded with a failure status code or if request execution failed
* < br > < br >
* @ since 1.1.0 */
@ Override public HttpResponse execute ( InvocationContext context , HttpRequestBase request ) { } } | HttpResponse response = null ; try { response = fetchResponse ( context , request ) ; } catch ( RequestExecutionException ree ) { executionHandler . onError ( context , ree ) ; } if ( response != null ) { if ( successful ( response ) ) { executionHandler . onSuccess ( context , response ) ; } else { executionHandler . onFailure ( context , response ) ; } } return response ; |
public class InitializationListener { /** * ( non - Javadoc )
* @ see javax . servlet . ServletContextListener # contextDestroyed ( javax . servlet . ServletContextEvent ) */
public void contextDestroyed ( ServletContextEvent arg0 ) { } } | Iterator < Driver > drivers = DriverManager . getDrivers ( ) ; while ( drivers . hasNext ( ) ) { Driver driver = drivers . next ( ) ; DriverManager . deregisterDriver ( driver ) ; DriverImpl impl = ( DriverImpl ) driver ; impl . shutdown ( ) ; } |
public class ConfigureLogback { /** * Configure logback logging system using the provided file . */
static void configure ( final File f ) { } } | new Configurator ( ) { @ Override void withConfigurator ( JoranConfigurator configurator ) throws JoranException { configurator . doConfigure ( f ) ; } } . configure ( ) ; |
public class Diff { /** * return wether field is in changedfieldlist and old value of this field
* @ param fieldId
* @ return */
public Pair < Boolean , Object > hasValueChanged ( String fieldId ) { } } | for ( int i = 0 ; i < changedFields . length ; i ++ ) { String changedField = changedFields [ i ] ; if ( fieldId . equals ( changedField ) ) { return new Pair < > ( true , oldValues [ i ] ) ; } } return new Pair < > ( false , null ) ; |
public class IdentitySourceMapGenerator { /** * Returns an array of integers representing the line lengths ( including CRLF ) of each of the
* lines in the input source .
* @ return array of line length integers ( one based ) */
private int [ ] getLineLengths ( ) { } } | List < Integer > lineLengthsList = new ArrayList < Integer > ( ) ; int linelength = 0 ; for ( int i = 0 ; i < source . length ( ) ; i ++ ) { linelength ++ ; char ch = source . charAt ( i ) ; if ( ch == '\n' ) { lineLengthsList . add ( linelength ) ; linelength = 0 ; } } lineLengthsList . add ( linelength ) ; int [ ] result = new int [ lineLengthsList . size ( ) ] ; for ( int i = 0 ; i < lineLengthsList . size ( ) ; i ++ ) { result [ i ] = lineLengthsList . get ( i ) ; } return result ; |
public class ExecutionGraphCache { /** * Gets the { @ link AccessExecutionGraph } for the given { @ link JobID } and caches it . The
* { @ link AccessExecutionGraph } will be requested again after the refresh interval has passed
* or if the graph could not be retrieved from the given gateway .
* @ param jobId identifying the { @ link ArchivedExecutionGraph } to get
* @ param restfulGateway to request the { @ link ArchivedExecutionGraph } from
* @ return Future containing the requested { @ link ArchivedExecutionGraph } */
public CompletableFuture < AccessExecutionGraph > getExecutionGraph ( JobID jobId , RestfulGateway restfulGateway ) { } } | return getExecutionGraphInternal ( jobId , restfulGateway ) . thenApply ( Function . identity ( ) ) ; |
public class EJBJarDescriptorHandler { /** * Insert EJB references in all of the descriptors of the EJB ' s in the supplied list
* @ param document DOM tree of an ejb - jar . xml file .
* @ param ejbInfo Contains information about the EJB control .
* @ param ejbLinkValue The ejb - link value for the EJBs .
* @ param ejbList The list of EJB ' s */
private void insertEJBRefsInEJBJar ( Document document , EJBInfo ejbInfo , String ejbLinkValue , List ejbList ) { } } | for ( Object ejb : ejbList ) { if ( ejbInfo . isLocal ( ) ) insertEJBLocalRefInEJBJar ( ( Element ) ejb , ejbInfo , ejbLinkValue , document ) ; else insertEJBRefInEJBJar ( ( Element ) ejb , ejbInfo , ejbLinkValue , document ) ; } |
public class JsonTokener { /** * Consume the next character , skipping whitespace , and check that it matches a
* specified character .
* @ param c The character to match .
* @ return The character . */
public char nextClean ( char c ) { } } | char n = nextClean ( ) ; if ( n != c ) { throw syntaxError ( "Expected '" + c + "' and instead saw '" + n + "'" ) ; } return n ; |
public class GenericGenbankHeaderFormat { /** * private String _ write _ multi _ entries ( String tag , ArrayList < String >
* text _ list ) { String output = _ write _ single _ line ( tag , text _ list . remove ( 0 ) ) ;
* for ( String s : text _ list ) { output + = _ write _ single _ line ( " " , s ) ; } return
* output ; } */
private String _get_date ( S sequence ) { } } | Date sysdate = Calendar . getInstance ( ) . getTime ( ) ; // String default _ date =
// sysdate . get ( Calendar . DAY _ OF _ MONTH ) + " - " + sysdate . get ( Calendar . MONTH ) + " - " + sysdate . get ( Calendar . YEAR ) ;
String default_date = new SimpleDateFormat ( "dd-MMM-yyyy" ) . format ( sysdate ) ; return default_date ; /* * try : date = record . annotations [ " date " ] except KeyError : return
* default # Cope with a list of one string : if isinstance ( date , list )
* and len ( date ) = = 1 : date = date [ 0 ] # TODO - allow a Python date object
* if not isinstance ( date , str ) or len ( date ) ! = 11 \ or date [ 2 ] ! = " - "
* or date [ 6 ] ! = " - " \ or not date [ : 2 ] . isdigit ( ) or not
* date [ 7 : ] . isdigit ( ) \ or int ( date [ : 2 ] ) > 31 \ or date [ 3:6 ] not in
* [ " JAN " , " FEB " , " MAR " , " APR " , " MAY " , " JUN " , " JUL " , " AUG " , " SEP " ,
* " OCT " , " NOV " , " DEC " ] : # TODO - Check is a valid date ( e . g . not 31
* Feb ) return default return date */ |
public class Configuration { /** * Checks for the presence of the property < code > name < / code > in the
* deprecation map . Returns the first of the list of new keys if present
* in the deprecation map or the < code > name < / code > itself . If the property
* is not presently set but the property map contains an entry for the
* deprecated key , the value of the deprecated key is set as the value for
* the provided property name .
* @ param name the property name
* @ return the first property in the list of properties mapping
* the < code > name < / code > or the < code > name < / code > itself . */
private String [ ] handleDeprecation ( String name ) { } } | ArrayList < String > names = new ArrayList < String > ( ) ; if ( isDeprecated ( name ) ) { DeprecatedKeyInfo keyInfo = deprecatedKeyMap . get ( name ) ; warnOnceIfDeprecated ( name ) ; for ( String newKey : keyInfo . newKeys ) { if ( newKey != null ) { names . add ( newKey ) ; } } } if ( names . isEmpty ( ) ) { names . add ( name ) ; } for ( String n : names ) { String deprecatedKey = reverseDeprecatedKeyMap . get ( n ) ; if ( deprecatedKey != null && ! getOverlay ( ) . containsKey ( n ) && getOverlay ( ) . containsKey ( deprecatedKey ) ) { getProps ( ) . setProperty ( n , getOverlay ( ) . getProperty ( deprecatedKey ) ) ; getOverlay ( ) . setProperty ( n , getOverlay ( ) . getProperty ( deprecatedKey ) ) ; } } return names . toArray ( new String [ names . size ( ) ] ) ; |
public class QueryBuilder { /** * Perform a UNION ALL between the query as defined prior to this method and the query that will be defined following this
* method .
* @ return this builder object , for convenience in method chaining */
public QueryBuilder unionAll ( ) { } } | this . firstQuery = query ( ) ; this . firstQuerySetOperation = Operation . UNION ; this . firstQueryAll = true ; clear ( false ) ; return this ; |
public class DefaultAnnotationProvider { /** * taken from org . apache . myfaces . view . facelets . util . Classpath
* For URLs to JARs that do not use JarURLConnection - allowed by the servlet spec - attempt to produce a JarFile
* object all the same . Known servlet engines that function like this include Weblogic and OC4J . This is not a full
* solution , since an unpacked WAR or EAR will not have JAR " files " as such . */
private static JarFile _getAlternativeJarFile ( URL url ) throws IOException { } } | String urlFile = url . getFile ( ) ; // Trim off any suffix - which is prefixed by " ! / " on Weblogic
int separatorIndex = urlFile . indexOf ( "!/" ) ; // OK , didn ' t find that . Try the less safe " ! " , used on OC4J
if ( separatorIndex == - 1 ) { separatorIndex = urlFile . indexOf ( '!' ) ; } if ( separatorIndex != - 1 ) { String jarFileUrl = urlFile . substring ( 0 , separatorIndex ) ; // And trim off any " file : " prefix .
if ( jarFileUrl . startsWith ( "file:" ) ) { jarFileUrl = jarFileUrl . substring ( "file:" . length ( ) ) ; } return new JarFile ( jarFileUrl ) ; } return null ; |
public class VisDialog { /** * Hides the dialog . Called automatically when a button is clicked . The default implementation fades out the dialog over 400
* milliseconds and then removes it from the stage . */
public void hide ( ) { } } | hide ( sequence ( Actions . fadeOut ( FADE_TIME , Interpolation . fade ) , Actions . removeListener ( ignoreTouchDown , true ) , Actions . removeActor ( ) ) ) ; |
public class AutoFringer { /** * Compute and return the fringe tile to be inserted at the specified location . */
public BaseTile getFringeTile ( MisoSceneModel scene , int col , int row , Map < FringeTile , WeakReference < FringeTile > > fringes , Map < Long , BufferedImage > masks ) { } } | // get the tileset id of the base tile we are considering
int underset = adjustTileSetId ( scene . getBaseTileId ( col , row ) >> 16 ) ; // start with a clean temporary fringer map
_fringers . clear ( ) ; boolean passable = true ; // walk through our influence tiles
for ( int y = row - 1 , maxy = row + 2 ; y < maxy ; y ++ ) { for ( int x = col - 1 , maxx = col + 2 ; x < maxx ; x ++ ) { // we sensibly do not consider ourselves
if ( ( x == col ) && ( y == row ) ) { continue ; } // determine the tileset for this tile
int btid = scene . getBaseTileId ( x , y ) ; int baseset = adjustTileSetId ( ( btid <= 0 ) ? scene . getDefaultBaseTileSet ( ) : ( btid >> 16 ) ) ; // determine if it fringes on our tile
int pri = _fringeconf . fringesOn ( baseset , underset ) ; if ( pri == - 1 ) { continue ; } FringerRec fringer = ( FringerRec ) _fringers . get ( baseset ) ; if ( fringer == null ) { fringer = new FringerRec ( baseset , pri ) ; _fringers . put ( baseset , fringer ) ; } // now turn on the appropriate fringebits
fringer . bits |= FLAGMATRIX [ y - row + 1 ] [ x - col + 1 ] ; // See if a tile that fringes on us kills our passability ,
// but don ' t count the default base tile against us , as
// we allow users to splash in the water .
if ( passable && ( btid > 0 ) ) { try { BaseTile bt = ( BaseTile ) _tmgr . getTile ( btid ) ; passable = bt . isPassable ( ) ; } catch ( NoSuchTileSetException nstse ) { log . warning ( "Autofringer couldn't find a base set while attempting to " + "figure passability" , nstse ) ; } } } } // if nothing fringed , we ' re done
int numfringers = _fringers . size ( ) ; if ( numfringers == 0 ) { return null ; } // otherwise compose a FringeTile from the specified fringes
FringerRec [ ] frecs = new FringerRec [ numfringers ] ; for ( int ii = 0 , pp = 0 ; ii < 16 ; ii ++ ) { FringerRec rec = ( FringerRec ) _fringers . getValue ( ii ) ; if ( rec != null ) { frecs [ pp ++ ] = rec ; } } return composeFringeTile ( frecs , fringes , TileUtil . getTileHash ( col , row ) , passable , masks ) ; |
public class WorkSheet { /** * Get back a list of unique values in the row
* @ param row
* @ return
* @ throws Exception */
public ArrayList < String > getDiscreteRowValues ( String row ) throws Exception { } } | HashMap < String , String > hashMapValues = new HashMap < String , String > ( ) ; ArrayList < String > values = new ArrayList < String > ( ) ; for ( String column : getColumns ( ) ) { String value = getCell ( row , column ) ; if ( ! hashMapValues . containsKey ( value ) ) { hashMapValues . put ( value , value ) ; values . add ( value ) ; } } return values ; |
public class CalcPoint { /** * Needs documentation !
* @ param x
* @ param y
* @ param maxDistance
* @ return */
public static int contacts ( Point3d [ ] x , Point3d [ ] y , double maxDistance ) { } } | int contacts = 0 ; for ( int i = 0 ; i < x . length ; i ++ ) { double minDist = Double . MAX_VALUE ; for ( int j = 0 ; j < y . length ; j ++ ) { minDist = Math . min ( minDist , x [ i ] . distanceSquared ( y [ j ] ) ) ; } if ( minDist < maxDistance * maxDistance ) { contacts ++ ; } } return contacts ; |
public class DoStuffFromPairwiseGraph { /** * Scores the motion for its ability to capture 3D structure */
public static double score ( PairwiseImageGraph2 . Motion m ) { } } | // countF and countF will be < = totalFeatures
// Prefer a scene more features from a fundamental matrix than a homography .
// This can be sign that the scene has a rich 3D structure and is poorly represented by
// a plane or rotational motion
double score = Math . min ( 5 , m . countF / ( double ) ( m . countH + 1 ) ) ; // Also prefer more features from the original image to be matched
score *= m . countF ; return score ; |
public class DefaultLoginWebflowConfigurer { /** * Create renew check state .
* @ param flow the flow */
protected void createRenewCheckActionState ( final Flow flow ) { } } | val action = createActionState ( flow , CasWebflowConstants . STATE_ID_RENEW_REQUEST_CHECK , CasWebflowConstants . ACTION_ID_RENEW_AUTHN_REQUEST ) ; createTransitionForState ( action , CasWebflowConstants . TRANSITION_ID_PROCEED , CasWebflowConstants . STATE_ID_GENERATE_SERVICE_TICKET ) ; createTransitionForState ( action , CasWebflowConstants . TRANSITION_ID_RENEW , CasWebflowConstants . STATE_ID_SERVICE_AUTHZ_CHECK ) ; createStateDefaultTransition ( action , CasWebflowConstants . STATE_ID_SERVICE_AUTHZ_CHECK ) ; |
public class Validator { /** * 验证是否为汉字
* @ param < T > 字符串类型
* @ param value 表单值
* @ param errorMsg 验证错误的信息
* @ return 验证后的值
* @ throws ValidateException 验证异常 */
public static < T extends CharSequence > T validateChinese ( T value , String errorMsg ) throws ValidateException { } } | if ( false == isChinese ( value ) ) { throw new ValidateException ( errorMsg ) ; } return value ; |
public class DescribeTransitGatewayAttachmentsResult { /** * Information about the attachments .
* @ return Information about the attachments . */
public java . util . List < TransitGatewayAttachment > getTransitGatewayAttachments ( ) { } } | if ( transitGatewayAttachments == null ) { transitGatewayAttachments = new com . amazonaws . internal . SdkInternalList < TransitGatewayAttachment > ( ) ; } return transitGatewayAttachments ; |
public class GrammaticalStructure { /** * Returns the dependency path as a list of String , from node to root , it is assumed that
* that root is an ancestor of node
* @ return A list of dependency labels */
public List < String > getDependencyPath ( int nodeIndex , int rootIndex ) { } } | TreeGraphNode node = getNodeByIndex ( nodeIndex ) ; TreeGraphNode rootTree = getNodeByIndex ( rootIndex ) ; return getDependencyPath ( node , rootTree ) ; |
public class RpcInvokeContext { /** * 删除一个调用上下文数据
* @ param key Key
* @ return 删除前的值 */
public Object remove ( String key ) { } } | if ( key != null ) { return map . remove ( key ) ; } return null ; |
public class CmsAdminEditorWrapper { /** * Performs the dialog actions depending on the initialized action and displays the dialog form . < p >
* @ throws Exception if writing to the JSP out fails */
public void displayDialog ( ) throws Exception { } } | initAdminTool ( ) ; getToolManager ( ) . setCurrentToolPath ( this , getParentPath ( ) ) ; JspWriter out = getJsp ( ) . getJspContext ( ) . getOut ( ) ; out . print ( htmlStart ( ) ) ; out . print ( bodyStart ( null ) ) ; out . print ( "<form name='editor' method='post' target='_top' action='" ) ; out . print ( getJsp ( ) . link ( "/system/workplace/editors/editor.jsp" ) ) ; out . print ( "'>\n" ) ; out . print ( allParamsAsHidden ( ) ) ; out . print ( "</form>\n" ) ; out . print ( "<script type='text/javascript'>\n" ) ; out . print ( "document.forms['editor'].submit();\n" ) ; out . print ( "</script>\n" ) ; out . print ( dialogContentStart ( getParamTitle ( ) ) ) ; out . print ( dialogContentEnd ( ) ) ; out . print ( dialogEnd ( ) ) ; out . print ( bodyEnd ( ) ) ; out . print ( htmlEnd ( ) ) ; |
public class ClockInterval { /** * / * [ deutsch ]
* < p > Liefert die L & auml ; nge dieses Intervalls . < / p >
* @ return duration in hours , minutes , seconds and nanoseconds
* @ since 2.0 */
public Duration < ClockUnit > getDuration ( ) { } } | PlainTime t1 = this . getTemporalOfClosedStart ( ) ; PlainTime t2 = this . getEnd ( ) . getTemporal ( ) ; if ( this . getEnd ( ) . isClosed ( ) ) { if ( t2 . getHour ( ) == 24 ) { if ( t1 . equals ( PlainTime . midnightAtStartOfDay ( ) ) ) { return Duration . of ( 24 , HOURS ) . plus ( 1 , NANOS ) ; } else { t1 = t1 . minus ( 1 , NANOS ) ; } } else { t2 = t2 . plus ( 1 , NANOS ) ; } } return Duration . inClockUnits ( ) . between ( t1 , t2 ) ; |
public class HelloSignClient { /** * Sends the provided signature request to HelloSign .
* @ param req SignatureRequest
* @ return SignatureRequest
* @ throws HelloSignException thrown if there ' s a problem processing the
* HTTP request or the JSON response . */
public SignatureRequest sendSignatureRequest ( SignatureRequest req ) throws HelloSignException { } } | if ( req . hasId ( ) ) { throw new HelloSignException ( "Sending an existing signature request is not supported" ) ; } return new SignatureRequest ( httpClient . withAuth ( auth ) . withPostFields ( req . getPostFields ( ) ) . post ( BASE_URI + SIGNATURE_REQUEST_SEND_URI ) . asJson ( ) ) ; |
public class BookRef { /** * Ordered by domain , path . */
public int compareTo ( BookRef o ) { } } | int diff = domain . compareTo ( o . domain ) ; if ( diff != 0 ) return diff ; return path . compareTo ( o . path ) ; |
public class ZPoller { /** * filters items to get the first one matching the criteria , or null if none found */
protected PollItem filter ( final Object socketOrChannel , int events ) { } } | if ( socketOrChannel == null ) { return null ; } CompositePollItem item = items . get ( socketOrChannel ) ; if ( item == null ) { return null ; } PollItem pollItem = item . item ( ) ; if ( pollItem == null ) { return null ; } if ( pollItem . hasEvent ( events ) ) { return pollItem ; } return null ; |
public class NIODirectorySocket { /** * { @ inheritDoc } */
@ Override public boolean connect ( InetSocketAddress address ) { } } | nioThread = new NIOThread ( address ) ; nioThread . start ( ) ; isConnecting = true ; long timeToSleep = this . connectTimeOut ; if ( LOGGER . isTraceEnabled ( ) ) { LOGGER . trace ( "NIO connect go to sleep - " + timeToSleep ) ; } while ( isConnecting && timeToSleep > 0 ) { long now = System . currentTimeMillis ( ) ; try { synchronized ( connectHolder ) { connectHolder . wait ( timeToSleep ) ; } } catch ( InterruptedException e ) { // do nothing .
} timeToSleep = timeToSleep - ( System . currentTimeMillis ( ) - now ) ; if ( LOGGER . isTraceEnabled ( ) ) { LOGGER . trace ( "NIO connect go to sleep - " + timeToSleep + ", isConnecting=" + isConnecting ) ; } } if ( ! isConnected ( ) ) { onConnectFailed ( ) ; return false ; } else { lenBuffer . clear ( ) ; incomingBuffer = lenBuffer ; return true ; } |
public class CoreZK { /** * Checks if the cluster suffered an aborted join or node shutdown and is still in the process of cleaning up .
* @ param zk ZooKeeper client
* @ return true if the cluster is still cleaning up .
* @ throws KeeperException
* @ throws InterruptedException */
public static boolean isPartitionCleanupInProgress ( ZooKeeper zk ) throws KeeperException , InterruptedException { } } | List < String > children = zk . getChildren ( VoltZK . leaders_initiators , null ) ; List < ZKUtil . ChildrenCallback > childrenCallbacks = Lists . newArrayList ( ) ; for ( String child : children ) { ZKUtil . ChildrenCallback callback = new ZKUtil . ChildrenCallback ( ) ; zk . getChildren ( ZKUtil . joinZKPath ( VoltZK . leaders_initiators , child ) , false , callback , null ) ; childrenCallbacks . add ( callback ) ; } for ( ZKUtil . ChildrenCallback callback : childrenCallbacks ) { if ( callback . get ( ) . isEmpty ( ) ) { return true ; } } return false ; |
public class TileSetBundler { /** * Creates a tileset bundle at the location specified by the
* < code > targetPath < / code > parameter , based on the description
* provided via the < code > bundleDesc < / code > parameter .
* @ param idBroker the tileset id broker that will be used to map
* tileset names to tileset ids .
* @ param bundleDesc a file object pointing to the bundle description
* file .
* @ param targetPath the path of the tileset bundle file that will be
* created .
* @ exception IOException thrown if an error occurs reading , writing
* or processing anything . */
public void createBundle ( TileSetIDBroker idBroker , File bundleDesc , String targetPath ) throws IOException { } } | createBundle ( idBroker , bundleDesc , new File ( targetPath ) ) ; |
public class AbstractChart { /** * Adiciona uma serie
* @ param serie Add serie of chart
* @ return AbstractChart */
public AbstractChart < T , S > addSerie ( Serie serie ) { } } | Collection < Serie > series = getSeries ( ) ; if ( series == null ) { series = new ArrayList < Serie > ( ) ; } series . add ( serie ) ; return this ; |
public class LoggerCreator { /** * Extract the logging level from the system properties .
* @ return the logging level . */
public static Level getLoggingLevelFromProperties ( ) { } } | if ( levelFromProperties == null ) { final String verboseLevel = JanusConfig . getSystemProperty ( JanusConfig . VERBOSE_LEVEL_NAME , JanusConfig . VERBOSE_LEVEL_VALUE ) ; levelFromProperties = parseLoggingLevel ( verboseLevel ) ; } return levelFromProperties ; |
public class NounFeats { /** * getter for gender - gets Gender , C
* @ generated
* @ return value of the feature */
public String getGender ( ) { } } | if ( NounFeats_Type . featOkTst && ( ( NounFeats_Type ) jcasType ) . casFeat_gender == null ) jcasType . jcas . throwFeatMissing ( "gender" , "de.julielab.jules.types.NounFeats" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( NounFeats_Type ) jcasType ) . casFeatCode_gender ) ; |
public class QueryAtomContainer { /** * { @ inheritDoc } */
@ Override public Iterable < IStereoElement > stereoElements ( ) { } } | return new Iterable < IStereoElement > ( ) { @ Override public Iterator < IStereoElement > iterator ( ) { return stereoElements . iterator ( ) ; } } ; |
public class AnnotationMetadataWriter { /** * Writes out the byte code necessary to instantiate the given { @ link DefaultAnnotationMetadata } .
* @ param owningType The owning type
* @ param declaringClassWriter The declaring class writer
* @ param generatorAdapter The generator adapter
* @ param annotationMetadata The annotation metadata
* @ param loadTypeMethods The generated load type methods */
@ Internal public static void instantiateNewMetadata ( Type owningType , ClassWriter declaringClassWriter , GeneratorAdapter generatorAdapter , DefaultAnnotationMetadata annotationMetadata , Map < String , GeneratorAdapter > loadTypeMethods ) { } } | instantiateInternal ( owningType , declaringClassWriter , generatorAdapter , annotationMetadata , true , loadTypeMethods ) ; |
public class SwiftAPIClient { /** * Swift has a bug where container listing might wrongly report size 0
* for large objects . It ' s seems to be a well known issue in Swift without
* solution .
* We have to provide work around for this .
* If container listing reports size 0 for some object , we send
* additional HEAD on that object to verify it ' s size .
* @ param tmp JOSS StoredObject
* @ param cObj JOSS Container object */
private void setCorrectSize ( StoredObject tmp , Container cObj ) { } } | long objectSize = tmp . getContentLength ( ) ; if ( objectSize == 0 ) { // we may hit a well known Swift bug .
// container listing reports 0 for large objects .
StoredObject soDirect = cObj . getObject ( tmp . getName ( ) ) ; long contentLength = soDirect . getContentLength ( ) ; if ( contentLength > 0 ) { tmp . setContentLength ( contentLength ) ; } } |
public class MultiThreadedPOWEngine { /** * This method will block until all pending nonce calculations are done , but not wait for its own calculation
* to finish .
* ( This implementation becomes very inefficient if multiple nonce are calculated at the same time . )
* @ param initialHash the SHA - 512 hash of the object to send , sans nonce
* @ param target the target , representing an unsigned long
* @ param callback called with the calculated nonce as argument . The ProofOfWorkEngine implementation must make */
@ Override public void calculateNonce ( final byte [ ] initialHash , final byte [ ] target , final Callback callback ) { } } | waiterPool . execute ( new Runnable ( ) { @ Override public void run ( ) { long startTime = System . currentTimeMillis ( ) ; int cores = Runtime . getRuntime ( ) . availableProcessors ( ) ; if ( cores > 255 ) cores = 255 ; LOG . info ( "Doing POW using " + cores + " cores" ) ; List < Worker > workers = new ArrayList < > ( cores ) ; for ( int i = 0 ; i < cores ; i ++ ) { Worker w = new Worker ( ( byte ) cores , i , initialHash , target ) ; workers . add ( w ) ; } List < Future < byte [ ] > > futures = new ArrayList < > ( cores ) ; for ( Worker w : workers ) { // Doing this in the previous loop might cause a ConcurrentModificationException in the worker
// if a worker finds a nonce while new ones are still being added .
futures . add ( workerPool . submit ( w ) ) ; } try { while ( ! Thread . interrupted ( ) ) { for ( Future < byte [ ] > future : futures ) { if ( future . isDone ( ) ) { callback . onNonceCalculated ( initialHash , future . get ( ) ) ; LOG . info ( "Nonce calculated in " + ( ( System . currentTimeMillis ( ) - startTime ) / 1000 ) + " seconds" ) ; for ( Future < byte [ ] > f : futures ) { f . cancel ( true ) ; } return ; } } Thread . sleep ( 100 ) ; } LOG . error ( "POW waiter thread interrupted - this should not happen!" ) ; } catch ( ExecutionException e ) { LOG . error ( e . getMessage ( ) , e ) ; } catch ( InterruptedException e ) { LOG . error ( "POW waiter thread interrupted - this should not happen!" , e ) ; } } } ) ; |
public class ByteBufUtil { /** * Writes a big - endian 24 - bit medium integer to the buffer . */
@ SuppressWarnings ( "deprecation" ) public static ByteBuf writeMediumBE ( ByteBuf buf , int mediumValue ) { } } | return buf . order ( ) == ByteOrder . BIG_ENDIAN ? buf . writeMedium ( mediumValue ) : buf . writeMediumLE ( mediumValue ) ; |
public class Matrix4d { /** * Apply a symmetric orthographic projection transformation for a left - handed coordinate system
* using the given NDC z range to this matrix and store the result in < code > dest < / code > .
* This method is equivalent to calling { @ link # orthoLH ( double , double , double , double , double , double , boolean , Matrix4d ) orthoLH ( ) } with
* < code > left = - width / 2 < / code > , < code > right = + width / 2 < / code > , < code > bottom = - height / 2 < / code > and < code > top = + height / 2 < / code > .
* If < code > M < / code > is < code > this < / code > matrix and < code > O < / code > the orthographic projection matrix ,
* then the new matrix will be < code > M * O < / code > . So when transforming a
* vector < code > v < / code > with the new matrix by using < code > M * O * v < / code > , the
* orthographic projection transformation will be applied first !
* In order to set the matrix to a symmetric orthographic projection without post - multiplying it ,
* use { @ link # setOrthoSymmetricLH ( double , double , double , double , boolean ) setOrthoSymmetricLH ( ) } .
* Reference : < a href = " http : / / www . songho . ca / opengl / gl _ projectionmatrix . html # ortho " > http : / / www . songho . ca < / a >
* @ see # setOrthoSymmetricLH ( double , double , double , double , boolean )
* @ param width
* the distance between the right and left frustum edges
* @ param height
* the distance between the top and bottom frustum edges
* @ param zNear
* near clipping plane distance
* @ param zFar
* far clipping plane distance
* @ param dest
* will hold the result
* @ param zZeroToOne
* whether to use Vulkan ' s and Direct3D ' s NDC z range of < code > [ 0 . . + 1 ] < / code > when < code > true < / code >
* or whether to use OpenGL ' s NDC z range of < code > [ - 1 . . + 1 ] < / code > when < code > false < / code >
* @ return dest */
public Matrix4d orthoSymmetricLH ( double width , double height , double zNear , double zFar , boolean zZeroToOne , Matrix4d dest ) { } } | if ( ( properties & PROPERTY_IDENTITY ) != 0 ) return dest . setOrthoSymmetricLH ( width , height , zNear , zFar , zZeroToOne ) ; return orthoSymmetricLHGeneric ( width , height , zNear , zFar , zZeroToOne , dest ) ; |
public class OperationValidator { /** * { @ inheritDoc } */
@ Override public void validate ( ValidationHelper helper , Context context , String key , Operation t ) { } } | if ( t != null ) { final String id = t . getOperationId ( ) ; if ( id != null && helper . addOperationId ( id ) ) { final String message = Tr . formatMessage ( tc , "operationIdsMustBeUnique" , id ) ; helper . addValidationEvent ( new ValidationEvent ( Severity . ERROR , context . getLocation ( "operationId" ) , message ) ) ; } final APIResponses responses = t . getResponses ( ) ; ValidatorUtils . validateRequiredField ( responses , context , "responses" ) . ifPresent ( helper :: addValidationEvent ) ; } |
public class Encoding { /** * Returns the canonical mime name for the given character encoding .
* @ param encoding character encoding name , possibly an alias
* @ return canonical mime name for the encoding . */
public static String getMimeName ( String encoding ) { } } | if ( encoding == null ) return null ; String value = _mimeName . get ( encoding ) ; if ( value != null ) return value ; String upper = normalize ( encoding ) ; String lookup = _mimeName . get ( upper ) ; value = lookup == null ? upper : lookup ; _mimeName . put ( encoding , value ) ; return value ; |
public class AbstractProject { /** * Schedules a build of this project , and returns a { @ link Future } object
* to wait for the completion of the build . */
@ WithBridgeMethods ( Future . class ) public QueueTaskFuture < R > scheduleBuild2 ( int quietPeriod , Cause c ) { } } | return scheduleBuild2 ( quietPeriod , c , new Action [ 0 ] ) ; |
public class DatamappingHelper { /** * Find a datamapping to create an element based on class annotation , uses static cache .
* @ param clazz
* @ return */
public static List < ElementConfig > getElements ( Class clazz ) { } } | if ( ! cacheEC . containsKey ( clazz ) ) { cacheEC . put ( clazz , new ArrayList < > ( 1 ) ) ; Element e = ( Element ) clazz . getAnnotation ( Element . class ) ; if ( e != null ) { cacheEC . get ( clazz ) . add ( fromAnnotation ( e ) ) ; } Elements es = ( Elements ) clazz . getAnnotation ( com . vectorprint . report . itext . annotations . Elements . class ) ; if ( es != null ) { for ( Element s : es . elements ( ) ) { cacheEC . get ( clazz ) . add ( fromAnnotation ( s ) ) ; } } } return cacheEC . get ( clazz ) ; |
public class PdfContentParser { /** * Reads a pdf object .
* @ return the pdf object
* @ throws IOException on error */
public PdfObject readPRObject ( ) throws IOException { } } | if ( ! nextValidToken ( ) ) return null ; int type = tokeniser . getTokenType ( ) ; switch ( type ) { case PRTokeniser . TK_START_DIC : { PdfDictionary dic = readDictionary ( ) ; return dic ; } case PRTokeniser . TK_START_ARRAY : return readArray ( ) ; case PRTokeniser . TK_STRING : PdfString str = new PdfString ( tokeniser . getStringValue ( ) , null ) . setHexWriting ( tokeniser . isHexString ( ) ) ; return str ; case PRTokeniser . TK_NAME : return new PdfName ( tokeniser . getStringValue ( ) , false ) ; case PRTokeniser . TK_NUMBER : return new PdfNumber ( tokeniser . getStringValue ( ) ) ; case PRTokeniser . TK_OTHER : return new PdfLiteral ( COMMAND_TYPE , tokeniser . getStringValue ( ) ) ; default : return new PdfLiteral ( - type , tokeniser . getStringValue ( ) ) ; } |
public class DurationFormatUtils { /** * < p > Converts a { @ code long } to a { @ code String } with optional
* zero padding . < / p >
* @ param value the value to convert
* @ param padWithZeros whether to pad with zeroes
* @ param count the size to pad to ( ignored if { @ code padWithZeros } is false )
* @ return the string result */
private static String paddedValue ( final long value , final boolean padWithZeros , final int count ) { } } | final String longString = Long . toString ( value ) ; return padWithZeros ? StringUtils . leftPad ( longString , count , '0' ) : longString ; |
public class CommercePriceListUtil { /** * Returns an ordered range of all the commerce price lists where commerceCurrencyId = & # 63 ; .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CommercePriceListModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param commerceCurrencyId the commerce currency ID
* @ param start the lower bound of the range of commerce price lists
* @ param end the upper bound of the range of commerce price lists ( not inclusive )
* @ param orderByComparator the comparator to order the results by ( optionally < code > null < / code > )
* @ return the ordered range of matching commerce price lists */
public static List < CommercePriceList > findByCommerceCurrencyId ( long commerceCurrencyId , int start , int end , OrderByComparator < CommercePriceList > orderByComparator ) { } } | return getPersistence ( ) . findByCommerceCurrencyId ( commerceCurrencyId , start , end , orderByComparator ) ; |
public class SearchCriteria { /** * Sets the specified ordering criteria to sort the result objects .
* < p > If the specified list is null or empty ,
* it clears the previous list .
* If one of the element in the list is null ,
* the previous list is not modified and an exception is thrown .
* @ param orders
* the ordering criteria .
* @ throws IllegalArgumentException
* if an element in the specified list is null . */
public SearchCriteria setOrders ( final List < ? extends Order > orders ) { } } | if ( orders == getOrders ( ) ) { return this ; } if ( orders == null || orders . size ( ) == 0 ) { clearOrders ( ) ; return this ; } synchronized ( orders ) { for ( Order order : orders ) { if ( order == null ) { throw new IllegalArgumentException ( "null element" ) ; } } clearOrders ( ) ; for ( Order order : orders ) { addOrder ( order ) ; } } return this ; |
public class ImageCreator { /** * Must be called before loading images .
* Initializes a new { @ link Picasso } instance as well as the
* { @ link ArrayList } of { @ link InstructionTarget } .
* @ param context to init Picasso */
public void initialize ( Context context ) { } } | if ( ! isInitialized ) { initializePicasso ( context ) ; initializeData ( context ) ; isInitialized = true ; } |
public class SRTServletRequest { /** * Note for MultiRead :
* If this is the first call - register an observer to get a notification ( alertClose ( ) ) when input stream is closed .
* If the is first call after alerClose , restart the input stream . This will cause a notification ( alertOpen ( ) ) that the input stream has been opened .
* Any other call - no special processing . */
public synchronized BufferedReader getReader ( ) throws UnsupportedEncodingException , IOException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "getReader" , "this->" + this + ": gotInputStream = " + _srtRequestHelper . _gotInputStream ) ; } if ( WCCustomProperties . CHECK_REQUEST_OBJECT_IN_USE ) { checkRequestObjectInUse ( ) ; } // MultiRead Start
if ( this . multiReadPropertyEnabled ) { if ( _srtRequestHelper . _InputStreamClosed ) { ( ( SRTInputStream ) this . _in ) . restart ( ) ; } } // MultiRead End
if ( _srtRequestHelper . _gotInputStream ) { throw new IllegalStateException ( liberty_nls . getString ( "InputStream.already.obtained" , "Input Stream already obtained" ) ) ; } if ( _srtRequestHelper . _reader == null ) { _srtRequestHelper . _reader = new BufferedReader ( new InputStreamReader ( _in , getReaderEncoding ( ) ) ) ; } _srtRequestHelper . _gotReader = true ; // MultiRead
if ( TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "getReader" , "this->" + this + ": reader = " + _srtRequestHelper . _reader ) ; } return _srtRequestHelper . _reader ; |
public class PropertiesMigrationReport { /** * Return a report for all the properties that are no longer supported . If no such
* properties were found , return { @ code null } .
* @ return a report with the configurations keys that are no longer supported */
public String getErrorReport ( ) { } } | Map < String , List < PropertyMigration > > content = getContent ( LegacyProperties :: getUnsupported ) ; if ( content . isEmpty ( ) ) { return null ; } StringBuilder report = new StringBuilder ( ) ; report . append ( String . format ( "%nThe use of configuration keys that are no longer " + "supported was found in the environment:%n%n" ) ) ; append ( report , content ) ; report . append ( String . format ( "%n" ) ) ; report . append ( "Please refer to the migration guide or reference guide for " + "potential alternatives." ) ; report . append ( String . format ( "%n" ) ) ; return report . toString ( ) ; |
public class CmsTypesTab { /** * Updates the type mode switch . < p > */
protected void updateTypeModeToggle ( ) { } } | m_typeModeToggle . setVisible ( false ) ; if ( m_types != null ) { for ( CmsResourceTypeBean type : m_types . values ( ) ) { if ( type . getVisibility ( ) == TypeVisibility . showOptional ) { m_typeModeToggle . setVisible ( true ) ; return ; } } } |
public class FSATraversal { /** * Finds a matching path in the dictionary for a given sequence of labels from
* < code > sequence < / code > and starting at node < code > node < / code > .
* @ param sequence Input sequence to look for in the automaton .
* @ param start Start index in the sequence array .
* @ param length Length of the byte sequence , must be at least 1.
* @ param node The node to start traversal from , typically the { @ linkplain FSA # getRootNode ( ) root node } .
* @ see # match ( byte [ ] , int )
* @ return { @ link MatchResult } with updated match { @ link MatchResult # kind } . */
public MatchResult match ( byte [ ] sequence , int start , int length , int node ) { } } | return match ( new MatchResult ( ) , sequence , start , length , node ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.