signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class DocBookBuildUtilities { /** * Clean a user specified publican . cfg to remove content that should be set for a build .
* @ param userPublicanCfg The User publican . cfg file to be cleaned .
* @ return The cleaned publican . cfg file . */
public static String cleanUserPublicanCfg ( final String userPublicanCfg ) { } } | // Remove any xml _ lang statements
String retValue = userPublicanCfg . replaceAll ( "(#( |\\t)*)?xml_lang\\s*:\\s*.*?($|\\r\\n|\\n)" , "" ) ; // Remove any type statements
retValue = retValue . replaceAll ( "(#( |\\t)*)?type\\s*:\\s*.*($|\\r\\n|\\n)" + "" , "" ) ; // Remove any brand statements
retValue = retValue . replaceAll ( "(#( |\\t)*)?brand\\s*:\\s*.*($|\\r\\n|\\n)" + "" , "" ) ; // Remove any dtdver statements
retValue = retValue . replaceAll ( "(^|\\n)( |\\t)*dtdver\\s*:\\s*.*($|\\r\\n|\\n)" , "" ) ; // BZ # 1091776 Remove mainfile
retValue = retValue . replaceAll ( "(^|\\n)( |\\t)*mainfile\\s*:\\s*.*($|\\r\\n|\\n)" , "" ) ; // Remove any whitespace before the text
retValue = retValue . replaceAll ( "(^|\\n)\\s*" , "$1" ) ; if ( ! retValue . endsWith ( "\n" ) ) { retValue += "\n" ; } return retValue ; |
public class HttpPostMultipartRequestDecoder { /** * Parse the Body for multipart
* @ throws ErrorDataDecoderException
* if there is a problem with the charset decoding or other
* errors */
private void parseBodyMultipart ( ) { } } | if ( undecodedChunk == null || undecodedChunk . readableBytes ( ) == 0 ) { // nothing to decode
return ; } InterfaceHttpData data = decodeMultipart ( currentStatus ) ; while ( data != null ) { addHttpData ( data ) ; if ( currentStatus == MultiPartStatus . PREEPILOGUE || currentStatus == MultiPartStatus . EPILOGUE ) { break ; } data = decodeMultipart ( currentStatus ) ; } |
public class LoadBalancer { /** * An array of InstanceHealthSummary objects describing the health of the load balancer .
* @ param instanceHealthSummary
* An array of InstanceHealthSummary objects describing the health of the load balancer . */
public void setInstanceHealthSummary ( java . util . Collection < InstanceHealthSummary > instanceHealthSummary ) { } } | if ( instanceHealthSummary == null ) { this . instanceHealthSummary = null ; return ; } this . instanceHealthSummary = new java . util . ArrayList < InstanceHealthSummary > ( instanceHealthSummary ) ; |
public class AttachInstancesToLoadBalancerRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AttachInstancesToLoadBalancerRequest attachInstancesToLoadBalancerRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( attachInstancesToLoadBalancerRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( attachInstancesToLoadBalancerRequest . getLoadBalancerName ( ) , LOADBALANCERNAME_BINDING ) ; protocolMarshaller . marshall ( attachInstancesToLoadBalancerRequest . getInstanceNames ( ) , INSTANCENAMES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class StringUtil { /** * Judge is boolean value or not .
* @ param value to be judged string value
* @ return is boolean value or not */
public static boolean isBooleanValue ( final String value ) { } } | return Boolean . TRUE . toString ( ) . equalsIgnoreCase ( value ) || Boolean . FALSE . toString ( ) . equalsIgnoreCase ( value ) ; |
public class RemoteEndpointBasicImpl { /** * synchronously . */
public void sendBinaryFromAsyncRemote ( @ Sensitive ByteBuffer data , OpcodeType type ) { } } | try { sendBinary ( data , type ) ; } catch ( IOException e ) { connLink . callOnError ( e ) ; } |
public class Slf4jLogChute { /** * Checks whether the specified log level is enabled . */
@ Override public boolean isLevelEnabled ( int level ) { } } | switch ( level ) { case LogChute . DEBUG_ID : return log . isDebugEnabled ( ) ; case LogChute . INFO_ID : return log . isInfoEnabled ( ) ; case LogChute . TRACE_ID : return log . isTraceEnabled ( ) ; case LogChute . WARN_ID : return log . isWarnEnabled ( ) ; case LogChute . ERROR_ID : return log . isErrorEnabled ( ) ; default : return true ; } |
public class RandomUtils { /** * 从数组中获取随机元素 */
public static Object getRandom ( Object ... array ) { } } | Random random = new Random ( ) ; int index = random . nextInt ( array . length ) ; return array [ index ] ; |
public class Controller { /** * Set Cookie to response .
* @ param name cookie name
* @ param value cookie value
* @ param maxAgeInSeconds - 1 : clear cookie when close browser . 0 : clear cookie immediately . n > 0 : max age in n seconds .
* @ param path see Cookie . setPath ( String )
* @ param isHttpOnly true if this cookie is to be marked as HttpOnly , false otherwise */
public Controller setCookie ( String name , String value , int maxAgeInSeconds , String path , boolean isHttpOnly ) { } } | return doSetCookie ( name , value , maxAgeInSeconds , path , null , isHttpOnly ) ; |
public class WordTagFactory { /** * Create a new word , where the label is formed from
* the < code > String < / code > passed in . The String is divided according
* to the divider character . We assume that we can always just
* divide on the rightmost divider character , rather than trying to
* parse up escape sequences . If the divider character isn ' t found
* in the word , then the whole string becomes the word , and the tag
* is < code > null < / code > .
* @ param word The word that will go into the < code > Word < / code >
* @ return The new WordTag */
public Label newLabelFromString ( String word ) { } } | int where = word . lastIndexOf ( divider ) ; if ( where >= 0 ) { return new WordTag ( word . substring ( 0 , where ) , word . substring ( where + 1 ) ) ; } else { return new WordTag ( word ) ; } |
public class Expressions { /** * Create a new Template expression
* @ param template template
* @ param args template parameters
* @ return template expression */
public static StringTemplate stringTemplate ( Template template , Object ... args ) { } } | return stringTemplate ( template , ImmutableList . copyOf ( args ) ) ; |
public class Pipeline { /** * Method called on each event before the processing , deleting the error file is this file exists .
* @ param watcher the watcher */
private void cleanupErrorFile ( Watcher watcher ) { } } | File file = getErrorFileForWatcher ( watcher ) ; FileUtils . deleteQuietly ( file ) ; |
public class ListLayerVersionsResult { /** * A list of versions .
* @ param layerVersions
* A list of versions . */
public void setLayerVersions ( java . util . Collection < LayerVersionsListItem > layerVersions ) { } } | if ( layerVersions == null ) { this . layerVersions = null ; return ; } this . layerVersions = new com . amazonaws . internal . SdkInternalList < LayerVersionsListItem > ( layerVersions ) ; |
public class Producers { /** * Feeds input stream to data consumer using metadata from tar entry .
* @ param consumer the consumer
* @ param inputStream the stream to feed
* @ param entry the entry to use for metadata
* @ throws IOException on consume error */
static void produceInputStreamWithEntry ( final DataConsumer consumer , final InputStream inputStream , final TarArchiveEntry entry ) throws IOException { } } | try { consumer . onEachFile ( inputStream , entry ) ; } finally { IOUtils . closeQuietly ( inputStream ) ; } |
public class StringValueMap { /** * Sets a new value to map element specified by its index . When the index is not
* defined , it resets the entire map value . This method has double purpose
* because method overrides are not supported in JavaScript .
* @ param key ( optional ) a key of the element to set
* @ param value a new element or map value . */
public void setAsObject ( String key , Object value ) { } } | put ( key , StringConverter . toNullableString ( value ) ) ; |
public class ReflectUtils { /** * Invokes a object ' s " getter " method by property name
* @ param obj The instance of a object
* @ param property The property name of this object
* @ return The value of this property
* @ throws Throwable A runtime exception */
public static Object get ( Object obj , String property ) throws Throwable { } } | return getGetterMethod ( obj . getClass ( ) , property ) . invoke ( obj ) ; |
public class World { /** * Called to dispose of the world */
public void clean ( ) { } } | log . debug ( "[clean] Cleaning world" ) ; for ( Robot bot : robotsPosition . keySet ( ) ) { bot . die ( "World cleanup" ) ; if ( robotsPosition . containsKey ( bot ) ) { log . warn ( "[clean] Robot did not unregister itself. Removing it" ) ; remove ( bot ) ; } } |
public class MemoryPersistenceManagerImpl { /** * Not well - suited to factor out into an interface method since for JPA it ' s embedded in a tran typically */
private TopLevelStepExecutionEntity getStepExecutionTopLevelFromJobExecutionIdAndStepName ( long jobExecutionId , String stepName ) { } } | JobExecutionEntity jobExecution = data . executionInstanceData . get ( jobExecutionId ) ; // Copy list to avoid ConcurrentModificationException
for ( StepThreadExecutionEntity stepExec : new ArrayList < StepThreadExecutionEntity > ( jobExecution . getStepThreadExecutions ( ) ) ) { if ( stepExec . getStepName ( ) . equals ( stepName ) ) { if ( stepExec instanceof TopLevelStepExecutionEntity ) { return ( TopLevelStepExecutionEntity ) stepExec ; } } } // Bad if we ' ve gotten here .
throw new IllegalStateException ( "Couldn't find top-level step execution for jobExecution = " + jobExecutionId + ", and stepName = " + stepName ) ; |
public class HelloSignClient { /** * Adds the provided user to the template indicated by the provided template
* ID . The new user can be designated using their account ID or email
* address .
* @ param templateId String template ID
* @ param idOrEmail String account ID or email address
* @ return Template
* @ throws HelloSignException thrown if there ' s a problem processing the
* HTTP request or the JSON response . */
public Template addTemplateUser ( String templateId , String idOrEmail ) throws HelloSignException { } } | String url = BASE_URI + TEMPLATE_ADD_USER_URI + "/" + templateId ; String key = ( idOrEmail != null && idOrEmail . contains ( "@" ) ) ? Account . ACCOUNT_EMAIL_ADDRESS : Account . ACCOUNT_ID ; return new Template ( httpClient . withAuth ( auth ) . withPostField ( key , idOrEmail ) . post ( url ) . asJson ( ) ) ; |
public class EDMImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . EDM__DM_NAME : return DM_NAME_EDEFAULT == null ? dmName != null : ! DM_NAME_EDEFAULT . equals ( dmName ) ; } return super . eIsSet ( featureID ) ; |
public class OgmSequenceGenerator { /** * NOTE : Copied from SequenceStyleGenerator
* Determine the name of the sequence ( or table if this resolves to a physical table )
* to use .
* Called during { @ link # configure configuration } .
* @ param params The params supplied in the generator config ( plus some standard useful extras ) .
* @ param jdbcEnv
* @ return The sequence name */
protected QualifiedName determineSequenceName ( Properties params , JdbcEnvironment jdbcEnv ) { } } | final String sequencePerEntitySuffix = ConfigurationHelper . getString ( SequenceStyleGenerator . CONFIG_SEQUENCE_PER_ENTITY_SUFFIX , params , SequenceStyleGenerator . DEF_SEQUENCE_SUFFIX ) ; // JPA _ ENTITY _ NAME value honors < class . . . entity - name = " . . . " > ( HBM ) and @ Entity # name ( JPA ) overrides .
final String defaultSequenceName = ConfigurationHelper . getBoolean ( SequenceStyleGenerator . CONFIG_PREFER_SEQUENCE_PER_ENTITY , params , false ) ? params . getProperty ( JPA_ENTITY_NAME ) + sequencePerEntitySuffix : SequenceStyleGenerator . DEF_SEQUENCE_NAME ; final String sequenceName = ConfigurationHelper . getString ( SequenceStyleGenerator . SEQUENCE_PARAM , params , defaultSequenceName ) ; if ( sequenceName . contains ( "." ) ) { return QualifiedNameParser . INSTANCE . parse ( sequenceName ) ; } else { final String schemaName = params . getProperty ( PersistentIdentifierGenerator . SCHEMA ) ; if ( schemaName != null ) { log . schemaOptionNotSupportedForSequenceGenerator ( schemaName ) ; } final String catalogName = params . getProperty ( PersistentIdentifierGenerator . CATALOG ) ; if ( catalogName != null ) { log . catalogOptionNotSupportedForSequenceGenerator ( catalogName ) ; } return new QualifiedNameParser . NameParts ( null , null , jdbcEnv . getIdentifierHelper ( ) . toIdentifier ( sequenceName ) ) ; } |
public class StreamMetadataResourceImpl { /** * Implementation of listScopes REST API .
* @ param securityContext The security for API access .
* @ param asyncResponse AsyncResponse provides means for asynchronous server side response processing . */
@ Override public void listScopes ( final SecurityContext securityContext , final AsyncResponse asyncResponse ) { } } | long traceId = LoggerHelpers . traceEnter ( log , "listScopes" ) ; final Principal principal ; final List < String > authHeader = getAuthorizationHeader ( ) ; try { principal = restAuthHelper . authenticate ( authHeader ) ; restAuthHelper . authorize ( authHeader , AuthResourceRepresentation . ofScopes ( ) , principal , READ ) ; } catch ( AuthException e ) { log . warn ( "Get scopes failed due to authentication failure." , e ) ; asyncResponse . resume ( Response . status ( Status . fromStatusCode ( e . getResponseCode ( ) ) ) . build ( ) ) ; LoggerHelpers . traceLeave ( log , "listScopes" , traceId ) ; return ; } controllerService . listScopes ( ) . thenApply ( scopesList -> { ScopesList scopes = new ScopesList ( ) ; scopesList . forEach ( scope -> { try { if ( restAuthHelper . isAuthorized ( authHeader , AuthResourceRepresentation . ofScope ( scope ) , principal , READ ) ) { scopes . addScopesItem ( new ScopeProperty ( ) . scopeName ( scope ) ) ; } } catch ( AuthException e ) { log . warn ( e . getMessage ( ) , e ) ; // Ignore . This exception occurs under abnormal circumstances and not to determine
// whether the user is authorized . In case it does occur , we assume that the user
// is unauthorized .
} } ) ; return Response . status ( Status . OK ) . entity ( scopes ) . build ( ) ; } ) . exceptionally ( exception -> { log . warn ( "listScopes failed with exception: " , exception ) ; return Response . status ( Status . INTERNAL_SERVER_ERROR ) . build ( ) ; } ) . thenApply ( response -> { asyncResponse . resume ( response ) ; LoggerHelpers . traceLeave ( log , "listScopes" , traceId ) ; return response ; } ) ; |
public class RaspiPin { /** * so this method definition will hide the subclass static method ) */
public static Pin [ ] allPins ( SystemInfo . BoardType board ) { } } | List < Pin > pins = new ArrayList < > ( ) ; // pins for all Raspberry Pi models
pins . add ( RaspiPin . GPIO_00 ) ; pins . add ( RaspiPin . GPIO_01 ) ; pins . add ( RaspiPin . GPIO_02 ) ; pins . add ( RaspiPin . GPIO_03 ) ; pins . add ( RaspiPin . GPIO_04 ) ; pins . add ( RaspiPin . GPIO_05 ) ; pins . add ( RaspiPin . GPIO_06 ) ; pins . add ( RaspiPin . GPIO_07 ) ; pins . add ( RaspiPin . GPIO_08 ) ; pins . add ( RaspiPin . GPIO_09 ) ; pins . add ( RaspiPin . GPIO_10 ) ; pins . add ( RaspiPin . GPIO_11 ) ; pins . add ( RaspiPin . GPIO_12 ) ; pins . add ( RaspiPin . GPIO_13 ) ; pins . add ( RaspiPin . GPIO_14 ) ; pins . add ( RaspiPin . GPIO_15 ) ; pins . add ( RaspiPin . GPIO_16 ) ; // no further pins to add for Model B Rev 1 boards
if ( board == SystemInfo . BoardType . RaspberryPi_B_Rev1 ) { // return pins collection
return pins . toArray ( new Pin [ 0 ] ) ; } // add pins exclusive to Model A and Model B ( Rev2)
if ( board == SystemInfo . BoardType . RaspberryPi_A || board == SystemInfo . BoardType . RaspberryPi_B_Rev2 ) { pins . add ( RaspiPin . GPIO_17 ) ; pins . add ( RaspiPin . GPIO_18 ) ; pins . add ( RaspiPin . GPIO_19 ) ; pins . add ( RaspiPin . GPIO_20 ) ; } // add pins exclusive to Models A + , B + , 2B , 3B , and Zero
else { pins . add ( RaspiPin . GPIO_21 ) ; pins . add ( RaspiPin . GPIO_22 ) ; pins . add ( RaspiPin . GPIO_23 ) ; pins . add ( RaspiPin . GPIO_24 ) ; pins . add ( RaspiPin . GPIO_25 ) ; pins . add ( RaspiPin . GPIO_26 ) ; pins . add ( RaspiPin . GPIO_27 ) ; pins . add ( RaspiPin . GPIO_28 ) ; pins . add ( RaspiPin . GPIO_29 ) ; pins . add ( RaspiPin . GPIO_30 ) ; pins . add ( RaspiPin . GPIO_31 ) ; } // return pins collection
return pins . toArray ( new Pin [ 0 ] ) ; |
public class SqlUtil { /** * 构件相等条件的where语句 < br >
* 如果没有条件语句 , 泽返回空串 , 表示没有条件
* @ param entity 条件实体
* @ param paramValues 条件值得存放List
* @ return 带where关键字的SQL部分 */
public static String buildEqualsWhere ( Entity entity , List < Object > paramValues ) { } } | if ( null == entity || entity . isEmpty ( ) ) { return StrUtil . EMPTY ; } final StringBuilder sb = new StringBuilder ( " WHERE " ) ; boolean isNotFirst = false ; for ( Entry < String , Object > entry : entity . entrySet ( ) ) { if ( isNotFirst ) { sb . append ( " and " ) ; } else { isNotFirst = true ; } sb . append ( "`" ) . append ( entry . getKey ( ) ) . append ( "`" ) . append ( " = ?" ) ; paramValues . add ( entry . getValue ( ) ) ; } return sb . toString ( ) ; |
public class DatabasesInner { /** * Checks that the database name is valid and is not already in use .
* @ param resourceGroupName The name of the resource group containing the Kusto cluster .
* @ param clusterName The name of the Kusto cluster .
* @ param name Database name .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the CheckNameResultInner object */
public Observable < CheckNameResultInner > checkNameAvailabilityAsync ( String resourceGroupName , String clusterName , String name ) { } } | return checkNameAvailabilityWithServiceResponseAsync ( resourceGroupName , clusterName , name ) . map ( new Func1 < ServiceResponse < CheckNameResultInner > , CheckNameResultInner > ( ) { @ Override public CheckNameResultInner call ( ServiceResponse < CheckNameResultInner > response ) { return response . body ( ) ; } } ) ; |
public class BuildWithDetails { /** * Returns the change set of a build if available .
* If a build performs several scm checkouts ( i . e . pipeline builds ) , the change set of the first
* checkout is returned . To get the complete list of change sets for all checkouts , use
* { @ link # getChangeSets ( ) }
* If no checkout is performed , null is returned .
* @ return The change set of the build . */
public BuildChangeSet getChangeSet ( ) { } } | BuildChangeSet result ; if ( changeSet != null ) { result = changeSet ; } else if ( changeSets != null && ! changeSets . isEmpty ( ) ) { result = changeSets . get ( 0 ) ; } else { result = null ; } return result ; |
public class DefaultSlabAllocator { /** * Compute how many slots in a slab will be used to do a default ( new slab ) allocation , and how many bytes it will consume
* @ param slabSlotsUsed - number of available slots in a slab that have been used prior to this allocation
* @ param slabBytesUsed - number of bytes in a slab that have been used prior to this allocation
* @ param eventSizes - list of the size in bytes of all events that we want to insert into the slab
* @ return a pair of integers , the left value is the number of slots that will be used by this allocation and the
* right value is the numb er of bytes that will be used by this allocation */
static Pair < Integer , Integer > defaultAllocationCount ( int slabSlotsUsed , int slabBytesUsed , PeekingIterator < Integer > eventSizes ) { } } | int slabTotalSlotCount = slabSlotsUsed ; int allocationSlotCount = 0 ; int slabTotalBytesUsed = slabBytesUsed ; int allocationBytes = 0 ; while ( eventSizes . hasNext ( ) ) { checkArgument ( eventSizes . peek ( ) <= Constants . MAX_EVENT_SIZE_IN_BYTES , "Event size (" + eventSizes . peek ( ) + ") is greater than the maximum allowed (" + Constants . MAX_EVENT_SIZE_IN_BYTES + ") event size" ) ; if ( slabTotalSlotCount + 1 <= Constants . MAX_SLAB_SIZE && slabTotalBytesUsed + eventSizes . peek ( ) <= Constants . MAX_SLAB_SIZE_IN_BYTES ) { slabTotalSlotCount ++ ; allocationSlotCount ++ ; int eventSize = eventSizes . next ( ) ; slabTotalBytesUsed += eventSize ; allocationBytes += eventSize ; } else { break ; } } return new ImmutablePair < > ( allocationSlotCount , allocationBytes ) ; |
public class FormatUtil { /** * Returns a string with the specified number of whitespace .
* @ param n the number of whitespace characters
* @ return a string with the specified number of blanks */
public static StringBuilder whitespace ( StringBuilder buf , int n ) { } } | while ( n >= WHITESPACE_BUFFER_LENGTH ) { buf . append ( WHITESPACE_BUFFER ) ; n -= WHITESPACE_BUFFER_LENGTH ; } return n > 0 ? buf . append ( WHITESPACE_BUFFER , 0 , n ) : buf ; |
public class ApiOvhOrder { /** * Create order
* REST : POST / order / router / new / { duration }
* @ param vrack [ required ] The name of your vrack
* @ param duration [ required ] Duration */
public OvhOrder router_new_duration_POST ( String duration , String vrack ) throws IOException { } } | String qPath = "/order/router/new/{duration}" ; StringBuilder sb = path ( qPath , duration ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "vrack" , vrack ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhOrder . class ) ; |
public class JSONParserWS { /** * TODO : use subclassing if handling comments is sufficiently slower ? */
protected int getCharNWS ( ) throws IOException { } } | outWS . reset ( ) ; outer : for ( ; ; ) { int ch = getChar ( ) ; switch ( ch ) { case ' ' : case '\t' : case '\r' : case '\n' : outWS . write ( ch ) ; continue outer ; case '#' : getNewlineComment ( ) ; continue outer ; case '/' : getSlashComment ( ) ; continue outer ; default : return ch ; } } |
public class SftpFileAttributes { /** * Returns a formatted byte array suitable for encoding into SFTP subsystem
* messages .
* @ return byte [ ]
* @ throws IOException */
public byte [ ] toByteArray ( ) throws IOException { } } | ByteArrayWriter baw = new ByteArrayWriter ( ) ; try { baw . writeInt ( flags ) ; if ( version > 3 ) baw . write ( type ) ; if ( isFlagSet ( SSH_FILEXFER_ATTR_SIZE ) ) { baw . write ( size . toByteArray ( ) ) ; } if ( version <= 3 && isFlagSet ( SSH_FILEXFER_ATTR_UIDGID ) ) { if ( uid != null ) { try { baw . writeInt ( Long . parseLong ( uid ) ) ; } catch ( NumberFormatException ex ) { baw . writeInt ( 0 ) ; } } else { baw . writeInt ( 0 ) ; } if ( gid != null ) { try { baw . writeInt ( Long . parseLong ( gid ) ) ; } catch ( NumberFormatException ex ) { baw . writeInt ( 0 ) ; } } else { baw . writeInt ( 0 ) ; } } else if ( version > 3 && isFlagSet ( SSH_FILEXFER_ATTR_OWNERGROUP ) ) { if ( uid != null ) baw . writeString ( uid , sftp . getCharsetEncoding ( ) ) ; else baw . writeString ( "" ) ; if ( gid != null ) baw . writeString ( gid , sftp . getCharsetEncoding ( ) ) ; else baw . writeString ( "" ) ; } if ( isFlagSet ( SSH_FILEXFER_ATTR_PERMISSIONS ) ) { baw . writeInt ( permissions . longValue ( ) ) ; } if ( version <= 3 && isFlagSet ( SSH_FILEXFER_ATTR_ACCESSTIME ) ) { baw . writeInt ( atime . longValue ( ) ) ; baw . writeInt ( mtime . longValue ( ) ) ; } else if ( version > 3 ) { if ( isFlagSet ( SSH_FILEXFER_ATTR_ACCESSTIME ) ) { baw . writeUINT64 ( atime ) ; } if ( isFlagSet ( SSH_FILEXFER_ATTR_SUBSECOND_TIMES ) ) { baw . writeUINT32 ( atime_nano ) ; } if ( isFlagSet ( SSH_FILEXFER_ATTR_CREATETIME ) ) { baw . writeUINT64 ( createtime ) ; } if ( isFlagSet ( SSH_FILEXFER_ATTR_SUBSECOND_TIMES ) ) { baw . writeUINT32 ( createtime_nano ) ; } if ( isFlagSet ( SSH_FILEXFER_ATTR_MODIFYTIME ) ) { baw . writeUINT64 ( mtime ) ; } if ( isFlagSet ( SSH_FILEXFER_ATTR_SUBSECOND_TIMES ) ) { baw . writeUINT32 ( mtime_nano ) ; } } if ( isFlagSet ( SSH_FILEXFER_ATTR_ACL ) ) { ByteArrayWriter tmp = new ByteArrayWriter ( ) ; try { Enumeration < ACL > e = acls . elements ( ) ; tmp . writeInt ( acls . size ( ) ) ; while ( e . hasMoreElements ( ) ) { ACL acl = e . nextElement ( ) ; tmp . writeInt ( acl . getType ( ) ) ; tmp . writeInt ( acl . getFlags ( ) ) ; tmp . writeInt ( acl . getMask ( ) ) ; tmp . writeString ( acl . getWho ( ) ) ; } baw . writeBinaryString ( tmp . toByteArray ( ) ) ; } finally { tmp . close ( ) ; } } if ( isFlagSet ( SSH_FILEXFER_ATTR_EXTENDED ) ) { baw . writeInt ( extendedAttributes . size ( ) ) ; Enumeration < String > e = extendedAttributes . keys ( ) ; while ( e . hasMoreElements ( ) ) { String key = e . nextElement ( ) ; baw . writeString ( key ) ; baw . writeBinaryString ( extendedAttributes . get ( key ) ) ; } } return baw . toByteArray ( ) ; } finally { try { baw . close ( ) ; } catch ( IOException e ) { } } |
public class LexerEngine { /** * Judge current token equals one of input tokens or not .
* @ param tokenTypes to be judged token types
* @ return current token equals one of input tokens or not */
public boolean equalAny ( final TokenType ... tokenTypes ) { } } | for ( TokenType each : tokenTypes ) { if ( each == lexer . getCurrentToken ( ) . getType ( ) ) { return true ; } } return false ; |
public class RRFedNonFedBudgetV1_0Generator { /** * This method returns RRFedNonFedBudgetDocument object based on proposal development document which contains the informations
* such as DUNSID , OrganizationName , BudgetType , BudgetYear and BudgetSummary .
* @ return rrFedNonFedBudgetDocument { @ link XmlObject } of type RRFedNonFedBudgetDocument . */
private RRFedNonFedBudgetDocument getRRFedNonFedBudget ( ) { } } | RRFedNonFedBudgetDocument rrFedNonFedBudgetDocument = RRFedNonFedBudgetDocument . Factory . newInstance ( ) ; RRFedNonFedBudgetDocument . RRFedNonFedBudget fedNonFedBudget = RRFedNonFedBudgetDocument . RRFedNonFedBudget . Factory . newInstance ( ) ; fedNonFedBudget . setFormVersion ( FormVersion . v1_0 . getVersion ( ) ) ; if ( pdDoc . getDevelopmentProposal ( ) . getApplicantOrganization ( ) != null ) { fedNonFedBudget . setDUNSID ( pdDoc . getDevelopmentProposal ( ) . getApplicantOrganization ( ) . getOrganization ( ) . getDunsNumber ( ) ) ; } if ( pdDoc . getDevelopmentProposal ( ) . getApplicantOrganization ( ) != null ) { fedNonFedBudget . setOrganizationName ( pdDoc . getDevelopmentProposal ( ) . getApplicantOrganization ( ) . getOrganization ( ) . getOrganizationName ( ) ) ; } fedNonFedBudget . setBudgetType ( BudgetTypeDataType . PROJECT ) ; // Set default values for mandatory fields
List < BudgetPeriodDto > budgetPeriodList ; BudgetSummaryDto budgetSummary = null ; try { budgetPeriodList = s2sBudgetCalculatorService . getBudgetPeriods ( pdDoc ) ; budgetSummary = s2sBudgetCalculatorService . getBudgetInfo ( pdDoc , budgetPeriodList ) ; } catch ( S2SException e ) { LOG . error ( e . getMessage ( ) , e ) ; return rrFedNonFedBudgetDocument ; } for ( BudgetPeriodDto budgetPeriodData : budgetPeriodList ) { if ( budgetPeriodData . getBudgetPeriod ( ) == BudgetPeriodNum . P1 . getNum ( ) ) { fedNonFedBudget . setBudgetYear1 ( getBudgetYear1DataType ( budgetPeriodData ) ) ; } else if ( budgetPeriodData . getBudgetPeriod ( ) == BudgetPeriodNum . P2 . getNum ( ) && budgetPeriodData . getLineItemCount ( ) > 0 ) { fedNonFedBudget . setBudgetYear2 ( getBudgetYearDataType ( budgetPeriodData ) ) ; } else if ( budgetPeriodData . getBudgetPeriod ( ) == BudgetPeriodNum . P3 . getNum ( ) && budgetPeriodData . getLineItemCount ( ) > 0 ) { fedNonFedBudget . setBudgetYear3 ( getBudgetYearDataType ( budgetPeriodData ) ) ; } else if ( budgetPeriodData . getBudgetPeriod ( ) == BudgetPeriodNum . P4 . getNum ( ) && budgetPeriodData . getLineItemCount ( ) > 0 ) { fedNonFedBudget . setBudgetYear4 ( getBudgetYearDataType ( budgetPeriodData ) ) ; } else if ( budgetPeriodData . getBudgetPeriod ( ) == BudgetPeriodNum . P5 . getNum ( ) && budgetPeriodData . getLineItemCount ( ) > 0 ) { fedNonFedBudget . setBudgetYear5 ( getBudgetYearDataType ( budgetPeriodData ) ) ; } } fedNonFedBudget . setBudgetSummary ( getBudgetSummary ( budgetSummary ) ) ; rrFedNonFedBudgetDocument . setRRFedNonFedBudget ( fedNonFedBudget ) ; return rrFedNonFedBudgetDocument ; |
public class SQLUtils { /** * 拼凑limit字句 。 前面有空格 。
* @ param offset 可以为null
* @ param limit 不能为null
* @ return */
public static String genLimitSQL ( Integer offset , Integer limit ) { } } | StringBuilder sb = new StringBuilder ( ) ; if ( limit != null ) { sb . append ( " limit " ) ; if ( offset != null ) { sb . append ( offset ) . append ( "," ) ; } sb . append ( limit ) ; } return sb . toString ( ) ; |
public class Matrix4d { /** * Apply a symmetric perspective projection frustum transformation using for a right - handed coordinate system
* the given NDC z range to this matrix .
* If < code > M < / code > is < code > this < / code > matrix and < code > P < / code > the perspective projection matrix ,
* then the new matrix will be < code > M * P < / code > . So when transforming a
* vector < code > v < / code > with the new matrix by using < code > M * P * v < / code > ,
* the perspective projection will be applied first !
* In order to set the matrix to a perspective frustum transformation without post - multiplying ,
* use { @ link # setPerspectiveRect ( double , double , double , double , boolean ) setPerspectiveRect } .
* @ see # setPerspectiveRect ( double , double , double , double , boolean )
* @ param width
* the width of the near frustum plane
* @ param height
* the height of the near frustum plane
* @ param zNear
* near clipping plane distance . If the special value { @ link Double # POSITIVE _ INFINITY } is used , the near clipping plane will be at positive infinity .
* In that case , < code > zFar < / code > may not also be { @ link Double # POSITIVE _ INFINITY } .
* @ param zFar
* far clipping plane distance . If the special value { @ link Double # POSITIVE _ INFINITY } is used , the far clipping plane will be at positive infinity .
* In that case , < code > zNear < / code > may not also be { @ link Double # POSITIVE _ INFINITY } .
* @ 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 a matrix holding the result */
public Matrix4d perspectiveRect ( double width , double height , double zNear , double zFar , boolean zZeroToOne ) { } } | return perspectiveRect ( width , height , zNear , zFar , zZeroToOne , this ) ; |
public class Nats { /** * Try to connect in another thread , a connection listener is required to get
* the connection .
* < p > Normally connect will loop through the available servers one time . If
* reconnectOnConnect is true , the connection attempt will repeat based on the
* settings in options , including indefinitely .
* < p > If there is an exception before a connection is created , and the error
* listener is set , it will be notified with a null connection .
* < p > < strong > This method is experimental , please provide feedback on its value . < / strong >
* @ param options the connection options
* @ param reconnectOnConnect if true , the connection will treat the initial
* connection as any other and attempt reconnects on
* failure
* @ throws IllegalArgumentException if no connection listener is set in the options
* @ throws InterruptedException if the current thread is interrupted */
public static void connectAsynchronously ( Options options , boolean reconnectOnConnect ) throws InterruptedException { } } | if ( options . getConnectionListener ( ) == null ) { throw new IllegalArgumentException ( "Connection Listener required in connectAsynchronously" ) ; } Thread t = new Thread ( ( ) -> { try { NatsImpl . createConnection ( options , reconnectOnConnect ) ; } catch ( Exception ex ) { if ( options . getErrorListener ( ) != null ) { options . getErrorListener ( ) . exceptionOccurred ( null , ex ) ; } } } ) ; t . setName ( "NATS - async connection" ) ; t . start ( ) ; |
public class Analyzer { /** * Analyze the given ASTType and produces a corresponding InjectionNode with the contained
* AST injection related elements ( constructor , method , field ) recursively analyzed for InjectionNodes
* @ param signature Injection Signature
* @ param concreteType required type
* @ param context required
* @ return InjectionNode root */
public InjectionNode analyze ( final InjectionSignature signature , final InjectionSignature concreteType , final AnalysisContext context ) { } } | InjectionNode injectionNode ; if ( context . isDependent ( concreteType . getType ( ) ) ) { // if this type is a dependency of itself , we ' ve found a back link .
// This dependency loop must be broken using a virtual proxy
injectionNode = context . getInjectionNode ( concreteType . getType ( ) ) ; Collection < InjectionNode > loopedDependencies = context . getDependencyHistory ( ) ; InjectionNode proxyDependency = findProxyableDependency ( injectionNode , loopedDependencies ) ; if ( proxyDependency == null ) { throw new TransfuseAnalysisException ( "Unable to find a dependency to proxy" ) ; } VirtualProxyAspect proxyAspect = getProxyAspect ( proxyDependency ) ; proxyAspect . getProxyInterfaces ( ) . add ( proxyDependency . getUsageType ( ) ) ; } else { injectionNode = new InjectionNode ( signature , concreteType ) ; // default variable builder
injectionNode . addAspect ( VariableBuilder . class , variableInjectionBuilderProvider . get ( ) ) ; AnalysisContext nextContext = context . addDependent ( injectionNode ) ; // loop over super classes ( extension and implements )
scanClassHierarchy ( concreteType . getType ( ) , injectionNode , nextContext ) ; } return injectionNode ; |
public class CompanyServiceClient { /** * Deletes specified company . Prerequisite : The company has no jobs associated with it .
* < p > Sample code :
* < pre > < code >
* try ( CompanyServiceClient companyServiceClient = CompanyServiceClient . create ( ) ) {
* CompanyName name = CompanyWithTenantName . of ( " [ PROJECT ] " , " [ TENANT ] " , " [ COMPANY ] " ) ;
* companyServiceClient . deleteCompany ( name ) ;
* < / code > < / pre >
* @ param name Required .
* < p > The resource name of the company to be deleted .
* < p > The format is " projects / { project _ id } / tenants / { tenant _ id } / companies / { company _ id } " , for
* example , " projects / api - test - project / tenants / foo / companies / bar " .
* < p > Tenant id is optional and the default tenant is used if unspecified , for example ,
* " projects / api - test - project / companies / bar " .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final void deleteCompany ( CompanyName name ) { } } | DeleteCompanyRequest request = DeleteCompanyRequest . newBuilder ( ) . setName ( name == null ? null : name . toString ( ) ) . build ( ) ; deleteCompany ( request ) ; |
public class IdentifiableConverter { /** * Determines whether this { @ link Converter } can convert { @ link Object Objects }
* { @ link Class from type } { @ link Class to type } .
* @ param fromType { @ link Class type } to convert from .
* @ param toType { @ link Class type } to convert to .
* @ return a boolean indicating whether this { @ link Converter } can convert { @ link Object Objects }
* { @ link Class from type } { @ link Class to type } .
* @ see org . cp . elements . data . conversion . ConversionService # canConvert ( Class , Class )
* @ see # canConvert ( Object , Class ) */
@ Override public boolean canConvert ( Class < ? > fromType , Class < ? > toType ) { } } | return Long . class . equals ( fromType ) && toType != null && Identifiable . class . isAssignableFrom ( toType ) ; |
public class CheckUtil { /** * Same as checkMmul , but for matrix addition */
public static boolean checkAdd ( INDArray first , INDArray second , double maxRelativeDifference , double minAbsDifference ) { } } | RealMatrix rmFirst = convertToApacheMatrix ( first ) ; RealMatrix rmSecond = convertToApacheMatrix ( second ) ; INDArray result = first . add ( second ) ; RealMatrix rmResult = rmFirst . add ( rmSecond ) ; if ( ! checkShape ( rmResult , result ) ) return false ; boolean ok = checkEntries ( rmResult , result , maxRelativeDifference , minAbsDifference ) ; if ( ! ok ) { INDArray onCopies = Shape . toOffsetZeroCopy ( first ) . add ( Shape . toOffsetZeroCopy ( second ) ) ; printFailureDetails ( first , second , rmResult , result , onCopies , "add" ) ; } return ok ; |
public class ApplicationWindowSetter { /** * If the given bean is an implementation of { @ link ApplicationWindowAware } , it will have its
* application window set to the window provided to this instance at construction time . */
public Object postProcessBeforeInitialization ( Object bean , String beanName ) throws BeansException { } } | if ( bean instanceof ApplicationWindowAware ) { ( ( ApplicationWindowAware ) bean ) . setApplicationWindow ( window ) ; } return bean ; |
public class CDKMCS { /** * Returns the first isomorph ' atom mapping ' found for targetGraph in sourceGraph .
* @ param sourceGraph first molecule . Must not be an IQueryAtomContainer .
* @ param targetGraph second molecule . May be an IQueryAtomContainer .
* @ param shouldMatchBonds
* @ return the first isomorph atom mapping found projected on sourceGraph .
* This is atom List of CDKRMap objects containing Ids of matching atoms .
* @ throws org . openscience . cdk . exception . CDKException if the first molecules is not an instance of
* { @ link org . openscience . cdk . isomorphism . matchers . IQueryAtomContainer } */
public static List < CDKRMap > getIsomorphAtomsMap ( IAtomContainer sourceGraph , IAtomContainer targetGraph , boolean shouldMatchBonds ) throws CDKException { } } | if ( sourceGraph instanceof IQueryAtomContainer ) { throw new CDKException ( "The first IAtomContainer must not be an IQueryAtomContainer" ) ; } List < CDKRMap > list = checkSingleAtomCases ( sourceGraph , targetGraph ) ; if ( list == null ) { return makeAtomsMapOfBondsMap ( CDKMCS . getIsomorphMap ( sourceGraph , targetGraph , shouldMatchBonds ) , sourceGraph , targetGraph ) ; } else if ( list . isEmpty ( ) ) { return null ; } else { return list ; } |
public class CppTask { /** * public void execute ( ) {
* FileWriter writer = null ;
* try {
* if ( input = = null )
* throw new BuildException ( " Input not specified " ) ;
* if ( output = = null )
* throw new BuildException ( " Output not specified " ) ;
* cpp . addInput ( this . input ) ;
* writer = new FileWriter ( this . output ) ;
* for ( ; ; ) {
* Tokentok = cpp . token ( ) ;
* if ( tok ! = null & & tok . getType ( ) = = Token . EOF )
* break ;
* writer . write ( tok . getText ( ) ) ;
* catch ( Exception e ) {
* throw new BuildException ( e ) ;
* finally {
* if ( writer ! = null ) {
* try {
* writer . close ( ) ;
* catch ( IOException e ) { */
private void preprocess ( File input , File output ) throws Exception { } } | if ( input == null ) throw new BuildException ( "Input not specified" ) ; if ( output == null ) throw new BuildException ( "Output not specified" ) ; Preprocessor cpp = new Preprocessor ( ) ; cpp . setListener ( listener ) ; for ( Macro macro : macros ) cpp . addMacro ( macro . getName ( ) , macro . getValue ( ) ) ; if ( systemincludepath != null ) cpp . setSystemIncludePath ( Arrays . asList ( systemincludepath . list ( ) ) ) ; if ( localincludepath != null ) cpp . setQuoteIncludePath ( Arrays . asList ( localincludepath . list ( ) ) ) ; File dir = output . getParentFile ( ) ; if ( ! dir . exists ( ) ) { if ( ! dir . mkdirs ( ) ) throw new BuildException ( "Failed to make parent directory " + dir ) ; } else if ( ! dir . isDirectory ( ) ) { throw new BuildException ( "Parent directory of output file " + output + " exists, but is not a directory." ) ; } FileWriter writer = null ; try { cpp . addInput ( input ) ; writer = new FileWriter ( output ) ; for ( ; ; ) { Token tok = cpp . token ( ) ; if ( tok == null ) break ; if ( tok . getType ( ) == Token . EOF ) break ; writer . write ( tok . getText ( ) ) ; } } finally { if ( writer != null ) { try { writer . close ( ) ; } catch ( IOException e ) { } } } |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcAirTerminalType ( ) { } } | if ( ifcAirTerminalTypeEClass == null ) { ifcAirTerminalTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 8 ) ; } return ifcAirTerminalTypeEClass ; |
public class LocalVariableStack { /** * Retrieves the Python expression for a given variable name . The stack is traversed from top to
* bottom , giving the tightest scope the highest priority .
* @ param variableName The name of the variable .
* @ return The translated expression , or null if not found . */
@ Nullable PyExpr getVariableExpression ( String variableName ) { } } | for ( Map < String , PyExpr > frame : localVarExprs ) { PyExpr translation = frame . get ( variableName ) ; if ( translation != null ) { return translation ; } } return null ; |
public class CSVParser { /** * precondition : the current back slash with N next will be an NULL case
* @ param nextLine
* @ param inQuotes
* @ param i
* @ return */
protected boolean isNullcaseForEscape ( String nextLine , boolean inQuotes , int i , String sb ) { } } | boolean result = false , hasmet = false ; for ( int k = 0 ; k < sb . length ( ) ; k ++ ) { char c = sb . charAt ( k ) ; if ( Character . isWhitespace ( c ) ) continue ; else if ( c == quotechar ) { if ( ! inQuotes || hasmet ) return false ; hasmet = true ; continue ; } else return false ; } hasmet = false ; if ( nextLine . length ( ) > ( i + 1 ) && ( nextLine . charAt ( i + 1 ) == 'N' ) ) { for ( int j = i + 2 ; j < nextLine . length ( ) ; j ++ ) { char c = nextLine . charAt ( j ) ; if ( Character . isWhitespace ( c ) ) continue ; else if ( c == quotechar ) { if ( ! inQuotes || hasmet ) return false ; hasmet = true ; continue ; } else if ( c == separator ) break ; else return false ; } result = true ; } return result ; |
public class DynamicOutputBuffer { /** * Clear the buffer and reset size and write position */
public void clear ( ) { } } | // release a static buffer if possible
if ( _buffersToReuse != null && ! _buffersToReuse . isEmpty ( ) ) { StaticBuffers . getInstance ( ) . releaseByteBuffer ( BUFFER_KEY , _buffersToReuse . peek ( ) ) ; } else if ( ! _buffers . isEmpty ( ) ) { StaticBuffers . getInstance ( ) . releaseByteBuffer ( BUFFER_KEY , _buffers . get ( 0 ) ) ; } if ( _buffersToReuse != null ) { _buffersToReuse . clear ( ) ; } _buffers . clear ( ) ; _position = 0 ; _flushPosition = 0 ; _size = 0 ; |
public class appfwhtmlerrorpage { /** * Use this API to fetch all the appfwhtmlerrorpage resources that are configured on netscaler . */
public static appfwhtmlerrorpage get ( nitro_service service , options option ) throws Exception { } } | appfwhtmlerrorpage obj = new appfwhtmlerrorpage ( ) ; appfwhtmlerrorpage [ ] response = ( appfwhtmlerrorpage [ ] ) obj . get_resources ( service , option ) ; return response [ 0 ] ; |
public class BuildTasksInner { /** * Creates a build task for a container registry with the specified parameters .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ param buildTaskName The name of the container registry build task .
* @ param buildTaskCreateParameters The parameters for creating a build task .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < BuildTaskInner > createAsync ( String resourceGroupName , String registryName , String buildTaskName , BuildTaskInner buildTaskCreateParameters ) { } } | return createWithServiceResponseAsync ( resourceGroupName , registryName , buildTaskName , buildTaskCreateParameters ) . map ( new Func1 < ServiceResponse < BuildTaskInner > , BuildTaskInner > ( ) { @ Override public BuildTaskInner call ( ServiceResponse < BuildTaskInner > response ) { return response . body ( ) ; } } ) ; |
public class ChainableReverseAbstractInterpreter { /** * Returns a version of type where undefined is not present . */
protected final JSType getRestrictedWithoutUndefined ( JSType type ) { } } | return type == null ? null : type . visit ( restrictUndefinedVisitor ) ; |
public class FieldListener { /** * Enable state is dependent on this listener .
* @ param dependentStateListener The listener to get the enabled state from . */
public void setDependentStateListener ( BaseListener dependentStateListener ) { } } | if ( ! ( dependentStateListener instanceof FieldListener ) ) dependentStateListener = null ; else if ( ( this . getOwner ( ) == null ) || ( ( ( FieldListener ) dependentStateListener ) . getOwner ( ) == null ) || ( this . getOwner ( ) . getRecord ( ) != ( ( FieldListener ) dependentStateListener ) . getOwner ( ) . getRecord ( ) ) ) dependentStateListener = null ; super . setDependentStateListener ( dependentStateListener ) ; |
public class Twilio { /** * Initialize the Twilio environment .
* @ param username account to use
* @ param password auth token for the account */
public static void init ( final String username , final String password ) { } } | Twilio . setUsername ( username ) ; Twilio . setPassword ( password ) ; |
public class JSIndirectBoxedListImpl { /** * Other overridden methods . */
public Object get ( int accessor ) { } } | try { return getValue ( accessor ) ; } catch ( JMFException ex ) { FFDCFilter . processException ( ex , "get" , "134" , this ) ; return null ; } |
public class DataReader { /** * Extract weekday names from a locale ' s mapping . */
private String [ ] weekdayMap ( JsonObject node ) { } } | String [ ] res = new String [ 7 ] ; for ( int i = 0 ; i < 7 ; i ++ ) { res [ i ] = node . get ( WEEKDAY_KEYS [ i ] ) . getAsString ( ) ; } return res ; |
public class SemanticHeadFinder { /** * Overwrite the postOperationFix method : a , b and c - > we want a to be the head */
@ Override protected int postOperationFix ( int headIdx , Tree [ ] daughterTrees ) { } } | if ( headIdx >= 2 ) { String prevLab = tlp . basicCategory ( daughterTrees [ headIdx - 1 ] . value ( ) ) ; if ( prevLab . equals ( "CC" ) || prevLab . equals ( "CONJP" ) ) { int newHeadIdx = headIdx - 2 ; Tree t = daughterTrees [ newHeadIdx ] ; while ( newHeadIdx >= 0 && t . isPreTerminal ( ) && tlp . isPunctuationTag ( t . value ( ) ) ) { newHeadIdx -- ; } while ( newHeadIdx >= 2 && tlp . isPunctuationTag ( daughterTrees [ newHeadIdx - 1 ] . value ( ) ) ) { newHeadIdx = newHeadIdx - 2 ; } if ( newHeadIdx >= 0 ) { headIdx = newHeadIdx ; } } } return headIdx ; |
public class MatrixVectorWriter { /** * Prints the coordinates to the underlying stream . One index pair on each
* line . The offset is added to each index , typically , this can transform
* from a 0 - based indicing to a 1 - based . */
public void printPattern ( int [ ] row , int [ ] column , int offset ) { } } | int size = row . length ; if ( size != column . length ) throw new IllegalArgumentException ( "All arrays must be of the same size" ) ; for ( int i = 0 ; i < size ; ++ i ) format ( Locale . ENGLISH , "%10d %10d%n" , row [ i ] + offset , column [ i ] + offset ) ; |
public class SparseHashDoubleVector { /** * { @ inheritDoc } */
public double magnitude ( ) { } } | if ( magnitude < 0 ) { magnitude = 0 ; TDoubleIterator iter = vector . valueCollection ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { double d = iter . next ( ) ; magnitude += d * d ; } magnitude = Math . sqrt ( magnitude ) ; } return magnitude ; |
public class ExtensionUtils { /** * Find Required bundles from the manifest file underneath specified directory recursively .
* this method does not expect that the parameters are null .
* returns list of RequredBundle object . */
static private List < LaunchManifest . RequiredBundle > findExtensionBundles ( List < File > dirs ) throws IOException { } } | List < LaunchManifest . RequiredBundle > list = new ArrayList < LaunchManifest . RequiredBundle > ( ) ; for ( File dir : dirs ) { if ( dir . exists ( ) ) { File [ ] files = dir . listFiles ( ) ; if ( files != null ) { for ( File file : files ) { if ( ! file . isDirectory ( ) && file . getName ( ) . toLowerCase ( ) . endsWith ( ".jar" ) ) { String bundles = getRequiredBundles ( file ) ; if ( bundles != null ) { list . addAll ( LaunchManifest . parseRequireBundle ( bundles ) ) ; } } } } } } return list ; |
public class JwtSSOTokenImpl { /** * ( non - Javadoc )
* @ see com . ibm . ws . security . jwt . sso . token . utils . JwtSSOToken #
* addCustomCacheKeyAndRealmToJwtSSOToken ( javax . security . auth . Subject ,
* java . lang . String ) */
@ Override public void addAttributesToJwtSSOToken ( Subject subject ) throws WSLoginFailedException { } } | Set < JsonWebToken > jsonWebTokenPrincipals = getJwtPrincipals ( subject ) ; if ( jsonWebTokenPrincipals != null && ! jsonWebTokenPrincipals . isEmpty ( ) ) { subject . getPrincipals ( ) . removeAll ( jsonWebTokenPrincipals ) ; } createJwtSSOToken ( subject ) ; |
public class ReminderDatePicker { /** * Gets the currently selected date ( that the Spinners are showing )
* @ return The selected date as Calendar , or null if there is none . */
public Calendar getSelectedDate ( ) { } } | Calendar result = dateSpinner . getSelectedDate ( ) ; Calendar time = timeSpinner . getSelectedTime ( ) ; if ( result != null && time != null ) { result . set ( Calendar . HOUR_OF_DAY , time . get ( Calendar . HOUR_OF_DAY ) ) ; result . set ( Calendar . MINUTE , time . get ( Calendar . MINUTE ) ) ; return result ; } else return null ; |
public class ControllerSourceVisitor { /** * Visit the Controller JavaDoc block .
* Add the JavadocComment as the ControllerModel description .
* Set the ControllerModel version as the javadoc version tag if it exists .
* @ param jdoc { @ inheritDoc }
* @ param controller The ControllerModel we are building . */
@ Override public void visit ( JavadocComment jdoc , ControllerModel controller ) { } } | controller . setDescription ( extractDescription ( jdoc ) ) ; Set < String > version = extractDocAnnotation ( "@version" , jdoc ) ; if ( ! version . isEmpty ( ) ) { controller . setVersion ( version . iterator ( ) . next ( ) ) ; } |
public class CmsXmlGroupContainerFactory { /** * Stores the given group container in the cache . < p >
* @ param cms the cms context
* @ param xmlGroupContainer the group container to cache
* @ param keepEncoding if the encoding was kept while unmarshalling */
private static void setCache ( CmsObject cms , CmsXmlGroupContainer xmlGroupContainer , boolean keepEncoding ) { } } | if ( xmlGroupContainer . getFile ( ) instanceof I_CmsHistoryResource ) { return ; } boolean online = cms . getRequestContext ( ) . getCurrentProject ( ) . isOnlineProject ( ) ; getCache ( ) . setCacheGroupContainer ( getCache ( ) . getCacheKey ( xmlGroupContainer . getFile ( ) . getStructureId ( ) , keepEncoding ) , xmlGroupContainer , online ) ; |
public class DeleteIntegrationResponseRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteIntegrationResponseRequest deleteIntegrationResponseRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteIntegrationResponseRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteIntegrationResponseRequest . getRestApiId ( ) , RESTAPIID_BINDING ) ; protocolMarshaller . marshall ( deleteIntegrationResponseRequest . getResourceId ( ) , RESOURCEID_BINDING ) ; protocolMarshaller . marshall ( deleteIntegrationResponseRequest . getHttpMethod ( ) , HTTPMETHOD_BINDING ) ; protocolMarshaller . marshall ( deleteIntegrationResponseRequest . getStatusCode ( ) , STATUSCODE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class FileLastModifiedFilter { /** * Factory method to create an instance of the { @ link FileLastModifiedFilter } that evaluates and filters { @ link File } s
* based on whether they were last modified before or after a given span of time .
* @ param onBefore { @ link Calendar } used to filter { @ link File } ' s that were last modified on or before this date / time .
* @ param onAfter { @ link Calendar } used to filter { @ link File } ' s that were last modified on or after this date / time .
* @ return an instance of the { @ link FileLastModifiedFilter } .
* @ see java . util . Calendar # getTimeInMillis ( )
* @ see # outside ( long , long ) */
public static FileLastModifiedFilter outside ( Calendar onBefore , Calendar onAfter ) { } } | return outside ( onBefore . getTimeInMillis ( ) , onAfter . getTimeInMillis ( ) ) ; |
public class Dial { /** * Dials the targetEndPoint connecting the call to the localHandset . The
* dial is done in two parts as we need to set the auto answer header
* differently for each phone . For the localHandset we set auto answer on ,
* whilst for the remote targetEndPoint we MUST not auto answer the phone .
* @ param localHandset the users handset we are going to dial from ( e . g .
* receptionist phone ) .
* @ param targetEndPoint - the remote handset we are going to connect the
* localHandset to .
* @ param dialContext - context we are going to dial from .
* @ param hideCallerId
* @ param channelVarsToSet
* @ param callerId - the callerID to display on the targetEndPoint .
* @ return
* @ throws PBXException */
public OriginateResult [ ] dial ( final NewChannelListener listener , final EndPoint localHandset , final EndPoint targetEndPoint , final String dialContext , final CallerID callerID , final boolean hideCallerId , Map < String , String > channelVarsToSet ) throws PBXException { } } | final PBX pbx = PBXFactory . getActivePBX ( ) ; try ( final OriginateToExtension originate = new OriginateToExtension ( listener ) ) { this . startListener ( ) ; // First bring the operator ' s handset up and connect it to the
// ' njr - dial ' extension where they can
// wait whilst we complete the second leg
final OriginateResult trcResult = originate . originate ( localHandset , pbx . getExtensionAgi ( ) , true , ( ( AsteriskPBX ) pbx ) . getManagementContext ( ) , callerID , null , hideCallerId , channelVarsToSet ) ; this . result [ 0 ] = trcResult ; if ( trcResult . isSuccess ( ) == true ) { try { if ( targetEndPoint instanceof HoldAtAgi ) { if ( trcResult . getChannel ( ) . waitForChannelToReachAgi ( 30 , TimeUnit . SECONDS ) ) { // call is now in agi
System . out . println ( "Call is in agi" ) ; } else { // call never reached agi
System . out . println ( "Call never reached agi" ) ; } } else { // The call is now up , so connect it to
// the
// destination .
this . _latch = new CountDownLatch ( 1 ) ; trcResult . getChannel ( ) . setCurrentActivityAction ( new AgiChannelActivityDial ( targetEndPoint . getFullyQualifiedName ( ) ) ) ; this . _latch . await ( 30 , TimeUnit . SECONDS ) ; } } catch ( final InterruptedException e ) { // noop
} } return this . result ; } finally { this . close ( ) ; } |
public class ContentHash { /** * The entity path is currently only required for resources , which base their content hash on the resource type
* path which can be specified using a relative or canonical path in the blueprint . For the content hash to be
* consistent we need to convert to just a single representation of the path .
* @ param entity the entity to produce the hash of
* @ param entityPath the canonical path of the entity ( can be null for all but resources )
* @ return the content hash of the entity */
public static String of ( Entity . Blueprint entity , CanonicalPath entityPath ) { } } | return ComputeHash . of ( InventoryStructure . of ( entity ) . build ( ) , entityPath , false , true , false ) . getContentHash ( ) ; |
public class FileUtils { /** * Copies a file to another location . */
public static void copyFile ( String fromFilename , String toFilename ) throws IOException { } } | copyFile ( new File ( fromFilename ) , new File ( toFilename ) ) ; |
public class StringUtils { /** * < p > Compares all CharSequences in an array and returns the index at which the
* CharSequences begin to differ . < / p >
* < p > For example ,
* < code > indexOfDifference ( new String [ ] { " i am a machine " , " i am a robot " } ) - & gt ; 7 < / code > < / p >
* < pre >
* StringUtils . indexOfDifference ( null ) = - 1
* StringUtils . indexOfDifference ( new String [ ] { } ) = - 1
* StringUtils . indexOfDifference ( new String [ ] { " abc " } ) = - 1
* StringUtils . indexOfDifference ( new String [ ] { null , null } ) = - 1
* StringUtils . indexOfDifference ( new String [ ] { " " , " " } ) = - 1
* StringUtils . indexOfDifference ( new String [ ] { " " , null } ) = 0
* StringUtils . indexOfDifference ( new String [ ] { " abc " , null , null } ) = 0
* StringUtils . indexOfDifference ( new String [ ] { null , null , " abc " } ) = 0
* StringUtils . indexOfDifference ( new String [ ] { " " , " abc " } ) = 0
* StringUtils . indexOfDifference ( new String [ ] { " abc " , " " } ) = 0
* StringUtils . indexOfDifference ( new String [ ] { " abc " , " abc " } ) = - 1
* StringUtils . indexOfDifference ( new String [ ] { " abc " , " a " } ) = 1
* StringUtils . indexOfDifference ( new String [ ] { " ab " , " abxyz " } ) = 2
* StringUtils . indexOfDifference ( new String [ ] { " abcde " , " abxyz " } ) = 2
* StringUtils . indexOfDifference ( new String [ ] { " abcde " , " xyz " } ) = 0
* StringUtils . indexOfDifference ( new String [ ] { " xyz " , " abcde " } ) = 0
* StringUtils . indexOfDifference ( new String [ ] { " i am a machine " , " i am a robot " } ) = 7
* < / pre >
* @ param css array of CharSequences , entries may be null
* @ return the index where the strings begin to differ ; - 1 if they are all equal
* @ since 2.4
* @ since 3.0 Changed signature from indexOfDifference ( String . . . ) to indexOfDifference ( CharSequence . . . ) */
public static int indexOfDifference ( final CharSequence ... css ) { } } | if ( css == null || css . length <= 1 ) { return INDEX_NOT_FOUND ; } boolean anyStringNull = false ; boolean allStringsNull = true ; final int arrayLen = css . length ; int shortestStrLen = Integer . MAX_VALUE ; int longestStrLen = 0 ; // find the min and max string lengths ; this avoids checking to make
// sure we are not exceeding the length of the string each time through
// the bottom loop .
for ( final CharSequence cs : css ) { if ( cs == null ) { anyStringNull = true ; shortestStrLen = 0 ; } else { allStringsNull = false ; shortestStrLen = Math . min ( cs . length ( ) , shortestStrLen ) ; longestStrLen = Math . max ( cs . length ( ) , longestStrLen ) ; } } // handle lists containing all nulls or all empty strings
if ( allStringsNull || longestStrLen == 0 && ! anyStringNull ) { return INDEX_NOT_FOUND ; } // handle lists containing some nulls or some empty strings
if ( shortestStrLen == 0 ) { return 0 ; } // find the position with the first difference across all strings
int firstDiff = - 1 ; for ( int stringPos = 0 ; stringPos < shortestStrLen ; stringPos ++ ) { final char comparisonChar = css [ 0 ] . charAt ( stringPos ) ; for ( int arrayPos = 1 ; arrayPos < arrayLen ; arrayPos ++ ) { if ( css [ arrayPos ] . charAt ( stringPos ) != comparisonChar ) { firstDiff = stringPos ; break ; } } if ( firstDiff != - 1 ) { break ; } } if ( firstDiff == - 1 && shortestStrLen != longestStrLen ) { // we compared all of the characters up to the length of the
// shortest string and didn ' t find a match , but the string lengths
// vary , so return the length of the shortest string .
return shortestStrLen ; } return firstDiff ; |
public class ContextTreeRenderer { /** * Renders bundle if allowed .
* @ param config tree config
* @ param root current node
* @ param scope current scope
* @ param bundle bundle class */
private void renderBundle ( final ContextTreeConfig config , final TreeNode root , final Class < ? > scope , final Class < Object > bundle ) { } } | final BundleItemInfo info = service . getData ( ) . getInfo ( bundle ) ; if ( isHidden ( config , info , scope ) ) { return ; } final List < String > markers = Lists . newArrayList ( ) ; fillCommonMarkers ( info , markers , scope ) ; final TreeNode node = new TreeNode ( RenderUtils . renderClassLine ( bundle , markers ) ) ; // avoid duplicate bundle content render
if ( ! isDuplicateRegistration ( info , scope ) ) { renderScopeContent ( config , node , bundle ) ; } // avoid showing empty bundle line if configured to hide ( but show if bundle is ignored as duplicate )
if ( node . hasChildren ( ) || ! config . isHideEmptyBundles ( ) || ( ! config . isHideDisables ( ) && markers . contains ( IGNORED ) ) ) { root . child ( node ) ; } |
public class DRL5Lexer { /** * $ ANTLR start " NULL " */
public final void mNULL ( ) throws RecognitionException { } } | try { int _type = NULL ; int _channel = DEFAULT_TOKEN_CHANNEL ; // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 149:6 : ( ' null ' )
// src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 149:8 : ' null '
{ match ( "null" ) ; if ( state . failed ) return ; } state . type = _type ; state . channel = _channel ; } finally { // do for sure before leaving
} |
public class PauseArgs { /** * Build argument sequence and populate { @ code args } .
* @ param args the target command args , must not be { @ literal null } */
public < K , V > void build ( CommandArgs < K , V > args ) { } } | // PAUSE < queue - name > [ option option . . . option ]
if ( bcast != null ) { args . add ( CommandKeyword . BCAST . getBytes ( ) ) ; } if ( state != null ) { args . add ( CommandKeyword . STATE . getBytes ( ) ) ; } if ( option != null ) { args . add ( option ) ; } |
public class PortComponentType { /** * { @ inheritDoc } */
@ Override public QName getWSDLPort ( ) { } } | if ( wsdl_port != null ) { return new QName ( wsdl_port . getNamespaceURI ( ) , wsdl_port . getLocalPart ( ) ) ; } else return null ; |
public class LdapConnection { /** * Searches in the named context or object for entries that satisfy the given search filter
* and match the given entity types . Performs the search as specified by the search controls .
* < p / > Will first query the search cache . If there is a cache miss , the search will be
* sent to the LDAP server .
* @ param name The name of the context or object to search
* @ param filterExpr the filter expression to use for the search . The expression may contain
* variables of the form " { i } " where i is a nonnegative integer . May not be null .
* @ param filterArgs the array of arguments to substitute for the variables in filterExpr . The
* value of filterArgs [ i ] will replace each occurrence of " { i } " . If null , equivalent
* to an empty array .
* @ param scope The search scope . One of : { @ link SearchControls # OBJECT _ SCOPE } ,
* { @ link SearchControls # ONELEVEL _ SCOPE } , { @ link SearchControls # SUBTREE _ SCOPE } .
* @ param inEntityTypes The entity types to return .
* @ param propNames The property names to return for the entities .
* @ param getMbrshipAttr Whether to request the configured membership attribute to be returned .
* @ param getMbrAttr Whether to request the configured member attribute to be returned .
* @ return The { @ link LdapEntry } s that match the search criteria .
* @ throws WIMException If the search failed with an error . */
public Set < LdapEntry > searchEntities ( String name , String filterExpr , Object [ ] filterArgs , int scope , List < String > inEntityTypes , List < String > propNames , boolean getMbrshipAttr , boolean getMbrAttr ) throws WIMException { } } | return searchEntities ( name , filterExpr , filterArgs , scope , inEntityTypes , propNames , getMbrshipAttr , getMbrAttr , iCountLimit , iTimeLimit ) ; |
public class ChannelFrameworkImpl { /** * Set the default chain quiesce timeout property from config .
* @ param value */
public void setDefaultChainQuiesceTimeout ( Object value ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Setting default chain quiesce timeout [" + value + "]" ) ; } try { long num = MetatypeUtils . parseLong ( PROPERTY_CONFIG_ALIAS , PROPERTY_CHAIN_QUIESCETIMEOUT , value , chainQuiesceTimeout ) ; if ( 0 < num ) { this . chainQuiesceTimeout = num ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Timeout is too low" ) ; } } } catch ( NumberFormatException nfe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Timeout is not a number" ) ; } } |
public class HeatMap { /** * generates a bunch of random data
* @ param view
* @ return */
private List < IGeoPoint > loadPoints ( BoundingBox view ) { } } | List < IGeoPoint > pts = new ArrayList < IGeoPoint > ( ) ; for ( int i = 0 ; i < 10000 ; i ++ ) { pts . add ( new GeoPoint ( ( Math . random ( ) * view . getLatitudeSpan ( ) ) + view . getLatSouth ( ) , ( Math . random ( ) * view . getLongitudeSpan ( ) ) + view . getLonWest ( ) ) ) ; } pts . add ( new GeoPoint ( 0d , 0d ) ) ; pts . add ( new GeoPoint ( 0d , 0d ) ) ; pts . add ( new GeoPoint ( 0d , 0d ) ) ; pts . add ( new GeoPoint ( 0d , 0d ) ) ; pts . add ( new GeoPoint ( 0d , 0d ) ) ; pts . add ( new GeoPoint ( 0d , 0d ) ) ; pts . add ( new GeoPoint ( 0d , 0d ) ) ; pts . add ( new GeoPoint ( 0d , 0d ) ) ; pts . add ( new GeoPoint ( 0d , 0d ) ) ; pts . add ( new GeoPoint ( 0d , 0d ) ) ; pts . add ( new GeoPoint ( 0d , 0d ) ) ; pts . add ( new GeoPoint ( 0d , 0d ) ) ; pts . add ( new GeoPoint ( 0d , 0d ) ) ; pts . add ( new GeoPoint ( 0d , 0d ) ) ; pts . add ( new GeoPoint ( 1.1d * cellSizeInDp , 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( 1.1d * cellSizeInDp , 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( 1.1d * cellSizeInDp , 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( 1.1d * cellSizeInDp , 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( 1.1d * cellSizeInDp , 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( 1.1d * cellSizeInDp , 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( 1.1d * cellSizeInDp , 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( - 1.1d * cellSizeInDp , - 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( - 1.1d * cellSizeInDp , - 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( - 1.1d * cellSizeInDp , - 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( - 1.1d * cellSizeInDp , - 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( - 1.1d * cellSizeInDp , - 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( - 1.1d * cellSizeInDp , - 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( - 1.1d * cellSizeInDp , - 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( - 1.1d * cellSizeInDp , 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( - 1.1d * cellSizeInDp , 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( - 1.1d * cellSizeInDp , 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( - 1.1d * cellSizeInDp , 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( 1.1d * cellSizeInDp , - 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( 1.1d * cellSizeInDp , - 1.1d * cellSizeInDp ) ) ; pts . add ( new GeoPoint ( 1.1d * cellSizeInDp , - 1.1d * cellSizeInDp ) ) ; return pts ; |
public class Frame { /** * Get a value on the operand stack .
* @ param loc
* the stack location , counting downwards from the top ( location */
public ValueType getStackValue ( int loc ) throws DataflowAnalysisException { } } | if ( ! isValid ( ) ) { throw new DataflowAnalysisException ( "Accessing TOP or BOTTOM frame!" ) ; } int stackDepth = getStackDepth ( ) ; if ( loc >= stackDepth ) { throw new DataflowAnalysisException ( "not enough values on stack: access=" + loc + ", avail=" + stackDepth ) ; } if ( loc < 0 ) { throw new DataflowAnalysisException ( "can't get position " + loc + " of stack" ) ; } int pos = slotList . size ( ) - ( loc + 1 ) ; return slotList . get ( pos ) ; |
public class LObjIntFltPredicateBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */
@ Nonnull public static < T > LObjIntFltPredicate < T > objIntFltPredicateFrom ( Consumer < LObjIntFltPredicateBuilder < T > > buildingFunction ) { } } | LObjIntFltPredicateBuilder builder = new LObjIntFltPredicateBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class MyfacesLogger { /** * Returns message string in default locale */
public MyfacesLogMessage getMyfacesMessage ( MyfacesLogKey key ) { } } | MyfacesLogMessage facesMessage = new MyfacesLogMessage ( ) ; try { String name = key . name ( ) ; String summary = _log . getResourceBundle ( ) . getString ( name ) ; facesMessage . setSummary ( summary ) ; try { String detail = _log . getResourceBundle ( ) . getString ( name + "_detail" ) ; facesMessage . setDetail ( detail ) ; } catch ( MissingResourceException e ) { facesMessage . setDetail ( name ) ; } try { String related = _log . getResourceBundle ( ) . getString ( name + "_related" ) ; facesMessage . setRelated ( related ) ; } catch ( MissingResourceException e ) { // / ignore
} return facesMessage ; } catch ( MissingResourceException mre ) { facesMessage . setSummary ( key . name ( ) ) ; return facesMessage ; } |
public class JobConfig { /** * Resets all adjustments in the config . */
public static void reset ( ) { } } | for ( JobApi api : JobApi . values ( ) ) { ENABLED_APIS . put ( api , Boolean . TRUE ) ; } allowSmallerIntervals = false ; forceAllowApi14 = false ; jobReschedulePause = DEFAULT_JOB_RESCHEDULE_PAUSE ; skipJobReschedule = false ; jobIdOffset = 0 ; forceRtc = false ; clock = Clock . DEFAULT ; executorService = DEFAULT_EXECUTOR_SERVICE ; closeDatabase = false ; JobCat . setLogcatEnabled ( true ) ; JobCat . clearLogger ( ) ; |
public class DynamicCacheHelper { /** * / * ( non - Javadoc )
* @ see org . danann . cernunnos . cache . CacheHelper # getCachedObject ( org . danann . cernunnos . TaskRequest , org . danann . cernunnos . TaskResponse , java . lang . Object , org . danann . cernunnos . cache . CacheHelper . Factory ) */
public V getCachedObject ( TaskRequest req , TaskResponse res , K key , Factory < K , V > factory ) { } } | final CacheMode cacheMode = CacheMode . valueOf ( ( String ) this . cacheModelPhrase . evaluate ( req , res ) ) ; if ( this . logger . isDebugEnabled ( ) ) { this . logger . debug ( "Getting cached object for '" + key + "' using cache mode " + cacheMode + " and factory " + factory ) ; } // Load the cache only if cache - all is enabled
final ConcurrentMap < Tuple < Serializable , K > , Object > cache ; final Tuple < Serializable , K > compoundCacheKey ; switch ( cacheMode ) { case NONE : { return factory . createObject ( key ) ; } default : case ONE : { cache = null ; compoundCacheKey = null ; } break ; case ALL : { cache = ( ConcurrentMap < Tuple < Serializable , K > , Object > ) this . cachePhrase . evaluate ( req , res ) ; final Serializable cacheNamespace = factory . getCacheNamespace ( key ) ; compoundCacheKey = new Tuple < Serializable , K > ( cacheNamespace , key ) ; } break ; } // Determine the object to synchronize around
final Object syncTarget = factory . getMutex ( key ) ; // get or create & cache the target object
V instance = null ; synchronized ( syncTarget ) { // Get the object from the local variables if no cache is available
if ( cache == null ) { // Try for a thread - local instance first
if ( this . compareKeys ( key , this . threadKeyHolder . get ( ) ) ) { instance = this . threadInstanceHolder . get ( ) ; } // Next try for a singleton instance
else if ( this . compareKeys ( key , this . key ) ) { instance = this . instance ; } } // Look in the passed cache for the instance
else { final Object object = cache . get ( compoundCacheKey ) ; // If the cached object is a ThreadLocal use it for the instance
if ( object instanceof ThreadLocal < ? > ) { instance = ( ( ThreadLocal < V > ) object ) . get ( ) ; } // If not assume it is the instance
else { instance = ( V ) object ; } } // If no instance was found create and cache one
if ( instance == null ) { instance = factory . createObject ( key ) ; final boolean threadSafe = factory . isThreadSafe ( key , instance ) ; if ( this . logger . isDebugEnabled ( ) ) { this . logger . debug ( "Cache miss for '" + key + "' created '" + instance + "' threadSafe=" + threadSafe ) ; } // If no cache is available store the instance in the local variables
if ( cache == null ) { if ( threadSafe ) { this . instance = instance ; this . key = key ; } else { this . threadInstanceHolder . set ( instance ) ; this . threadKeyHolder . set ( key ) ; } } // Cache available store there
else { if ( threadSafe ) { cache . put ( compoundCacheKey , instance ) ; } else { ThreadLocal < V > threadInstanceHolder = ( ThreadLocal < V > ) cache . get ( compoundCacheKey ) ; if ( threadInstanceHolder == null ) { threadInstanceHolder = new ThreadLocal < V > ( ) ; while ( true ) { Object existing = cache . putIfAbsent ( compoundCacheKey , threadInstanceHolder ) ; if ( existing == null ) { // nothing existed for that key , put was successful
break ; } if ( existing instanceof ThreadLocal ) { // Existing ThreadLocal , just use it
threadInstanceHolder = ( ThreadLocal ) existing ; break ; } // something other than a ThreadLocal already exists , try replacing with the ThreadLocal
final boolean replaced = cache . replace ( compoundCacheKey , threadInstanceHolder , existing ) ; if ( replaced ) { // Replace worked !
break ; } // Replace didn ' t work , try the whole process again , yay non - blocking !
} if ( cache instanceof EvictionAwareCache ) { ( ( EvictionAwareCache ) cache ) . registerCacheEvictionListener ( ThreadLocalCacheEvictionListener . INSTANCE ) ; } } threadInstanceHolder . set ( instance ) ; } } } else if ( this . logger . isDebugEnabled ( ) ) { this . logger . debug ( "Cache hit for '" + key + "' using '" + instance + "'" ) ; } } return instance ; |
public class Evaluation { /** * Collects statistics on the real outcomes vs the
* guesses . This is for logistic outcome matrices .
* Note that an IllegalArgumentException is thrown if the two passed in
* matrices aren ' t the same length .
* @ param realOutcomes the real outcomes ( labels - usually binary )
* @ param guesses the guesses / prediction ( usually a probability vector ) */
public void eval ( INDArray realOutcomes , INDArray guesses ) { } } | eval ( realOutcomes , guesses , ( List < Serializable > ) null ) ; |
public class Nfs3 { /** * / * ( non - Javadoc )
* @ see com . emc . ecs . nfsclient . nfs . Nfs # wrapped _ sendCommit ( com . emc . ecs . nfsclient . nfs . NfsCommitRequest ) */
public Nfs3CommitResponse wrapped_sendCommit ( NfsCommitRequest request ) throws IOException { } } | NfsResponseHandler < Nfs3CommitResponse > responseHandler = new NfsResponseHandler < Nfs3CommitResponse > ( ) { /* ( non - Javadoc )
* @ see com . emc . ecs . nfsclient . rpc . RpcResponseHandler # makeNewResponse ( ) */
protected Nfs3CommitResponse makeNewResponse ( ) { return new Nfs3CommitResponse ( ) ; } } ; _rpcWrapper . callRpcWrapped ( request , responseHandler , _server ) ; return responseHandler . getResponse ( ) ; |
public class StringIterate { /** * Find the first element that returns true for the specified { @ code predicate } .
* @ deprecated since 7.0 . Use { @ link # detectChar ( String , CharPredicate ) } instead . */
@ Deprecated public static Character detect ( String string , CharPredicate predicate ) { } } | return StringIterate . detectChar ( string , predicate ) ; |
public class ModifyBeanHelper { /** * Generate where condition .
* @ param methodBuilder
* the method builder
* @ param method
* the method
* @ param analyzer
* the analyzer */
public void generateWhereCondition ( MethodSpec . Builder methodBuilder , SQLiteModelMethod method , SqlAnalyzer analyzer ) { } } | SQLiteEntity entity = method . getEntity ( ) ; String beanParamName = method . getParameters ( ) . get ( 0 ) . value0 ; SQLProperty property ; boolean nullable ; TypeName beanClass = typeName ( entity . getElement ( ) ) ; // methodBuilder . addStatement ( " $ T < String >
// _ sqlWhereParams = getWhereParamsArray ( ) " , ArrayList . class ) ;
for ( String item : analyzer . getUsedBeanPropertyNames ( ) ) { property = entity . findPropertyByName ( item ) ; // methodBuilder . addCode ( " _ sqlWhereParams . add ( " ) ;
methodBuilder . addCode ( "_contentValues.addWhereArgs(" ) ; nullable = TypeUtility . isNullable ( property ) ; if ( nullable && ! ( property . hasTypeAdapter ( ) ) ) { // transform null in " "
methodBuilder . addCode ( "($L==null?\"\":" , getter ( beanParamName , beanClass , property ) ) ; } // check for string conversion
TypeUtility . beginStringConversion ( methodBuilder , property ) ; SQLTransformer . javaProperty2WhereCondition ( methodBuilder , method , beanParamName , beanClass , property ) ; // check for string conversion
TypeUtility . endStringConversion ( methodBuilder , property ) ; if ( nullable && ! ( property . hasTypeAdapter ( ) ) ) { methodBuilder . addCode ( ")" ) ; } methodBuilder . addCode ( ");\n" ) ; } |
public class QueryParameterAnnotationHandler { /** * Process an object to generate a query string .
* < ul >
* < li > only { @ link QueryParameter } annotated fields are used < / li >
* < li > null or empty values are ignored < / li >
* < / ul >
* @ param o
* the object to scan for { @ link QueryParameter } annotations
* @ return the generated query string
* @ throws UnsupportedEncodingException */
static String process ( final Object o ) { } } | final StringBuilder s = new StringBuilder ( ) ; for ( final Field f : o . getClass ( ) . getDeclaredFields ( ) ) { final QueryParameter paramMetadata = f . getAnnotation ( QueryParameter . class ) ; final Object fieldValue = getValue ( o , f ) ; // each field having the QueryParameter annotation is processed
if ( null != fieldValue && null != paramMetadata ) { final String paramFormat = paramMetadata . value ( ) ; String paramValue = serialize ( paramMetadata , fieldValue , f . getName ( ) ) ; if ( null != paramValue && ! "" . equals ( paramValue . trim ( ) ) ) { if ( s . length ( ) > 0 ) { s . append ( '&' ) ; } if ( paramMetadata . encode ( ) ) { paramValue = uriEncode ( paramValue ) ; } s . append ( String . format ( Locale . US , paramFormat , paramValue ) ) ; } } } return s . toString ( ) ; |
public class LWJGFont { /** * Draws the paragraph given by the specified string , using this font instance ' s current color . < br >
* if the specified string protrudes from paragraphWidth , protruded substring is auto wrapped with the specified align . < br >
* Note that the specified destination coordinates is a left point of the rendered string ' s baseline .
* @ param text the string to be drawn .
* @ param dstX the x coordinate to render the string .
* @ param dstY the y coordinate to render the string .
* @ param dstZ the z coordinate to render the string .
* @ param paragraphWidth the max width to draw the paragraph .
* @ param align the horizontal align to render the string .
* @ throws IOException Indicates a failure to read font images as textures . */
public final void drawParagraph ( String text , float dstX , float dstY , float dstZ , float paragraphWidth , ALIGN align ) throws IOException { } } | DrawPoint drawPoint = new DrawPoint ( dstX , dstY , dstZ ) ; DrawPoint tmpDrawPoint ; MappedCharacter character ; String line = "" ; float lineWidth = 0 ; if ( ! LwjgFontUtil . isEmpty ( text ) ) { for ( int i = 0 ; i < text . length ( ) ; i ++ ) { char ch = text . charAt ( i ) ; if ( ch == LineFeed . getCharacter ( ) ) { // LF は改行扱いにする
// drawPoint . dstX = dstX ;
// drawPoint . dstY - = getLineHeight ( ) ;
// ここまでの文字を表示する
tmpDrawPoint = align . calcDrawPoint ( paragraphWidth , lineWidth , drawPoint ) ; drawString ( line , tmpDrawPoint . dstX , tmpDrawPoint . dstY , tmpDrawPoint . dstZ ) ; line = "" ; lineWidth = 0 ; drawPoint . dstY -= getLineHeight ( ) ; continue ; } else if ( ch == CarriageReturn . getCharacter ( ) ) { // CR は無視する
continue ; } character = retreiveCharacter ( ch ) ; // floatcurrentWidth = drawPoint . dstX - dstX ;
if ( paragraphWidth < lineWidth + character . getAdvance ( ) ) { // paragraphWidth を超える場合はで折り返す
// drawPoint . dstX = dstX ;
// ここまでの文字を表示する
tmpDrawPoint = align . calcDrawPoint ( paragraphWidth , lineWidth , drawPoint ) ; drawString ( line , tmpDrawPoint . dstX , tmpDrawPoint . dstY , tmpDrawPoint . dstZ ) ; line = "" ; lineWidth = 0 ; drawPoint . dstY -= getLineHeight ( ) ; } line += String . valueOf ( ch ) ; lineWidth += character . getAdvance ( ) ; } // 残った文字を表示する
if ( ! LwjgFontUtil . isEmpty ( line ) ) { tmpDrawPoint = align . calcDrawPoint ( paragraphWidth , lineWidth , drawPoint ) ; drawString ( line , tmpDrawPoint . dstX , tmpDrawPoint . dstY , tmpDrawPoint . dstZ ) ; } } |
public class MenuEntry { /** * returns all additional js from this to upper menu item hierarchy beginning with the root .
* @ return
* @ since 1.1.4 */
public Map < String , Boolean > getAdditionalJSReverse ( ) { } } | Map < String , Boolean > result = new LinkedHashMap < > ( ) ; List < MenuEntry > parents = reverseFlattened ( ) . collect ( AdminToolMenuUtils . toListReversed ( ) ) ; parents . forEach ( menuEntry -> { if ( null != menuEntry . getAdditionalJS ( ) ) { result . putAll ( menuEntry . getAdditionalJS ( ) ) ; } } ) ; return result ; |
public class AbstractBaseDestinationHandler { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . impl . interfaces . DestinationHandler # isReceiveExclusive ( ) */
public boolean isReceiveExclusive ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "isReceiveExclusive" ) ; boolean isReceiveExclusive = definition . isReceiveExclusive ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "isReceiveExclusive" , Boolean . valueOf ( isReceiveExclusive ) ) ; return isReceiveExclusive ; |
public class InternalXtextParser { /** * InternalXtext . g : 1644:1 : entryRuleNamedArgument returns [ EObject current = null ] : iv _ ruleNamedArgument = ruleNamedArgument EOF ; */
public final EObject entryRuleNamedArgument ( ) throws RecognitionException { } } | EObject current = null ; EObject iv_ruleNamedArgument = null ; try { // InternalXtext . g : 1644:54 : ( iv _ ruleNamedArgument = ruleNamedArgument EOF )
// InternalXtext . g : 1645:2 : iv _ ruleNamedArgument = ruleNamedArgument EOF
{ newCompositeNode ( grammarAccess . getNamedArgumentRule ( ) ) ; pushFollow ( FollowSets000 . FOLLOW_1 ) ; iv_ruleNamedArgument = ruleNamedArgument ( ) ; state . _fsp -- ; current = iv_ruleNamedArgument ; match ( input , EOF , FollowSets000 . FOLLOW_2 ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class VpnConnectionsInner { /** * Retrieves the details of a vpn connection .
* @ param resourceGroupName The resource group name of the VpnGateway .
* @ param gatewayName The name of the gateway .
* @ param connectionName The name of the vpn connection .
* @ 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 < VpnConnectionInner > getAsync ( String resourceGroupName , String gatewayName , String connectionName , final ServiceCallback < VpnConnectionInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( getWithServiceResponseAsync ( resourceGroupName , gatewayName , connectionName ) , serviceCallback ) ; |
public class XLogging { /** * Logs a message .
* @ param message Log message .
* @ param importance Message importance . */
public static void log ( String message , Importance importance ) { } } | if ( listener != null ) { listener . log ( message , importance ) ; } |
public class ExtensionScopeHelper { /** * Check the type of the first parameter against the argument type rather
* than the { @ link # rawArgumentType } . Should not be used during linking
* since we need proper error messages there for type mismatches . */
protected boolean isMatchingFirstParameterDeepCheck ( JvmOperation feature ) { } } | if ( isMatchingFirstParameter ( feature ) ) { if ( isResolvedReceiverType ( ) ) { LightweightTypeReference parameterType = argumentType . getOwner ( ) . toLightweightTypeReference ( feature . getParameters ( ) . get ( 0 ) . getParameterType ( ) ) ; if ( isResolvedOrKnownTypeParam ( parameterType ) && ! parameterType . isAssignableFrom ( argumentType ) ) { return false ; } } return true ; } return false ; |
public class CombinedStringDistanceLearner { /** * Prepare data for the sublearners . */
public StringWrapperIterator prepare ( StringWrapperIterator it ) { } } | List multiWrappers = asMultiStringWrapperList ( it ) ; if ( multiWrappers . size ( ) == 0 ) return new BasicStringWrapperIterator ( Collections . EMPTY_SET . iterator ( ) ) ; MultiStringWrapper prototype = ( MultiStringWrapper ) multiWrappers . get ( 0 ) ; for ( int i = 0 ; i < prototype . size ( ) ; i ++ ) { int j = prototype . getDistanceLearnerIndex ( i ) ; StringDistanceLearner learner = innerLearners [ j ] ; StringWrapperIterator prepped = learner . prepare ( new JthStringWrapperValueIterator ( j , multiWrappers . iterator ( ) ) ) ; for ( int k = 0 ; k < multiWrappers . size ( ) ; k ++ ) { MultiStringWrapper msw = ( MultiStringWrapper ) multiWrappers . get ( k ) ; StringWrapper w = prepped . nextStringWrapper ( ) ; msw . set ( i , w ) ; } } return new BasicStringWrapperIterator ( multiWrappers . iterator ( ) ) ; |
public class RouteCache { /** * Returns a { @ link Router } which is wrapped with a { @ link Cache } layer in order to improve the
* performance of the { @ link CompositeServiceEntry } search . */
static < I extends Request , O extends Response > Router < CompositeServiceEntry < I , O > > wrapCompositeServiceRouter ( Router < CompositeServiceEntry < I , O > > delegate ) { } } | final Cache < PathMappingContext , CompositeServiceEntry < I , O > > cache = Flags . compositeServiceCacheSpec ( ) . map ( RouteCache :: < CompositeServiceEntry < I , O > > buildCache ) . orElse ( null ) ; if ( cache == null ) { return delegate ; } return new CachingRouter < > ( delegate , cache , CompositeServiceEntry :: pathMapping ) ; |
public class PippoSettings { /** * Returns a list of strings from the specified name using the specified delimiter .
* @ param name
* @ param delimiter
* @ return list of strings */
public List < String > getStrings ( String name , String delimiter ) { } } | String value = getString ( name , null ) ; if ( StringUtils . isNullOrEmpty ( value ) ) { return Collections . emptyList ( ) ; } value = value . trim ( ) ; // to handles cases where value is specified like [ a , b , c ]
if ( value . startsWith ( "[" ) && value . endsWith ( "]" ) ) { value = value . substring ( 1 , value . length ( ) - 1 ) ; } return StringUtils . getList ( value , delimiter ) ; |
public class WorkflowTemplateServiceClient { /** * Retrieves the latest workflow template .
* < p > Can retrieve previously instantiated template by specifying optional version parameter .
* < p > Sample code :
* < pre > < code >
* try ( WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient . create ( ) ) {
* WorkflowTemplateName name = WorkflowTemplateName . of ( " [ PROJECT ] " , " [ REGION ] " , " [ WORKFLOW _ TEMPLATE ] " ) ;
* WorkflowTemplate response = workflowTemplateServiceClient . getWorkflowTemplate ( name . toString ( ) ) ;
* < / code > < / pre >
* @ param name Required . The " resource name " of the workflow template , as described in
* https : / / cloud . google . com / apis / design / resource _ names of the form
* ` projects / { project _ id } / regions / { region } / workflowTemplates / { template _ id } `
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final WorkflowTemplate getWorkflowTemplate ( String name ) { } } | GetWorkflowTemplateRequest request = GetWorkflowTemplateRequest . newBuilder ( ) . setName ( name ) . build ( ) ; return getWorkflowTemplate ( request ) ; |
public class AbstractIoAcceptor { /** * { @ inheritDoc } */
@ Override public final void unbind ( SocketAddress localAddress ) { } } | if ( localAddress == null ) { throw new NullPointerException ( "localAddress" ) ; } List < SocketAddress > localAddresses = new ArrayList < > ( 1 ) ; localAddresses . add ( localAddress ) ; unbind ( localAddresses ) ; |
public class ModelDef { /** * Get the properties that are pertaining to the model , this does not include linker columns
* @ return */
public String [ ] getPlainProperties ( ) { } } | String [ ] commonColumns = { "created" , "createdby" , "updated" , "updatedby" , "isactive" } ; String [ ] referencedProperties = getReferencedColumns ( ) ; List < String > plainProperties = new ArrayList < String > ( ) ; for ( String att : attributes ) { if ( CStringUtils . indexOf ( referencedProperties , att ) >= 0 ) { // do not include referenced columns
} else if ( att . endsWith ( "_id" ) ) { ; // do not include implied columns
} else if ( CStringUtils . indexOf ( commonColumns , att ) >= 0 ) { ; // do not include common columns
} else { plainProperties . add ( att ) ; } } return plainProperties . toArray ( new String [ plainProperties . size ( ) ] ) ; |
public class CmsAddCategoriesPostCreateHandler { /** * Adds the categories specified via < code > config < / code > to the newly created resource iff not in copy mode .
* @ param cms the current user ' s CMS context
* @ param createdResource the resource which has been created
* @ param copyMode < code > true < / code > if the user chose one of the elements in the collector list as a model
* @ param config a comma separted list of category , site or root paths that specify the categories to be added to the created resource
* if < code > copyMode < / code > is < code > false < / code > .
* @ see org . opencms . file . collectors . I _ CmsCollectorPostCreateHandler # onCreate ( org . opencms . file . CmsObject , org . opencms . file . CmsResource , boolean , java . lang . String ) */
public void onCreate ( CmsObject cms , CmsResource createdResource , boolean copyMode , String config ) { } } | if ( ( null != config ) && ! copyMode ) { List < String > cats = Arrays . asList ( config . split ( "," ) ) ; CmsCategoryService catService = CmsCategoryService . getInstance ( ) ; try { try ( AutoCloseable c = CmsLockUtil . withLockedResources ( cms , createdResource ) ) { String sitePath = cms . getRequestContext ( ) . getSitePath ( createdResource ) ; for ( String catPath : cats ) { if ( ! catPath . isEmpty ( ) ) { try { CmsCategory cat ; if ( catPath . startsWith ( "/" ) ) { // assume we have a site or rootpath
cat = catService . getCategory ( cms , catPath ) ; } else { // assume we have the category path
cat = catService . readCategory ( cms , catPath , sitePath ) ; } if ( null != cat ) { catService . addResourceToCategory ( cms , sitePath , cat ) ; } } catch ( CmsException e ) { // TODO Auto - generated catch block
e . printStackTrace ( ) ; } } } } } catch ( Exception e1 ) { // TODO Auto - generated catch block
e1 . printStackTrace ( ) ; } } |
public class DefaultRequestLogEvent { /** * Override { @ link JsonValue } serialization , instead use annotations to include type information for polymorphic
* { @ link Query } objects . */
@ JsonValue ( value = false ) @ Override public Map < String , Object > toMap ( ) { } } | return ImmutableMap . of ( ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.