signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class PKIXRevocationChecker { /** * Sets the OCSP responses . These responses are used to determine * the revocation status of the specified certificates when OCSP is used . * @ param responses a map of OCSP responses . Each key is an * { @ code X509Certificate } that maps to the corresponding * DER - encoded OCSP response for that certificate . A deep copy of * the map is performed to protect against subsequent modification . */ public void setOcspResponses ( Map < X509Certificate , byte [ ] > responses ) { } }
if ( responses == null ) { this . ocspResponses = Collections . < X509Certificate , byte [ ] > emptyMap ( ) ; } else { Map < X509Certificate , byte [ ] > copy = new HashMap < > ( responses . size ( ) ) ; for ( Map . Entry < X509Certificate , byte [ ] > e : responses . entrySet ( ) ) { copy . put ( e . getKey ( ) , e . getValue ( ) . clone ( ) ) ; } this . ocspResponses = copy ; }
public class SpeakUtil { /** * Notes that the specified user was privy to the specified message . If { @ link * ChatMessage # timestamp } is not already filled in , it will be . */ protected static void noteMessage ( SpeakObject sender , Name username , UserMessage msg ) { } }
// fill in the message ' s time stamp if necessary if ( msg . timestamp == 0L ) { msg . timestamp = System . currentTimeMillis ( ) ; } // Log . info ( " Noted that " + username + " heard " + msg + " . " ) ; // notify any message observers _messageOp . init ( sender , username , msg ) ; _messageObs . apply ( _messageOp ) ;
public class MetaZone { /** * Find the metazone that applies for a given timestamp . */ public String applies ( ZonedDateTime d ) { } }
long epoch = d . toEpochSecond ( ) ; for ( int i = 0 ; i < size ; i ++ ) { Entry entry = entries [ i ] ; if ( entry . from == - 1 ) { if ( entry . to == - 1 || epoch < entry . to ) { return entry . metazoneId ; } } else if ( entry . to == - 1 ) { if ( entry . from <= epoch ) { return entry . metazoneId ; } } else if ( entry . from <= epoch && epoch < entry . to ) { return entry . metazoneId ; } } return null ;
public class LdapUtils { /** * New pooled connection factory pooled connection factory . * @ param l the ldap properties * @ return the pooled connection factory */ public static PooledConnectionFactory newLdaptivePooledConnectionFactory ( final AbstractLdapProperties l ) { } }
val cp = newLdaptiveBlockingConnectionPool ( l ) ; return new PooledConnectionFactory ( cp ) ;
public class SecStrucCalc { /** * Calculate the coordinates of the H atoms . They are usually * missing in the PDB files as only few experimental methods allow * to resolve their location . */ private void calculateHAtoms ( ) throws StructureException { } }
for ( int i = 0 ; i < groups . length - 1 ; i ++ ) { SecStrucGroup a = groups [ i ] ; SecStrucGroup b = groups [ i + 1 ] ; if ( ! b . hasAtom ( "H" ) ) { // Atom H = calc _ H ( a . getC ( ) , b . getN ( ) , b . getCA ( ) ) ; Atom H = calcSimple_H ( a . getC ( ) , a . getO ( ) , b . getN ( ) ) ; b . setH ( H ) ; } }
public class InstanceValidator { /** * / * private void validateAnswerCode ( List < ValidationMessage > errors , Element value , NodeStack stack , List < Coding > optionList ) { * String system = value . getNamedChildValue ( " system " ) ; * String code = value . getNamedChildValue ( " code " ) ; * boolean found = false ; * for ( Coding c : optionList ) { * if ( ObjectUtil . equals ( c . getSystem ( ) , system ) & & ObjectUtil . equals ( c . getCode ( ) , code ) ) { * found = true ; * break ; * rule ( errors , IssueType . STRUCTURE , value . line ( ) , value . col ( ) , stack . getLiteralPath ( ) , found , " The code " + system + " : : " + code + " is not a valid option " ) ; */ private void validateAnswerCode ( List < ValidationMessage > errors , Element value , NodeStack stack , Questionnaire qSrc , Reference ref , boolean theOpenChoice ) { } }
ValueSet vs = resolveBindingReference ( qSrc , ref ) ; if ( warning ( errors , IssueType . CODEINVALID , value . line ( ) , value . col ( ) , stack . getLiteralPath ( ) , vs != null , "ValueSet " + describeReference ( ref ) + " not found" ) ) { try { Coding c = readAsCoding ( value ) ; if ( isBlank ( c . getCode ( ) ) && isBlank ( c . getSystem ( ) ) && isNotBlank ( c . getDisplay ( ) ) ) { if ( theOpenChoice ) { return ; } } long t = System . nanoTime ( ) ; ValidationResult res = context . validateCode ( c , vs ) ; txTime = txTime + ( System . nanoTime ( ) - t ) ; if ( ! res . isOk ( ) ) rule ( errors , IssueType . CODEINVALID , value . line ( ) , value . col ( ) , stack . getLiteralPath ( ) , false , "The value provided (" + c . getSystem ( ) + "::" + c . getCode ( ) + ") is not in the options value set in the questionnaire" ) ; } catch ( Exception e ) { warning ( errors , IssueType . CODEINVALID , value . line ( ) , value . col ( ) , stack . getLiteralPath ( ) , false , "Error " + e . getMessage ( ) + " validating Coding against Questionnaire Options" ) ; } }
public class DataObject { /** * Returns a String where references to DataObject values are replaced with actual values . * E . g . reference $ { Firstname } will be replaced with property ' Firstname ' value . * @ param format * @ return */ public String format ( String format ) { } }
Matcher m = REF . matcher ( format ) ; StringBuffer sb = new StringBuffer ( ) ; while ( m . find ( ) ) { Object ob = get ( m . group ( 1 ) ) ; if ( ob != null ) { m . appendReplacement ( sb , ob . toString ( ) ) ; } else { m . appendReplacement ( sb , m . group ( ) ) ; } } m . appendTail ( sb ) ; return sb . toString ( ) ;
public class AbstractValidate { /** * Method without varargs to increase performance */ public < T extends Iterable < ? > > T noNullElements ( final T iterable , final String message ) { } }
notNull ( iterable ) ; final int index = indexOfNullElement ( iterable ) ; if ( index != - 1 ) { fail ( String . format ( message , index ) ) ; } return iterable ;
public class MetricQueryService { /** * Starts the MetricQueryService actor in the given actor system . * @ param rpcService The rpcService running the MetricQueryService * @ param resourceID resource ID to disambiguate the actor name * @ return actor reference to the MetricQueryService */ public static MetricQueryService createMetricQueryService ( RpcService rpcService , ResourceID resourceID , long maximumFrameSize ) { } }
String endpointId = resourceID == null ? METRIC_QUERY_SERVICE_NAME : METRIC_QUERY_SERVICE_NAME + "_" + resourceID . getResourceIdString ( ) ; return new MetricQueryService ( rpcService , endpointId , maximumFrameSize ) ;
public class XSynchronizedExpressionImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setParam ( XExpression newParam ) { } }
if ( newParam != param ) { NotificationChain msgs = null ; if ( param != null ) msgs = ( ( InternalEObject ) param ) . eInverseRemove ( this , EOPPOSITE_FEATURE_BASE - XbasePackage . XSYNCHRONIZED_EXPRESSION__PARAM , null , msgs ) ; if ( newParam != null ) msgs = ( ( InternalEObject ) newParam ) . eInverseAdd ( this , EOPPOSITE_FEATURE_BASE - XbasePackage . XSYNCHRONIZED_EXPRESSION__PARAM , null , msgs ) ; msgs = basicSetParam ( newParam , msgs ) ; if ( msgs != null ) msgs . dispatch ( ) ; } else if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , XbasePackage . XSYNCHRONIZED_EXPRESSION__PARAM , newParam , newParam ) ) ;
public class WireTapHelper { /** * If the " org . talend . esb . sam . agent . log . messageContent " property value is " true " then log the message content * If it is " false " then skip the message content logging * Else fall back to global property " log . messageContent " * @ param message * @ param logMessageContent * @ param logMessageContentOverride * @ return */ public static boolean isMessageContentToBeLogged ( final Message message , final boolean logMessageContent , boolean logMessageContentOverride ) { } }
/* * If controlling of logging behavior is not allowed externally * then log according to global property value */ if ( ! logMessageContentOverride ) { return logMessageContent ; } Object logMessageContentExtObj = message . getContextualProperty ( EXTERNAL_PROPERTY_NAME ) ; if ( null == logMessageContentExtObj ) { return logMessageContent ; } else if ( logMessageContentExtObj instanceof Boolean ) { return ( ( Boolean ) logMessageContentExtObj ) . booleanValue ( ) ; } else if ( logMessageContentExtObj instanceof String ) { String logMessageContentExtVal = ( String ) logMessageContentExtObj ; if ( logMessageContentExtVal . equalsIgnoreCase ( "true" ) ) { return true ; } else if ( logMessageContentExtVal . equalsIgnoreCase ( "false" ) ) { return false ; } else { return logMessageContent ; } } else { return logMessageContent ; }
public class RegistriesInner { /** * Regenerates one of the login credentials for the specified container registry . * @ param resourceGroupName The name of the resource group to which the container registry belongs . * @ param registryName The name of the container registry . * @ param name Specifies name of the password which should be regenerated - - password or password2 . Possible values include : ' password ' , ' password2' * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the RegistryListCredentialsResultInner object */ public Observable < ServiceResponse < RegistryListCredentialsResultInner > > regenerateCredentialWithServiceResponseAsync ( String resourceGroupName , String registryName , PasswordName name ) { } }
if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( registryName == null ) { throw new IllegalArgumentException ( "Parameter registryName is required and cannot be null." ) ; } if ( name == null ) { throw new IllegalArgumentException ( "Parameter name is required and cannot be null." ) ; } final String apiVersion = "2017-10-01" ; RegenerateCredentialParameters regenerateCredentialParameters = new RegenerateCredentialParameters ( ) ; regenerateCredentialParameters . withName ( name ) ; return service . regenerateCredential ( this . client . subscriptionId ( ) , resourceGroupName , registryName , apiVersion , this . client . acceptLanguage ( ) , regenerateCredentialParameters , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < RegistryListCredentialsResultInner > > > ( ) { @ Override public Observable < ServiceResponse < RegistryListCredentialsResultInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < RegistryListCredentialsResultInner > clientResponse = regenerateCredentialDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class Node { /** * Insert the specified node into the DOM before this node ( i . e . as a preceding sibling ) . * @ param node to add before this node * @ return this node , for chaining * @ see # after ( Node ) */ public Node before ( Node node ) { } }
Validate . notNull ( node ) ; Validate . notNull ( parentNode ) ; parentNode . addChildren ( siblingIndex , node ) ; return this ;
public class GrantFlowEntitlementsRequest { /** * The list of entitlements that you want to grant . * @ param entitlements * The list of entitlements that you want to grant . */ public void setEntitlements ( java . util . Collection < GrantEntitlementRequest > entitlements ) { } }
if ( entitlements == null ) { this . entitlements = null ; return ; } this . entitlements = new java . util . ArrayList < GrantEntitlementRequest > ( entitlements ) ;
public class SQLParsingEngine { /** * Parse SQL . * @ param useCache use cache or not * @ return parsed SQL statement */ public SQLStatement parse ( final boolean useCache ) { } }
Optional < SQLStatement > cachedSQLStatement = getSQLStatementFromCache ( useCache ) ; if ( cachedSQLStatement . isPresent ( ) ) { return cachedSQLStatement . get ( ) ; } LexerEngine lexerEngine = LexerEngineFactory . newInstance ( dbType , sql ) ; SQLStatement result = SQLParserFactory . newInstance ( dbType , shardingRule , lexerEngine , shardingTableMetaData , sql ) . parse ( ) ; if ( useCache ) { parsingResultCache . put ( sql , result ) ; } return result ;
public class RefreshMemoryMirror { /** * 判断对象是否过期 * @ param refreshObject * @ return */ private boolean isExpired ( RefreshObject refreshObject ) { } }
if ( refreshObject == null ) { return false ; } Calendar calendar = Calendar . getInstance ( ) ; calendar . setTimeInMillis ( refreshObject . getTimestamp ( ) ) ; // calendar . add ( Calendar . SECOND , period . intValue ( ) ) ; calendar . add ( Calendar . MILLISECOND , period . intValue ( ) ) ; Date now = new Date ( ) ; return now . after ( calendar . getTime ( ) ) ;
public class BinaryExpressionEvaluator { /** * Utility methods */ static public long div ( double lv , double rv ) { } }
/* * There is often confusion on how integer division , remainder and modulus work on negative numbers . In fact , * there are two valid answers to - 14 div 3 : either ( the intuitive ) - 4 as in the Toolbox , or - 5 as in e . g . * Standard ML [ Paulson91 ] . It is therefore appropriate to explain these operations in some detail . Integer * division is defined using floor and real number division : x / y < 0 : x div y = - floor ( abs ( - x / y ) ) x / y > = 0 : x * div y = floor ( abs ( x / y ) ) Note that the order of floor and abs on the right - hand side makes a difference , the * above example would yield - 5 if we changed the order . This is because floor always yields a smaller ( or * equal ) integer , e . g . floor ( 14/3 ) is 4 while floor ( - 14/3 ) is - 5. */ if ( lv / rv < 0 ) { return ( long ) - Math . floor ( Math . abs ( lv / rv ) ) ; } else { return ( long ) Math . floor ( Math . abs ( - lv / rv ) ) ; }
public class StringUtil { /** * Converts the specified byte array into a hexadecimal value and appends it to the specified buffer . */ public static < T extends Appendable > T toHexString ( T dst , byte [ ] src , int offset , int length ) { } }
assert length >= 0 ; if ( length == 0 ) { return dst ; } final int end = offset + length ; final int endMinusOne = end - 1 ; int i ; // Skip preceding zeroes . for ( i = offset ; i < endMinusOne ; i ++ ) { if ( src [ i ] != 0 ) { break ; } } byteToHexString ( dst , src [ i ++ ] ) ; int remaining = end - i ; toHexStringPadded ( dst , src , i , remaining ) ; return dst ;
public class NameNode { /** * Stub for 0.20 clients that don ' t support HDFS - 630 */ public LocatedBlock addBlock ( String src , String clientName ) throws IOException { } }
return addBlock ( src , clientName , null ) ;
public class ProteinNameLister { /** * - - - - - main ( ) method - - - - - */ public static void main ( String [ ] args ) { } }
if ( args . length != 1 ) { System . out . println ( "\nUse Parameter: path (to biopax OWL files)\n" ) ; System . exit ( - 1 ) ; } BioPAXIOHandler reader = new SimpleIOHandler ( ) ; final String pathname = args [ 0 ] ; File testDir = new File ( pathname ) ; /* * Customized Fetcher is to fix the issue with Level2 * - when NEXT - STEP leads out of the pathway . . . * ( do not worry - those pathway steps that are part of * the pathway must be in the PATHWAY - COMPONENTS set ) */ Filter < PropertyEditor > nextStepPropertyFilter = new Filter < PropertyEditor > ( ) { public boolean filter ( PropertyEditor editor ) { return ! editor . getProperty ( ) . equals ( "NEXT-STEP" ) ; } } ; fetcher = new Fetcher ( SimpleEditorMap . L2 , nextStepPropertyFilter ) ; FilenameFilter filter = new FilenameFilter ( ) { public boolean accept ( File dir , String name ) { return ( name . endsWith ( "owl" ) ) ; } } ; for ( String s : testDir . list ( filter ) ) { try { process ( pathname , s , reader ) ; } catch ( Exception e ) { log . error ( "Failed at testing " + s , e ) ; } }
public class UpdatableResultSet { /** * { inheritDoc } . */ public void updateCharacterStream ( int columnIndex , Reader reader , int length ) throws SQLException { } }
updateCharacterStream ( columnIndex , reader , ( long ) length ) ;
public class MyVector { /** * Calculates the associated normalized Vector of this Vector * @ return the associated normalized Vector of this Vector */ public MyVector normalize ( ) { } }
double vmodule = module ( ) ; double [ ] associatedVector = new double [ vector . length ] ; for ( int i = 0 ; i < vector . length ; i ++ ) { associatedVector [ i ] = ( 1 / vmodule ) * vector [ i ] ; } return new MyVector ( associatedVector ) ;
public class FacebookRestClient { /** * Call the specified method , with the given parameters , and return a DOM tree with the results . * @ param method the fieldName of the method * @ param paramPairs a list of arguments to the method * @ throws Exception with a description of any errors given to us by the server . */ protected T callMethod ( IFacebookMethod method , Collection < Pair < String , CharSequence > > paramPairs ) throws FacebookException , IOException { } }
HashMap < String , CharSequence > params = new HashMap < String , CharSequence > ( 2 * method . numTotalParams ( ) ) ; params . put ( "method" , method . methodName ( ) ) ; params . put ( "api_key" , _apiKey ) ; params . put ( "v" , TARGET_API_VERSION ) ; String format = getResponseFormat ( ) ; if ( null != format ) { params . put ( "format" , format ) ; } if ( method . requiresSession ( ) ) { params . put ( "call_id" , Long . toString ( System . currentTimeMillis ( ) ) ) ; params . put ( "session_key" , _sessionKey ) ; } CharSequence oldVal ; for ( Pair < String , CharSequence > p : paramPairs ) { oldVal = params . put ( p . first , p . second ) ; if ( oldVal != null ) System . err . printf ( "For parameter %s, overwrote old value %s with new value %s." , p . first , oldVal , p . second ) ; } assert ( ! params . containsKey ( "sig" ) ) ; String signature = generateSignature ( FacebookSignatureUtil . convert ( params . entrySet ( ) ) , method . requiresSession ( ) ) ; params . put ( "sig" , signature ) ; boolean doHttps = this . isDesktop ( ) && FacebookMethod . AUTH_GET_SESSION . equals ( method ) ; InputStream data = method . takesFile ( ) ? postFileRequest ( method . methodName ( ) , params ) : postRequest ( method . methodName ( ) , params , doHttps , /* doEncode */ true ) ; return parseCallResult ( data , method ) ;
public class MultiContentHandler { /** * Reads the content and adds it into the email . This method is expected to * update the content of the { @ code email } parameter . * While the method signature accepts any { @ link Content } instance as * parameter , the method will fail if anything other than a * { @ link MultiContent } is provided . * @ param email * the email to put the content in * @ param content * the unprocessed content * @ throws ContentHandlerException * the handler is unable to add the content to the email * @ throws IllegalArgumentException * the content provided is not of the right type */ @ Override public void setContent ( final SendGrid . Email email , final Content content ) throws ContentHandlerException { } }
if ( email == null ) { throw new IllegalArgumentException ( "[email] cannot be null" ) ; } if ( content == null ) { throw new IllegalArgumentException ( "[content] cannot be null" ) ; } if ( content instanceof MultiContent ) { for ( Content subContent : ( ( MultiContent ) content ) . getContents ( ) ) { delegate . setContent ( email , subContent ) ; } } else { throw new IllegalArgumentException ( "This instance can only work with MultiContent instances, but was passed " + content . getClass ( ) . getSimpleName ( ) ) ; }
public class ELHelper { /** * This method will process a configuration value for LdapSearchScope setting in * { @ link LdapIdentityStoreDefinition } . It will first check to see if there is an * EL expression . It there is , it will return the evaluated expression ; otherwise , it * will return the non - EL value . * @ param name The name of the property . Used for error messages . * @ param expression The EL expression returned from from the identity store definition . * @ param value The non - EL value . * @ param immediateOnly Return null if the value is a deferred EL expression . * @ return Either the evaluated EL expression or the non - EL value . */ protected LdapSearchScope processLdapSearchScope ( String name , String expression , LdapSearchScope value , boolean immediateOnly ) { } }
LdapSearchScope result ; boolean immediate = false ; /* * The expression language value takes precedence over the direct setting . */ if ( expression . isEmpty ( ) ) { /* * Direct setting . */ result = value ; } else { /* * Evaluate the EL expression to get the value . */ Object obj = evaluateElExpression ( expression ) ; if ( obj instanceof LdapSearchScope ) { result = ( LdapSearchScope ) obj ; immediate = isImmediateExpression ( expression ) ; } else if ( obj instanceof String ) { result = LdapSearchScope . valueOf ( ( ( String ) obj ) . toUpperCase ( ) ) ; immediate = isImmediateExpression ( expression ) ; } else { throw new IllegalArgumentException ( "Expected '" + name + "' to evaluate to an LdapSearchScope type." ) ; } } return ( immediateOnly && ! immediate ) ? null : result ;
public class ThriftConnectionPool { /** * 根据配置获取原始连接的方法 * @ param serverInfo * thrift服务器信息 * @ return thrift客户端连接对象 * @ throws ThriftConnectionPoolException * 当获取连接出现问题时抛出该异常 */ private ThriftConnection < T > obtainRawInternalConnection ( ThriftServerInfo serverInfo ) throws ThriftConnectionPoolException { } }
// 判断单服务还是多服务模式 ThriftConnection < T > connection ; if ( this . thriftServiceType == ThriftServiceType . SINGLE_INTERFACE ) { connection = new DefaultThriftConnection < > ( serverInfo . getHost ( ) , serverInfo . getPort ( ) , this . connectionTimeOut , this . config . getThriftProtocol ( ) , this . config . getClientClass ( ) ) ; } else { connection = new MulitServiceThriftConnecion < > ( serverInfo . getHost ( ) , serverInfo . getPort ( ) , this . connectionTimeOut , this . config . getThriftProtocol ( ) , this . config . getThriftClientClasses ( ) ) ; } return connection ;
public class DeviceImpl { /** * remove an attribute of the device . Not possible to remove State or Status * @ param attribute * @ throws DevFailed */ public synchronized void removeAttribute ( final AttributeImpl attribute ) throws DevFailed { } }
if ( attribute . getName ( ) . equalsIgnoreCase ( STATUS_NAME ) || attribute . getName ( ) . equalsIgnoreCase ( STATE_NAME ) ) { return ; } pollingManager . removeAttributePolling ( attribute . getName ( ) ) ; statusImpl . removeAttributeAlarm ( attribute . getName ( ) ) ; stateImpl . removeAttributeAlarm ( attribute . getName ( ) ) ; attributeList . remove ( attribute ) ;
public class AtomPlacer3D { /** * Gets the first placed Heavy Atom around atomA which is not atomB . * @ param molecule * @ param atomA Description of the Parameter * @ param atomB Description of the Parameter * @ return The placedHeavyAtom value */ public IAtom getPlacedHeavyAtom ( IAtomContainer molecule , IAtom atomA , IAtom atomB ) { } }
List < IBond > bonds = molecule . getConnectedBondsList ( atomA ) ; for ( IBond bond : bonds ) { IAtom connectedAtom = bond . getOther ( atomA ) ; if ( isPlacedHeavyAtom ( connectedAtom ) && ! connectedAtom . equals ( atomB ) ) { return connectedAtom ; } } return null ;
public class EntityMappingsImpl { /** * Returns all < code > named - stored - procedure - query < / code > elements * @ return list of < code > named - stored - procedure - query < / code > */ public List < NamedStoredProcedureQuery < EntityMappings < T > > > getAllNamedStoredProcedureQuery ( ) { } }
List < NamedStoredProcedureQuery < EntityMappings < T > > > list = new ArrayList < NamedStoredProcedureQuery < EntityMappings < T > > > ( ) ; List < Node > nodeList = childNode . get ( "named-stored-procedure-query" ) ; for ( Node node : nodeList ) { NamedStoredProcedureQuery < EntityMappings < T > > type = new NamedStoredProcedureQueryImpl < EntityMappings < T > > ( this , "named-stored-procedure-query" , childNode , node ) ; list . add ( type ) ; } return list ;
public class Model { /** * Overrides attribute values from input map . The input map may have attributes whose name do not match the * attribute names ( columns ) of this model . Such attributes will be ignored . Those values whose names are * not present in the argument map , will stay untouched . The input map may have only partial list of attributes . * @ param input map with attributes to overwrite this models ' . Keys are names of attributes of this model , values * are new values for it . */ public < T extends Model > T fromMap ( Map input ) { } }
Set < String > changedAttributeNames = hydrate ( input , false ) ; dirtyAttributeNames . addAll ( changedAttributeNames ) ; return ( T ) this ;
public class XPathScanner { /** * Reads the string char by char and returns one token by call . The scanning * starts in the start state , if not further specified before , and specifies * the next scanner state and the type of the future token according to its * first char . As soon as the current char does not fit the conditions for * the current token type , the token is generated and returned . * @ return token The new token . */ public IXPathToken nextToken ( ) { } }
// some tokens start in another state than the START state mState = mStartState ; // reset startState mStartState = State . START ; mOutput = new StringBuilder ( ) ; mFinnished = false ; mType = TokenType . INVALID ; mLastPos = mPos ; do { mInput = mQuery . charAt ( mPos ) ; switch ( mState ) { case START : // specify token type according to first char scanStart ( ) ; break ; case NUMBER : // number scanNumber ( ) ; break ; case TEXT : // some text , could be a name scanText ( ) ; break ; case SPECIAL2 : // special character that could have 2 digits scanTwoDigitSpecial ( ) ; break ; case COMMENT : scanComment ( ) ; break ; case E_NUM : scanENum ( ) ; break ; default : mPos ++ ; mFinnished = true ; } } while ( ! mFinnished || mPos >= mQuery . length ( ) ) ; if ( mCommentCount > 0 ) { throw new IllegalStateException ( "Error in Query. Comment does not end." ) ; } return new VariableXPathToken ( mOutput . toString ( ) , mType ) ;
public class MarkerUtil { /** * Create an Eclipse marker for given BugInstance . * @ param javaProject * the project * @ param monitor */ public static void createMarkers ( final IJavaProject javaProject , final SortedBugCollection theCollection , final ISchedulingRule rule , IProgressMonitor monitor ) { } }
if ( monitor . isCanceled ( ) ) { return ; } final List < MarkerParameter > bugParameters = createBugParameters ( javaProject , theCollection , monitor ) ; if ( monitor . isCanceled ( ) ) { return ; } WorkspaceJob wsJob = new WorkspaceJob ( "Creating SpotBugs markers" ) { @ Override public IStatus runInWorkspace ( IProgressMonitor monitor1 ) throws CoreException { IProject project = javaProject . getProject ( ) ; try { new MarkerReporter ( bugParameters , theCollection , project ) . run ( monitor1 ) ; } catch ( CoreException e ) { FindbugsPlugin . getDefault ( ) . logException ( e , "Core exception on add marker" ) ; return e . getStatus ( ) ; } return monitor1 . isCanceled ( ) ? Status . CANCEL_STATUS : Status . OK_STATUS ; } } ; wsJob . setRule ( rule ) ; wsJob . setSystem ( true ) ; wsJob . setUser ( false ) ; wsJob . schedule ( ) ;
public class CountingLittleEndianDataInputStream { /** * Reads an unsigned { @ code short } as specified by * { @ link DataInputStream # readUnsignedShort ( ) } , except using little - endian * byte order . * @ return the next two bytes of the input stream , interpreted as an * unsigned 16 - bit integer in little - endian byte order * @ throws IOException * if an I / O error occurs */ @ Override public int readUnsignedShort ( ) throws IOException { } }
byte b1 = readAndCheckByte ( ) ; byte b2 = readAndCheckByte ( ) ; return Ints . fromBytes ( ( byte ) 0 , ( byte ) 0 , b2 , b1 ) ;
public class Hierarchy { /** * Determine if one reference type is a subtype of another . * @ param t * a reference type * @ param possibleSupertype * the possible supertype * @ return true if t is a subtype of possibleSupertype , false if not */ public static boolean isSubtype ( ReferenceType t , ReferenceType possibleSupertype ) throws ClassNotFoundException { } }
return Global . getAnalysisCache ( ) . getDatabase ( Subtypes2 . class ) . isSubtype ( t , possibleSupertype ) ;
public class CmsSitemapController { /** * Adds the entry to the navigation . < p > * @ param entry the entry */ public void addToNavigation ( CmsClientSitemapEntry entry ) { } }
entry . setInNavigation ( true ) ; CmsSitemapChange change = new CmsSitemapChange ( entry . getId ( ) , entry . getSitePath ( ) , ChangeType . modify ) ; CmsPropertyModification mod = new CmsPropertyModification ( entry . getId ( ) , CmsClientProperty . PROPERTY_NAVTEXT , entry . getTitle ( ) , true ) ; change . setPropertyChanges ( Collections . singletonList ( mod ) ) ; change . setPosition ( entry . getPosition ( ) ) ; commitChange ( change , null ) ;
public class RedisCommandFactory { /** * Returns a Redis Commands interface instance for the given interface . * @ param commandInterface must not be { @ literal null } . * @ param < T > command interface type . * @ return the implemented Redis Commands interface . */ public < T extends Commands > T getCommands ( Class < T > commandInterface ) { } }
LettuceAssert . notNull ( commandInterface , "Redis Command Interface must not be null" ) ; RedisCommandsMetadata metadata = new DefaultRedisCommandsMetadata ( commandInterface ) ; InvocationProxyFactory factory = new InvocationProxyFactory ( ) ; factory . addInterface ( commandInterface ) ; BatchAwareCommandLookupStrategy lookupStrategy = new BatchAwareCommandLookupStrategy ( new CompositeCommandLookupStrategy ( ) , metadata ) ; factory . addInterceptor ( new DefaultMethodInvokingInterceptor ( ) ) ; factory . addInterceptor ( new CommandFactoryExecutorMethodInterceptor ( metadata , lookupStrategy ) ) ; return factory . createProxy ( commandInterface . getClassLoader ( ) ) ;
public class StencilOperands { /** * Given a BigInteger , narrow it to an Integer or Long if it fits and the * arguments class allow it . * The rules are : if either arguments is a BigInteger , no narrowing will occur * if either arguments is a Long , no narrowing to Integer will occur * @ param lhs * the left hand side operand that lead to the bigi result * @ param rhs * the right hand side operand that lead to the bigi result * @ param bigi * the BigInteger to narrow * @ return an Integer or Long if narrowing is possible , the original * BigInteger otherwise */ protected Number narrowBigInteger ( Object lhs , Object rhs , BigInteger bigi ) { } }
// coerce to long if possible if ( ! ( lhs instanceof BigInteger || rhs instanceof BigInteger ) && bigi . compareTo ( BIGI_LONG_MAX_VALUE ) <= 0 && bigi . compareTo ( BIGI_LONG_MIN_VALUE ) >= 0 ) { // coerce to int if possible long l = bigi . longValue ( ) ; // coerce to int when possible ( int being so often used in method parms ) if ( ! ( lhs instanceof Long || rhs instanceof Long ) && l <= Integer . MAX_VALUE && l >= Integer . MIN_VALUE ) { return Integer . valueOf ( ( int ) l ) ; } return Long . valueOf ( l ) ; } return bigi ;
public class MethodContentAnalyzer { /** * Searches for own project method invoke instructions in the given list . * @ param instructions The instructions where to search * @ return The found project methods */ Set < ProjectMethod > findProjectMethods ( final List < Instruction > instructions ) { } }
final Set < ProjectMethod > projectMethods = new HashSet < > ( ) ; addProjectMethods ( instructions , projectMethods ) ; return projectMethods ;
public class AbstractNumber { /** * This method is used in constructor that takes byte [ ] or ByteArrayInputStream as parameter . Decodes digits part . * @ param bis * @ return - number of bytes reads * @ throws IllegalArgumentException - thrown if read error is encountered . */ public int decodeDigits ( ByteArrayInputStream bis ) throws ParameterException { } }
if ( skipDigits ( ) ) { return 0 ; } if ( bis . available ( ) == 0 ) { throw new ParameterException ( "No more data to read." ) ; } // FIXME : we could spare time by passing length arg - or getting it from // bis ? ? int count = 0 ; try { address = "" ; int b = 0 ; while ( bis . available ( ) - 1 > 0 ) { b = ( byte ) bis . read ( ) ; int d1 = b & 0x0f ; int d2 = ( b & 0xf0 ) >> 4 ; address += Integer . toHexString ( d1 ) + Integer . toHexString ( d2 ) ; } b = bis . read ( ) & 0xff ; address += Integer . toHexString ( ( b & 0x0f ) ) ; if ( oddFlag != _FLAG_ODD ) { address += Integer . toHexString ( ( b & 0xf0 ) >> 4 ) ; } this . setAddress ( address ) ; } catch ( Exception e ) { throw new ParameterException ( e ) ; } return count ;
public class MolecularFormulaManipulator { /** * Adjust the protonation of a molecular formula . This utility method adjusts the hydrogen isotope count * and charge at the same time . * < pre > * IMolecularFormula mf = MolecularFormulaManipulator . getMolecularFormula ( " [ C6H5O ] - " , bldr ) ; * MolecularFormulaManipulator . adjustProtonation ( mf , + 1 ) ; / / now " C6H6O " * MolecularFormulaManipulator . adjustProtonation ( mf , - 1 ) ; / / now " C6H5O - " * < / pre > * The return value indicates whether the protonation could be adjusted : * < pre > * IMolecularFormula mf = MolecularFormulaManipulator . getMolecularFormula ( " [ Cl ] - " , bldr ) ; * MolecularFormulaManipulator . adjustProtonation ( mf , + 0 ) ; / / false still " [ Cl ] - " * MolecularFormulaManipulator . adjustProtonation ( mf , + 1 ) ; / / true now " HCl " * MolecularFormulaManipulator . adjustProtonation ( mf , - 1 ) ; / / true now " [ Cl ] - " ( again ) * MolecularFormulaManipulator . adjustProtonation ( mf , - 1 ) ; / / false still " [ Cl ] - " ( no H to remove ! ) * < / pre > * The method tries to select an existing hydrogen isotope to augment . If no hydrogen isotopes are found * a new major isotope ( < sup > 1 < / sup > H ) is created . * @ param mf molecular formula * @ param hcnt the number of hydrogens to add / remove , ( & gt ; 0 protonate : , & lt ; 0 : deprotonate ) * @ return the protonation was be adjusted */ public static boolean adjustProtonation ( IMolecularFormula mf , int hcnt ) { } }
if ( mf == null ) throw new NullPointerException ( "No formula provided" ) ; if ( hcnt == 0 ) return false ; // no protons to add final IChemObjectBuilder bldr = mf . getBuilder ( ) ; final int chg = mf . getCharge ( ) != null ? mf . getCharge ( ) : 0 ; IIsotope proton = null ; int pcount = 0 ; for ( IIsotope iso : mf . isotopes ( ) ) { if ( "H" . equals ( iso . getSymbol ( ) ) ) { final int count = mf . getIsotopeCount ( iso ) ; if ( count < hcnt ) continue ; // acceptable if ( proton == null && ( iso . getMassNumber ( ) == null || iso . getMassNumber ( ) == 1 ) ) { proton = iso ; pcount = count ; } // better else if ( proton != null && iso . getMassNumber ( ) != null && iso . getMassNumber ( ) == 1 && proton . getMassNumber ( ) == null ) { proton = iso ; pcount = count ; } } } if ( proton == null && hcnt < 0 ) { return false ; } else if ( proton == null && hcnt > 0 ) { proton = bldr . newInstance ( IIsotope . class , "H" ) ; proton . setMassNumber ( 1 ) ; } mf . removeIsotope ( proton ) ; if ( pcount + hcnt > 0 ) mf . addIsotope ( proton , pcount + hcnt ) ; mf . setCharge ( chg + hcnt ) ; return true ;
public class KeyVaultClientBaseImpl { /** * Sets the certificate contacts for the specified key vault . * Sets the certificate contacts for the specified key vault . This operation requires the certificates / managecontacts permission . * @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net . * @ param contacts The contacts for the key vault certificate . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the Contacts object */ public Observable < Contacts > setCertificateContactsAsync ( String vaultBaseUrl , Contacts contacts ) { } }
return setCertificateContactsWithServiceResponseAsync ( vaultBaseUrl , contacts ) . map ( new Func1 < ServiceResponse < Contacts > , Contacts > ( ) { @ Override public Contacts call ( ServiceResponse < Contacts > response ) { return response . body ( ) ; } } ) ;
public class ConfigurationKey { /** * Return the names of the variables specified in the key if any * @ return names ( might be zero sized ) */ public Collection < String > getVariableNames ( ) { } }
ImmutableSet . Builder < String > builder = ImmutableSet . builder ( ) ; for ( ConfigurationKeyPart p : parts ) { if ( p . isVariable ( ) ) { builder . add ( p . getValue ( ) ) ; } } return builder . build ( ) ;
public class ResetPasswordTenantOperationsListener { /** * Implementation */ private TenantOperationResponse prepareResponse ( final ITenant tenant ) { } }
try { sendResetPasswordEmail ( tenant ) ; } catch ( Exception e ) { log . error ( "Failed to send tenant admin email to address {} for tenant {}" , tenant . getAttribute ( ADMIN_CONTACT_EMAIL ) , tenant . getName ( ) , e ) ; final TenantOperationResponse error = new TenantOperationResponse ( this , TenantOperationResponse . Result . FAIL ) ; // Just a warning error . addMessage ( createLocalizedMessage ( UNABLE_TO_SEND_TENANT_ADMIN_EMAIL , new String [ ] { tenant . getAttribute ( ADMIN_CONTACT_EMAIL ) } ) ) ; return error ; } final TenantOperationResponse rslt = new TenantOperationResponse ( this , TenantOperationResponse . Result . SUCCESS ) ; rslt . addMessage ( createLocalizedMessage ( TENANT_ADMIN_EMAIL_SENT , new String [ ] { tenant . getAttribute ( ADMIN_CONTACT_EMAIL ) } ) ) ; return rslt ;
public class PreferenceActivity { /** * Obtains the text of the back button from the activity ' s theme . */ private void obtainBackButtonText ( ) { } }
CharSequence text ; try { text = ThemeUtil . getText ( this , R . attr . backButtonText ) ; } catch ( NotFoundException e ) { text = getText ( R . string . back_button_text ) ; } setBackButtonText ( text ) ;
public class ForwardBuilder { /** * Retrieves all end - entity certificates which satisfy constraints * and requirements specified in the parameters and PKIX state . */ private void getMatchingEECerts ( ForwardState currentState , List < CertStore > certStores , Collection < X509Certificate > eeCerts ) throws IOException { } }
if ( debug != null ) { debug . println ( "ForwardBuilder.getMatchingEECerts()..." ) ; } /* * Compose a certificate matching rule to filter out * certs which don ' t satisfy constraints * First , retrieve clone of current target cert constraints , * and then add more selection criteria based on current validation * state . Since selector never changes , cache local copy & reuse . */ if ( eeSelector == null ) { eeSelector = ( X509CertSelector ) targetCertConstraints . clone ( ) ; /* * Match on certificate validity date */ eeSelector . setCertificateValid ( buildParams . date ( ) ) ; /* * Policy processing optimizations */ if ( buildParams . explicitPolicyRequired ( ) ) { eeSelector . setPolicy ( getMatchingPolicies ( ) ) ; } /* * Require EE certs */ eeSelector . setBasicConstraints ( - 2 ) ; } /* Retrieve matching EE certs from CertStores */ addMatchingCerts ( eeSelector , certStores , eeCerts , searchAllCertStores ) ;
public class StagePathUtils { /** * = = = = = helper method = = = = = */ private static String getChannelId ( Long pipelineId ) { } }
Channel channel = ArbitrateConfigUtils . getChannel ( pipelineId ) ; return String . valueOf ( channel . getId ( ) ) ;
public class ClusterManager { /** * converts a long to a dot delimited IP address string . */ public String convertIPBackToString ( long ip ) { } }
StringBuffer sb = new StringBuffer ( 16 ) ; sb . append ( Long . toString ( ( ip >> 24 ) & 0xFF ) ) ; sb . append ( '.' ) ; sb . append ( Long . toString ( ( ip >> 16 ) & 0xFF ) ) ; sb . append ( '.' ) ; sb . append ( Long . toString ( ( ip >> 8 ) & 0xFF ) ) ; sb . append ( '.' ) ; sb . append ( Long . toString ( ip & 0xFF ) ) ; return sb . toString ( ) ;
public class Location { /** * Return a new { @ link Point } from { @ code this } location . If the * { @ link # latitude ( ) } or the { @ link # longitude ( ) } is not given , * { @ link Optional # empty ( ) } is returned * @ return a new { @ link Point } if the latitude and longitude is given , * { @ link Optional # empty ( ) } otherwise */ public Optional < Point > toPoint ( ) { } }
return latitude ( ) . flatMap ( lat -> longitude ( ) . map ( lon -> WayPoint . of ( lat , lon , _elevation , null ) ) ) ;
public class PrcAccEntryCopy { /** * < p > Process entity request . < / p > * @ param pAddParam additional param , e . g . return this line ' s * document in " nextEntity " for farther process * @ param pRequestData Request Data * @ param pEntity Entity to process * @ return Entity processed for farther process or null * @ throws Exception - an exception */ @ Override public final AccountingEntry process ( final Map < String , Object > pAddParam , final AccountingEntry pEntity , final IRequestData pRequestData ) throws Exception { } }
AccountingEntry entity = this . srvOrm . retrieveEntity ( pAddParam , pEntity ) ; AccountingEntries doc = getSrvOrm ( ) . retrieveEntityById ( pAddParam , AccountingEntries . class , entity . getSourceId ( ) ) ; if ( ! doc . getIdDatabaseBirth ( ) . equals ( getSrvOrm ( ) . getIdDatabase ( ) ) ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "can_not_make_entry_for_foreign_src" ) ; } entity . setIsNew ( true ) ; entity . setItsId ( null ) ; entity . setIdBirth ( null ) ; entity . setIdDatabaseBirth ( this . srvOrm . getIdDatabase ( ) ) ; entity . setItsDate ( new Date ( ) ) ; entity . setSourceType ( this . accountingEntriesTypeCode ) ; String docDescription ; if ( doc . getDescription ( ) != null ) { docDescription = doc . getDescription ( ) ; } else { docDescription = "" ; } String langDef = ( String ) pAddParam . get ( "langDef" ) ; DateFormat dateFormat = DateFormat . getDateTimeInstance ( DateFormat . MEDIUM , DateFormat . SHORT , new Locale ( langDef ) ) ; entity . setDescription ( getSrvI18n ( ) . getMsg ( AccountingEntries . class . getSimpleName ( ) + "short" , langDef ) + " #" + doc . getIdDatabaseBirth ( ) + "-" + doc . getItsId ( ) + ", " + dateFormat . format ( doc . getItsDate ( ) ) + ". " + docDescription ) ; // only local allowed entity . setIsNew ( true ) ; pRequestData . setAttribute ( "entity" , entity ) ; pRequestData . setAttribute ( "AccountingEntriesVersion" , doc . getItsVersion ( ) ) ; pRequestData . setAttribute ( "mngUvds" , this . mngUvdSettings ) ; pRequestData . setAttribute ( "srvOrm" , this . srvOrm ) ; pRequestData . setAttribute ( "srvDate" , this . srvDate ) ; pRequestData . setAttribute ( "hldCnvFtfsNames" , this . fieldConverterNamesHolder ) ; pRequestData . setAttribute ( "fctCnvFtfs" , this . convertersFieldsFatory ) ; return entity ;
public class Counters { /** * Divides every non - zero count in target by the corresponding value in the * denominator Counter . Beware that this can give NaN values for zero counts * in the denominator counter ! */ public static < E > void divideInPlace ( Counter < E > target , Counter < E > denominator ) { } }
for ( E key : target . keySet ( ) ) { target . setCount ( key , target . getCount ( key ) / denominator . getCount ( key ) ) ; }
public class AmazonDynamoDBAsyncClient { /** * Retrieves information about the table , including the current status of * the table , the primary key schema and when the table was created . * If the table does not exist , Amazon DynamoDB returns a * < code > ResourceNotFoundException < / code > . * @ param describeTableRequest Container for the necessary parameters to * execute the DescribeTable operation on AmazonDynamoDB . * @ return A Java Future object containing the response from the * DescribeTable service method , as returned by AmazonDynamoDB . * @ throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response . For example * if a network connection is not available . * @ throws AmazonServiceException * If an error response is returned by AmazonDynamoDB indicating * either a problem with the data in the request , or a server side issue . */ public Future < DescribeTableResult > describeTableAsync ( final DescribeTableRequest describeTableRequest ) throws AmazonServiceException , AmazonClientException { } }
return executorService . submit ( new Callable < DescribeTableResult > ( ) { public DescribeTableResult call ( ) throws Exception { return describeTable ( describeTableRequest ) ; } } ) ;
public class SimplifyVisitor { /** * Helpers . */ private static boolean isConstant ( @ Nullable ExprRootNode exprRoot ) { } }
return exprRoot != null && SimplifyExprVisitor . isConstant ( exprRoot . getRoot ( ) ) ;
public class JsMainAdminServiceImpl { /** * Creates SIBDestination objects and is added to destination list . * Destination is constructed from the queue or topic tags in server . xml * Creates default queue or topic if not provided by user in server . xml * Deals with destinations only of type Queue or Topic * Some properties even though not there in config it is set * to maintain backward compatibility with the runtime code . * @ param properties * @ param destinationList * @ param destinationType * @ param configAdmin */ private void populateDestinations ( Map < String , Object > properties , HashMap < String , BaseDestination > destinationList , HashMap < String , SIBLocalizationPoint > destinationLocalizationList , String meName , String destinationType , ConfigurationAdmin configAdmin , boolean modified ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "populateDestinations" , new Object [ ] { properties , destinationList , destinationLocalizationList , meName , destinationType , configAdmin } ) ; } String [ ] destinations = ( String [ ] ) properties . get ( destinationType ) ; // flag indicating if user have provided default queue or topic . // If user have overridden then we need to consider that instead of // using defaults boolean defaultQueueTopicProvided = false ; // flag indicating if user have provided the _ SYSTEM . Exception . Destination boolean exceptionDestinationProvided = false ; if ( destinations != null ) { for ( String destinationPid : destinations ) { pids . add ( destinationPid ) ; Configuration config = null ; try { config = configAdmin . getConfiguration ( destinationPid , bundleLocation ) ; } catch ( IOException e ) { SibTr . exception ( tc , e ) ; FFDCFilter . processException ( e , this . getClass ( ) . getName ( ) , "369" , this ) ; } Dictionary destinationProperties = config . getProperties ( ) ; SIBDestination destination = new SIBDestinationImpl ( ) ; SIBLocalizationPoint destinationLocalization = new SIBLocalizationPointImpl ( ) ; if ( destinationProperties != null ) { if ( destinationProperties . get ( JsAdminConstants . ID ) != null && ! destinationProperties . get ( JsAdminConstants . ID ) . toString ( ) . trim ( ) . isEmpty ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . debug ( this , tc , "Destination ID : " + destinationProperties . get ( JsAdminConstants . ID ) ) ; } String destinationName = ( String ) destinationProperties . get ( JsAdminConstants . ID ) ; // we hit this scenario when use have given same id for < queue > and < topic > // tags . We always consider queue first while constructing the destinations . // Hence we ignore the destinaiton if ( destinationList . containsKey ( destinationName ) ) { SibTr . warning ( tc , "SAME_DEST_ID_SIAS0123" , new Object [ ] { destinationName } ) ; continue ; } // set the name of the queue . Here ID is considered as the name destination . setName ( destinationName ) ; // set the destiantion type as Queue if ( destinationType . equals ( JsAdminConstants . QUEUE ) ) { destination . setDestinationType ( DestinationType . QUEUE ) ; if ( destinationProperties . get ( JsAdminConstants . ID ) . equals ( JsAdminConstants . DEFAULTQUEUE ) ) defaultQueueTopicProvided = true ; if ( destinationProperties . get ( JsAdminConstants . ID ) . equals ( JsAdminConstants . EXCEPTION_DESTINATION ) ) exceptionDestinationProvided = true ; } else { // TOPICSPACE destination . setDestinationType ( DestinationType . TOPICSPACE ) ; if ( destinationProperties . get ( JsAdminConstants . ID ) . equals ( JsAdminConstants . DEFAULTTOPIC ) ) defaultQueueTopicProvided = true ; } // here local is true and alias is false as we are negotiating the destination // of type Queue or Topic and not Alias or Foreign destination . setLocal ( true ) ; destination . setAlias ( false ) ; // The max and default have been replaced with forceReliability in the config // overrideOfQOSByProducerAllowed is removed from config but we have to pass // to admin hence it is set as true by default in SIBDestinationImpl String forceReliability = ( String ) destinationProperties . get ( JsAdminConstants . FORCERELIABILITY ) ; String defaultReliability = forceReliability ; String maxReliability = forceReliability ; // set the defaultReliability and maxReliability // if defaultReliability > maxReliability then consider the defaults for both // During modified if the condition is not satisfied , the old values are retained destination . setDefaultAndMaxReliability ( defaultReliability , maxReliability , jsMEConfig , modified ) ; // Set the exception destination String exceptionDest = ( String ) destinationProperties . get ( JsAdminConstants . EXCEPTIONDESTINATION ) ; if ( exceptionDest . trim ( ) . isEmpty ( ) ) destination . setExceptionDestination ( JsAdminConstants . EXCEPTION_DESTINATION ) ; else destination . setExceptionDestination ( exceptionDest ) ; String failedDeliveryPolicy = ( String ) destinationProperties . get ( JsAdminConstants . FAILEDDELIVERYPOLICY ) ; Long redeliveryInterval = ( Long ) destinationProperties . get ( JsAdminConstants . REDELIVERYINTERVAL ) ; if ( redeliveryInterval < 1 ) { redeliveryInterval = JsAdminConstants . DEFAULT_REDELIVERYINTERVAL_VALUE ; } destination . setBlockedRetryTimeout ( redeliveryInterval ) ; if ( failedDeliveryPolicy . equals ( JsAdminConstants . KEEP_TRYING ) ) { destination . setFailedDeliveryPolicy ( failedDeliveryPolicy ) ; destination . setExceptionDestination ( null ) ; } else if ( failedDeliveryPolicy . equals ( JsAdminConstants . DISCARD ) ) { destination . setExceptionDestination ( null ) ; // Exception Discard Reliability is the property which makes the messages ( having // reliability level less than whatever specified ) get discarded after trying // for a maximum number of attempts as specified in maxRedelivery count // Setting it to ASSUREDPERSISTENT , makes sure that all the messages will get discarded // once it reaches the maxRedelivery Count destination . setExceptionDiscardReliability ( JsAdminConstants . ASSUREDPERSISTENT ) ; } Integer maxRedeliveryCount = ( Integer ) destinationProperties . get ( JsAdminConstants . MAXREDELIVERYCOUNT ) ; destination . setMaxFailedDeliveries ( maxRedeliveryCount ) ; destination . setSendAllowed ( ( Boolean ) destinationProperties . get ( JsAdminConstants . SENDALLOWED ) ) ; destination . setReceiveAllowed ( ( Boolean ) destinationProperties . get ( JsAdminConstants . RECEIVEALLOWED ) ) ; // in liberty release the maintainstrictorder and receiveexclusive are // having the same value . This is because to get strict order // it is required to have a single consumer consuming the message Boolean maintainStrictOrder = ( Boolean ) destinationProperties . get ( JsAdminConstants . MAINTAINSTRICTORDER ) ; destination . setMaintainStrictOrder ( maintainStrictOrder ) ; destination . setReceiveExclusive ( maintainStrictOrder ) ; Long maxQueueDepth = ( Long ) destinationProperties . get ( JsAdminConstants . MAXMESSAGEDEPTH ) ; destination . setHighMessageThreshold ( maxQueueDepth ) ; } else { SibTr . error ( tc , "NO_ID_PROVIDED_SIAS0102" , new Object [ ] { destinationType } ) ; continue ; } // destination localization identifier is always in the format " destinationname @ mename " destinationLocalization . setIdentifier ( destination . getName ( ) + "@" + meName ) ; destinationLocalization . setSendAllowed ( destination . isSendAllowed ( ) ) ; destinationLocalization . setHighMsgThreshold ( destination . getHighMessageThreshold ( ) ) ; destinationList . put ( destination . getName ( ) , destination ) ; destinationLocalizationList . put ( destination . getName ( ) + "@" + meName , destinationLocalization ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . debug ( this , tc , "destinationProperties is null" ) ; } } } // end of for loop } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . debug ( this , tc , "No " + destinationType + "defined in server.xml" ) ; } } // create the default exception destiantion if ( destinationType . equals ( JsAdminConstants . QUEUE ) && ! exceptionDestinationProvided ) { if ( ! modified ) { SIBDestination exceptionDest = new SIBDestinationImpl ( JsAdminConstants . EXCEPTION_DESTINATION , DestinationType . QUEUE ) ; exceptionDest . setExceptionDestination ( null ) ; // set the exceptiondestination to empty as it itself is the exceptiondestiantion SIBLocalizationPoint exceptionDestLocalization = new SIBLocalizationPointImpl ( ) ; exceptionDestLocalization . setIdentifier ( exceptionDest . getName ( ) + "@" + meName ) ; exceptionDestLocalization . setSendAllowed ( exceptionDest . isSendAllowed ( ) ) ; exceptionDestLocalization . setHighMsgThreshold ( exceptionDest . getHighMessageThreshold ( ) ) ; destinationList . put ( exceptionDest . getName ( ) , exceptionDest ) ; destinationLocalizationList . put ( exceptionDest . getName ( ) + "@" + meName , exceptionDestLocalization ) ; } } // create defaults if not provided - during activate ( ) // if during modified the defaultQueue or defaultTopic is deleted , we // should not create the new defaults as the old has to be retained if ( destinationType . equals ( JsAdminConstants . QUEUE ) && ! defaultQueueTopicProvided ) { if ( ! modified ) { SIBDestination defaultQueue = new SIBDestinationImpl ( JsAdminConstants . DEFAULTQUEUE , DestinationType . QUEUE ) ; SIBLocalizationPoint defaultQueueLocalization = new SIBLocalizationPointImpl ( ) ; defaultQueueLocalization . setIdentifier ( defaultQueue . getName ( ) + "@" + meName ) ; defaultQueueLocalization . setSendAllowed ( defaultQueue . isSendAllowed ( ) ) ; defaultQueueLocalization . setHighMsgThreshold ( defaultQueue . getHighMessageThreshold ( ) ) ; destinationList . put ( defaultQueue . getName ( ) , defaultQueue ) ; destinationLocalizationList . put ( defaultQueue . getName ( ) + "@" + meName , defaultQueueLocalization ) ; } } else if ( destinationType . equals ( JsAdminConstants . TOPICSPACE ) && ! defaultQueueTopicProvided ) { if ( ! modified ) { SIBDestination defaultTopic = new SIBDestinationImpl ( JsAdminConstants . DEFAULTTOPIC , DestinationType . TOPICSPACE ) ; SIBLocalizationPoint defaultTopicLocalization = new SIBLocalizationPointImpl ( ) ; defaultTopicLocalization . setIdentifier ( defaultTopic . getName ( ) + "@" + meName ) ; defaultTopicLocalization . setSendAllowed ( defaultTopic . isSendAllowed ( ) ) ; defaultTopicLocalization . setHighMsgThreshold ( defaultTopic . getHighMessageThreshold ( ) ) ; destinationList . put ( defaultTopic . getName ( ) , defaultTopic ) ; destinationLocalizationList . put ( defaultTopic . getName ( ) + "@" + meName , defaultTopicLocalization ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , "populateDestiantions" , new Object [ ] { destinationList } ) ; }
public class SwingGroovyMethods { /** * Overloads the left shift operator to provide an easy way to add * components to a menu . < p > * @ param self a JMenu * @ param gstr a GString to be added to the menu . * @ return same menu , after the value was added to it . * @ since 1.6.4 */ public static JMenu leftShift ( JMenu self , GString gstr ) { } }
self . add ( gstr . toString ( ) ) ; return self ;
public class DRL6Expressions { /** * src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 771:1 : short _ key : { . . . } ? = > id = ID ; */ public final void short_key ( ) throws RecognitionException { } }
Token id = null ; try { // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 772:5 : ( { . . . } ? = > id = ID ) // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 772:12 : { . . . } ? = > id = ID { if ( ! ( ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . SHORT ) ) ) ) ) { if ( state . backtracking > 0 ) { state . failed = true ; return ; } throw new FailedPredicateException ( input , "short_key" , "(helper.validateIdentifierKey(DroolsSoftKeywords.SHORT))" ) ; } id = ( Token ) match ( input , ID , FOLLOW_ID_in_short_key4911 ) ; if ( state . failed ) return ; if ( state . backtracking == 0 ) { helper . emit ( id , DroolsEditorType . KEYWORD ) ; } } } catch ( RecognitionException re ) { throw re ; } finally { // do for sure before leaving }
public class GenbankReaderHelper { /** * Selecting lazySequenceLoad = true will parse the Genbank file and figure out the accessionid and offsets and return sequence objects * that can in the future read the sequence from the disk . This allows the loading of large Genbank files where you are only interested * in one sequence based on accession id . * @ param file * @ param lazySequenceLoad * @ return * @ throws Exception */ public static LinkedHashMap < String , ProteinSequence > readGenbankProteinSequence ( File file , boolean lazySequenceLoad ) throws Exception { } }
if ( ! lazySequenceLoad ) { return readGenbankProteinSequence ( file ) ; } GenbankReader < ProteinSequence , AminoAcidCompound > GenbankProxyReader = new GenbankReader < ProteinSequence , AminoAcidCompound > ( file , new GenericGenbankHeaderParser < ProteinSequence , AminoAcidCompound > ( ) , new FileProxyProteinSequenceCreator ( file , AminoAcidCompoundSet . getAminoAcidCompoundSet ( ) , new GenbankSequenceParser < AbstractSequence < AminoAcidCompound > , AminoAcidCompound > ( ) ) ) ; return GenbankProxyReader . process ( ) ;
public class AbstractBaseDestinationHandler { /** * Add data to given object for message store persistence . * @ param hm */ public void addPersistentData ( HashMap hm ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addPersistentData" , hm ) ; hm . put ( "name" , definition . getName ( ) ) ; hm . put ( "uuid" , definition . getUUID ( ) . toByteArray ( ) ) ; hm . put ( "maxReliability" , Integer . valueOf ( definition . getMaxReliability ( ) . toInt ( ) ) ) ; hm . put ( "defaultReliability" , Integer . valueOf ( definition . getDefaultReliability ( ) . toInt ( ) ) ) ; hm . put ( "destinationType" , Integer . valueOf ( definition . getDestinationType ( ) . toInt ( ) ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addPersistentData" ) ;
public class Authentication { /** * Checks if a username is locked because of to many failed login attempts * @ param username The username to check * @ return true if the user has a lock , false otherwise */ public boolean userHasLock ( String username ) { } }
Objects . requireNonNull ( username , Required . USERNAME . toString ( ) ) ; boolean lock = false ; Config config = Application . getInstance ( Config . class ) ; Cache cache = Application . getInstance ( CacheProvider . class ) . getCache ( CacheName . AUTH ) ; AtomicInteger counter = cache . getCounter ( username ) ; if ( counter != null && counter . get ( ) > config . getAuthenticationLock ( ) ) { lock = true ; } return lock ;
public class BotMetadataMarshaller { /** * Marshall the given parameter object . */ public void marshall ( BotMetadata botMetadata , ProtocolMarshaller protocolMarshaller ) { } }
if ( botMetadata == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( botMetadata . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( botMetadata . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( botMetadata . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( botMetadata . getLastUpdatedDate ( ) , LASTUPDATEDDATE_BINDING ) ; protocolMarshaller . marshall ( botMetadata . getCreatedDate ( ) , CREATEDDATE_BINDING ) ; protocolMarshaller . marshall ( botMetadata . getVersion ( ) , VERSION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Swift { /** * Url encode object path , and concatenate to current container URL to get full URL * @ param path The object path * @ return The object url */ private String getObjectUrl ( CPath path ) { } }
String containerUrl = getCurrentContainerUrl ( ) ; return containerUrl + path . getUrlEncoded ( ) ;
public class RestoreAgent { /** * Change the state of the restore agent based on the current state . */ private void changeState ( ) { } }
if ( m_state == State . RESTORE ) { fetchSnapshotTxnId ( ) ; exitRestore ( ) ; m_state = State . REPLAY ; /* * Add the interest here so that we can use the barriers in replay * agent to synchronize . */ m_snapshotMonitor . addInterest ( this ) ; m_replayAgent . replay ( ) ; } else if ( m_state == State . REPLAY ) { m_state = State . TRUNCATE ; } else if ( m_state == State . TRUNCATE ) { m_snapshotMonitor . removeInterest ( this ) ; if ( m_callback != null ) { m_callback . onReplayCompletion ( m_truncationSnapshot , m_truncationSnapshotPerPartition ) ; } // Call balance partitions after enabling transactions on the node to shorten the recovery time if ( m_isLeader ) { m_replayAgent . resumeElasticOperationIfNecessary ( ) ; } }
public class ProcessorDecimalFormat { /** * Receive notification of the start of an element . * @ param handler The calling StylesheetHandler / TemplatesBuilder . * @ param uri The Namespace URI , or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed . * @ param localName The local name ( without prefix ) , or the * empty string if Namespace processing is not being * performed . * @ param rawName The raw XML 1.0 name ( with prefix ) , or the * empty string if raw names are not available . * @ param attributes The attributes attached to the element . If * there are no attributes , it shall be an empty * Attributes object . * @ see org . apache . xalan . processor . StylesheetHandler # startElement * @ see org . apache . xalan . processor . StylesheetHandler # endElement * @ see org . xml . sax . ContentHandler # startElement * @ see org . xml . sax . ContentHandler # endElement * @ see org . xml . sax . Attributes */ public void startElement ( StylesheetHandler handler , String uri , String localName , String rawName , Attributes attributes ) throws org . xml . sax . SAXException { } }
DecimalFormatProperties dfp = new DecimalFormatProperties ( handler . nextUid ( ) ) ; dfp . setDOMBackPointer ( handler . getOriginatingNode ( ) ) ; dfp . setLocaterInfo ( handler . getLocator ( ) ) ; setPropertiesFromAttributes ( handler , rawName , attributes , dfp ) ; handler . getStylesheet ( ) . setDecimalFormat ( dfp ) ; handler . getStylesheet ( ) . appendChild ( dfp ) ;
public class OStringSerializerEmbedded { /** * Serialize the class name size + class name + object content * @ param iValue */ public StringBuilder toStream ( final StringBuilder iOutput , Object iValue ) { } }
if ( iValue != null ) { if ( ! ( iValue instanceof OSerializableStream ) ) throw new OSerializationException ( "Cannot serialize the object since it's not implements the OSerializableStream interface" ) ; OSerializableStream stream = ( OSerializableStream ) iValue ; iOutput . append ( iValue . getClass ( ) . getName ( ) ) ; iOutput . append ( OStreamSerializerHelper . SEPARATOR ) ; iOutput . append ( OBinaryProtocol . bytes2string ( stream . toStream ( ) ) ) ; } return iOutput ;
public class ExtendedAttributeDefinitionImpl { /** * ( non - Javadoc ) * @ see com . ibm . ws . config . internal . services . ExtendedAttributeDefinition # getAttributeName ( ) */ @ Override public String getAttributeName ( ) { } }
if ( delegate instanceof AttributeDefinitionSpecification ) { return ( ( AttributeDefinitionSpecification ) delegate ) . getAttributeName ( ) ; } return delegate . getName ( ) ;
public class KernelMatrix { /** * Centers the matrix in feature space according to Smola et Schoelkopf , * Learning with Kernels p . 431 Alters the input matrix . If you still need the * original matrix , use * < code > centeredMatrix = centerKernelMatrix ( uncenteredMatrix . copy ( ) ) { < / code > * @ param matrix the matrix to be centered * @ return centered matrix ( for convenience ) */ public static double [ ] [ ] centerMatrix ( final double [ ] [ ] matrix ) { } }
// FIXME : implement more efficiently . Maybe in matrix class itself ? final double [ ] [ ] normalizingMatrix = new double [ matrix . length ] [ matrix [ 0 ] . length ] ; for ( double [ ] row : normalizingMatrix ) { Arrays . fill ( row , 1.0 / matrix [ 0 ] . length ) ; } return times ( plusEquals ( minusEquals ( minus ( matrix , times ( normalizingMatrix , matrix ) ) , times ( matrix , normalizingMatrix ) ) , times ( normalizingMatrix , matrix ) ) , normalizingMatrix ) ;
public class VectorMath { /** * Adds two { @ code DoubleVector } s with some scalar weight for each { @ code * DoubleVector } . * @ param vector1 The vector values should be added to . * @ param weight1 The weight of values in { @ code vector1} * @ param vector2 The vector values that should be added to { @ code vector1} * @ param weight2 The weight of values in { @ code vector2} * @ param { @ code vector1} */ public static Vector addWithScalars ( DoubleVector vector1 , double weight1 , DoubleVector vector2 , double weight2 ) { } }
if ( vector2 . length ( ) != vector1 . length ( ) ) throw new IllegalArgumentException ( "Vectors of different sizes cannot be added" ) ; int length = vector2 . length ( ) ; for ( int i = 0 ; i < length ; ++ i ) { double value = vector1 . get ( i ) * weight1 + vector2 . get ( i ) * weight2 ; vector1 . set ( i , value ) ; } return vector1 ;
public class MimeType { /** * public int getMxb ( ) { return Caster . toIntValue ( properties . get ( " mxb " ) , DEFAULT _ MXB ) ; } * public double getMxt ( ) { return Caster . toDoubleValue ( properties . get ( " mxt " ) , DEFAULT _ MXT ) ; } */ private String getProperty ( String name ) { } }
if ( properties != null ) { String value = properties . get ( name ) ; if ( value != null ) return value ; Iterator < Entry < String , String > > it = properties . entrySet ( ) . iterator ( ) ; Entry < String , String > e ; while ( it . hasNext ( ) ) { e = it . next ( ) ; if ( name . equalsIgnoreCase ( e . getKey ( ) ) ) return e . getValue ( ) ; } } return null ;
public class PKIXParameters { /** * Sets the { @ code Set } of most - trusted CAs . * Note that the { @ code Set } is copied to protect against * subsequent modifications . * @ param trustAnchors a { @ code Set } of { @ code TrustAnchor } s * @ throws InvalidAlgorithmParameterException if the specified * { @ code Set } is empty { @ code ( trustAnchors . isEmpty ( ) = = true ) } * @ throws NullPointerException if the specified { @ code Set } is * { @ code null } * @ throws ClassCastException if any of the elements in the set * are not of type { @ code java . security . cert . TrustAnchor } * @ see # getTrustAnchors */ public void setTrustAnchors ( Set < TrustAnchor > trustAnchors ) throws InvalidAlgorithmParameterException { } }
if ( trustAnchors == null ) { throw new NullPointerException ( "the trustAnchors parameters must" + " be non-null" ) ; } if ( trustAnchors . isEmpty ( ) ) { throw new InvalidAlgorithmParameterException ( "the trustAnchors " + "parameter must be non-empty" ) ; } for ( Iterator < TrustAnchor > i = trustAnchors . iterator ( ) ; i . hasNext ( ) ; ) { if ( ! ( i . next ( ) instanceof TrustAnchor ) ) { throw new ClassCastException ( "all elements of set must be " + "of type java.security.cert.TrustAnchor" ) ; } } this . unmodTrustAnchors = Collections . unmodifiableSet ( new HashSet < TrustAnchor > ( trustAnchors ) ) ;
public class QueryableStateClient { /** * Returns a future holding the request result . * @ param jobId JobID of the job the queryable state belongs to . * @ param queryableStateName Name under which the state is queryable . * @ param key The key we are interested in . * @ param keyTypeHintA { @ link TypeHint } used to extract the type of the key . * @ param stateDescriptorThe { @ link StateDescriptor } of the state we want to query . * @ return Future holding the immutable { @ link State } object containing the result . */ @ PublicEvolving public < K , S extends State , V > CompletableFuture < S > getKvState ( final JobID jobId , final String queryableStateName , final K key , final TypeHint < K > keyTypeHint , final StateDescriptor < S , V > stateDescriptor ) { } }
Preconditions . checkNotNull ( keyTypeHint ) ; TypeInformation < K > keyTypeInfo = keyTypeHint . getTypeInfo ( ) ; return getKvState ( jobId , queryableStateName , key , keyTypeInfo , stateDescriptor ) ;
public class WsByteBufferPoolManagerImpl { /** * Allocate the direct ByteBuffer that will be wrapped by the * input WsByteBuffer object . * @ param buffer * @ param size * @ param overrideRefCount */ protected WsByteBufferImpl allocateBufferDirect ( WsByteBufferImpl buffer , int size , boolean overrideRefCount ) { } }
DirectByteBufferHelper directByteBufferHelper = this . directByteBufferHelper . get ( ) ; ByteBuffer byteBuffer ; if ( directByteBufferHelper != null ) { byteBuffer = directByteBufferHelper . allocateDirectByteBuffer ( size ) ; } else { byteBuffer = ByteBuffer . allocateDirect ( size ) ; } buffer . setByteBufferNonSafe ( byteBuffer ) ; return buffer ;
public class IOUtils { /** * < p > read . < / p > * @ param reader a { @ link java . io . Reader } object . * @ param length a int . * @ return a { @ link java . lang . String } object . */ public static String read ( Reader reader , int length ) { } }
try { char [ ] buffer = new char [ length ] ; int offset = 0 ; int rest = length ; int len ; while ( ( len = reader . read ( buffer , offset , rest ) ) != - 1 ) { rest -= len ; offset += len ; if ( rest == 0 ) { break ; } } return new String ( buffer , 0 , length - rest ) ; } catch ( IOException ex ) { throw new IllegalStateException ( "read error" , ex ) ; }
public class StringUtil { /** * Generate string of value and type . * @ param value to inspect * @ return string of value : type */ public static String typeValueString ( final Object value ) { } }
StringBuilder sb = new StringBuilder ( valueString ( value ) ) ; return sb . append ( " :" ) . append ( typeString ( value ) ) . toString ( ) ;
public class BitVector { /** * accelerating methods */ @ Override public long getBits ( int position , int length ) { } }
checkBitsLength ( length ) ; return getBitsAdj ( adjPosition ( position , length ) , length ) ;
public class ImageGridViewAdapter { /** * Click an image * @ param index * @ return True if handled here ; False , let the caller handle it , i . e . launch 3rd party app to open attachment */ public boolean clickOn ( int index ) { } }
ImageItem item = getItem ( index ) ; if ( item == null || TextUtils . isEmpty ( item . mimeType ) ) { return false ; } // For non - image items , the first tap will start it downloading if ( ! Util . isMimeTypeImage ( item . mimeType ) ) { // It is being downloaded , do nothing ( prevent double tap , etc ) if ( downloadItems . contains ( item . originalPath ) ) { return true ; } else { // If no write permission , do not try to download . Instead let caller handles it by launching browser if ( ! bHasWritePermission ) { return false ; } File localFile = new File ( item . localCachePath ) ; if ( localFile . exists ( ) && ApptentiveAttachmentLoader . getInstance ( ) . isFileCompletelyDownloaded ( item . localCachePath ) ) { // If have right permission , and already downloaded , let caller open 3rd app to view it return false ; } else { // First tap detected and never download before , start download downloadItems . add ( item . originalPath ) ; notifyDataSetChanged ( ) ; return true ; } } } return false ;
public class XalanAuthorizationHelperBean { /** * / * ( non - Javadoc ) * @ see org . apereo . portal . security . xslt . IAuthorizationHelper # canRender ( java . lang . String , java . lang . String ) */ @ Override public boolean canRender ( final String userName , final String fname ) { } }
if ( userName == null || fname == null ) { return false ; } final IAuthorizationPrincipal userPrincipal = this . getUserPrincipal ( userName ) ; if ( userPrincipal == null ) { return false ; } final String portletId ; try { final IPortletDefinition portletDefinition = this . portletDefinitionRegistry . getPortletDefinitionByFname ( fname ) ; if ( portletDefinition == null ) { if ( this . logger . isInfoEnabled ( ) ) { this . logger . info ( "No PortletDefinition for fname='" + fname + "', returning false." ) ; } return false ; } portletId = portletDefinition . getPortletDefinitionId ( ) . getStringId ( ) ; } catch ( Exception e ) { this . logger . warn ( "Could not find PortletDefinition for fname='" + fname + "' while checking if user '" + userName + "' can render it. Returning FALSE." , e ) ; return false ; } return userPrincipal . canRender ( portletId ) ;
public class TableMgr { /** * Creates a new table having the specified name and schema . * @ param tblName * the name of the new table * @ param sch * the table ' s schema * @ param tx * the transaction creating the table */ public void createTable ( String tblName , Schema sch , Transaction tx ) { } }
if ( tblName != TCAT_TBLNAME && tblName != FCAT_TBLNAME ) formatFileHeader ( tblName , tx ) ; // Optimization : store the ti tiMap . put ( tblName , new TableInfo ( tblName , sch ) ) ; // insert one record into tblcat RecordFile tcatfile = tcatInfo . open ( tx , true ) ; tcatfile . insert ( ) ; tcatfile . setVal ( TCAT_TBLNAME , new VarcharConstant ( tblName ) ) ; tcatfile . close ( ) ; // insert a record into fldcat for each field RecordFile fcatfile = fcatInfo . open ( tx , true ) ; for ( String fldname : sch . fields ( ) ) { fcatfile . insert ( ) ; fcatfile . setVal ( FCAT_TBLNAME , new VarcharConstant ( tblName ) ) ; fcatfile . setVal ( FCAT_FLDNAME , new VarcharConstant ( fldname ) ) ; fcatfile . setVal ( FCAT_TYPE , new IntegerConstant ( sch . type ( fldname ) . getSqlType ( ) ) ) ; fcatfile . setVal ( FCAT_TYPEARG , new IntegerConstant ( sch . type ( fldname ) . getArgument ( ) ) ) ; } fcatfile . close ( ) ;
public class CmsFormatterConfiguration { /** * Gets the formatters which are available for the given container type and width . < p > * @ param containerTypes the container types ( comma separated ) * @ param containerWidth the container width * @ return the list of available formatters */ public List < I_CmsFormatterBean > getAllMatchingFormatters ( String containerTypes , int containerWidth ) { } }
return new ArrayList < I_CmsFormatterBean > ( Collections2 . filter ( m_allFormatters , new MatchesTypeOrWidth ( containerTypes , containerWidth ) ) ) ;
public class LockResourceImpl { /** * Signal a waiter . * We need to pass objectName because the name in { # objectName } is unrealible . * @ param conditionId * @ param maxSignalCount * @ param objectName * @ see InternalLockNamespace */ public void signal ( String conditionId , int maxSignalCount , String objectName ) { } }
if ( waiters == null ) { return ; } Set < WaitersInfo . ConditionWaiter > waiters ; WaitersInfo condition = this . waiters . get ( conditionId ) ; if ( condition == null ) { return ; } else { waiters = condition . getWaiters ( ) ; } if ( waiters == null ) { return ; } Iterator < WaitersInfo . ConditionWaiter > iterator = waiters . iterator ( ) ; for ( int i = 0 ; iterator . hasNext ( ) && i < maxSignalCount ; i ++ ) { WaitersInfo . ConditionWaiter waiter = iterator . next ( ) ; ConditionKey signalKey = new ConditionKey ( objectName , key , conditionId , waiter . getCaller ( ) , waiter . getThreadId ( ) ) ; registerSignalKey ( signalKey ) ; iterator . remove ( ) ; } if ( ! condition . hasWaiter ( ) ) { this . waiters . remove ( conditionId ) ; }
public class ValidationMatcherUtils { /** * Checks if expression is a validation matcher expression . * @ param expression the expression to check * @ return */ public static boolean isValidationMatcherExpression ( String expression ) { } }
return expression . startsWith ( Citrus . VALIDATION_MATCHER_PREFIX ) && expression . endsWith ( Citrus . VALIDATION_MATCHER_SUFFIX ) ;
public class ResultUtils { /** * Flattening is important for simple cases : when querying for count ( or other aggregated function ) or * for single field ( column ) . * @ param object result object * @ param returnClass expected type * @ return either object itself or just object field ( extracted ) */ public static Object applyProjection ( final Object object , final Class < ? > returnClass ) { } }
Object res = object ; if ( ! ODocument . class . isAssignableFrom ( returnClass ) ) { ODocument doc = null ; if ( object instanceof ODocument ) { doc = ( ODocument ) object ; } if ( object instanceof OIdentifiable ) { // most likely OrientVertex , which is returned under graph connection , even for partial requests final Object record = ( ( OIdentifiable ) object ) . getRecord ( ) ; if ( record instanceof ODocument ) { doc = ( ODocument ) record ; } } if ( doc != null && doc . fieldNames ( ) . length == 1 ) { res = doc . fieldValues ( ) [ 0 ] ; // if required , perform result correction if ( res != null && ! returnClass . isAssignableFrom ( res . getClass ( ) ) ) { res = convertPlainImpl ( res , returnClass , true ) ; } } } return res ;
public class Strings { /** * Returns the first valid string in the given set . * @ param strings * a set of strings . * @ return * the first valid string in the set , or null if none is valid . */ public static String firstValidOf ( String ... strings ) { } }
if ( strings != null ) { for ( int i = 0 ; i < strings . length ; ++ i ) { if ( Strings . isValid ( strings [ i ] ) ) { return strings [ i ] ; } } } return null ;
public class DecimalFormat { /** * Fix for prefix and suffix in Ticket 11805. */ private void formatAffix2Attribute ( boolean isPrefix , Field fieldType , StringBuffer buf , int offset , int symbolSize ) { } }
int begin ; begin = offset ; if ( ! isPrefix ) { begin += buf . length ( ) ; } addAttribute ( fieldType , begin , begin + symbolSize ) ;
public class MQMessageUtils { /** * 将FlatMessage按指定的字段值hash拆分 * @ param flatMessage flatMessage * @ param partitionsNum 分区数量 * @ param pkHashConfigs hash映射 * @ return 拆分后的flatMessage数组 */ public static FlatMessage [ ] messagePartition ( FlatMessage flatMessage , Integer partitionsNum , String pkHashConfigs ) { } }
if ( partitionsNum == null ) { partitionsNum = 1 ; } FlatMessage [ ] partitionMessages = new FlatMessage [ partitionsNum ] ; if ( flatMessage . getIsDdl ( ) ) { partitionMessages [ 0 ] = flatMessage ; } else { if ( flatMessage . getData ( ) != null && ! flatMessage . getData ( ) . isEmpty ( ) ) { String database = flatMessage . getDatabase ( ) ; String table = flatMessage . getTable ( ) ; HashMode hashMode = getPartitionHashColumns ( database + "." + table , pkHashConfigs ) ; if ( hashMode == null ) { // 如果都没有匹配 , 发送到第一个分区 partitionMessages [ 0 ] = flatMessage ; } else if ( hashMode . tableHash ) { int hashCode = table . hashCode ( ) ; int pkHash = Math . abs ( hashCode ) % partitionsNum ; // math . abs可能返回负值 , 这里再取反 , 把出现负值的数据还是写到固定的分区 , 仍然可以保证消费顺序 pkHash = Math . abs ( pkHash ) ; partitionMessages [ pkHash ] = flatMessage ; } else { List < String > pkNames = hashMode . pkNames ; if ( hashMode . autoPkHash ) { pkNames = flatMessage . getPkNames ( ) ; } int idx = 0 ; for ( Map < String , String > row : flatMessage . getData ( ) ) { int hashCode = database . hashCode ( ) ; for ( String pkName : pkNames ) { String value = row . get ( pkName ) ; if ( value == null ) { value = "" ; } hashCode = hashCode ^ value . hashCode ( ) ; } int pkHash = Math . abs ( hashCode ) % partitionsNum ; // math . abs可能返回负值 , 这里再取反 , 把出现负值的数据还是写到固定的分区 , 仍然可以保证消费顺序 pkHash = Math . abs ( pkHash ) ; FlatMessage flatMessageTmp = partitionMessages [ pkHash ] ; if ( flatMessageTmp == null ) { flatMessageTmp = new FlatMessage ( flatMessage . getId ( ) ) ; partitionMessages [ pkHash ] = flatMessageTmp ; flatMessageTmp . setDatabase ( flatMessage . getDatabase ( ) ) ; flatMessageTmp . setTable ( flatMessage . getTable ( ) ) ; flatMessageTmp . setIsDdl ( flatMessage . getIsDdl ( ) ) ; flatMessageTmp . setType ( flatMessage . getType ( ) ) ; flatMessageTmp . setSql ( flatMessage . getSql ( ) ) ; flatMessageTmp . setSqlType ( flatMessage . getSqlType ( ) ) ; flatMessageTmp . setMysqlType ( flatMessage . getMysqlType ( ) ) ; flatMessageTmp . setEs ( flatMessage . getEs ( ) ) ; flatMessageTmp . setTs ( flatMessage . getTs ( ) ) ; } List < Map < String , String > > data = flatMessageTmp . getData ( ) ; if ( data == null ) { data = new ArrayList < > ( ) ; flatMessageTmp . setData ( data ) ; } data . add ( row ) ; if ( flatMessage . getOld ( ) != null && ! flatMessage . getOld ( ) . isEmpty ( ) ) { List < Map < String , String > > old = flatMessageTmp . getOld ( ) ; if ( old == null ) { old = new ArrayList < > ( ) ; flatMessageTmp . setOld ( old ) ; } old . add ( flatMessage . getOld ( ) . get ( idx ) ) ; } idx ++ ; } } } else { // 针对stmt / mixed binlog格式的query事件 partitionMessages [ 0 ] = flatMessage ; } } return partitionMessages ;
public class InternalXbaseParser { /** * InternalXbase . g : 342:1 : ruleOpCompare : ( ( rule _ _ OpCompare _ _ Alternatives ) ) ; */ public final void ruleOpCompare ( ) throws RecognitionException { } }
int stackSize = keepStackSize ( ) ; try { // InternalXbase . g : 346:2 : ( ( ( rule _ _ OpCompare _ _ Alternatives ) ) ) // InternalXbase . g : 347:2 : ( ( rule _ _ OpCompare _ _ Alternatives ) ) { // InternalXbase . g : 347:2 : ( ( rule _ _ OpCompare _ _ Alternatives ) ) // InternalXbase . g : 348:3 : ( rule _ _ OpCompare _ _ Alternatives ) { if ( state . backtracking == 0 ) { before ( grammarAccess . getOpCompareAccess ( ) . getAlternatives ( ) ) ; } // InternalXbase . g : 349:3 : ( rule _ _ OpCompare _ _ Alternatives ) // InternalXbase . g : 349:4 : rule _ _ OpCompare _ _ Alternatives { pushFollow ( FOLLOW_2 ) ; rule__OpCompare__Alternatives ( ) ; state . _fsp -- ; if ( state . failed ) return ; } if ( state . backtracking == 0 ) { after ( grammarAccess . getOpCompareAccess ( ) . getAlternatives ( ) ) ; } } } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { restoreStackSize ( stackSize ) ; } return ;
public class ModelsImpl { /** * Gets information about the hierarchical entity model . * @ param appId The application ID . * @ param versionId The version ID . * @ param hEntityId The hierarchical entity extractor ID . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws ErrorResponseException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the HierarchicalEntityExtractor object if successful . */ public HierarchicalEntityExtractor getHierarchicalEntity ( UUID appId , String versionId , UUID hEntityId ) { } }
return getHierarchicalEntityWithServiceResponseAsync ( appId , versionId , hEntityId ) . toBlocking ( ) . single ( ) . body ( ) ;
public class AbstractAlchemyEntity { /** * Set the score ( 0.0 = neutral ) . * @ param score score */ public void setScore ( Double score ) { } }
if ( score == null ) { score = Constants . DEFAULT_SCORE ; } this . score = score ;
public class HTODDynacache { /** * initfileManager ( ) * Initialize the file manager instance . Caching within the filemanager is * experimental so it is disabled here . */ void initFileManager ( ) throws IOException , FileManagerException { } }
final String methodName = "initFileManager()" ; object_filemgr = new FileManagerImpl ( filename + object_suffix + ".htod" , // filename false , // automatic coalesce , not reccomended "rw" , // " r " or " rw " physical_disk_manager , // physical file layer this ) ; if ( ! this . disableDependencyId ) { dependency_filemgr = new FileManagerImpl ( filename + dependency_suffix + ".htod" , // filename false , // automatic coalesce , not reccomended "rw" , // " r " or " rw " physical_disk_manager , // physical file layer this ) ; } if ( ! this . disableTemplatesSupport ) { template_filemgr = new FileManagerImpl ( filename + template_suffix + ".htod" , // filename false , // automatic coalesce , not reccomended "rw" , // " r " or " rw " physical_disk_manager , // physical file layer this ) ; }
public class DefaultGroovyMethods { /** * Returns < code > true < / code > if the intersection of two iterables is empty . * < pre class = " groovyTestCase " > assert [ 1,2,3 ] . disjoint ( [ 3,4,5 ] ) = = false < / pre > * < pre class = " groovyTestCase " > assert [ 1,2 ] . disjoint ( [ 3,4 ] ) = = true < / pre > * @ param left an Iterable * @ param right an Iterable * @ return boolean < code > true < / code > if the intersection of two iterables * is empty , < code > false < / code > otherwise . * @ since 2.4.0 */ public static boolean disjoint ( Iterable left , Iterable right ) { } }
Collection leftCol = asCollection ( left ) ; Collection rightCol = asCollection ( right ) ; if ( leftCol . isEmpty ( ) || rightCol . isEmpty ( ) ) return true ; Collection pickFrom = new TreeSet ( new NumberAwareComparator ( ) ) ; pickFrom . addAll ( rightCol ) ; for ( final Object o : leftCol ) { if ( pickFrom . contains ( o ) ) return false ; } return true ;
public class Collections { /** * Returns a synchronized ( thread - safe ) map backed by the specified * map . In order to guarantee serial access , it is critical that * < strong > all < / strong > access to the backing map is accomplished * through the returned map . < p > * It is imperative that the user manually synchronize on the returned * map when iterating over any of its collection views : * < pre > * Map m = Collections . synchronizedMap ( new HashMap ( ) ) ; * Set s = m . keySet ( ) ; / / Needn ' t be in synchronized block * synchronized ( m ) { / / Synchronizing on m , not s ! * Iterator i = s . iterator ( ) ; / / Must be in synchronized block * while ( i . hasNext ( ) ) * foo ( i . next ( ) ) ; * < / pre > * Failure to follow this advice may result in non - deterministic behavior . * < p > The returned map will be serializable if the specified map is * serializable . * @ param < K > the class of the map keys * @ param < V > the class of the map values * @ param m the map to be " wrapped " in a synchronized map . * @ return a synchronized view of the specified map . */ public static < K , V > Map < K , V > synchronizedMap ( Map < K , V > m ) { } }
return new SynchronizedMap < > ( m ) ;
public class IsDateWithTime { /** * Creates a matcher that matches when the examined { @ linkplain Date } has the given values < code > hour < / code > in a 24 * hours clock period , < code > minute < / code > , < code > sec < / code > and < code > millis < / code > . */ public static Matcher < Date > hasHourMinSecAndMillis ( final int hour , final int minute , final int second , final int millisecond ) { } }
return new IsDateWithTime ( hour , minute , second , millisecond ) ;
public class AbstractTokenizer { /** * This is an optional operation , by default supported . * @ return The next token in the token stream . * @ throws java . util . NoSuchElementException * if the token stream has no more tokens . */ public T peek ( ) { } }
if ( nextToken == null ) { nextToken = getNext ( ) ; } if ( nextToken == null ) { throw new NoSuchElementException ( ) ; } return nextToken ;
public class GitHubWebHook { /** * Receives the webhook call * @ param event GH event type . Never null * @ param payload Payload from hook . Never blank */ @ SuppressWarnings ( "unused" ) @ RequirePostWithGHHookPayload public void doIndex ( @ Nonnull @ GHEventHeader GHEvent event , @ Nonnull @ GHEventPayload String payload ) { } }
GHSubscriberEvent subscriberEvent = new GHSubscriberEvent ( SCMEvent . originOf ( Stapler . getCurrentRequest ( ) ) , event , payload ) ; from ( GHEventsSubscriber . all ( ) ) . filter ( isInterestedIn ( event ) ) . transform ( processEvent ( subscriberEvent ) ) . toList ( ) ;
public class ListQualificationRequestsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ListQualificationRequestsRequest listQualificationRequestsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( listQualificationRequestsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listQualificationRequestsRequest . getQualificationTypeId ( ) , QUALIFICATIONTYPEID_BINDING ) ; protocolMarshaller . marshall ( listQualificationRequestsRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listQualificationRequestsRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class RandomFactory { /** * This method returns new onject implementing Random interface , initialized with seed value * @ param seed seed for this rng object * @ return object implementing Random interface */ public Random getNewRandomInstance ( long seed ) { } }
try { Random t = ( Random ) randomClass . newInstance ( ) ; if ( t . getStatePointer ( ) != null ) { // TODO : attach this thing to deallocator // if it ' s stateless random - we just don ' t care then } t . setSeed ( seed ) ; return t ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; }
public class Command { /** * / * package */ void bind ( String shortcut ) { } }
String normalized = CommandUtil . validateShortcut ( shortcut ) ; if ( normalized == null ) { throw new IllegalArgumentException ( "Invalid shortcut specifier: " + shortcut ) ; } if ( shortcutBindings . add ( normalized ) ) { shortcutChanged ( normalized , false ) ; }
public class Promises { /** * Transforms a { @ link Stream } of { @ link AsyncSupplier } * { @ code tasks } to a collection of { @ code Promise } s . */ public static < T > Iterator < Promise < T > > asPromises ( @ NotNull Stream < ? extends AsyncSupplier < ? extends T > > tasks ) { } }
return asPromises ( tasks . iterator ( ) ) ;
public class GenericType { /** * Returns the array component type if this type represents an array ( { @ code int [ ] } , { @ code T [ ] } , * { @ code < ? extends Map < String , Integer > [ ] > } etc . ) , or else { @ code null } is returned . */ @ Nullable @ SuppressWarnings ( "unchecked" ) public final GenericType < ? > getComponentType ( ) { } }
TypeToken < ? > componentTypeToken = token . getComponentType ( ) ; return ( componentTypeToken == null ) ? null : new GenericType ( componentTypeToken ) ;
public class CommonOps_DSCC { /** * Creates a diagonal matrix from an array . Elements in the array can be offset . * @ param A ( Optional ) Storage for diagonal matrix . If null a new one will be declared . * @ param values First index in the diagonal matirx * @ param length Length of the diagonal matrix * @ param offset First index in values * @ return The diagonal matrix */ public static DMatrixSparseCSC diag ( @ Nullable DMatrixSparseCSC A , double values [ ] , int offset , int length ) { } }
int N = length ; if ( A == null ) A = new DMatrixSparseCSC ( N , N , N ) ; else A . reshape ( N , N , N ) ; A . nz_length = N ; for ( int i = 0 ; i < N ; i ++ ) { A . col_idx [ i + 1 ] = i + 1 ; A . nz_rows [ i ] = i ; A . nz_values [ i ] = values [ offset + i ] ; } return A ;
public class RdfConverter { /** * Writes triples to determine the statements with the highest rank . */ void writeBestRankTriples ( ) { } }
for ( Resource resource : this . rankBuffer . getBestRankedStatements ( ) ) { try { this . rdfWriter . writeTripleUriObject ( resource , RdfWriter . RDF_TYPE , RdfWriter . WB_BEST_RANK . toString ( ) ) ; } catch ( RDFHandlerException e ) { throw new RuntimeException ( e . getMessage ( ) , e ) ; } } this . rankBuffer . clear ( ) ;
public class GrpcUtils { /** * Converts wire type to proto type . * @ param info the wire representation to convert * @ return converted proto representation */ public static alluxio . grpc . MountPointInfo toProto ( MountPointInfo info ) { } }
return alluxio . grpc . MountPointInfo . newBuilder ( ) . setUfsUri ( info . getUfsUri ( ) ) . setUfsType ( info . getUfsType ( ) ) . setUfsCapacityBytes ( info . getUfsCapacityBytes ( ) ) . setReadOnly ( info . getReadOnly ( ) ) . putAllProperties ( info . getProperties ( ) ) . setShared ( info . getShared ( ) ) . build ( ) ;