signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class TimeNode { /** * Obtain value from list considering specified index and required shifts .
* @ param values - possible values
* @ param index - index to be considered
* @ param shift - shifts that should be applied
* @ return int - required value from values list */
@ VisibleForTesting int getValueFromList ( final List < Integer > values , int index , final AtomicInteger shift ) { } } | Preconditions . checkNotNullNorEmpty ( values , "List must not be empty" ) ; if ( index < 0 ) { index = index + values . size ( ) ; shift . incrementAndGet ( ) ; return getValueFromList ( values , index , shift ) ; } if ( index >= values . size ( ) ) { index = index - values . size ( ) ; shift . incrementAndGet ( ) ; return getValueFromList ( values , index , shift ) ; } return values . get ( index ) ; |
public class AstUtil { /** * Parses a string for caller id information . < br >
* The caller id string should be in the form
* < code > " Some Name " & lt ; 1234 & gt ; < / code > . < br >
* This resembles < code > ast _ callerid _ parse < / code > in < code > callerid . c < / code >
* but strips any whitespace .
* @ param s the string to parse
* @ return a String [ ] with name ( index 0 ) and number ( index 1) */
public static String [ ] parseCallerId ( String s ) { } } | final String [ ] result = new String [ 2 ] ; final int lbPosition ; final int rbPosition ; String name ; String number ; if ( s == null ) { return result ; } lbPosition = s . lastIndexOf ( '<' ) ; rbPosition = s . lastIndexOf ( '>' ) ; // no opening and closing brace ? use value as CallerId name
if ( lbPosition < 0 || rbPosition < 0 ) { name = s . trim ( ) ; if ( name . length ( ) == 0 ) { name = null ; } result [ 0 ] = name ; return result ; } number = s . substring ( lbPosition + 1 , rbPosition ) . trim ( ) ; if ( number . length ( ) == 0 ) { number = null ; } name = s . substring ( 0 , lbPosition ) . trim ( ) ; if ( name . startsWith ( "\"" ) && name . endsWith ( "\"" ) && name . length ( ) > 1 ) { name = name . substring ( 1 , name . length ( ) - 1 ) . trim ( ) ; } if ( name . length ( ) == 0 ) { name = null ; } result [ 0 ] = name ; result [ 1 ] = number ; return result ; |
public class CommerceSubscriptionEntryPersistenceImpl { /** * Returns the first commerce subscription entry in the ordered set where subscriptionStatus = & # 63 ; .
* @ param subscriptionStatus the subscription status
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce subscription entry
* @ throws NoSuchSubscriptionEntryException if a matching commerce subscription entry could not be found */
@ Override public CommerceSubscriptionEntry findBySubscriptionStatus_First ( int subscriptionStatus , OrderByComparator < CommerceSubscriptionEntry > orderByComparator ) throws NoSuchSubscriptionEntryException { } } | CommerceSubscriptionEntry commerceSubscriptionEntry = fetchBySubscriptionStatus_First ( subscriptionStatus , orderByComparator ) ; if ( commerceSubscriptionEntry != null ) { return commerceSubscriptionEntry ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "subscriptionStatus=" ) ; msg . append ( subscriptionStatus ) ; msg . append ( "}" ) ; throw new NoSuchSubscriptionEntryException ( msg . toString ( ) ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < }
* { @ link CmisExtensionType } { @ code > } */
@ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "extension" , scope = RemovePolicy . class ) public JAXBElement < CmisExtensionType > createRemovePolicyExtension ( CmisExtensionType value ) { } } | return new JAXBElement < CmisExtensionType > ( _GetPropertiesExtension_QNAME , CmisExtensionType . class , RemovePolicy . class , value ) ; |
public class BitapPattern { /** * Returns a BitapMatcher preforming a fuzzy search in a subsequence of { @ code sequence } . Search range starts from
* { @ code from } ( inclusive ) and ends at { @ code to } ( exclusive ) . Search allows no more than { @ code substitutions }
* number of substitutions . Matcher will return positions of first matched letter in the motif in ascending order .
* @ param substitutions maximal number of allowed substitutions
* @ param sequence target sequence
* @ param from left boundary of search range ( inclusive )
* @ param to right boundary of search range ( exclusive )
* @ return matcher which will return positions of first matched letter in the motif in ascending order */
public BitapMatcher substitutionOnlyMatcherFirst ( int substitutions , final Sequence sequence , int from , int to ) { } } | if ( sequence . getAlphabet ( ) . size ( ) != patternMask . length ) throw new IllegalArgumentException ( ) ; return new BitapMatcherImpl ( substitutions + 1 , from , to ) { @ Override public int findNext ( ) { long matchingMask = ( 1L << ( size - 1 ) ) ; int d ; long preMismatchTmp , mismatchTmp ; boolean match = false ; for ( int i = current ; i < to ; ++ i ) { long currentPatternMask = patternMask [ sequence . codeAt ( i ) ] ; // Exact match on the previous step = = match with insertion on current step
R [ 0 ] <<= 1 ; mismatchTmp = R [ 0 ] ; R [ 0 ] |= currentPatternMask ; if ( 0 == ( R [ 0 ] & matchingMask ) ) { errors = 0 ; match = true ; } for ( d = 1 ; d < R . length ; ++ d ) { R [ d ] <<= 1 ; preMismatchTmp = R [ d ] ; R [ d ] |= currentPatternMask ; R [ d ] &= mismatchTmp ; if ( ! match && 0 == ( R [ d ] & matchingMask ) && i >= size - 1 ) { errors = d ; match = true ; } mismatchTmp = preMismatchTmp ; } if ( match ) { current = i + 1 ; return i - size + 1 ; } } current = to ; return - 1 ; } } ; |
public class LottieDrawable { /** * Use this to manually set fonts . */
public void setFontAssetDelegate ( @ SuppressWarnings ( "NullableProblems" ) FontAssetDelegate assetDelegate ) { } } | this . fontAssetDelegate = assetDelegate ; if ( fontAssetManager != null ) { fontAssetManager . setDelegate ( assetDelegate ) ; } |
public class SemanticAPI { /** * 提交语音
* @ param accessToken 接口调用凭证
* @ param voiceId 语音唯一标识
* @ param lang 语言 , zh _ CN 或 en _ US , 默认中文
* @ param uri 文件格式 只支持mp3,16k , 单声道 , 最大1M
* @ return BaseResult
* @ since 2.8.22 */
public static BaseResult addvoicetorecofortext ( String accessToken , String voiceId , String lang , URI uri ) { } } | HttpPost httpPost = new HttpPost ( BASE_URI + "/cgi-bin/media/voice/addvoicetorecofortext" ) ; CloseableHttpClient tempHttpClient = HttpClients . createDefault ( ) ; try { HttpEntity entity = tempHttpClient . execute ( RequestBuilder . get ( ) . setUri ( uri ) . build ( ) ) . getEntity ( ) ; HttpEntity reqEntity = MultipartEntityBuilder . create ( ) . addBinaryBody ( "media" , EntityUtils . toByteArray ( entity ) , ContentType . get ( entity ) , "temp." + MediaType . voice_mp3 . fileSuffix ( ) ) . addTextBody ( PARAM_ACCESS_TOKEN , API . accessToken ( accessToken ) ) . addTextBody ( "format" , MediaType . voice_mp3 . fileSuffix ( ) ) . addTextBody ( "voice_id" , voiceId ) . addTextBody ( "lang" , lang == null || lang . isEmpty ( ) ? "zh_CN" : lang ) . build ( ) ; httpPost . setEntity ( reqEntity ) ; return LocalHttpClient . executeJsonResult ( httpPost , BaseResult . class ) ; } catch ( UnsupportedCharsetException | ParseException | IOException e ) { logger . error ( "" , e ) ; throw new RuntimeException ( e ) ; } finally { try { tempHttpClient . close ( ) ; } catch ( IOException e ) { logger . error ( "" , e ) ; } } |
public class Streams { /** * Append values to the take of this Stream
* < pre >
* { @ code
* List < String > result = of ( 1,2,3 ) . append ( 100,200,300)
* . map ( it - > it + " ! ! " )
* . collect ( CyclopsCollectors . toList ( ) ) ;
* assertThat ( result , equalTo ( Arrays . asList ( " 1 ! ! " , " 2 ! ! " , " 3 ! ! " , " 100 ! ! " , " 200 ! ! " , " 300 ! ! " ) ) ) ;
* < / pre >
* @ param values to append
* @ return Stream with appended values */
public static final < T > Stream < T > append ( final Stream < T > stream , final T ... values ) { } } | return appendStream ( stream , Stream . of ( values ) ) ; |
public class Pickler { /** * Pickle a single object and write its pickle representation to the output stream .
* Normally this is used internally by the pickler , but you can also utilize it from
* within custom picklers . This is handy if as part of the custom pickler , you need
* to write a couple of normal objects such as strings or ints , that are already
* supported by the pickler .
* This method can be called recursively to output sub - objects . */
public void save ( Object o ) throws PickleException , IOException { } } | recurse ++ ; if ( recurse > MAX_RECURSE_DEPTH ) throw new java . lang . StackOverflowError ( "recursion too deep in Pickler.save (>" + MAX_RECURSE_DEPTH + ")" ) ; // null type ?
if ( o == null ) { out . write ( Opcodes . NONE ) ; recurse -- ; return ; } // check the memo table , otherwise simply dispatch
Class < ? > t = o . getClass ( ) ; if ( lookupMemo ( t , o ) || dispatch ( t , o ) ) { recurse -- ; return ; } throw new PickleException ( "couldn't pickle object of type " + t ) ; |
public class PortletRenderResponseContextImpl { /** * / * ( non - Javadoc )
* @ see org . apache . pluto . container . PortletRenderResponseContext # setTitle ( java . lang . String ) */
@ Override public void setTitle ( String title ) { } } | this . checkContextStatus ( ) ; this . servletRequest . setAttribute ( IPortletRenderer . ATTRIBUTE__PORTLET_TITLE , title ) ; |
public class bridgetable { /** * Use this API to fetch all the bridgetable resources that are configured on netscaler . */
public static bridgetable [ ] get ( nitro_service service ) throws Exception { } } | bridgetable obj = new bridgetable ( ) ; bridgetable [ ] response = ( bridgetable [ ] ) obj . get_resources ( service ) ; return response ; |
public class ConnectionReadCompletedCallback { /** * begin F181603.2 */
protected void stopReceiving ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "stopReceiving" ) ; receivePhysicalCloseRequest = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "stopReceiving" , "" + receivePhysicalCloseRequest ) ; |
public class SharedCount { /** * Changes the shared count only if its value has not changed since the version specified by
* newCount . If the count has changed , the value is not set and this client ' s view of the
* value is updated . i . e . if the count is not successful you can get the updated value
* by calling { @ link # getCount ( ) } .
* @ param newCount the new value to attempt
* @ return true if the change attempt was successful , false if not . If the change
* was not successful , { @ link # getCount ( ) } will return the updated value
* @ throws Exception ZK errors , interruptions , etc . */
public boolean trySetCount ( VersionedValue < Integer > previous , int newCount ) throws Exception { } } | VersionedValue < byte [ ] > previousCopy = new VersionedValue < byte [ ] > ( previous . getVersion ( ) , toBytes ( previous . getValue ( ) ) ) ; return sharedValue . trySetValue ( previousCopy , toBytes ( newCount ) ) ; |
public class AtomPositionMap { /** * Returns a list of { @ link ResidueRange ResidueRanges } corresponding to this entire AtomPositionMap . */
public List < ResidueRangeAndLength > getRanges ( ) { } } | String currentChain = "" ; ResidueNumber first = null ; ResidueNumber prev = null ; List < ResidueRangeAndLength > ranges = new ArrayList < ResidueRangeAndLength > ( ) ; for ( ResidueNumber rn : treeMap . keySet ( ) ) { if ( ! rn . getChainName ( ) . equals ( currentChain ) ) { if ( first != null ) { ResidueRangeAndLength newRange = new ResidueRangeAndLength ( currentChain , first , prev , this . getLength ( first , prev ) ) ; ranges . add ( newRange ) ; } first = rn ; } prev = rn ; currentChain = rn . getChainName ( ) ; } ResidueRangeAndLength newRange = new ResidueRangeAndLength ( currentChain , first , prev , this . getLength ( first , prev ) ) ; ranges . add ( newRange ) ; return ranges ; |
public class ReflectUtil { /** * 调用指定对象的指定方法
* @ param obj 指定对象 , 不能为空 , 如果要调用的方法为静态方法那么传入Class对象
* @ param methodName 要调用的方法名 , 不能为空
* @ param parameterTypes 方法参数类型 , 方法没有参数请传null
* @ param args 参数
* @ param < R > 结果类型
* @ return 调用结果 */
@ SuppressWarnings ( "unchecked" ) public static < R > R invoke ( Object obj , String methodName , Class < ? > [ ] parameterTypes , Object ... args ) { } } | Assert . isFalse ( CollectionUtil . safeIsEmpty ( parameterTypes ) ^ CollectionUtil . safeIsEmpty ( args ) , "方法参数类型列表必须和方法参数列表一致" ) ; Assert . isTrue ( parameterTypes == null || parameterTypes . length == args . length , "方法参数类型列表长度必须和方法参数列表长度一致" ) ; Method method ; if ( obj instanceof Class ) { method = getMethod ( ( Class ) obj , methodName , parameterTypes ) ; } else { method = getMethod ( obj . getClass ( ) , methodName , parameterTypes ) ; } return invoke ( obj , method , args ) ; |
public class GridFile { /** * Checks whether the parent directories are present ( and are directories ) . If createIfAbsent is true ,
* creates missing dirs
* @ param path
* @ param createIfAbsent
* @ return */
protected boolean checkParentDirs ( String path , boolean createIfAbsent ) throws IOException { } } | String [ ] components = Util . components ( path , SEPARATOR ) ; if ( components == null ) return false ; if ( components . length == 1 ) // no parent directories to create , e . g . " data . txt "
return true ; StringBuilder sb = new StringBuilder ( ) ; boolean first = true ; for ( int i = 0 ; i < components . length - 1 ; i ++ ) { String tmp = components [ i ] ; if ( ! tmp . equals ( SEPARATOR ) ) { if ( first ) first = false ; else sb . append ( SEPARATOR ) ; } sb . append ( tmp ) ; String comp = sb . toString ( ) ; if ( comp . equals ( SEPARATOR ) ) continue ; Metadata val = exists ( comp ) ; if ( val != null ) { if ( val . isFile ( ) ) throw new IOException ( format ( "cannot create %s as component %s is a file" , path , comp ) ) ; } else if ( createIfAbsent ) { metadataCache . put ( comp , new Metadata ( 0 , System . currentTimeMillis ( ) , chunkSize , Metadata . DIR ) ) ; } else { // Couldn ' t find a component and we ' re not allowed to create components !
return false ; } } // check that we have found all the components we need .
return true ; |
public class ListDeviceInstancesResult { /** * An object containing information about your device instances .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setDeviceInstances ( java . util . Collection ) } or { @ link # withDeviceInstances ( java . util . Collection ) } if you
* want to override the existing values .
* @ param deviceInstances
* An object containing information about your device instances .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListDeviceInstancesResult withDeviceInstances ( DeviceInstance ... deviceInstances ) { } } | if ( this . deviceInstances == null ) { setDeviceInstances ( new java . util . ArrayList < DeviceInstance > ( deviceInstances . length ) ) ; } for ( DeviceInstance ele : deviceInstances ) { this . deviceInstances . add ( ele ) ; } return this ; |
public class FileUploadValidator { /** * 验证文件大小 , 文件名 , 文件后缀
* @ param files
* @ param maxLength
* @ param allowExtName
* @ return */
public List < MultipartFile > validateFiles ( List < MultipartFile > files , long maxLength , String [ ] allowExtName ) { } } | List < MultipartFile > retFiles = new ArrayList < MultipartFile > ( ) ; for ( MultipartFile multipartFile : files ) { try { this . validateFile ( multipartFile , maxLength , allowExtName ) ; retFiles . add ( multipartFile ) ; } catch ( Exception e ) { LOG . warn ( e . toString ( ) ) ; } } return retFiles ; |
public class FileBasedTemporalSemanticSpace { /** * Loads the { @ link TemporalSemanticSpace } from the sparse text formatted
* file .
* @ param sspaceFile a file in { @ link TSSpaceFormat # SPARSE _ TEXT sparse text }
* format */
private Map < String , SemanticVector > loadSparseText ( File sspaceFile ) throws IOException { } } | LOGGER . info ( "loading sparse text TSS from " + sspaceFile ) ; BufferedReader br = new BufferedReader ( new FileReader ( sspaceFile ) ) ; String [ ] header = br . readLine ( ) . split ( "\\s+" ) ; int words = Integer . parseInt ( header [ 0 ] ) ; dimensions = Integer . parseInt ( header [ 1 ] ) ; Map < String , SemanticVector > wordToSemantics = new HashMap < String , SemanticVector > ( words , 2f ) ; for ( int wordIndex = 0 ; wordIndex < words ; ++ wordIndex ) { String [ ] wordAndSemantics = br . readLine ( ) . split ( "\\|" ) ; String word = wordAndSemantics [ 0 ] ; SemanticVector semantics = new SemanticVector ( dimensions ) ; wordToSemantics . put ( word , semantics ) ; LOGGER . info ( "loading " + wordAndSemantics . length + " timesteps for word " + word ) ; // read in each of the timesteps
for ( int tsIndx = 1 ; tsIndx < wordAndSemantics . length ; ++ tsIndx ) { String [ ] tsAndVec = wordAndSemantics [ tsIndx ] . split ( "%" ) ; String [ ] tsAndNonZero = tsAndVec [ 0 ] . split ( " " ) ; long timeStep = Long . parseLong ( tsAndNonZero [ 0 ] ) ; updateTimeRange ( timeStep ) ; int nonZero = Integer . parseInt ( tsAndNonZero [ 1 ] ) ; String [ ] vecElements = tsAndVec [ 1 ] . split ( "," ) ; Map < Integer , Double > sparseArr = new IntegerMap < Double > ( ) ; // elements are ordered as pairs of index , value , index , value , . . .
for ( int i = 0 ; i < vecElements . length ; i += 2 ) { Integer index = Integer . valueOf ( vecElements [ i ] ) ; Double value = Double . valueOf ( vecElements [ i + 1 ] ) ; } semantics . setSemantics ( timeStep , sparseArr ) ; } } return wordToSemantics ; |
public class LinuxTaskController { /** * get the Job ID from the information in the TaskControllerContext */
private String getJobId ( TaskControllerContext context ) { } } | String taskId = context . task . getTaskID ( ) . toString ( ) ; TaskAttemptID tId = TaskAttemptID . forName ( taskId ) ; String jobId = tId . getJobID ( ) . toString ( ) ; return jobId ; |
public class Profiler { /** * Returns a specific instance of profiler , specifying verbosity
* < br >
* < p style = " color : red " >
* NOTE : Verbosity is not guaranteed . since loggers are cached , if there was another
* profiler with the specified name and it was not verbose , that instance will be
* returned . To set the verbosity afterwards see { @ link Profiler # setVerbose ( boolean ) }
* @ param name The name of the profiler
* @ param verbose Whether to print to { @ link System # out } when ending a section
* @ return A profiler identified by the specified name . */
public static Profiler getInstance ( String name , boolean verbose ) { } } | if ( Profiler . profilers . containsKey ( name ) ) return Profiler . profilers . get ( name ) ; else { Profiler p = new Profiler ( verbose ) ; Profiler . profilers . put ( name , p ) ; return p ; } |
public class PISAHypervolume { /** * / * remove all points which have a value < = ' threshold ' regarding the
* dimension ' objective ' ; the points referenced by
* ' front [ 0 . . noPoints - 1 ] ' are considered ; ' front ' is resorted , such that
* ' front [ 0 . . n - 1 ] ' contains the remaining points ; ' n ' is returned */
private int reduceNondominatedSet ( double [ ] [ ] front , int noPoints , int objective , double threshold ) { } } | int n ; int i ; n = noPoints ; for ( i = 0 ; i < n ; i ++ ) { if ( front [ i ] [ objective ] <= threshold ) { n -- ; swap ( front , i , n ) ; } } return n ; |
public class CommerceOrderLocalServiceBaseImpl { /** * Creates a new commerce order with the primary key . Does not add the commerce order to the database .
* @ param commerceOrderId the primary key for the new commerce order
* @ return the new commerce order */
@ Override @ Transactional ( enabled = false ) public CommerceOrder createCommerceOrder ( long commerceOrderId ) { } } | return commerceOrderPersistence . create ( commerceOrderId ) ; |
public class MessageProcessorMatching { /** * Method retrieveMatchingConsumerPoints
* Used to retrieve matching ConsumerPoints from the MatchSpace .
* @ param destUuid The destination name to retrieve matches
* @ param cmUuid The consumer manager uuid
* @ param msg The msg to key against for selector support
* @ param searchResults The search results object to use to locate matches
* @ return MessageProcessorSearchResults The results object containing the matches */
public void retrieveMatchingConsumerPoints ( SIBUuid12 destUuid , SIBUuid8 cmUuid , JsMessage msg , MessageProcessorSearchResults searchResults ) throws SIDiscriminatorSyntaxException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "retrieveMatchingConsumerPoints" , new Object [ ] { destUuid , cmUuid , msg , searchResults } ) ; // Form a branch for the MatchSpace from a combination of the destination uuid and
// the CM uuid
String mSpacePrefix = destUuid . toString ( ) + MatchSpace . SUBTOPIC_SEPARATOR_CHAR + cmUuid . toString ( ) ; // Retrieve the set of wrapped consumer points from the matchspace
try { // Set up Results object to hold the results from the MatchSpace traversal
searchResults . reset ( ) ; // Set up an evaluation cache ( need to keep one of these per thread . Newing up is expensive )
EvalCache cache = _matching . createEvalCache ( ) ; String discriminator = msg . getDiscriminator ( ) ; if ( discriminator != null ) { try { _syntaxChecker . checkEventTopicSyntax ( discriminator ) ; String theTopic = buildSendTopicExpression ( mSpacePrefix , discriminator ) ; search ( theTopic , // keyed on destination name
( MatchSpaceKey ) msg , cache , searchResults ) ; } catch ( InvalidTopicSyntaxException e ) { // No FFDC code needed
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "retrieveMatchingConsumerPoints" , e ) ; throw new SIDiscriminatorSyntaxException ( nls . getFormattedMessage ( "INVALID_TOPIC_ERROR_CWSIP0372" , new Object [ ] { discriminator } , null ) ) ; } } else { // no discriminator
search ( mSpacePrefix , // keyed on destination name / concumer manager combo
( MatchSpaceKey ) msg , cache , searchResults ) ; } } catch ( BadMessageFormatMatchingException e ) { // FFDC
FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.matching.MessageProcessorMatching.retrieveMatchingConsumerPoints" , "1:759:1.117.1.11" , this ) ; SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "retrieveMatchingConsumerPoints" , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.matching.MessageProcessorMatching" , "1:770:1.117.1.11" , e } ) ; throw new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.matching.MessageProcessorMatching" , "1:778:1.117.1.11" , e } , null ) , e ) ; } catch ( MatchingException e ) { // FFDC
FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.matching.MessageProcessorMatching.retrieveMatchingConsumerPoints" , "1:789:1.117.1.11" , this ) ; SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "retrieveMatchingConsumerPoints" , "SIErrorException" ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.matching.MessageProcessorMatching" , "1:800:1.117.1.11" , e } ) ; throw new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.matching.MessageProcessorMatching" , "1:808:1.117.1.11" , e } , null ) , e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "retrieveMatchingConsumerPoints" ) ; |
public class TypeSystem { /** * The only core OOB type we will define is the Struct to represent the Identity of an Instance . */
private void registerCoreTypes ( ) { } } | idType = new IdType ( ) ; coreTypes . put ( idType . getStructType ( ) . getName ( ) , idType . getStructType ( ) ) ; |
public class Postbox { /** * Initialize this component . < br >
* This is basically called by DI setting file . */
@ PostConstruct public synchronized void initialize ( ) { } } | final FwCoreDirection direction = assistCoreDirection ( ) ; final SMailDeliveryDepartment deliveryDepartment = direction . assistMailDeliveryDepartment ( ) ; postOffice = deliveryDepartment != null ? newPostOffice ( deliveryDepartment ) : null ; prepareHotDeploy ( ) ; showBootLogging ( ) ; |
public class PerfModules { /** * return all the ModuleConfigs */
public static PmiModuleConfig [ ] getConfigs40 ( ) { } } | int index = modulePrefix . indexOf ( "xml." ) ; if ( index > 0 ) { moduleIDs = moduleIDs40 ; modulePrefix = modulePrefix . substring ( 0 , index ) ; moduleConfigs = new HashMap ( ) ; } initConfigs ( ) ; return getConfigs ( ) ; |
public class WebImage { /** * Build the image url .
* @ return the full image url string */
public String getUrl ( ) { } } | final StringBuilder sb = new StringBuilder ( ) ; sb . append ( secured ( ) ? "https://" : "http://" ) . append ( website ( ) ) . append ( path ( ) ) . append ( name ( ) ) . append ( extension ( ) ) ; return sb . toString ( ) ; |
public class CmsRelationSystemValidator { /** * Validates the links for the specified resource . < p >
* @ param dbc the database context
* @ param resource the resource that will be validated
* @ param fileLookup a map for faster lookup with all resources keyed by their rootpath
* @ param project the project to validate
* @ param report the report to write to
* @ return a list with the broken links as { @ link CmsRelation } objects for the specified resource ,
* or an empty list if no broken links were found */
protected List < CmsRelation > validateLinks ( CmsDbContext dbc , CmsResource resource , Map < String , CmsResource > fileLookup , CmsProject project , I_CmsReport report ) { } } | List < CmsRelation > brokenRelations = new ArrayList < CmsRelation > ( ) ; Map < String , Boolean > validatedLinks = new HashMap < String , Boolean > ( ) ; // get the relations
List < CmsRelation > incomingRelationsOnline = new ArrayList < CmsRelation > ( ) ; List < CmsRelation > outgoingRelationsOffline = new ArrayList < CmsRelation > ( ) ; try { if ( ! resource . getState ( ) . isDeleted ( ) ) { // search the target of links in the current ( offline ) project
outgoingRelationsOffline = m_driverManager . getRelationsForResource ( dbc , resource , CmsRelationFilter . TARGETS ) ; } else { // search the source of links in the online project
CmsProject currentProject = dbc . currentProject ( ) ; dbc . getRequestContext ( ) . setCurrentProject ( project ) ; try { incomingRelationsOnline = m_driverManager . getRelationsForResource ( dbc , resource , CmsRelationFilter . SOURCES ) ; } finally { dbc . getRequestContext ( ) . setCurrentProject ( currentProject ) ; } } } catch ( CmsException e ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_LINK_SEARCH_1 , resource ) , e ) ; if ( report != null ) { report . println ( Messages . get ( ) . container ( Messages . LOG_LINK_SEARCH_1 , dbc . removeSiteRoot ( resource . getRootPath ( ) ) ) , I_CmsReport . FORMAT_ERROR ) ; } return brokenRelations ; } List < CmsRelation > relations = new ArrayList < CmsRelation > ( ) ; relations . addAll ( incomingRelationsOnline ) ; relations . addAll ( outgoingRelationsOffline ) ; HashMultimap < String , String > outgoingRelationTargets = HashMultimap . create ( ) ; for ( CmsRelation outRelation : outgoingRelationsOffline ) { String sourcePath = outRelation . getSourcePath ( ) ; String targetId = outRelation . getTargetId ( ) . toString ( ) ; String targetPath = outRelation . getTargetPath ( ) ; outgoingRelationTargets . put ( sourcePath , targetId ) ; outgoingRelationTargets . put ( sourcePath , targetPath ) ; } // check the relations
boolean first = true ; Iterator < CmsRelation > itRelations = relations . iterator ( ) ; while ( itRelations . hasNext ( ) ) { CmsRelation relation = itRelations . next ( ) ; String link ; if ( ! resource . getState ( ) . isDeleted ( ) ) { link = relation . getTargetPath ( ) ; } else { link = relation . getSourcePath ( ) ; } if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( link ) ) { // skip empty links
continue ; } if ( validatedLinks . keySet ( ) . contains ( link ) ) { // skip already validated links
if ( validatedLinks . get ( link ) . booleanValue ( ) ) { // add broken relation of different type
brokenRelations . add ( relation ) ; } continue ; } boolean result ; if ( resource . getState ( ) . isDeleted ( ) ) { result = checkLinkForDeletedLinkTarget ( relation , link , fileLookup , outgoingRelationTargets ) ; } else { result = checkLinkForNewOrChangedLinkSource ( dbc , resource , relation , link , project , fileLookup ) ; } boolean isValidLink = result ; if ( ! isValidLink ) { if ( first ) { if ( report != null ) { report . println ( Messages . get ( ) . container ( Messages . RPT_HTMLLINK_FOUND_BROKEN_LINKS_0 ) , I_CmsReport . FORMAT_WARNING ) ; } first = false ; } brokenRelations . add ( relation ) ; if ( report != null ) { if ( ! resource . getState ( ) . isDeleted ( ) ) { report . println ( Messages . get ( ) . container ( Messages . RPT_HTMLLINK_BROKEN_TARGET_2 , relation . getSourcePath ( ) , dbc . removeSiteRoot ( link ) ) , I_CmsReport . FORMAT_WARNING ) ; } else { report . println ( Messages . get ( ) . container ( Messages . RPT_HTMLLINK_BROKEN_SOURCE_2 , dbc . removeSiteRoot ( link ) , relation . getTargetPath ( ) ) , I_CmsReport . FORMAT_WARNING ) ; } } } validatedLinks . put ( link , Boolean . valueOf ( ! isValidLink ) ) ; } return brokenRelations ; |
public class TransferListener { /** * Return true if new session for transaction
* @ param xferId
* @ param sessionId
* @ return boolean */
private boolean isNewSession ( String xferId , String sessionId ) { } } | List < String > currentSessions = transactionSessions . get ( xferId ) ; if ( currentSessions == null ) { List < String > sessions = new ArrayList < String > ( ) ; sessions . add ( sessionId ) ; transactionSessions . put ( xferId , sessions ) ; return true ; } else if ( ! currentSessions . contains ( sessionId ) ) { currentSessions . add ( sessionId ) ; return true ; } else { return false ; } |
public class CommerceCurrencyUtil { /** * Returns the last commerce currency in the ordered set where groupId = & # 63 ; and primary = & # 63 ; and active = & # 63 ; .
* @ param groupId the group ID
* @ param primary the primary
* @ param active the active
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching commerce currency , or < code > null < / code > if a matching commerce currency could not be found */
public static CommerceCurrency fetchByG_P_A_Last ( long groupId , boolean primary , boolean active , OrderByComparator < CommerceCurrency > orderByComparator ) { } } | return getPersistence ( ) . fetchByG_P_A_Last ( groupId , primary , active , orderByComparator ) ; |
public class AbstractTicketRegistry { /** * Encode ticket .
* @ param ticket the ticket
* @ return the ticket */
@ SneakyThrows protected Ticket encodeTicket ( final Ticket ticket ) { } } | if ( ! isCipherExecutorEnabled ( ) ) { LOGGER . trace ( MESSAGE ) ; return ticket ; } if ( ticket == null ) { LOGGER . debug ( "Ticket passed is null and cannot be encoded" ) ; return null ; } LOGGER . debug ( "Encoding ticket [{}]" , ticket ) ; val encodedTicketObject = SerializationUtils . serializeAndEncodeObject ( this . cipherExecutor , ticket ) ; val encodedTicketId = encodeTicketId ( ticket . getId ( ) ) ; val encodedTicket = new EncodedTicket ( encodedTicketId , ByteSource . wrap ( encodedTicketObject ) . read ( ) ) ; LOGGER . debug ( "Created encoded ticket [{}]" , encodedTicket ) ; return encodedTicket ; |
public class GanttDesignerReader { /** * Read project properties .
* @ param gantt Gantt Designer file */
private void readProjectProperties ( Gantt gantt ) { } } | Gantt . File file = gantt . getFile ( ) ; ProjectProperties props = m_projectFile . getProjectProperties ( ) ; props . setLastSaved ( file . getSaved ( ) ) ; props . setCreationDate ( file . getCreated ( ) ) ; props . setName ( file . getName ( ) ) ; |
public class ApiOvhTelephony { /** * Alter this object properties
* REST : PUT / telephony / { billingAccount } / ovhPabx / { serviceName } / tts / { id }
* @ param body [ required ] New object properties
* @ param billingAccount [ required ] The name of your billingAccount
* @ param serviceName [ required ]
* @ param id [ required ] */
public void billingAccount_ovhPabx_serviceName_tts_id_PUT ( String billingAccount , String serviceName , Long id , OvhOvhPabxTts body ) throws IOException { } } | String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/tts/{id}" ; StringBuilder sb = path ( qPath , billingAccount , serviceName , id ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ; |
public class ResponseBuilder { /** * Builds a DOM response .
* @ param availableResources
* list of resources to include in the output
* @ return streaming output */
public static StreamingOutput buildDOMResponse ( final List < String > availableResources ) { } } | try { final Document document = createSurroundingXMLResp ( ) ; final Element resElement = createResultElement ( document ) ; final List < Element > resources = createCollectionElement ( availableResources , document ) ; for ( final Element resource : resources ) { resElement . appendChild ( resource ) ; } document . appendChild ( resElement ) ; return createStream ( document ) ; } catch ( final ParserConfigurationException exc ) { throw new JaxRxException ( exc ) ; } |
public class SocketRWChannelSelector { /** * @ see com . ibm . ws . tcpchannel . internal . ChannelSelector # updateCount ( ) */
@ Override protected void updateCount ( ) { } } | // set counter to the actual value , rather than to try and
// keep track with a seperate variable .
// This counter must only be updated by the selector thread ,
// which allows us to omit synchronized logic .
// there can be timing windows where before we signal a deletion ,
// another request comes in , but the timeout logic will insure
// that we don ' t delete an active selector .
final int selectorCount = selector . keys ( ) . size ( ) ; if ( selectorCount > 0 ) { // if any keys , don ' t let selector die
waitingToQuit = false ; } wqm . updateCount ( countIndex , selectorCount , channelType ) ; |
public class GwAPI { /** * Setup XML and JSON implementations for each supported Version type
* We do this by taking the Code passed in and creating clones of these with the appropriate Facades and properties
* to do Versions and Content switches */
public void route ( HttpMethods meth , String path , API api , GwCode code ) throws Exception { } } | String version = "1.0" ; // Get Correct API Class from Mapper
Class < ? > respCls = facade . mapper ( ) . getClass ( api ) ; if ( respCls == null ) throw new Exception ( "Unknown class associated with " + api . getClass ( ) . getName ( ) + ' ' + api . name ( ) ) ; // setup Application API HTML ContentTypes for JSON and Route
String application = applicationJSON ( respCls , version ) ; // route ( env , meth , path , code , application , " application / json ; version = " + version , " * / * " ) ;
// setup Application API HTML ContentTypes for XML and Route
application = applicationXML ( respCls , version ) ; // route ( env , meth , path , code . clone ( facade _ 1_0 _ XML , false ) , application , " text / xml ; version = " + version ) ;
// Add other Supported APIs here as created |
public class NodeGroupClient { /** * Returns the specified NodeGroup . Get a list of available NodeGroups by making a list ( ) request .
* Note : the " nodes " field should not be used . Use nodeGroups . listNodes instead .
* < p > Sample code :
* < pre > < code >
* try ( NodeGroupClient nodeGroupClient = NodeGroupClient . create ( ) ) {
* ProjectZoneNodeGroupName nodeGroup = ProjectZoneNodeGroupName . of ( " [ PROJECT ] " , " [ ZONE ] " , " [ NODE _ GROUP ] " ) ;
* NodeGroup response = nodeGroupClient . getNodeGroup ( nodeGroup ) ;
* < / code > < / pre >
* @ param nodeGroup Name of the node group to return .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final NodeGroup getNodeGroup ( ProjectZoneNodeGroupName nodeGroup ) { } } | GetNodeGroupHttpRequest request = GetNodeGroupHttpRequest . newBuilder ( ) . setNodeGroup ( nodeGroup == null ? null : nodeGroup . toString ( ) ) . build ( ) ; return getNodeGroup ( request ) ; |
public class CommerceCountryPersistenceImpl { /** * Returns the commerce countries before and after the current commerce country in the ordered set where groupId = & # 63 ; and billingAllowed = & # 63 ; and active = & # 63 ; .
* @ param commerceCountryId the primary key of the current commerce country
* @ param groupId the group ID
* @ param billingAllowed the billing allowed
* @ param active the active
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the previous , current , and next commerce country
* @ throws NoSuchCountryException if a commerce country with the primary key could not be found */
@ Override public CommerceCountry [ ] findByG_B_A_PrevAndNext ( long commerceCountryId , long groupId , boolean billingAllowed , boolean active , OrderByComparator < CommerceCountry > orderByComparator ) throws NoSuchCountryException { } } | CommerceCountry commerceCountry = findByPrimaryKey ( commerceCountryId ) ; Session session = null ; try { session = openSession ( ) ; CommerceCountry [ ] array = new CommerceCountryImpl [ 3 ] ; array [ 0 ] = getByG_B_A_PrevAndNext ( session , commerceCountry , groupId , billingAllowed , active , orderByComparator , true ) ; array [ 1 ] = commerceCountry ; array [ 2 ] = getByG_B_A_PrevAndNext ( session , commerceCountry , groupId , billingAllowed , active , orderByComparator , false ) ; return array ; } catch ( Exception e ) { throw processException ( e ) ; } finally { closeSession ( session ) ; } |
public class SslContextFactory { /** * Override this method to provide alternate way to load a truststore .
* @ return the key store instance
* @ throws Exception */
protected KeyStore loadTrustStore ( ) throws Exception { } } | return getKeyStore ( trustStoreInputStream , sslConfig . getTrustStorePath ( ) , sslConfig . getTrustStoreType ( ) , sslConfig . getTrustStoreProvider ( ) , sslConfig . getTrustStorePassword ( ) ) ; |
public class TableProcessor { /** * Adds relationship info into metadata for a given field
* < code > relationField < / code > .
* @ param entityClass
* the entity class
* @ param relationField
* the relation field
* @ param metadata
* the metadata */
private void addRelationIntoMetadata ( Class < ? > entityClass , Field relationField , EntityMetadata metadata ) { } } | RelationMetadataProcessor relProcessor = null ; try { relProcessor = RelationMetadataProcessorFactory . getRelationMetadataProcessor ( relationField , kunderaMetadata ) ; this . factory . validate ( relationField , new RelationAttributeRule ( ) ) ; relProcessor = RelationMetadataProcessorFactory . getRelationMetadataProcessor ( relationField , kunderaMetadata ) ; if ( relProcessor != null ) { relProcessor . addRelationIntoMetadata ( relationField , metadata ) ; } } catch ( PersistenceException pe ) { throw new MetamodelLoaderException ( "Error with relationship in @Entity(" + entityClass + "." + relationField . getName ( ) + "), reason: " + pe ) ; } |
public class RouteBuilder { /** * Sets the URI ( pattern ) of the resulting route .
* @ param uri the uri that can use the route uri pattern , must not be { @ literal null } .
* @ return the current route builder */
public RouteBuilder on ( String uri ) { } } | if ( ! uri . startsWith ( "/" ) ) { this . uri = "/" + uri ; } else { this . uri = uri ; } return this ; |
public class DividableGridAdapter { /** * Adds a new item to the adapter .
* @ param item
* The item , which should be added , as an instance of the class { @ link AbstractItem } .
* The item may not be null */
public final void add ( @ NonNull final AbstractItem item ) { } } | Condition . INSTANCE . ensureNotNull ( item , "The item may not be null" ) ; items . add ( item ) ; if ( item instanceof Item && ( ( Item ) item ) . getIcon ( ) != null ) { iconCount ++ ; } else if ( item instanceof Divider ) { dividerCount ++ ; } rawItems = null ; notifyOnDataSetChanged ( ) ; |
public class JsonUtils { /** * Use the stringToType method instead . */
@ Deprecated public static < T > T jsonTo ( String json , TypeReference < T > typeRef ) { } } | return util . stringToType ( json , typeRef ) ; |
public class WritableComparator { /** * Lexicographic order of binary data . */
public static int compareBytes ( byte [ ] b1 , int s1 , int l1 , byte [ ] b2 , int s2 , int l2 ) { } } | return FastByteComparisons . compareTo ( b1 , s1 , l1 , b2 , s2 , l2 ) ; |
public class PartialApplicator { /** * Returns a function with 1 arguments applied to the supplied Function
* @ param t1 Generic argument
* @ param func Function
* @ param < T1 > Generic argument type
* @ param < T2 > Generic argument type
* @ param < R > Function generic return type
* @ return Function as a result of 2 arguments being applied to the incoming TriFunction */
public static < T1 , T2 , R > Supplier < R > partial ( final T1 t1 , final Function < T1 , R > func ) { } } | return ( ) -> func . apply ( t1 ) ; |
public class StorageAccountsInner { /** * Asynchronously creates a new storage account with the specified parameters . If an account is already created and a subsequent create request is issued with different properties , the account properties will be updated . If an account is already created and a subsequent create or update request is issued with the exact same set of properties , the request will succeed .
* @ param resourceGroupName The name of the resource group within the user ' s subscription . The name is case insensitive .
* @ param accountName The name of the storage account within the specified resource group . Storage account names must be between 3 and 24 characters in length and use numbers and lower - case letters only .
* @ param parameters The parameters to provide for the created account .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the StorageAccountInner object if successful . */
public StorageAccountInner beginCreate ( String resourceGroupName , String accountName , StorageAccountCreateParameters parameters ) { } } | return beginCreateWithServiceResponseAsync ( resourceGroupName , accountName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class RollingFileWriter { /** * Creates policies from a nullable string .
* @ param property
* Nullable string with policies to create
* @ return Created policies */
private static List < Policy > createPolicies ( final String property ) { } } | if ( property == null || property . isEmpty ( ) ) { return Collections . < Policy > singletonList ( new StartupPolicy ( null ) ) ; } else { ServiceLoader < Policy > loader = new ServiceLoader < Policy > ( Policy . class , String . class ) ; List < Policy > policies = new ArrayList < Policy > ( ) ; for ( String entry : property . split ( "," ) ) { int separator = entry . indexOf ( ':' ) ; if ( separator == - 1 ) { policies . add ( loader . create ( entry , ( String ) null ) ) ; } else { String name = entry . substring ( 0 , separator ) . trim ( ) ; String argument = entry . substring ( separator + 1 ) . trim ( ) ; policies . add ( loader . create ( name , argument ) ) ; } } return policies ; } |
public class UnionIterator { /** * Takes the resulting union and builds the { @ link # current _ values }
* and { @ link # meta } maps .
* @ param ordered _ union The union to build from . */
private void setCurrentAndMeta ( final ByteMap < ExpressionDataPoint [ ] > ordered_union ) { } } | for ( final String id : queries . keySet ( ) ) { current_values . put ( id , new ExpressionDataPoint [ ordered_union . size ( ) ] ) ; // TODO - blech . Fill with a sentinel value to reflect " no data here ! "
final int [ ] m = new int [ ordered_union . size ( ) ] ; for ( int i = 0 ; i < m . length ; i ++ ) { m [ i ] = - 1 ; } single_series_matrix . put ( id , m ) ; } int i = 0 ; for ( final Entry < byte [ ] , ExpressionDataPoint [ ] > entry : ordered_union . entrySet ( ) ) { final ExpressionDataPoint [ ] idps = entry . getValue ( ) ; for ( int x = 0 ; x < idps . length ; x ++ ) { final ExpressionDataPoint [ ] current_dps = current_values . get ( index_to_names [ x ] ) ; current_dps [ i ] = idps [ x ] ; final int [ ] m = single_series_matrix . get ( index_to_names [ x ] ) ; if ( idps [ x ] != null ) { m [ i ] = idps [ x ] . getIndex ( ) ; } } ++ i ; } // set fills on nulls
for ( final ExpressionDataPoint [ ] idps : current_values . values ( ) ) { for ( i = 0 ; i < idps . length ; i ++ ) { if ( idps [ i ] == null ) { idps [ i ] = fill_dp ; } } } series_size = ordered_union . size ( ) ; |
public class HashOperations { /** * This is a classical Knuth - style Open Addressing , Double Hash insert scheme , but inserts
* values directly into a Memory .
* This method assumes that the input hash is not a duplicate .
* Useful for rebuilding tables to avoid unnecessary comparisons .
* Returns the index of insertion , which is always positive or zero .
* Throws an exception if table has no empty slot .
* @ param wmem The writable memory
* @ param lgArrLongs < a href = " { @ docRoot } / resources / dictionary . html # lgArrLongs " > See lgArrLongs < / a > .
* lgArrLongs & le ; log2 ( hashTable . length ) .
* @ param hash value that must not be zero and will be inserted into the array into an empty slot .
* @ param memOffsetBytes offset in the memory where the hash array starts
* @ return index of insertion . Always positive or zero . */
public static int fastHashInsertOnly ( final WritableMemory wmem , final int lgArrLongs , final long hash , final int memOffsetBytes ) { } } | final int arrayMask = ( 1 << lgArrLongs ) - 1 ; // current Size - 1
final int stride = getStride ( hash , lgArrLongs ) ; int curProbe = ( int ) ( hash & arrayMask ) ; // search for duplicate or zero
final int loopIndex = curProbe ; do { final int curProbeOffsetBytes = ( curProbe << 3 ) + memOffsetBytes ; final long curArrayHash = wmem . getLong ( curProbeOffsetBytes ) ; if ( curArrayHash == EMPTY ) { wmem . putLong ( curProbeOffsetBytes , hash ) ; return curProbe ; } curProbe = ( curProbe + stride ) & arrayMask ; } while ( curProbe != loopIndex ) ; throw new SketchesArgumentException ( "No empty slot in table!" ) ; |
public class ClassContext { /** * Check for the name in the current context and classdef , and if not present search the global context . Note that
* the context chain is not followed .
* @ see Context # check ( ILexNameToken ) */
@ Override public Value check ( ILexNameToken name ) { } } | // A RootContext stops the name search from continuing down the
// context chain . It first checks any local context , then it
// checks the " class " context , then it goes down to the global level .
Value v = get ( name ) ; // Local variables
if ( v != null ) { return v ; } if ( freeVariables != null ) { v = freeVariables . get ( name ) ; if ( v != null ) { return v ; } } v = assistantFactory . createSClassDefinitionAssistant ( ) . getStatic ( classdef , name ) ; if ( v != null ) { return v ; } Context g = getGlobal ( ) ; if ( g != this ) { return g . check ( name ) ; } return v ; |
public class AbstractGeneratorConfigurationBlock { /** * Create the " experimental " warning message .
* @ param composite the parent . */
protected void createExperimentalWarningMessage ( Composite composite ) { } } | final Label dangerIcon = new Label ( composite , SWT . WRAP ) ; dangerIcon . setImage ( getImage ( IMAGE ) ) ; final GridData labelLayoutData = new GridData ( ) ; labelLayoutData . horizontalIndent = 0 ; dangerIcon . setLayoutData ( labelLayoutData ) ; |
public class AbstractMaterialDialogBuilder { /** * Obtains the window background from a specific theme .
* @ param themeResourceId
* The resource id of the theme , the window background should be obtained from , as an
* { @ link Integer } value */
private void obtainWindowBackground ( @ StyleRes final int themeResourceId ) { } } | TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogWindowBackground } ) ; int resourceId = typedArray . getResourceId ( 0 , 0 ) ; if ( resourceId != 0 ) { setWindowBackground ( resourceId ) ; } else { setWindowBackground ( R . drawable . material_dialog_background ) ; } |
public class TableSession { /** * Retreive this relative record in the table .
* This method is used exclusively by the get method to read a single row of a grid table .
* @ param iRowIndex The row to retrieve .
* @ return The record or an error code as an Integer .
* @ exception DBException File exception .
* @ exception RemoteException RMI exception . */
private Object getAtRow ( int iRowIndex ) throws DBException { } } | try { Utility . getLogger ( ) . info ( "get row " + iRowIndex ) ; GridTable gridTable = this . getGridTable ( this . getMainRecord ( ) ) ; gridTable . getCurrentTable ( ) . getRecord ( ) . setEditMode ( Constants . EDIT_NONE ) ; Record record = ( Record ) gridTable . get ( iRowIndex ) ; int iRecordStatus = DBConstants . RECORD_NORMAL ; if ( record == null ) { if ( iRowIndex >= 0 ) iRecordStatus = DBConstants . RECORD_AT_EOF ; else iRecordStatus = DBConstants . RECORD_AT_BOF ; } else { if ( record . getEditMode ( ) == DBConstants . EDIT_NONE ) iRecordStatus = DBConstants . RECORD_NEW ; // Deleted record .
if ( record . getEditMode ( ) == DBConstants . EDIT_ADD ) iRecordStatus = DBConstants . RECORD_NEW ; } if ( iRecordStatus == DBConstants . NORMAL_RETURN ) { Record recordBase = this . getMainRecord ( ) . getTable ( ) . getCurrentTable ( ) . getRecord ( ) ; int iFieldTypes = this . getFieldTypes ( recordBase ) ; BaseBuffer buffer = new VectorBuffer ( null , iFieldTypes ) ; buffer . fieldsToBuffer ( recordBase , iFieldTypes ) ; return buffer . getPhysicalData ( ) ; } else return new Integer ( iRecordStatus ) ; } catch ( DBException ex ) { throw ex ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; throw new DBException ( ex . getMessage ( ) ) ; } |
public class CassQuery { /** * Gets column name for a given field name .
* @ param metadata
* the metadata
* @ param property
* the property
* @ return the column name */
private String getColumnName ( EntityMetadata metadata , String property ) { } } | MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( metadata . getPersistenceUnit ( ) ) ; String jpaColumnName = null ; if ( property . equals ( ( ( AbstractAttribute ) metadata . getIdAttribute ( ) ) . getJPAColumnName ( ) ) ) { jpaColumnName = CassandraUtilities . getIdColumnName ( kunderaMetadata , metadata , ( ( CassandraClientBase ) persistenceDelegeator . getClient ( metadata ) ) . getExternalProperties ( ) , ( ( CassandraClientBase ) persistenceDelegeator . getClient ( metadata ) ) . isCql3Enabled ( metadata ) ) ; } else { jpaColumnName = ( ( AbstractAttribute ) metaModel . getEntityAttribute ( metadata . getEntityClazz ( ) , property ) ) . getJPAColumnName ( ) ; } return jpaColumnName ; |
public class UserCoreDao { /** * Query for all rows
* @ return result */
public TResult queryForAll ( ) { } } | TResult result = userDb . query ( getTableName ( ) , table . getColumnNames ( ) , null , null , null , null , null ) ; prepareResult ( result ) ; return result ; |
public class OperationsInner { /** * Get operation .
* @ param locationName The name of the location .
* @ param operationName The name of the operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the OperationResultInner object */
public Observable < OperationResultInner > getAsync ( String locationName , String operationName ) { } } | return getWithServiceResponseAsync ( locationName , operationName ) . map ( new Func1 < ServiceResponse < OperationResultInner > , OperationResultInner > ( ) { @ Override public OperationResultInner call ( ServiceResponse < OperationResultInner > response ) { return response . body ( ) ; } } ) ; |
public class NumberPickerPreference { /** * Initializes the preference .
* @ param attributeSet
* The attribute set , the attributes should be obtained from , as an instance of the type
* { @ link AttributeSet } or null , if no attributes should be obtained
* @ param defaultStyle
* The default style to apply to this preference . If 0 , no style will be applied ( beyond
* what is included in the theme ) . This may either be an attribute resource , whose value
* will be retrieved from the current theme , or an explicit style resource
* @ param defaultStyleResource
* A resource identifier of a style resource that supplies default values for the
* preference , used only if the default style is 0 or can not be found in the theme . Can
* be 0 to not look for defaults */
private void initialize ( @ Nullable final AttributeSet attributeSet , @ AttrRes final int defaultStyle , @ StyleRes final int defaultStyleResource ) { } } | obtainStyledAttributes ( attributeSet , defaultStyle , defaultStyleResource ) ; |
public class DBCluster { /** * Provides a list of VPC security groups that the DB cluster belongs to .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setVpcSecurityGroups ( java . util . Collection ) } or { @ link # withVpcSecurityGroups ( java . util . Collection ) } if
* you want to override the existing values .
* @ param vpcSecurityGroups
* Provides a list of VPC security groups that the DB cluster belongs to .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DBCluster withVpcSecurityGroups ( VpcSecurityGroupMembership ... vpcSecurityGroups ) { } } | if ( this . vpcSecurityGroups == null ) { setVpcSecurityGroups ( new com . amazonaws . internal . SdkInternalList < VpcSecurityGroupMembership > ( vpcSecurityGroups . length ) ) ; } for ( VpcSecurityGroupMembership ele : vpcSecurityGroups ) { this . vpcSecurityGroups . add ( ele ) ; } return this ; |
public class AbstractLogoutServlet { /** * 在SSO注销之后 , 默认会跳转回到应用根地址 , 这个时候有可能由于缓存导致浏览器不会自动跳转到登录页 。
* 这里返回一个随机状态码让浏览器不使用缓存页面 。
* 默认状态码是当前是时间毫秒数 , 如果不希望增加这个状态码 , 可以重写这个方法返回一个空值 。 */
protected String getStateQueryParam ( HttpServletRequest req , HttpServletResponse resp ) { } } | return String . valueOf ( System . currentTimeMillis ( ) ) ; |
public class BucketSort { /** * Adds new element to the bucket builder . The value must be between
* min _ value and max _ value .
* @ param The
* value used for bucketing .
* @ param The
* index of the element to store in the buffer . Usually it is an
* index into some array , where the real elements are stored . */
private int getBucket ( double value ) { } } | assert ( value >= m_min_value && value <= m_max_value ) ; int bucket = ( int ) ( ( value - m_min_value ) / m_dy ) ; return bucket ; |
public class FileUtilsV2_2 { /** * Schedules a directory recursively for deletion on JVM exit .
* @ param directory directory to delete , must not be < code > null < / code >
* @ throws NullPointerException if the directory is < code > null < / code >
* @ throws IOException in case deletion is unsuccessful */
private static void deleteDirectoryOnExit ( File directory ) throws IOException { } } | if ( ! directory . exists ( ) ) { return ; } directory . deleteOnExit ( ) ; if ( ! isSymlink ( directory ) ) { cleanDirectoryOnExit ( directory ) ; } |
public class Tuple3 { /** * Constructor method to utilize type inference .
* @ param a first component
* @ param b second component
* @ param c third component
* @ param < A > type of the first component
* @ param < B > type of the second component
* @ param < C > type of the third component
* @ return the pair */
@ Nonnull public static < A , B , C > Tuple3 < A , B , C > of ( @ Nonnull A a , @ Nonnull B b , @ Nonnull C c ) { } } | return new Tuple3 < > ( a , b , c ) ; |
public class GetAllPremiumRates { /** * Runs the example .
* @ param adManagerServices the services factory .
* @ param session the session .
* @ throws ApiException if the API request failed with one or more service errors .
* @ throws RemoteException if the API request failed due to other errors . */
public static void runExample ( AdManagerServices adManagerServices , AdManagerSession session ) throws RemoteException { } } | // Get the PremiumRateService .
PremiumRateServiceInterface premiumRateService = adManagerServices . get ( session , PremiumRateServiceInterface . class ) ; // Create a statement to get all premium rates .
StatementBuilder statementBuilder = new StatementBuilder ( ) . orderBy ( "id ASC" ) . limit ( StatementBuilder . SUGGESTED_PAGE_LIMIT ) ; // Default for total result set size .
int totalResultSetSize = 0 ; do { // Get premium rates by statement .
PremiumRatePage page = premiumRateService . getPremiumRatesByStatement ( statementBuilder . toStatement ( ) ) ; if ( page . getResults ( ) != null ) { totalResultSetSize = page . getTotalResultSetSize ( ) ; int i = page . getStartIndex ( ) ; for ( PremiumRate premiumRate : page . getResults ( ) ) { System . out . printf ( "%d) Premium rate with ID %d of type '%s' assigned to rate card with ID %d " + "was found.%n" , i ++ , premiumRate . getId ( ) , premiumRate . getPremiumFeature ( ) . getClass ( ) . getSimpleName ( ) , premiumRate . getRateCardId ( ) ) ; } } statementBuilder . increaseOffsetBy ( StatementBuilder . SUGGESTED_PAGE_LIMIT ) ; } while ( statementBuilder . getOffset ( ) < totalResultSetSize ) ; System . out . printf ( "Number of results found: %d%n" , totalResultSetSize ) ; |
public class VariableUtils { /** * Cut off double quotes prefix and suffix .
* @ param variable
* @ return */
public static String cutOffDoubleQuotes ( String variable ) { } } | if ( StringUtils . hasText ( variable ) && variable . length ( ) > 1 && variable . charAt ( 0 ) == '"' && variable . charAt ( variable . length ( ) - 1 ) == '"' ) { return variable . substring ( 1 , variable . length ( ) - 1 ) ; } return variable ; |
public class TimeDuration { /** * Creates a { @ link TimeDuration } from the delay passed in parameter
* @ param delay the delay either in milliseconds without unit , or in seconds if suffixed by sec or secs .
* @ return the TimeDuration created from the delay expressed as a String . */
@ CheckForNull public static TimeDuration fromString ( @ CheckForNull String delay ) { } } | if ( delay == null ) { return null ; } long unitMultiplier = 1L ; delay = delay . trim ( ) ; try { // TODO : more unit handling
if ( delay . endsWith ( "sec" ) || delay . endsWith ( "secs" ) ) { delay = delay . substring ( 0 , delay . lastIndexOf ( "sec" ) ) ; delay = delay . trim ( ) ; unitMultiplier = 1000L ; } return new TimeDuration ( Long . parseLong ( delay . trim ( ) ) * unitMultiplier ) ; } catch ( NumberFormatException e ) { throw new IllegalArgumentException ( "Invalid time duration value: " + delay ) ; } |
public class FeatureOverlayQuery { /** * Perform a query based upon the map click location and build feature table data
* @ param latLng location
* @ param view view
* @ param map Google Map
* @ param projection desired geometry projection
* @ return table data on what was clicked , or null
* @ since 1.2.7 */
public FeatureTableData buildMapClickTableData ( LatLng latLng , View view , GoogleMap map , Projection projection ) { } } | // Get the zoom level
double zoom = MapUtils . getCurrentZoom ( map ) ; // Build a bounding box to represent the click location
BoundingBox boundingBox = MapUtils . buildClickBoundingBox ( latLng , view , map , screenClickPercentage ) ; // Get the map click distance tolerance
double tolerance = MapUtils . getToleranceDistance ( latLng , view , map , screenClickPercentage ) ; FeatureTableData tableData = buildMapClickTableData ( latLng , zoom , boundingBox , tolerance , projection ) ; return tableData ; |
public class FluoEntryInputFormat { /** * Configure properties needed to connect to a Fluo application
* @ param conf Job configuration
* @ param config use { @ link FluoConfiguration } to configure programmatically */
public static void configure ( Job conf , SimpleConfiguration config ) { } } | try { FluoConfiguration fconfig = new FluoConfiguration ( config ) ; try ( Environment env = new Environment ( fconfig ) ) { long ts = env . getSharedResources ( ) . getTimestampTracker ( ) . allocateTimestamp ( ) . getTxTimestamp ( ) ; conf . getConfiguration ( ) . setLong ( TIMESTAMP_CONF_KEY , ts ) ; ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; config . save ( baos ) ; conf . getConfiguration ( ) . set ( PROPS_CONF_KEY , new String ( baos . toByteArray ( ) , StandardCharsets . UTF_8 ) ) ; AccumuloInputFormat . setZooKeeperInstance ( conf , fconfig . getAccumuloInstance ( ) , fconfig . getAccumuloZookeepers ( ) ) ; AccumuloInputFormat . setConnectorInfo ( conf , fconfig . getAccumuloUser ( ) , new PasswordToken ( fconfig . getAccumuloPassword ( ) ) ) ; AccumuloInputFormat . setInputTableName ( conf , env . getTable ( ) ) ; AccumuloInputFormat . setScanAuthorizations ( conf , env . getAuthorizations ( ) ) ; } } catch ( Exception e ) { throw new RuntimeException ( e ) ; } |
public class WriterBasedGenerator { /** * Helper method to try to call appropriate write method for given
* untyped Object . At this point , no structural conversions should be done ,
* only simple basic types are to be coerced as necessary .
* @ param value Non - null value to write */
protected void _writeSimpleObject ( Object value ) throws IOException , JsonGenerationException { } } | /* 31 - Dec - 2009 , tatu : Actually , we could just handle some basic
* types even without codec . This can improve interoperability ,
* and specifically help with TokenBuffer . */
if ( value == null ) { writeNull ( ) ; return ; } if ( value instanceof String ) { writeString ( ( String ) value ) ; return ; } if ( value instanceof Number ) { Number n = ( Number ) value ; if ( n instanceof Integer ) { writeNumber ( n . intValue ( ) ) ; return ; } else if ( n instanceof Long ) { writeNumber ( n . longValue ( ) ) ; return ; } else if ( n instanceof Double ) { writeNumber ( n . doubleValue ( ) ) ; return ; } else if ( n instanceof Float ) { writeNumber ( n . floatValue ( ) ) ; return ; } else if ( n instanceof Short ) { writeNumber ( n . shortValue ( ) ) ; return ; } else if ( n instanceof Byte ) { writeNumber ( n . byteValue ( ) ) ; return ; } else if ( n instanceof BigInteger ) { writeNumber ( ( BigInteger ) n ) ; return ; } else if ( n instanceof BigDecimal ) { writeNumber ( ( BigDecimal ) n ) ; return ; // then Atomic types
} else if ( n instanceof AtomicInteger ) { writeNumber ( ( ( AtomicInteger ) n ) . get ( ) ) ; return ; } else if ( n instanceof AtomicLong ) { writeNumber ( ( ( AtomicLong ) n ) . get ( ) ) ; return ; } } else if ( value instanceof Boolean ) { writeBoolean ( ( ( Boolean ) value ) . booleanValue ( ) ) ; return ; } else if ( value instanceof AtomicBoolean ) { writeBoolean ( ( ( AtomicBoolean ) value ) . get ( ) ) ; return ; } throw new IllegalStateException ( "No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed " + value . getClass ( ) . getName ( ) + ")" ) ; |
public class DayCountConvention_ACT_ACT_ICMA { /** * / * ( non - Javadoc )
* @ see net . finmath . time . daycount . DayCountConventionInterface # getDaycountFraction ( org . threeten . bp . LocalDate , org . threeten . bp . LocalDate ) */
@ Override public double getDaycountFraction ( LocalDate startDate , LocalDate endDate ) { } } | if ( startDate . isAfter ( endDate ) ) { return - getDaycountFraction ( endDate , startDate ) ; } int periodIndexEndDate = Collections . binarySearch ( periods , new Period ( endDate , endDate , endDate , endDate ) ) ; int periodIndexStartDate = Collections . binarySearch ( periods , new Period ( startDate , startDate , startDate , startDate ) ) ; if ( periodIndexEndDate < 0 ) { periodIndexEndDate = - periodIndexEndDate - 1 ; } if ( periodIndexStartDate < 0 ) { periodIndexStartDate = - periodIndexStartDate - 1 ; } else { periodIndexStartDate = periodIndexStartDate + 1 ; } Period startDatePeriod = periods . get ( periodIndexStartDate ) ; Period endDatePeriod = periods . get ( periodIndexEndDate ) ; double periodFraction = getDaycount ( startDate , startDatePeriod . getPeriodEnd ( ) ) / getDaycount ( startDatePeriod . getPeriodStart ( ) , startDatePeriod . getPeriodEnd ( ) ) + getDaycount ( endDatePeriod . getPeriodStart ( ) , endDate ) / getDaycount ( endDatePeriod . getPeriodStart ( ) , endDatePeriod . getPeriodEnd ( ) ) + ( periodIndexEndDate - periodIndexStartDate ) - 1 ; return periodFraction / frequency ; |
public class UniversalProjectReader { /** * Open a database and build a set of table names .
* @ param url database URL
* @ return set containing table names */
private Set < String > populateTableNames ( String url ) throws SQLException { } } | Set < String > tableNames = new HashSet < String > ( ) ; Connection connection = null ; ResultSet rs = null ; try { connection = DriverManager . getConnection ( url ) ; DatabaseMetaData dmd = connection . getMetaData ( ) ; rs = dmd . getTables ( null , null , null , null ) ; while ( rs . next ( ) ) { tableNames . add ( rs . getString ( "TABLE_NAME" ) . toUpperCase ( ) ) ; } } finally { if ( rs != null ) { rs . close ( ) ; } if ( connection != null ) { connection . close ( ) ; } } return tableNames ; |
public class QueryExecutorImpl { /** * Send a query to the backend . */
private void sendQuery ( Query query , V3ParameterList parameters , int maxRows , int fetchSize , int flags , ResultHandler resultHandler , BatchResultHandler batchHandler ) throws IOException , SQLException { } } | // Now the query itself .
Query [ ] subqueries = query . getSubqueries ( ) ; SimpleParameterList [ ] subparams = parameters . getSubparams ( ) ; // We know this is deprecated , but still respect it in case anyone ' s using it .
// PgJDBC its self no longer does .
@ SuppressWarnings ( "deprecation" ) boolean disallowBatching = ( flags & QueryExecutor . QUERY_DISALLOW_BATCHING ) != 0 ; if ( subqueries == null ) { flushIfDeadlockRisk ( query , disallowBatching , resultHandler , batchHandler , flags ) ; // If we saw errors , don ' t send anything more .
if ( resultHandler . getException ( ) == null ) { sendOneQuery ( ( SimpleQuery ) query , ( SimpleParameterList ) parameters , maxRows , fetchSize , flags ) ; } } else { for ( int i = 0 ; i < subqueries . length ; ++ i ) { final Query subquery = subqueries [ i ] ; flushIfDeadlockRisk ( subquery , disallowBatching , resultHandler , batchHandler , flags ) ; // If we saw errors , don ' t send anything more .
if ( resultHandler . getException ( ) != null ) { break ; } // In the situation where parameters is already
// NO _ PARAMETERS it cannot know the correct
// number of array elements to return in the
// above call to getSubparams ( ) , so it must
// return null which we check for here .
SimpleParameterList subparam = SimpleQuery . NO_PARAMETERS ; if ( subparams != null ) { subparam = subparams [ i ] ; } sendOneQuery ( ( SimpleQuery ) subquery , subparam , maxRows , fetchSize , flags ) ; } } |
public class EncryptedToken { /** * Parses a key - value pair string such as " param1 = WdfaA , param2 = AZrr , param3 " into a map .
* < p > Keys with no value are assigned an empty string for convenience . The ` valueMapper ` function is applied to
* all values of the map < / p >
* @ param kvString a string containing key value pairs . Multiple pairs are separated by comma ' , '
* and the keys are separated from the values by the equal sign " = "
* @ param valueMapper a function that will be applied to the parsed values . Use Functions . identity to keep the original value .
* @ return a String - String Map */
private static Map < String , String > parseKeyValueMap ( String kvString , Function < String , String > valueMapper ) { } } | return Stream . of ( Optional . ofNullable ( kvString ) . map ( StringUtils :: trimAllWhitespace ) . filter ( StringUtils :: hasText ) . map ( s -> s . split ( PAIR_SEPARATOR ) ) . orElse ( new String [ 0 ] ) ) . map ( StringUtils :: trimAllWhitespace ) . map ( pair -> pair . split ( KEY_VALUE_SEPARATOR , 2 ) ) . collect ( toMap ( FIRST . andThen ( StringUtils :: trimAllWhitespace ) , SECOND . andThen ( StringUtils :: trimAllWhitespace ) . andThen ( valueMapper ) ) ) ; |
public class BatchSampler { /** * Samples a batch of indices in the range [ 0 , numExamples ) without replacement . */
public int [ ] sampleBatchWithoutReplacement ( ) { } } | int [ ] batch = new int [ batchSize ] ; for ( int i = 0 ; i < batch . length ; i ++ ) { if ( cur == indices . length ) { cur = 0 ; } if ( cur == 0 ) { IntArrays . shuffle ( indices ) ; } batch [ i ] = indices [ cur ++ ] ; } return batch ; |
public class AMRRuleSetProcessor { /** * / * ( non - Javadoc )
* @ see com . yahoo . labs . samoa . core . Processor # process ( com . yahoo . labs . samoa . core . ContentEvent ) */
@ Override public boolean process ( ContentEvent event ) { } } | if ( event instanceof InstanceContentEvent ) { this . processInstanceEvent ( ( InstanceContentEvent ) event ) ; } else if ( event instanceof PredicateContentEvent ) { PredicateContentEvent pce = ( PredicateContentEvent ) event ; if ( pce . getRuleSplitNode ( ) == null ) { this . updateLearningNode ( pce ) ; } else { this . updateRuleSplitNode ( pce ) ; } } else if ( event instanceof RuleContentEvent ) { RuleContentEvent rce = ( RuleContentEvent ) event ; if ( rce . isRemoving ( ) ) { this . removeRule ( rce . getRuleNumberID ( ) ) ; } else { addRule ( rce . getRule ( ) ) ; } } return true ; |
public class appfwprofile_contenttype_binding { /** * Use this API to fetch appfwprofile _ contenttype _ binding resources of given name . */
public static appfwprofile_contenttype_binding [ ] get ( nitro_service service , String name ) throws Exception { } } | appfwprofile_contenttype_binding obj = new appfwprofile_contenttype_binding ( ) ; obj . set_name ( name ) ; appfwprofile_contenttype_binding response [ ] = ( appfwprofile_contenttype_binding [ ] ) obj . get_resources ( service ) ; return response ; |
public class AtomContainerManipulator { /** * This method will reset all atom configuration to UNSET .
* This method is the reverse of { @ link # percieveAtomTypesAndConfigureAtoms ( org . openscience . cdk . interfaces . IAtomContainer ) }
* and after a call to this method all atoms will be " unconfigured " .
* Note that it is not a complete reversal of { @ link # percieveAtomTypesAndConfigureAtoms ( org . openscience . cdk . interfaces . IAtomContainer ) }
* since the atomic symbol of the atoms remains unchanged . Also , all the flags that were set
* by the configuration method ( such as IS _ HYDROGENBOND _ ACCEPTOR or ISAROMATIC ) will be set to False .
* @ param container The molecule , whose atoms are to be unconfigured
* @ see # percieveAtomTypesAndConfigureAtoms ( org . openscience . cdk . interfaces . IAtomContainer ) */
public static void clearAtomConfigurations ( IAtomContainer container ) { } } | for ( IAtom atom : container . atoms ( ) ) { atom . setAtomTypeName ( ( String ) CDKConstants . UNSET ) ; atom . setMaxBondOrder ( ( IBond . Order ) CDKConstants . UNSET ) ; atom . setBondOrderSum ( ( Double ) CDKConstants . UNSET ) ; atom . setCovalentRadius ( ( Double ) CDKConstants . UNSET ) ; atom . setValency ( ( Integer ) CDKConstants . UNSET ) ; atom . setFormalCharge ( ( Integer ) CDKConstants . UNSET ) ; atom . setHybridization ( ( IAtomType . Hybridization ) CDKConstants . UNSET ) ; atom . setFormalNeighbourCount ( ( Integer ) CDKConstants . UNSET ) ; atom . setFlag ( CDKConstants . IS_HYDROGENBOND_ACCEPTOR , false ) ; atom . setFlag ( CDKConstants . IS_HYDROGENBOND_DONOR , false ) ; atom . setProperty ( CDKConstants . CHEMICAL_GROUP_CONSTANT , CDKConstants . UNSET ) ; atom . setFlag ( CDKConstants . ISAROMATIC , false ) ; atom . setProperty ( "org.openscience.cdk.renderer.color" , CDKConstants . UNSET ) ; atom . setExactMass ( ( Double ) CDKConstants . UNSET ) ; } |
public class CmsToolbar { /** * Helper method for setting toolbar visibility . < p >
* @ param toolbar the toolbar
* @ param show true if the toolbar should be shown
* @ param toolbarVisibility the style variable controlling the toolbar visibility */
public static void showToolbar ( final CmsToolbar toolbar , final boolean show , final CmsStyleVariable toolbarVisibility ) { } } | if ( show ) { toolbarVisibility . setValue ( null ) ; } else { toolbarVisibility . setValue ( I_CmsLayoutBundle . INSTANCE . toolbarCss ( ) . toolbarHide ( ) ) ; } |
public class HtmlDocletWriter { /** * Return the link to the given package .
* @ param pkg the package to link to .
* @ param label the label for the link .
* @ return a content tree for the package link . */
public Content getPackageLink ( PackageDoc pkg , Content label ) { } } | boolean included = pkg != null && pkg . isIncluded ( ) ; if ( ! included ) { for ( PackageDoc p : configuration . packages ) { if ( p . equals ( pkg ) ) { included = true ; break ; } } } if ( included || pkg == null ) { return getHyperLink ( pathString ( pkg , DocPaths . PACKAGE_SUMMARY ) , label ) ; } else { DocLink crossPkgLink = getCrossPackageLink ( utils . getPackageName ( pkg ) ) ; if ( crossPkgLink != null ) { return getHyperLink ( crossPkgLink , label ) ; } else { return label ; } } |
public class csvserver_stats { /** * Use this API to fetch statistics of csvserver _ stats resource of given name . */
public static csvserver_stats get ( nitro_service service , String name ) throws Exception { } } | csvserver_stats obj = new csvserver_stats ( ) ; obj . set_name ( name ) ; csvserver_stats response = ( csvserver_stats ) obj . stat_resource ( service ) ; return response ; |
public class AbstractAmazonDynamoDBAsync { /** * Simplified method form for invoking the DeleteItem operation .
* @ see # deleteItemAsync ( DeleteItemRequest ) */
@ Override public java . util . concurrent . Future < DeleteItemResult > deleteItemAsync ( String tableName , java . util . Map < String , AttributeValue > key ) { } } | return deleteItemAsync ( new DeleteItemRequest ( ) . withTableName ( tableName ) . withKey ( key ) ) ; |
public class LogTable { /** * Add this record ( Always called from the record class ) .
* @ exception DBException File exception . */
public void add ( Rec fieldList ) throws DBException { } } | super . add ( fieldList ) ; this . logTrx ( ( FieldList ) fieldList , ProxyConstants . ADD ) ; |
import java . util . Arrays ; import java . util . Collections ; class CheckMonotonic { /** * Checks if array elements are either consistently increasing or decreasing .
* Examples :
* is _ monotonic ( [ 1 , 2 , 4 , 20 ] ) - > True
* is _ monotonic ( [ 1 , 20 , 4 , 10 ] ) - > False
* is _ monotonic ( [ 4 , 1 , 0 , - 10 ] ) - > True */
public static boolean isMonotonic ( Integer [ ] array ) { } } | Integer [ ] sortedArray = array . clone ( ) ; Integer [ ] reversedArray = array . clone ( ) ; Arrays . sort ( sortedArray ) ; Arrays . sort ( reversedArray , Collections . reverseOrder ( ) ) ; return Arrays . equals ( array , sortedArray ) || Arrays . equals ( array , reversedArray ) ; |
public class CProductLocalServiceBaseImpl { /** * Deletes the c product from the database . Also notifies the appropriate model listeners .
* @ param cProduct the c product
* @ return the c product that was removed */
@ Indexable ( type = IndexableType . DELETE ) @ Override public CProduct deleteCProduct ( CProduct cProduct ) { } } | return cProductPersistence . remove ( cProduct ) ; |
public class MutableDoubleArrayTrieInteger { /** * 转移状态
* @ param state
* @ param codePoint
* @ return */
public int transfer ( int state , int codePoint ) { } } | if ( state < 1 ) { return - 1 ; } if ( ( state != 1 ) && ( isEmpty ( state ) ) ) { return - 1 ; } int [ ] ids = this . charMap . toIdList ( codePoint ) ; if ( ids . length == 0 ) { return - 1 ; } return transfer ( state , ids ) ; |
public class CassandraExecutionDAO { /** * This is a dummy implementation and this feature is not implemented
* for Cassandra backed Conductor */
@ Override public List < Task > getTasks ( String taskType , String startKey , int count ) { } } | throw new UnsupportedOperationException ( "This method is not implemented in CassandraExecutionDAO. Please use ExecutionDAOFacade instead." ) ; |
public class ProcessExecutorImpl { /** * Method that creates the event log based on the passed in params */
EventWaitInstance createEventWaitInstances ( Long actInstId , String [ ] pEventNames , String [ ] pWakeUpEventTypes , boolean [ ] pEventOccurances , boolean notifyIfArrived , boolean reregister ) throws DataAccessException , ProcessException { } } | try { EventWaitInstance ret = null ; Long documentId = null ; String pCompCode = null ; int i ; for ( i = 0 ; i < pEventNames . length ; i ++ ) { pCompCode = pWakeUpEventTypes [ i ] ; documentId = edao . recordEventWait ( pEventNames [ i ] , ! pEventOccurances [ i ] , 3600 , // TODO set this value in designer !
actInstId , pWakeUpEventTypes [ i ] ) ; if ( logger . isInfoEnabled ( ) ) { logger . info ( "registered event wait event='" + pEventNames [ i ] + "' actInst=" + actInstId + ( pEventOccurances [ i ] ? " as recurring" : " as broadcast-waiting" ) ) ; } if ( documentId != null && ! reregister ) break ; } if ( documentId != null && ! reregister ) { if ( logger . isInfoEnabled ( ) ) { logger . info ( ( notifyIfArrived ? "notify" : "return" ) + " event before registration: event='" + pEventNames [ i ] + "' actInst=" + actInstId ) ; } if ( pCompCode != null && pCompCode . length ( ) == 0 ) pCompCode = null ; if ( notifyIfArrived ) { ActivityInstance actInst = edao . getActivityInstance ( actInstId ) ; resumeActivityInstance ( actInst , pCompCode , documentId , null , 0 ) ; edao . removeEventWaitForActivityInstance ( actInstId , "activity notified" ) ; } else { edao . removeEventWaitForActivityInstance ( actInstId , "activity to notify is returned" ) ; } ret = new EventWaitInstance ( ) ; ret . setMessageDocumentId ( documentId ) ; ret . setCompletionCode ( pCompCode ) ; Document docvo = edao . getDocument ( documentId , true ) ; edao . updateDocumentInfo ( docvo ) ; } return ret ; } catch ( SQLException e ) { throw new ProcessException ( - 1 , e . getMessage ( ) , e ) ; } catch ( MdwException e ) { throw new ProcessException ( - 1 , e . getMessage ( ) , e ) ; } |
public class FilterServletResponseWrapper { /** * Ferme le flux .
* @ throws IOException e */
public void close ( ) throws IOException { } } | if ( writer != null ) { writer . close ( ) ; } else if ( stream != null ) { stream . close ( ) ; } |
public class JsonSchema { /** * Get optional property from a { @ link JsonObject } for a { @ link String } key .
* If key does ' nt exists returns { @ link # DEFAULT _ VALUE _ FOR _ OPTIONAL _ PROPERTY } .
* @ param jsonObject
* @ param key
* @ return */
private String getOptionalProperty ( JsonObject jsonObject , String key ) { } } | return jsonObject . has ( key ) ? jsonObject . get ( key ) . getAsString ( ) : DEFAULT_VALUE_FOR_OPTIONAL_PROPERTY ; |
public class ModuleConfigImpl { /** * / * ( non - Javadoc )
* @ see org . jboss . as . cli . handlers . module . ModuleConfig # getDependencies ( ) */
@ Override public Collection < Dependency > getDependencies ( ) { } } | return dependencies == null ? Collections . < Dependency > emptyList ( ) : dependencies ; |
public class Range { /** * Sums the boundaries of this range with the ones of the passed . So the returned range has
* this . min + plus . min as minimum and this . max + plus . max as maximum respectively .
* @ return a range object whose boundaries are summed */
public Range sumBoundaries ( final Range plus ) { } } | int newMin = min + plus . min ; int newMax = max == RANGE_MAX || plus . max == RANGE_MAX ? RANGE_MAX : max + plus . max ; return new Range ( newMin , newMax ) ; |
public class BinaryIntExpressionHelper { /** * writes a std compare . This involves the tokens IF _ ICMPEQ , IF _ ICMPNE ,
* IF _ ICMPEQ , IF _ ICMPNE , IF _ ICMPGE , IF _ ICMPGT , IF _ ICMPLE and IF _ ICMPLT
* @ param type the token type
* @ return true if a successful std compare write */
protected boolean writeStdCompare ( int type , boolean simulate ) { } } | type = type - COMPARE_NOT_EQUAL ; // look if really compare
if ( type < 0 || type > 7 ) return false ; if ( ! simulate ) { MethodVisitor mv = getController ( ) . getMethodVisitor ( ) ; OperandStack operandStack = getController ( ) . getOperandStack ( ) ; // operands are on the stack already
int bytecode = stdCompareCodes [ type ] ; Label l1 = new Label ( ) ; mv . visitJumpInsn ( bytecode , l1 ) ; mv . visitInsn ( ICONST_1 ) ; Label l2 = new Label ( ) ; mv . visitJumpInsn ( GOTO , l2 ) ; mv . visitLabel ( l1 ) ; mv . visitInsn ( ICONST_0 ) ; mv . visitLabel ( l2 ) ; operandStack . replace ( ClassHelper . boolean_TYPE , 2 ) ; } return true ; |
public class DefaultGroovyMethods { /** * A helper method to allow lists to work with subscript operators .
* < pre class = " groovyTestCase " > def list = [ " a " , true , 42 , 9.4]
* list [ 1 , 4 ] = [ " x " , false ]
* assert list = = [ " a " , " x " , 42 , 9.4 , false ] < / pre >
* @ param self a List
* @ param splice the subset of the list to set
* @ param values the value to put at the given sublist
* @ since 1.0 */
public static void putAt ( List self , List splice , List values ) { } } | if ( splice . isEmpty ( ) ) { if ( ! values . isEmpty ( ) ) throw new IllegalArgumentException ( "Trying to replace 0 elements with " + values . size ( ) + " elements" ) ; return ; } Object first = splice . iterator ( ) . next ( ) ; if ( first instanceof Integer ) { if ( values . size ( ) != splice . size ( ) ) throw new IllegalArgumentException ( "Trying to replace " + splice . size ( ) + " elements with " + values . size ( ) + " elements" ) ; Iterator < ? > valuesIter = values . iterator ( ) ; for ( Object index : splice ) { putAt ( self , ( Integer ) index , valuesIter . next ( ) ) ; } } else { throw new IllegalArgumentException ( "Can only index a List with another List of Integers, not a List of " + first . getClass ( ) . getName ( ) ) ; } |
public class SessionDriver { /** * Set the priority for this session in the ClusterManager
* @ param prio the priority of this session
* @ throws IOException */
public void setPriority ( SessionPriority prio ) throws IOException { } } | if ( failException != null ) { throw failException ; } sessionInfo . priority = prio ; SessionInfo newInfo = new SessionInfo ( sessionInfo ) ; cmNotifier . addCall ( new ClusterManagerService . sessionUpdateInfo_args ( sessionId , newInfo ) ) ; |
public class TransformProcessRecordReader { /** * Load multiple records from the given a list of { @ link RecordMetaData } instances < br >
* @ param recordMetaDatas Metadata for the records that we want to load from
* @ return Multiple records for the given RecordMetaData instances
* @ throws IOException If I / O error occurs during loading */
@ Override public List < Record > loadFromMetaData ( List < RecordMetaData > recordMetaDatas ) throws IOException { } } | return recordReader . loadFromMetaData ( recordMetaDatas ) ; |
public class ExcelDataProviderImpl { /** * A utility method that setups up data members which are arrays .
* @ param memberInfo
* A { @ link DataMemberInformation } object that represents values pertaining to every data member .
* @ throws IllegalAccessException
* @ throws ArrayIndexOutOfBoundsException
* @ throws IllegalArgumentException
* @ throws InstantiationException */
private void setValueForArrayType ( DataMemberInformation memberInfo ) throws IllegalAccessException , ArrayIndexOutOfBoundsException , IllegalArgumentException , InstantiationException { } } | logger . entering ( memberInfo ) ; Field eachField = memberInfo . getField ( ) ; Object objectToSetDataInto = memberInfo . getObjectToSetDataInto ( ) ; String data = memberInfo . getDataToUse ( ) ; Class < ? > eachFieldType = eachField . getType ( ) ; // We are dealing with arrays
String [ ] arrayData = data . split ( "," ) ; Object arrayObject ; // Check if its an array of primitive data type
if ( ReflectionUtils . isPrimitiveArray ( eachFieldType ) ) { arrayObject = ReflectionUtils . instantiatePrimitiveArray ( eachFieldType , arrayData ) ; eachField . set ( objectToSetDataInto , arrayObject ) ; logger . exiting ( ) ; return ; } if ( ReflectionUtils . isWrapperArray ( eachFieldType ) || ReflectionUtils . hasOneArgStringConstructor ( eachFieldType . getComponentType ( ) ) ) { // Check if its an array of either Wrapper classes or classes that have a 1 arg string constructor
arrayObject = ReflectionUtils . instantiateWrapperArray ( eachFieldType , arrayData ) ; eachField . set ( objectToSetDataInto , arrayObject ) ; logger . exiting ( ) ; return ; } DefaultCustomType customType = fetchMatchingCustomType ( eachFieldType ) ; if ( customType != null ) { // Maybe it belongs to one of the custom types
arrayObject = ReflectionUtils . instantiateDefaultCustomTypeArray ( customType , arrayData ) ; eachField . set ( objectToSetDataInto , arrayObject ) ; logger . exiting ( ) ; return ; } // If we are here then it means that the field is a Pojo class that points to another sheet in the excel sheet
arrayObject = Array . newInstance ( eachFieldType . getComponentType ( ) , arrayData . length ) ; for ( int counter = 0 ; counter < arrayData . length ; counter ++ ) { Array . set ( arrayObject , counter , getSingleExcelRow ( eachFieldType . getComponentType ( ) . newInstance ( ) , arrayData [ counter ] . trim ( ) , true ) ) ; } eachField . set ( objectToSetDataInto , arrayObject ) ; logger . exiting ( ) ; |
public class ChainedProperty { /** * Parses a chained property .
* @ param info Info for Storable type containing property
* @ param str string to parse
* @ throws IllegalArgumentException if any parameter is null or string
* format is incorrect */
@ SuppressWarnings ( "unchecked" ) public static < S extends Storable > ChainedProperty < S > parse ( StorableInfo < S > info , String str ) throws IllegalArgumentException { } } | if ( info == null || str == null ) { throw new IllegalArgumentException ( ) ; } int pos = 0 ; int dot = str . indexOf ( '.' , pos ) ; String name ; if ( dot < 0 ) { name = str . trim ( ) ; } else { name = str . substring ( pos , dot ) . trim ( ) ; pos = dot + 1 ; } List < Boolean > outerJoinList = null ; if ( name . startsWith ( "(" ) && name . endsWith ( ")" ) ) { outerJoinList = new ArrayList < Boolean > ( 4 ) ; outerJoinList . add ( true ) ; name = name . substring ( 1 , name . length ( ) - 1 ) . trim ( ) ; } StorableProperty < S > prime = info . getAllProperties ( ) . get ( name ) ; if ( prime == null ) { throw new IllegalArgumentException ( "Property \"" + name + "\" not found for type: \"" + info . getStorableType ( ) . getName ( ) + '"' ) ; } if ( pos <= 0 ) { if ( outerJoinList == null || ! outerJoinList . get ( 0 ) ) { return get ( prime ) ; } else { return get ( prime , null , new boolean [ ] { true } ) ; } } List < StorableProperty < ? > > chain = new ArrayList < StorableProperty < ? > > ( 4 ) ; Class < ? > type = prime . getType ( ) ; while ( pos > 0 ) { dot = str . indexOf ( '.' , pos ) ; if ( dot < 0 ) { name = str . substring ( pos ) . trim ( ) ; pos = - 1 ; } else { name = str . substring ( pos , dot ) . trim ( ) ; pos = dot + 1 ; } if ( name . startsWith ( "(" ) && name . endsWith ( ")" ) ) { if ( outerJoinList == null ) { outerJoinList = new ArrayList < Boolean > ( 4 ) ; // Fill in false values .
outerJoinList . add ( false ) ; // prime is inner join
for ( int i = chain . size ( ) ; -- i >= 0 ; ) { outerJoinList . add ( false ) ; } } outerJoinList . add ( true ) ; name = name . substring ( 1 , name . length ( ) - 1 ) . trim ( ) ; } else if ( outerJoinList != null ) { outerJoinList . add ( false ) ; } if ( Storable . class . isAssignableFrom ( type ) ) { StorableInfo propInfo = StorableIntrospector . examine ( ( Class < ? extends Storable > ) type ) ; Map < String , ? extends StorableProperty < ? > > props = propInfo . getAllProperties ( ) ; StorableProperty < ? > prop = props . get ( name ) ; if ( prop == null ) { throw new IllegalArgumentException ( "Property \"" + name + "\" not found for type: \"" + type . getName ( ) + '"' ) ; } chain . add ( prop ) ; type = prop . isJoin ( ) ? prop . getJoinedType ( ) : prop . getType ( ) ; } else { throw new IllegalArgumentException ( "Property \"" + name + "\" not found for type \"" + type . getName ( ) + "\" because it has no properties" ) ; } } boolean [ ] outerJoin = null ; if ( outerJoinList != null ) { outerJoin = new boolean [ outerJoinList . size ( ) ] ; for ( int i = outerJoinList . size ( ) ; -- i >= 0 ; ) { outerJoin [ i ] = outerJoinList . get ( i ) ; } } return get ( prime , ( StorableProperty < ? > [ ] ) chain . toArray ( new StorableProperty [ chain . size ( ) ] ) , outerJoin ) ; |
public class AmazonSNSClient { /** * Prepares to subscribe an endpoint by sending the endpoint a confirmation message . To actually create a
* subscription , the endpoint owner must call the < code > ConfirmSubscription < / code > action with the token from the
* confirmation message . Confirmation tokens are valid for three days .
* This action is throttled at 100 transactions per second ( TPS ) .
* @ param subscribeRequest
* Input for Subscribe action .
* @ return Result of the Subscribe operation returned by the service .
* @ throws SubscriptionLimitExceededException
* Indicates that the customer already owns the maximum allowed number of subscriptions .
* @ throws FilterPolicyLimitExceededException
* Indicates that the number of filter polices in your AWS account exceeds the limit . To add more filter
* polices , submit an SNS Limit Increase case in the AWS Support Center .
* @ throws InvalidParameterException
* Indicates that a request parameter does not comply with the associated constraints .
* @ throws InternalErrorException
* Indicates an internal service error .
* @ throws NotFoundException
* Indicates that the requested resource does not exist .
* @ throws AuthorizationErrorException
* Indicates that the user has been denied access to the requested resource .
* @ throws InvalidSecurityException
* The credential signature isn ' t valid . You must use an HTTPS endpoint and sign your request using
* Signature Version 4.
* @ sample AmazonSNS . Subscribe
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / sns - 2010-03-31 / Subscribe " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public SubscribeResult subscribe ( SubscribeRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeSubscribe ( request ) ; |
public class KnowledgeSessionFactory { /** * 创建一个用于批处理的BatchSession对象 , 这里默认将开启10个普通的线程池来运行提交的批处理任务 , 第二个参数用来决定单个线程处理的任务数
* @ param knowledgePackage 创建BatchSession对象所需要的KnowledgePackage对象
* @ param batchSize 单个线程处理的任务数
* @ return 返回一个新的BatchSession对象 */
public static BatchSession newBatchSessionByBatchSize ( KnowledgePackage knowledgePackage , int batchSize ) { } } | return new BatchSessionImpl ( knowledgePackage , BatchSession . DEFAULT_THREAD_SIZE , batchSize ) ; |
public class View { /** * Get all views that have the same prefix if specified .
* The prefix ends with slash ' / ' character .
* @ return An array of all views with the same prefix . */
@ InterfaceAudience . Private protected List < View > getViewsInGroup ( ) { } } | List < View > views = new ArrayList < View > ( ) ; int slash = name . indexOf ( '/' ) ; if ( slash > 0 ) { String prefix = name . substring ( 0 , slash + 1 ) ; for ( View view : database . getAllViews ( ) ) { if ( view . name . startsWith ( prefix ) ) views . add ( view ) ; } } else views . add ( this ) ; return views ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.