signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class JingleSession { /** * Return true if all of the media managers have finished . */
public boolean isFullyEstablished ( ) { } }
|
boolean result = true ; for ( ContentNegotiator contentNegotiator : contentNegotiators ) { if ( ! contentNegotiator . isFullyEstablished ( ) ) result = false ; } return result ;
|
public class LostExceptionStackTrace { /** * looks for methods that contain a catch block and an ATHROW opcode
* @ param code
* the context object of the current code block
* @ param method
* the context object of the current method
* @ return if the class throws exceptions */
public boolean prescreen ( Code code , Method method ) { } }
|
if ( method . isSynthetic ( ) ) { return false ; } CodeException [ ] ce = code . getExceptionTable ( ) ; if ( CollectionUtils . isEmpty ( ce ) ) { return false ; } BitSet bytecodeSet = getClassContext ( ) . getBytecodeSet ( method ) ; return ( bytecodeSet != null ) && bytecodeSet . get ( Const . ATHROW ) ;
|
public class KeyringMonitorImpl { /** * Registers this KeyringMonitor to start monitoring the specified keyrings
* by mbean notification .
* @ param id of keyrings to monitor .
* @ param trigger what trigger the keyring update notification mbean
* @ return The < code > KeyringMonitor < / code > service registration . */
public ServiceRegistration < KeyringMonitor > monitorKeyRings ( String ID , String trigger , String keyStoreLocation ) { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "monitorKeyRing registration for" , ID ) ; } BundleContext bundleContext = actionable . getBundleContext ( ) ; final Hashtable < String , Object > keyRingMonitorProps = new Hashtable < String , Object > ( ) ; keyRingMonitorProps . put ( KeyringMonitor . MONITOR_KEYSTORE_CONFIG_ID , ID ) ; keyRingMonitorProps . put ( KeyringMonitor . KEYSTORE_LOCATION , keyStoreLocation ) ; if ( ! ( trigger . equalsIgnoreCase ( "disabled" ) ) && trigger . equals ( "polled" ) ) { Tr . warning ( tc , "Cannot have polled trigger for keyRing ID: " , ID ) ; } return bundleContext . registerService ( KeyringMonitor . class , this , keyRingMonitorProps ) ;
|
public class StrBuilder { /** * Checks the capacity and ensures that it is at least the size specified .
* @ param capacity the capacity to ensure
* @ return this , to enable chaining */
public StrBuilder ensureCapacity ( final int capacity ) { } }
|
if ( capacity > buffer . length ) { final char [ ] old = buffer ; buffer = new char [ capacity * 2 ] ; System . arraycopy ( old , 0 , buffer , 0 , size ) ; } return this ;
|
public class RealVoltDB { /** * This host can be a leader if partition 0 is on it or it is in the same partition group as a node which has
* partition 0 . This is because the partition group with partition 0 can never be removed by elastic remove .
* @ param partitions { @ link List } of partitions on this host
* @ param partitionGroupPeers { @ link List } of hostIds which are in the same partition group as this host
* @ param topology { @ link AbstractTopology } for the cluster
* @ return { @ code true } if this host is eligible as a leader for non partition services */
private boolean determineIfEligibleAsLeader ( Collection < Integer > partitions , Set < Integer > partitionGroupPeers , AbstractTopology topology ) { } }
|
if ( partitions . contains ( Integer . valueOf ( 0 ) ) ) { return true ; } for ( Integer host : topology . getHostIdList ( 0 ) ) { if ( partitionGroupPeers . contains ( host ) ) { return true ; } } return false ;
|
public class PasswordUtil { /** * Encode the provided password by using the specified encoding algorithm . The encoded string consistes of the
* algorithm of the encoding and the encoded value .
* If the decoded _ string is already encoded , the string will be decoded and then encoded by using the specified crypto algorithm .
* Use this method for encoding the string by using specific encoding algorithm .
* Use securityUtility encode - - listCustom command line utility to see if any additional custom encryptions are supported .
* @ param decoded _ string the string to be encoded .
* @ param crypto _ algorithm the algorithm to be used for encoding . The supported values are xor , aes , or hash .
* @ return The encoded string .
* @ throws InvalidPasswordEncodingException If the decoded _ string is null or invalid . Or the encoded _ string is null .
* @ throws UnsupportedCryptoAlgorithmException If the algorithm is not supported . */
public static String encode ( String decoded_string , String crypto_algorithm ) throws InvalidPasswordEncodingException , UnsupportedCryptoAlgorithmException { } }
|
return encode ( decoded_string , crypto_algorithm , ( String ) null ) ;
|
public class Admin { /** * @ throws PageException */
private void doGetDatasource ( ) throws PageException { } }
|
String name = getString ( "admin" , action , "name" ) ; Map ds = config . getDataSourcesAsMap ( ) ; Iterator it = ds . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { String key = ( String ) it . next ( ) ; if ( key . equalsIgnoreCase ( name ) ) { DataSource d = ( DataSource ) ds . get ( key ) ; Struct sct = new StructImpl ( ) ; ClassDefinition cd = d . getClassDefinition ( ) ; sct . setEL ( KeyConstants . _name , key ) ; sct . setEL ( KeyConstants . _host , d . getHost ( ) ) ; sct . setEL ( "classname" , cd . getClassName ( ) ) ; sct . setEL ( "class" , cd . getClassName ( ) ) ; sct . setEL ( "bundleName" , cd . getName ( ) ) ; sct . setEL ( "bundleVersion" , cd . getVersionAsString ( ) ) ; sct . setEL ( "dsn" , d . getDsnOriginal ( ) ) ; sct . setEL ( "database" , d . getDatabase ( ) ) ; sct . setEL ( "port" , d . getPort ( ) < 1 ? "" : Caster . toString ( d . getPort ( ) ) ) ; sct . setEL ( "dsnTranslated" , d . getDsnTranslated ( ) ) ; sct . setEL ( "timezone" , toStringTimeZone ( d . getTimeZone ( ) ) ) ; sct . setEL ( "password" , d . getPassword ( ) ) ; sct . setEL ( "passwordEncrypted" , ConfigWebUtil . encrypt ( d . getPassword ( ) ) ) ; sct . setEL ( "username" , d . getUsername ( ) ) ; sct . setEL ( "readonly" , Caster . toBoolean ( d . isReadOnly ( ) ) ) ; sct . setEL ( "select" , Boolean . valueOf ( d . hasAllow ( DataSource . ALLOW_SELECT ) ) ) ; sct . setEL ( "delete" , Boolean . valueOf ( d . hasAllow ( DataSource . ALLOW_DELETE ) ) ) ; sct . setEL ( "update" , Boolean . valueOf ( d . hasAllow ( DataSource . ALLOW_UPDATE ) ) ) ; sct . setEL ( "insert" , Boolean . valueOf ( d . hasAllow ( DataSource . ALLOW_INSERT ) ) ) ; sct . setEL ( "create" , Boolean . valueOf ( d . hasAllow ( DataSource . ALLOW_CREATE ) ) ) ; sct . setEL ( "insert" , Boolean . valueOf ( d . hasAllow ( DataSource . ALLOW_INSERT ) ) ) ; sct . setEL ( "drop" , Boolean . valueOf ( d . hasAllow ( DataSource . ALLOW_DROP ) ) ) ; sct . setEL ( "grant" , Boolean . valueOf ( d . hasAllow ( DataSource . ALLOW_GRANT ) ) ) ; sct . setEL ( "revoke" , Boolean . valueOf ( d . hasAllow ( DataSource . ALLOW_REVOKE ) ) ) ; sct . setEL ( "alter" , Boolean . valueOf ( d . hasAllow ( DataSource . ALLOW_ALTER ) ) ) ; sct . setEL ( "connectionLimit" , d . getConnectionLimit ( ) < 1 ? "-1" : Caster . toString ( d . getConnectionLimit ( ) ) ) ; sct . setEL ( "connectionTimeout" , d . getConnectionTimeout ( ) < 1 ? "" : Caster . toString ( d . getConnectionTimeout ( ) ) ) ; sct . setEL ( "metaCacheTimeout" , Caster . toDouble ( d . getMetaCacheTimeout ( ) ) ) ; sct . setEL ( "custom" , d . getCustoms ( ) ) ; sct . setEL ( "blob" , Boolean . valueOf ( d . isBlob ( ) ) ) ; sct . setEL ( "clob" , Boolean . valueOf ( d . isClob ( ) ) ) ; sct . setEL ( "validate" , Boolean . valueOf ( d . validate ( ) ) ) ; sct . setEL ( "storage" , Boolean . valueOf ( d . isStorage ( ) ) ) ; if ( d instanceof DataSourceImpl ) { DataSourceImpl di = ( ( DataSourceImpl ) d ) ; sct . setEL ( "literalTimestampWithTSOffset" , Boolean . valueOf ( di . getLiteralTimestampWithTSOffset ( ) ) ) ; sct . setEL ( "alwaysSetTimeout" , Boolean . valueOf ( di . getAlwaysSetTimeout ( ) ) ) ; sct . setEL ( "dbdriver" , Caster . toString ( di . getDbDriver ( ) , "" ) ) ; } pageContext . setVariable ( getString ( "admin" , action , "returnVariable" ) , sct ) ; return ; } } throw new ApplicationException ( "there is no datasource with name [" + name + "]" ) ;
|
public class WhitelistingApi { /** * Get the status of whitelist feature ( enabled / disabled ) of a device type .
* Get the status of whitelist feature ( enabled / disabled ) of a device type .
* @ param dtid Device Type ID . ( required )
* @ return WhitelistEnvelope
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public WhitelistEnvelope getWhitelistStatus ( String dtid ) throws ApiException { } }
|
ApiResponse < WhitelistEnvelope > resp = getWhitelistStatusWithHttpInfo ( dtid ) ; return resp . getData ( ) ;
|
public class SystemUtil { /** * Returns a Properties , loaded from the given inputstream . If the given
* inputstream is null , then an empty Properties object is returned .
* @ param pInput the inputstream to read from
* @ return a Properties object read from the given stream , or an empty
* Properties mapping , if the stream is null .
* @ throws IOException if an error occurred when reading from the input
* stream . */
private static Properties loadProperties ( InputStream pInput ) throws IOException { } }
|
if ( pInput == null ) { throw new IllegalArgumentException ( "InputStream == null!" ) ; } Properties mapping = new Properties ( ) ; /* if ( pInput instanceof XMLPropertiesInputStream ) {
mapping = new XMLProperties ( ) ;
else {
mapping = new Properties ( ) ; */
// Load the properties
mapping . load ( pInput ) ; return mapping ;
|
public class QueryImpl { /** * Validated parameter ' s class with input paramClass . Returns back parameter
* if it matches , else throws an { @ link IllegalArgumentException } .
* @ param < T >
* type of class .
* @ param paramClass
* expected class type .
* @ param parameter
* parameter
* @ return parameter if it matches , else throws an
* { @ link IllegalArgumentException } . */
private < T > Parameter < T > onTypeCheck ( Class < T > paramClass , Parameter < T > parameter ) { } }
|
if ( parameter != null && parameter . getParameterType ( ) != null && parameter . getParameterType ( ) . equals ( paramClass ) ) { return parameter ; } throw new IllegalArgumentException ( "The parameter of the specified name does not exist or is not assignable to the type" ) ;
|
public class BeansImpl { /** * Returns all < code > decorators < / code > elements
* @ return list of < code > decorators < / code > */
public List < Decorators < Beans < T > > > getAllDecorators ( ) { } }
|
List < Decorators < Beans < T > > > list = new ArrayList < Decorators < Beans < T > > > ( ) ; List < Node > nodeList = childNode . get ( "decorators" ) ; for ( Node node : nodeList ) { Decorators < Beans < T > > type = new DecoratorsImpl < Beans < T > > ( this , "decorators" , childNode , node ) ; list . add ( type ) ; } return list ;
|
public class Relation { /** * Returns a synchronized ( thread - safe ) relation wrapper backed by
* the given relation < code > rel < / code > . Each operation
* synchronizes on < code > rel < / code > .
* < p > For operations that return a collection ( e . g . , { @ link
* # keys ( ) } , { @ link # values ( ) } ) , it is strongly recommended to
* synchronize the whole block that ( 1 ) invokes the
* collection - returning relation operation , and ( 2 ) uses that
* collection . This is similar to the recommended usage pattern
* for the JDK synchronized collections ( e . g . ,
* < code > Collections . synchronizedSet < / code > . Here is an example :
* < pre >
* Relation & lt ; K , V & gt ; syncRel = Relation . synchronizedRelation ( someRel ) ;
* synchronized ( syncRel ) {
* Iterator & lt ; K & gt ; it = syncRel . keys ( ) . iterator ( ) ;
* while ( it . hasNext ( ) ) {
* K key = it . next ( ) ;
* < / pre >
* This pattern prevents non - deterministic , hard - to - reproduce
* behavior due to modifications from other threads on the
* relation you iterate over . */
public static < K , V > Relation < K , V > synchronizedRelation ( final Relation < K , V > rel ) { } }
|
return new SynchronizedRelation < K , V > ( rel ) ;
|
public class CliFrontend { /** * Loads a class from the classpath that implements the CustomCommandLine interface .
* @ param className The fully - qualified class name to load .
* @ param params The constructor parameters */
private static CustomCommandLine < ? > loadCustomCommandLine ( String className , Object ... params ) throws IllegalAccessException , InvocationTargetException , InstantiationException , ClassNotFoundException , NoSuchMethodException { } }
|
Class < ? extends CustomCommandLine > customCliClass = Class . forName ( className ) . asSubclass ( CustomCommandLine . class ) ; // construct class types from the parameters
Class < ? > [ ] types = new Class < ? > [ params . length ] ; for ( int i = 0 ; i < params . length ; i ++ ) { Preconditions . checkNotNull ( params [ i ] , "Parameters for custom command-lines may not be null." ) ; types [ i ] = params [ i ] . getClass ( ) ; } Constructor < ? extends CustomCommandLine > constructor = customCliClass . getConstructor ( types ) ; return constructor . newInstance ( params ) ;
|
public class DescribeConfigurationSetResult { /** * A list of event destinations associated with the configuration set .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setEventDestinations ( java . util . Collection ) } or { @ link # withEventDestinations ( java . util . Collection ) } if
* you want to override the existing values .
* @ param eventDestinations
* A list of event destinations associated with the configuration set .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DescribeConfigurationSetResult withEventDestinations ( EventDestination ... eventDestinations ) { } }
|
if ( this . eventDestinations == null ) { setEventDestinations ( new com . amazonaws . internal . SdkInternalList < EventDestination > ( eventDestinations . length ) ) ; } for ( EventDestination ele : eventDestinations ) { this . eventDestinations . add ( ele ) ; } return this ;
|
public class SwingUtils { /** * Ensures the given runnable is executed into the event dispatcher thread .
* @ param runnable
* the runnable .
* @ param wait
* whether should wait until execution is completed . */
public static void runInEventDispatcherThread ( Runnable runnable , Boolean wait ) { } }
|
Assert . notNull ( runnable , "runnable" ) ; Assert . notNull ( wait , "wait" ) ; if ( EventQueue . isDispatchThread ( ) ) { runnable . run ( ) ; } else if ( wait ) { try { EventQueue . invokeAndWait ( runnable ) ; } catch ( InterruptedException e ) { throw new RuntimeException ( e ) ; } catch ( InvocationTargetException e ) { throw new RuntimeException ( e ) ; } } else { EventQueue . invokeLater ( runnable ) ; }
|
public class GroovyRunnerRegistry { /** * Registers a runner with the specified key .
* @ param key to associate with the runner
* @ param runner the runner to register
* @ return the previously registered runner for the given key ,
* if no runner was previously registered for the key
* then { @ code null } */
@ Override public GroovyRunner put ( String key , GroovyRunner runner ) { } }
|
if ( key == null || runner == null ) { return null ; } Map < String , GroovyRunner > map = getMap ( ) ; writeLock . lock ( ) ; try { cachedValues = null ; return map . put ( key , runner ) ; } finally { writeLock . unlock ( ) ; }
|
public class Version { /** * Check if this version is higher than the passed other version . Only taking major and minor version number in account .
* @ param other { @ link Version } to compare */
@ Deprecated public boolean greaterMinor ( Version other ) { } }
|
return other . major < this . major || other . major == this . major && other . minor < this . minor ;
|
public class DataUtils { /** * Split a module Id to get the module name
* @ param moduleId
* @ return String */
public static String getModuleName ( final String moduleId ) { } }
|
final int splitter = moduleId . indexOf ( ':' ) ; if ( splitter == - 1 ) { return moduleId ; } return moduleId . substring ( 0 , splitter ) ;
|
public class WorkQueue { /** * Start a worker . Called by startWorkers ( ) , but should also be called by the main thread to do some of the work
* on that thread , to prevent deadlock in the case that the ExecutorService doesn ' t have as many threads
* available as numParallelTasks . When this method returns , either all the work has been completed , or this or
* some other thread was interrupted . If InterruptedException is thrown , this thread or another was interrupted .
* @ throws InterruptedException
* if a worker thread was interrupted
* @ throws ExecutionException
* if a worker thread throws an uncaught exception */
private void runWorkLoop ( ) throws InterruptedException , ExecutionException { } }
|
// Get next work unit from queue
for ( ; ; ) { // Check for interruption
interruptionChecker . check ( ) ; // Get next work unit
final WorkUnitWrapper < T > workUnitWrapper = workUnits . take ( ) ; if ( workUnitWrapper . workUnit == null ) { // Received poison pill
break ; } // Process the work unit
try { // Process the work unit ( may throw InterruptedException )
workUnitProcessor . processWorkUnit ( workUnitWrapper . workUnit , this , log ) ; } catch ( InterruptedException | OutOfMemoryError e ) { // On InterruptedException or OutOfMemoryError , drain work queue , send poison pills , and re - throw
workUnits . clear ( ) ; sendPoisonPills ( ) ; throw e ; } catch ( final RuntimeException e ) { // On unchecked exception , drain work queue , send poison pills , and throw ExecutionException
workUnits . clear ( ) ; sendPoisonPills ( ) ; throw new ExecutionException ( "Worker thread threw unchecked exception" , e ) ; } finally { if ( numIncompleteWorkUnits . decrementAndGet ( ) == 0 ) { // No more work units - - send poison pills
sendPoisonPills ( ) ; } } }
|
public class UserAgentManager { /** * normalize : normalize clients that contain @ sign in user e . g . maria @ xyz . com
* @ param user
* @ return */
private String normalize ( String user ) { } }
|
if ( user != null ) { if ( user . contains ( "@" ) ) user = user . replaceAll ( "@" , "%40" ) ; } if ( logger . isDebugEnabled ( ) ) logger . debug ( "Normalized User = " + user ) ; return user ;
|
public class Handling { /** * Throws exception ( convenience method for lambda expressions ) . Pretends that there might be a product - but it will never be returned . */
public static < T , X extends Throwable > T throwThe ( X e ) throws X { } }
|
if ( e == null ) { throw new ExceptionNotHandled ( "Cannot throw null exception." ) ; } throw e ;
|
public class QNameSort { /** * Sort lexicographically by qname local - name , then by qname uri
* @ param ns1
* qname1 namespace
* @ param ln1
* qname1 local - name
* @ param ns2
* qname2 namespace
* @ param ln2
* qname2 local - name
* @ return a negative integer , zero , or a positive integer as the first
* qname is less than , equal to , or greater than the second . */
public static int compare ( String ns1 , String ln1 , String ns2 , String ln2 ) { } }
|
if ( ns1 == null ) { ns1 = Constants . XML_NULL_NS_URI ; } if ( ns2 == null ) { ns2 = Constants . XML_NULL_NS_URI ; } int cLocalPart = ln1 . compareTo ( ln2 ) ; return ( cLocalPart == 0 ? ns1 . compareTo ( ns2 ) : cLocalPart ) ;
|
public class DdlTokenStream { /** * Returns the string content for characters bounded by the previous marked position and the position of the currentToken
* ( inclusive ) . Method also marks ( ) the new position the the currentToken .
* @ return the string content for characters bounded by the previous marked position and the position of the currentToken
* ( inclusive ) . */
public String getMarkedContent ( ) { } }
|
Position startPosition = new Position ( currentMarkedPosition . getIndexInContent ( ) , currentMarkedPosition . getLine ( ) , currentMarkedPosition . getColumn ( ) ) ; mark ( ) ; return getContentBetween ( startPosition , currentMarkedPosition ) ;
|
public class DeduceBondSystemTool { /** * Recovers a RingSet corresponding to a AtomContainer that has been
* stored by storeRingSystem ( ) .
* @ param mol The IAtomContainer for which to recover the IRingSet . */
private IRingSet recoverRingSystem ( IAtomContainer mol ) { } }
|
IRingSet ringSet = mol . getBuilder ( ) . newInstance ( IRingSet . class ) ; for ( Integer [ ] bondNumbers : listOfRings ) { IRing ring = mol . getBuilder ( ) . newInstance ( IRing . class , bondNumbers . length ) ; for ( int bondNumber : bondNumbers ) { IBond bond = mol . getBond ( bondNumber ) ; ring . addBond ( bond ) ; if ( ! ring . contains ( bond . getBegin ( ) ) ) ring . addAtom ( bond . getBegin ( ) ) ; if ( ! ring . contains ( bond . getEnd ( ) ) ) ring . addAtom ( bond . getEnd ( ) ) ; } ringSet . addAtomContainer ( ring ) ; } return ringSet ;
|
public class SenderWorker { /** * Sends the given < code > ProtocolDataUnit < / code > instance over the socket to the connected iSCSI Target .
* @ param unit The < code > ProtocolDataUnit < / code > instances to send .
* @ throws InternetSCSIException if any violation of the iSCSI - Standard emerge .
* @ throws IOException if an I / O error occurs .
* @ throws InterruptedException if another caller interrupted the current caller before or while the current caller
* was waiting for a notification . The interrupted status of the current caller is cleared when this
* exception is thrown . */
public final void sendOverWire ( final ProtocolDataUnit unit ) throws InternetSCSIException , IOException , InterruptedException { } }
|
final Session session = connection . getSession ( ) ; unit . getBasicHeaderSegment ( ) . setInitiatorTaskTag ( session . getInitiatorTaskTag ( ) ) ; final InitiatorMessageParser parser = ( InitiatorMessageParser ) unit . getBasicHeaderSegment ( ) . getParser ( ) ; parser . setCommandSequenceNumber ( session . getCommandSequenceNumber ( ) ) ; parser . setExpectedStatusSequenceNumber ( connection . getExpectedStatusSequenceNumber ( ) . getValue ( ) ) ; unit . write ( socketChannel ) ; LOGGER . debug ( "Sending this PDU: " + unit ) ; // increment the Command Sequence Number
if ( parser . incrementSequenceNumber ( ) ) { connection . getSession ( ) . incrementCommandSequenceNumber ( ) ; }
|
public class OmsShalstab { /** * Calculates the trasmissivity in every pixel of the map . */
private void qcrit ( RenderedImage slope , RenderedImage ab , RandomIter trasmissivityRI , RandomIter frictionRI , RandomIter cohesionRI , RandomIter hsIter , RandomIter effectiveRI , RandomIter densityRI ) { } }
|
HashMap < String , Double > regionMap = CoverageUtilities . getRegionParamsFromGridCoverage ( inSlope ) ; int cols = regionMap . get ( CoverageUtilities . COLS ) . intValue ( ) ; int rows = regionMap . get ( CoverageUtilities . ROWS ) . intValue ( ) ; RandomIter slopeRI = RandomIterFactory . create ( slope , null ) ; RandomIter abRI = RandomIterFactory . create ( ab , null ) ; WritableRaster qcritWR = CoverageUtilities . createWritableRaster ( cols , rows , null , null , null ) ; WritableRandomIter qcritIter = RandomIterFactory . createWritable ( qcritWR , null ) ; WritableRaster classiWR = CoverageUtilities . createWritableRaster ( cols , rows , null , null , null ) ; WritableRandomIter classiIter = RandomIterFactory . createWritable ( classiWR , null ) ; pm . beginTask ( "Creating qcrit map..." , rows ) ; for ( int j = 0 ; j < rows ; j ++ ) { pm . worked ( 1 ) ; for ( int i = 0 ; i < cols ; i ++ ) { double slopeValue = slopeRI . getSampleDouble ( i , j , 0 ) ; double tanPhiValue = frictionRI . getSampleDouble ( i , j , 0 ) ; double cohValue = cohesionRI . getSampleDouble ( i , j , 0 ) ; double rhoValue = densityRI . getSampleDouble ( i , j , 0 ) ; double hsValue = hsIter . getSampleDouble ( i , j , 0 ) ; if ( ! isNovalue ( slopeValue ) && ! isNovalue ( tanPhiValue ) && ! isNovalue ( cohValue ) && ! isNovalue ( rhoValue ) && ! isNovalue ( hsValue ) ) { if ( hsValue <= EPS || slopeValue > pRock ) { qcritIter . setSample ( i , j , 0 , ROCK ) ; } else { double checkUnstable = tanPhiValue + cohValue / ( 9810.0 * rhoValue * hsValue ) * ( 1 + pow ( slopeValue , 2 ) ) ; if ( slopeValue >= checkUnstable ) { /* * uncond unstable */
qcritIter . setSample ( i , j , 0 , 5 ) ; } else { double checkStable = tanPhiValue * ( 1 - 1 / rhoValue ) + cohValue / ( 9810 * rhoValue * hsValue ) * ( 1 + pow ( slopeValue , 2 ) ) ; if ( slopeValue < checkStable ) { /* * uncond . stable */
qcritIter . setSample ( i , j , 0 , 0 ) ; } else { double qCrit = trasmissivityRI . getSampleDouble ( i , j , 0 ) * sin ( atan ( slopeValue ) ) / abRI . getSampleDouble ( i , j , 0 ) * rhoValue * ( 1 - slopeValue / tanPhiValue + cohValue / ( 9810 * rhoValue * hsValue * tanPhiValue ) * ( 1 + pow ( slopeValue , 2 ) ) ) * 1000 ; qcritIter . setSample ( i , j , 0 , qCrit ) ; /* * see the Qcrit ( critical effective
* precipitation ) that leads the slope to
* instability ( see article of Montgomery et Al ,
* Hydrological Processes , 12 , 943-955 , 1998) */
double value = qcritIter . getSampleDouble ( i , j , 0 ) ; if ( value > 0 && value < 50 ) qcritIter . setSample ( i , j , 0 , 1 ) ; if ( value >= 50 && value < 100 ) qcritIter . setSample ( i , j , 0 , 2 ) ; if ( value >= 100 && value < 200 ) qcritIter . setSample ( i , j , 0 , 3 ) ; if ( value >= 200 ) qcritIter . setSample ( i , j , 0 , 4 ) ; } } } } else { qcritIter . setSample ( i , j , 0 , doubleNovalue ) ; } } } pm . done ( ) ; /* * build the class matrix 1 = inc inst 2 = inc stab 3 = stab 4 = instab
* rock = presence of rock */
pm . beginTask ( "Creating stability map..." , rows ) ; double Tq = 0 ; for ( int j = 0 ; j < rows ; j ++ ) { pm . worked ( 1 ) ; for ( int i = 0 ; i < cols ; i ++ ) { Tq = trasmissivityRI . getSampleDouble ( i , j , 0 ) / ( effectiveRI . getSampleDouble ( i , j , 0 ) / 1000.0 ) ; double slopeValue = slopeRI . getSampleDouble ( i , j , 0 ) ; double abValue = abRI . getSampleDouble ( i , j , 0 ) ; double tangPhiValue = frictionRI . getSampleDouble ( i , j , 0 ) ; double cohValue = cohesionRI . getSampleDouble ( i , j , 0 ) ; double rhoValue = densityRI . getSampleDouble ( i , j , 0 ) ; double hsValue = hsIter . getSampleDouble ( i , j , 0 ) ; if ( ! isNovalue ( slopeValue ) && ! isNovalue ( abValue ) && ! isNovalue ( tangPhiValue ) && ! isNovalue ( cohValue ) && ! isNovalue ( rhoValue ) && ! isNovalue ( hsValue ) ) { if ( hsValue <= EPS || slopeValue > pRock ) { classiIter . setSample ( i , j , 0 , ROCK ) ; } else { double checkUncondUnstable = tangPhiValue + cohValue / ( 9810 * rhoValue * hsValue ) * ( 1 + pow ( slopeValue , 2 ) ) ; double checkUncondStable = tangPhiValue * ( 1 - 1 / rhoValue ) + cohValue / ( 9810 * rhoValue * hsValue ) * ( 1 + pow ( slopeValue , 2 ) ) ; double checkStable = Tq * sin ( atan ( slopeValue ) ) * rhoValue * ( 1 - slopeValue / tangPhiValue + cohValue / ( 9810 * rhoValue * hsValue * tangPhiValue ) * ( 1 + pow ( slopeValue , 2 ) ) ) ; if ( slopeValue >= checkUncondUnstable ) { classiIter . setSample ( i , j , 0 , 1 ) ; } else if ( slopeValue < checkUncondStable ) { classiIter . setSample ( i , j , 0 , 2 ) ; } else if ( abValue < checkStable && classiIter . getSampleDouble ( i , j , 0 ) != 1 && classiIter . getSampleDouble ( i , j , 0 ) != 2 ) { classiIter . setSample ( i , j , 0 , 3 ) ; } else { classiIter . setSample ( i , j , 0 , 4 ) ; } } } else { classiIter . setSample ( i , j , 0 , doubleNovalue ) ; } } } pm . done ( ) ; outQcrit = CoverageUtilities . buildCoverage ( "qcrit" , qcritWR , regionMap , inSlope . getCoordinateReferenceSystem ( ) ) ; outShalstab = CoverageUtilities . buildCoverage ( "classi" , classiWR , regionMap , inSlope . getCoordinateReferenceSystem ( ) ) ;
|
public class TCPMemcachedNodeImpl { /** * ( non - Javadoc )
* @ see net . spy . memcached . MemcachedNode # destroyInputQueue ( ) */
public Collection < Operation > destroyInputQueue ( ) { } }
|
Collection < Operation > rv = new ArrayList < Operation > ( ) ; inputQueue . drainTo ( rv ) ; return rv ;
|
public class Client { /** * Get the current sequence numbers from all partitions .
* @ return an { @ link Observable } of partition and sequence number . */
private Observable < PartitionAndSeqno > getSeqnos ( ) { } }
|
return conductor . getSeqnos ( ) . flatMap ( new Func1 < ByteBuf , Observable < PartitionAndSeqno > > ( ) { @ Override public Observable < PartitionAndSeqno > call ( ByteBuf buf ) { int numPairs = buf . readableBytes ( ) / 10 ; // 2 byte short + 8 byte long
List < PartitionAndSeqno > pairs = new ArrayList < > ( numPairs ) ; for ( int i = 0 ; i < numPairs ; i ++ ) { pairs . add ( new PartitionAndSeqno ( buf . getShort ( 10 * i ) , buf . getLong ( 10 * i + 2 ) ) ) ; } buf . release ( ) ; return Observable . from ( pairs ) ; } } ) ;
|
public class PageMetadata { /** * Generate query parameters for the backward page with the specified startkey .
* Pages only have a reference to the start key , when paging backwards this is the
* startkey of the following page ( i . e . the last element of the previous page ) so to
* correctly present page results when paging backwards requires some parameters to
* be reversed for the previous page request
* @ param initialQueryParameters page 1 query parameters
* @ param startkey the startkey for the backward page
* @ param startkey _ docid the doc id for the start key ( in case of duplicate keys )
* @ param < K > the view key type
* @ param < V > the view value type
* @ return the query parameters for the backward page . */
static < K , V > ViewQueryParameters < K , V > reversePaginationQueryParameters ( ViewQueryParameters < K , V > initialQueryParameters , K startkey , String startkey_docid ) { } }
|
// Get a copy of the parameters , using the forward pagination method
ViewQueryParameters < K , V > reversedParameters = forwardPaginationQueryParameters ( initialQueryParameters , startkey , startkey_docid ) ; // Now reverse some of the parameters to page backwards .
// Paging backward is descending from the original direction .
reversedParameters . setDescending ( ! initialQueryParameters . getDescending ( ) ) ; // We must always include our start key if paging backwards so inclusive end is true
reversedParameters . setInclusiveEnd ( true ) ; // Any initial startkey is now the end key because we are reversed from original direction
if ( startkey != null ) { reversedParameters . endkey = initialQueryParameters . startkey ; } if ( startkey_docid != null ) { reversedParameters . setEndKeyDocId ( initialQueryParameters . startkey_docid ) ; } return reversedParameters ;
|
public class BasicDeviceFactory { /** * Get a device according to his id
* @ param id The device id
* @ return The device
* @ throws UnknownDeviceException
* @ throws NullIdException */
public Device getDevice ( String id ) throws UnknownDeviceException , NullIdException { } }
|
if ( ( id == null ) || ( id . trim ( ) . equals ( "" ) ) ) { throw new NullIdException ( ) ; } else { if ( this . devices . containsKey ( id ) ) { return this . devices . get ( id ) ; } else { throw new UnknownDeviceException ( ) ; } }
|
public class ApplicationManifestUtils { /** * Write { @ link ApplicationManifest } s to an { @ link OutputStream }
* @ param out the { @ link OutputStream } to write to
* @ param applicationManifests the manifests to write */
public static void write ( OutputStream out , ApplicationManifest ... applicationManifests ) { } }
|
write ( out , Arrays . asList ( applicationManifests ) ) ;
|
public class XmlSlurper { /** * / * ( non - Javadoc )
* @ see org . xml . sax . ContentHandler # endElement ( java . lang . String , java . lang . String , java . lang . String ) */
public void endElement ( final String namespaceURI , final String localName , final String qName ) throws SAXException { } }
|
addCdata ( ) ; Node oldCurrentNode = stack . pop ( ) ; if ( oldCurrentNode != null ) { currentNode = oldCurrentNode ; }
|
public class FlowWatcher { /** * Called to fire events to the JobRunner listeners */
protected synchronized void handleJobStatusChange ( final String jobId , final Status status ) { } }
|
final BlockingStatus block = this . map . get ( jobId ) ; if ( block != null ) { block . changeStatus ( status ) ; }
|
public class AuthenticationInfo { /** * < pre >
* The email address of the authenticated user making the request .
* < / pre >
* < code > string principal _ email = 1 ; < / code > */
public com . google . protobuf . ByteString getPrincipalEmailBytes ( ) { } }
|
java . lang . Object ref = principalEmail_ ; if ( ref instanceof java . lang . String ) { com . google . protobuf . ByteString b = com . google . protobuf . ByteString . copyFromUtf8 ( ( java . lang . String ) ref ) ; principalEmail_ = b ; return b ; } else { return ( com . google . protobuf . ByteString ) ref ; }
|
public class Index { /** * Partially Override the content of several objects
* @ param objects the array of objects to update ( each object must contains an objectID attribute )
* @ param requestOptions Options to pass to this request */
public JSONObject partialUpdateObjects ( JSONArray objects , RequestOptions requestOptions ) throws AlgoliaException { } }
|
try { JSONArray array = new JSONArray ( ) ; for ( int n = 0 ; n < objects . length ( ) ; n ++ ) { array . put ( partialUpdateObject ( objects . getJSONObject ( n ) ) ) ; } return batch ( array , requestOptions ) ; } catch ( JSONException e ) { throw new AlgoliaException ( e . getMessage ( ) ) ; }
|
public class PortletTypeImpl { /** * If not already created , a new < code > portlet - info < / code > element with the given value will be created .
* Otherwise , the existing < code > portlet - info < / code > element will be returned .
* @ return a new or existing instance of < code > PortletInfoType < PortletType < T > > < / code > */
public PortletInfoType < PortletType < T > > getOrCreatePortletInfo ( ) { } }
|
Node node = childNode . getOrCreate ( "portlet-info" ) ; PortletInfoType < PortletType < T > > portletInfo = new PortletInfoTypeImpl < PortletType < T > > ( this , "portlet-info" , childNode , node ) ; return portletInfo ;
|
public class ModelsImpl { /** * Gets information about the application version ' s Pattern . Any model .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param entityId The entity extractor ID .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PatternAnyEntityExtractor object */
public Observable < PatternAnyEntityExtractor > getPatternAnyEntityInfoAsync ( UUID appId , String versionId , UUID entityId ) { } }
|
return getPatternAnyEntityInfoWithServiceResponseAsync ( appId , versionId , entityId ) . map ( new Func1 < ServiceResponse < PatternAnyEntityExtractor > , PatternAnyEntityExtractor > ( ) { @ Override public PatternAnyEntityExtractor call ( ServiceResponse < PatternAnyEntityExtractor > response ) { return response . body ( ) ; } } ) ;
|
public class MeasureUnitUtil { /** * Convert the given value expressed in the given unit to meters .
* @ param value is the value to convert
* @ param inputUnit is the unit of the { @ code value }
* @ return the result of the convertion . */
@ Pure @ SuppressWarnings ( "checkstyle:returncount" ) public static double toMeters ( double value , SpaceUnit inputUnit ) { } }
|
switch ( inputUnit ) { case TERAMETER : return value * 1e12 ; case GIGAMETER : return value * 1e9 ; case MEGAMETER : return value * 1e6 ; case KILOMETER : return value * 1e3 ; case HECTOMETER : return value * 1e2 ; case DECAMETER : return value * 1e1 ; case METER : break ; case DECIMETER : return value * 1e-1 ; case CENTIMETER : return value * 1e-2 ; case MILLIMETER : return value * 1e-3 ; case MICROMETER : return value * 1e-6 ; case NANOMETER : return value * 1e-9 ; case PICOMETER : return value * 1e-12 ; case FEMTOMETER : return value * 1e-15 ; default : throw new IllegalArgumentException ( ) ; } return value ;
|
public class NodeArbitrateEvent { /** * 销毁的node节点
* < pre >
* 1 . 是个同步调用
* < / pre > */
public void destory ( Long nid ) { } }
|
String path = ManagePathUtils . getNode ( nid ) ; try { zookeeper . delete ( path ) ; // 删除节点 , 不关心版本
} catch ( ZkNoNodeException e ) { // 如果节点已经不存在 , 则不抛异常
// ignore
} catch ( ZkException e ) { throw new ArbitrateException ( "Node_destory" , nid . toString ( ) , e ) ; }
|
public class Range { /** * Checks where the specified element occurs relative to this range .
* Returns { @ code - 1 } if this range is before the specified element ,
* { @ code 1 } if the this range is after the specified element , otherwise { @ code 0 } if the specified element is contained in this range .
* @ param element
* the element to check for , not null
* @ return - 1 , 0 or + 1 depending on the element ' s location relative to the range */
public int compareTo ( final T element ) { } }
|
if ( element == null ) { // Comparable API says throw NPE on null
throw new NullPointerException ( "Element is null" ) ; } if ( isBefore ( element ) ) { return - 1 ; } else if ( isAfter ( element ) ) { return 1 ; } else { return 0 ; }
|
public class ActionButton { /** * Draws the main circle of the < b > Action Button < / b > and calls
* { @ link # drawShadow ( ) } to draw the shadow if present
* @ param canvas canvas , on which circle is to be drawn */
protected void drawCircle ( Canvas canvas ) { } }
|
resetPaint ( ) ; if ( hasShadow ( ) ) { if ( isShadowResponsiveEffectEnabled ( ) ) { shadowResponsiveDrawer . draw ( canvas ) ; } else { drawShadow ( ) ; } } getPaint ( ) . setStyle ( Paint . Style . FILL ) ; boolean rippleInProgress = isRippleEffectEnabled ( ) && ( ( RippleEffectDrawer ) rippleEffectDrawer ) . isDrawingInProgress ( ) ; getPaint ( ) . setColor ( getState ( ) == State . PRESSED || rippleInProgress ? getButtonColorPressed ( ) : getButtonColor ( ) ) ; canvas . drawCircle ( calculateCenterX ( ) , calculateCenterY ( ) , calculateCircleRadius ( ) , getPaint ( ) ) ; LOGGER . trace ( "Drawn the Action Button circle" ) ;
|
public class DistortImageOps { /** * Applies a pixel transform to a single band image . More flexible but order to use function .
* @ deprecated As of v0.19 . Use { @ link FDistort } instead
* @ param input Input ( source ) image .
* @ param output Where the result of transforming the image image is written to .
* @ param renderAll true it renders all pixels , even ones outside the input image .
* @ param transform The transform that is being applied to the image
* @ param interp Interpolation algorithm . */
public static < Input extends ImageGray < Input > , Output extends ImageGray < Output > > void distortSingle ( Input input , Output output , boolean renderAll , PixelTransform < Point2D_F32 > transform , InterpolatePixelS < Input > interp ) { } }
|
Class < Output > inputType = ( Class < Output > ) input . getClass ( ) ; ImageDistort < Input , Output > distorter = FactoryDistort . distortSB ( false , interp , inputType ) ; distorter . setRenderAll ( renderAll ) ; distorter . setModel ( transform ) ; distorter . apply ( input , output ) ;
|
public class ApplyPendingMaintenanceActionRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ApplyPendingMaintenanceActionRequest applyPendingMaintenanceActionRequest , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( applyPendingMaintenanceActionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( applyPendingMaintenanceActionRequest . getReplicationInstanceArn ( ) , REPLICATIONINSTANCEARN_BINDING ) ; protocolMarshaller . marshall ( applyPendingMaintenanceActionRequest . getApplyAction ( ) , APPLYACTION_BINDING ) ; protocolMarshaller . marshall ( applyPendingMaintenanceActionRequest . getOptInType ( ) , OPTINTYPE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class RendererFactory { /** * Checks if a particular renderer ( descriptor ) is a good match for a
* particular renderer .
* @ param rendererDescriptor
* the renderer ( descriptor ) to check .
* @ param renderable
* the renderable that needs rendering .
* @ param bestMatchingDescriptor
* the currently " best matching " renderer ( descriptor ) , or null
* if no other renderers matches yet .
* @ return a { @ link RendererSelection } object if the renderer is a match , or
* null if not . */
private RendererSelection isRendererMatch ( final RendererBeanDescriptor < ? > rendererDescriptor , final Renderable renderable , final RendererSelection bestMatch ) { } }
|
final Class < ? extends Renderable > renderableType = rendererDescriptor . getRenderableType ( ) ; final Class < ? extends Renderable > renderableClass = renderable . getClass ( ) ; if ( ReflectionUtils . is ( renderableClass , renderableType ) ) { if ( bestMatch == null ) { return isRendererCapable ( rendererDescriptor , renderable , bestMatch ) ; } else { final int hierarchyDistance ; try { hierarchyDistance = ReflectionUtils . getHierarchyDistance ( renderableClass , renderableType ) ; } catch ( final IllegalArgumentException e ) { logger . warn ( "Failed to determine hierarchy distance between renderable type '{}' and renderable of class '{}'" , renderableType , renderableClass , e ) ; return null ; } if ( hierarchyDistance == 0 ) { // no hierarchy distance
return isRendererCapable ( rendererDescriptor , renderable , bestMatch ) ; } if ( hierarchyDistance <= bestMatch . getHierarchyDistance ( ) ) { // lower hierarchy distance than best match
return isRendererCapable ( rendererDescriptor , renderable , bestMatch ) ; } } } return null ;
|
public class BatchDetectEntitiesItemResultMarshaller { /** * Marshall the given parameter object . */
public void marshall ( BatchDetectEntitiesItemResult batchDetectEntitiesItemResult , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( batchDetectEntitiesItemResult == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( batchDetectEntitiesItemResult . getIndex ( ) , INDEX_BINDING ) ; protocolMarshaller . marshall ( batchDetectEntitiesItemResult . getEntities ( ) , ENTITIES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class ClassWriterImpl { /** * { @ inheritDoc } */
public void addSubInterfacesInfo ( Content classInfoTree ) { } }
|
if ( classDoc . isInterface ( ) ) { List < ClassDoc > subInterfaces = classtree . allSubs ( classDoc , false ) ; if ( subInterfaces . size ( ) > 0 ) { Content label = getResource ( "doclet.Subinterfaces" ) ; Content dt = HtmlTree . DT ( label ) ; Content dl = HtmlTree . DL ( dt ) ; dl . addContent ( getClassLinks ( LinkInfoImpl . Kind . SUBINTERFACES , subInterfaces ) ) ; classInfoTree . addContent ( dl ) ; } }
|
public class LaplaceInterpolation { /** * Compute squared root of L2 norms for a vector . */
private static double snorm ( double [ ] sx ) { } }
|
int n = sx . length ; double ans = 0.0 ; for ( int i = 0 ; i < n ; i ++ ) { ans += sx [ i ] * sx [ i ] ; } return Math . sqrt ( ans ) ;
|
public class Doc { /** * Checks to see if the specified tag exists */
public boolean isTagPresent ( String tagName ) { } }
|
Tag [ ] tags = getTagMap ( ) . get ( tagName ) ; return ( tags != null && tags . length > 0 ) ;
|
public class SpringApplicationRunner { /** * Compile and run the application .
* @ throws Exception on error */
public void compileAndRun ( ) throws Exception { } }
|
synchronized ( this . monitor ) { try { stop ( ) ; Class < ? > [ ] compiledSources = compile ( ) ; monitorForChanges ( ) ; // Run in new thread to ensure that the context classloader is setup
this . runThread = new RunThread ( compiledSources ) ; this . runThread . start ( ) ; this . runThread . join ( ) ; } catch ( Exception ex ) { if ( this . fileWatchThread == null ) { throw ex ; } else { ex . printStackTrace ( ) ; } } }
|
public class Selector { /** * Find elements matching selector .
* @ param evaluator CSS selector
* @ param root root element to descend into
* @ return matching elements , empty if none */
public static Elements select ( Evaluator evaluator , Element root ) { } }
|
Validate . notNull ( evaluator ) ; Validate . notNull ( root ) ; return Collector . collect ( evaluator , root ) ;
|
public class DumbDataFactory { /** * { @ inheritDoc } */
@ Override public IData deserializeData ( DataInput pSource ) throws TTIOException { } }
|
try { final long key = pSource . readLong ( ) ; byte [ ] data = new byte [ pSource . readInt ( ) ] ; pSource . readFully ( data ) ; return new DumbData ( key , data ) ; } catch ( final IOException exc ) { throw new TTIOException ( exc ) ; }
|
public class WebSockets { /** * Sends a complete binary message using blocking IO
* Automatically frees the pooled byte buffer when done .
* @ param pooledData The data to send , it will be freed when done
* @ param wsChannel The web socket channel */
public static void sendBinaryBlocking ( final PooledByteBuffer pooledData , final WebSocketChannel wsChannel ) throws IOException { } }
|
sendBlockingInternal ( pooledData , WebSocketFrameType . BINARY , wsChannel ) ;
|
public class Facet { /** * Ensure the path that is passed is only the name of the file and not a path */
protected boolean isBasename ( String potentialPath ) { } }
|
if ( ALLOW_VIEW_NAME_PATH_TRAVERSAL ) { return true ; } else { if ( potentialPath . contains ( "\\" ) || potentialPath . contains ( "/" ) ) { // prevent absolute path and folder traversal to find scripts
return false ; } return true ; }
|
public class PackageMemberAnnotation { /** * Format the annotation . Note that this version ( defined by
* PackageMemberAnnotation ) only handles the " class " and " package " keys , and
* calls formatPackageMember ( ) for all other keys .
* @ param key
* the key
* @ return the formatted annotation */
@ Override public final String format ( String key , ClassAnnotation primaryClass ) { } }
|
if ( "class.givenClass" . equals ( key ) ) { return shorten ( primaryClass . getPackageName ( ) , className ) ; } if ( "simpleClass" . equals ( key ) ) { return ClassName . extractSimpleName ( className ) ; } if ( "class" . equals ( key ) ) { return className ; } if ( "package" . equals ( key ) ) { return getPackageName ( ) ; } if ( "" . equals ( key ) && FindBugsDisplayFeatures . isAbridgedMessages ( ) && primaryClass != null ) { return formatPackageMember ( "givenClass" , primaryClass ) ; } return formatPackageMember ( key , primaryClass ) ;
|
public class ProcessCache { /** * Find all definitions matching the specified version spec . Returns shallow processes . */
public static List < Process > getProcessesSmart ( AssetVersionSpec spec ) throws DataAccessException { } }
|
if ( spec . getPackageName ( ) == null ) throw new DataAccessException ( "Spec must be package-qualified: " + spec ) ; List < Process > matches = new ArrayList < > ( ) ; for ( Process process : getAllProcesses ( ) ) { if ( spec . getQualifiedName ( ) . equals ( process . getQualifiedName ( ) ) ) { if ( process . meetsVersionSpec ( spec . getVersion ( ) ) ) matches . add ( process ) ; } } return matches ;
|
public class DB { /** * Updates the status for a post .
* @ param postId The post id .
* @ param status The new status .
* @ throws SQLException on database error . */
public void updatePostStatus ( final long postId , final Post . Status status ) throws SQLException { } }
|
Connection conn = null ; PreparedStatement stmt = null ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( updatePostStatusSQL ) ; stmt . setString ( 1 , status . toString ( ) . toLowerCase ( ) ) ; stmt . setLong ( 2 , postId ) ; stmt . executeUpdate ( ) ; } finally { SQLUtil . closeQuietly ( conn , stmt ) ; }
|
public class Cache { /** * skip checkstyle : OverloadMethodsDeclarationOrder */
@ Override public synchronized boolean free ( CachedData data ) { } }
|
@ SuppressWarnings ( "unchecked" ) Value value = ( ( Data < Value > ) data ) . value ; values . remove ( value ) ; Key key = null ; for ( Map . Entry < Key , Data < Value > > e : map . entrySet ( ) ) if ( e . getValue ( ) == data ) { key = e . getKey ( ) ; break ; } map . remove ( key ) ; if ( freer != null ) freer . fire ( value ) ; return true ;
|
public class EvalT { /** * Flat Map the wrapped Eval
* < pre >
* { @ code
* EvalWT . of ( AnyM . fromStream ( Arrays . asEvalW ( 10 ) )
* . flatMap ( t - > Eval . completedEval ( 20 ) ) ;
* / / EvalWT < AnyMSeq < Stream < Eval [ 20 ] > > >
* < / pre >
* @ param f FlatMap function
* @ return EvalWT that applies the flatMap function to the wrapped Eval */
public < B > EvalT < W , B > flatMapT ( final Function < ? super T , EvalT < W , B > > f ) { } }
|
return of ( run . map ( Eval -> Eval . flatMap ( a -> f . apply ( a ) . run . stream ( ) . toList ( ) . get ( 0 ) ) ) ) ;
|
public class Job { /** * Set the value class for the map output data . This allows the user to
* specify the map output value class to be different than the final output
* value class .
* @ param theClass the map output value class .
* @ throws IllegalStateException if the job is submitted */
public void setMapOutputValueClass ( Class < ? > theClass ) throws IllegalStateException { } }
|
ensureState ( JobState . DEFINE ) ; conf . setMapOutputValueClass ( theClass ) ;
|
public class CmsInternalLinkValidationList { /** * Returns the link validator class . < p >
* @ return the link validator class */
private CmsInternalLinksValidator getValidator ( ) { } }
|
if ( m_validator == null ) { // get the content check result object
Map objects = ( Map ) getSettings ( ) . getDialogObject ( ) ; Object o = objects . get ( CmsInternalLinkValidationDialog . class . getName ( ) ) ; List resources = new ArrayList ( ) ; if ( ( o != null ) && ( o instanceof List ) ) { resources = ( List ) o ; } m_validator = new CmsInternalLinksValidator ( getCms ( ) , resources ) ; } return m_validator ;
|
public class PropertiesManager { /** * Set the given property using an object ' s string representation . This will not write
* the new value to the file system .
* @ see # saveProperty ( Object , Object )
* @ param property
* the property whose value is being set
* @ param value
* the value to set
* @ throws IllegalArgumentException
* if a < code > null < / code > value is given ( see
* { @ link # resetProperty ( Object ) } ) */
public void setProperty ( T property , Object value ) throws IllegalArgumentException { } }
|
if ( value == null ) { throw new IllegalArgumentException ( "Cannot set a null value, use reset instead" ) ; } setProperty ( property , value . toString ( ) ) ;
|
public class RuntimeCapability { /** * Gets the name of service provided by this capability .
* @ param address the path from which dynamic portion of the capability name is calculated from . Cannot be { @ code null }
* @ param serviceValueType the expected type of the service ' s value . Only used to provide validate that
* the service value type provided by the capability matches the caller ' s
* expectation . May be { @ code null } in which case no validation is performed
* @ return the name of the service . Will not be { @ code null }
* @ throws IllegalArgumentException if the capability does not provide a service or if its value type
* is not assignable to { @ code serviceValueType }
* @ throws IllegalStateException if { @ link # isDynamicallyNamed ( ) } does not return { @ code true } */
public ServiceName getCapabilityServiceName ( PathAddress address , Class < ? > serviceValueType ) { } }
|
return fromBaseCapability ( address ) . getCapabilityServiceName ( serviceValueType ) ;
|
public class AppenderatorDriverRealtimeIndexTask { /** * Is a firehose from this factory drainable by closing it ? If so , we should drain on stopGracefully rather than
* abruptly stopping .
* This is a hack to get around the fact that the Firehose and FirehoseFactory interfaces do not help us do this .
* Protected for tests . */
protected boolean isFirehoseDrainableByClosing ( FirehoseFactory firehoseFactory ) { } }
|
return firehoseFactory instanceof EventReceiverFirehoseFactory || ( firehoseFactory instanceof TimedShutoffFirehoseFactory && isFirehoseDrainableByClosing ( ( ( TimedShutoffFirehoseFactory ) firehoseFactory ) . getDelegateFactory ( ) ) ) || ( firehoseFactory instanceof ClippedFirehoseFactory && isFirehoseDrainableByClosing ( ( ( ClippedFirehoseFactory ) firehoseFactory ) . getDelegate ( ) ) ) ;
|
public class ConfusionMatrix { /** * The Matthews Correlation Coefficient , takes true negatives into account in contrast to F - Score
* See < a href = " http : / / en . wikipedia . org / wiki / Matthews _ correlation _ coefficient " > MCC < / a >
* MCC = Correlation between observed and predicted binary classification
* @ return mcc ranges from - 1 ( total disagreement ) . . . 0 ( no better than random ) . . . 1 ( perfect ) */
public double mcc ( ) { } }
|
if ( ! isBinary ( ) ) throw new UnsupportedOperationException ( "mcc is only implemented for 2 class problems." ) ; if ( tooLarge ( ) ) throw new UnsupportedOperationException ( "mcc cannot be computed: too many classes" ) ; double tn = _cm [ 0 ] [ 0 ] ; double fp = _cm [ 0 ] [ 1 ] ; double tp = _cm [ 1 ] [ 1 ] ; double fn = _cm [ 1 ] [ 0 ] ; return ( tp * tn - fp * fn ) / Math . sqrt ( ( tp + fp ) * ( tp + fn ) * ( tn + fp ) * ( tn + fn ) ) ;
|
public class UIManager { /** * Attempts to find the configured renderer for the given output format and component .
* @ param component the component to find a manager for .
* @ param rendererPackage the package containing the renderers .
* @ return the Renderer for the component , or null if there is no renderer defined . */
private Renderer findConfiguredRenderer ( final WComponent component , final String rendererPackage ) { } }
|
Renderer renderer = null ; // We loop for each WComponent in the class hierarchy , as the
// Renderer may have been specified at a higher level .
for ( Class < ? > c = component . getClass ( ) ; renderer == null && c != null && ! AbstractWComponent . class . equals ( c ) ; c = c . getSuperclass ( ) ) { String qualifiedClassName = c . getName ( ) ; // Is there an override for this class ?
String rendererName = ConfigurationProperties . getRendererOverride ( qualifiedClassName ) ; if ( rendererName != null ) { renderer = createRenderer ( rendererName ) ; if ( renderer == null ) { LOG . warn ( "Layout Manager \"" + rendererName + "\" specified for " + qualifiedClassName + " was not found" ) ; } else { return renderer ; } } renderer = findRendererFactory ( rendererPackage ) . getRenderer ( c ) ; } return renderer ;
|
public class JPAPersistenceManagerImpl { /** * DS deactivate */
@ Deactivate protected void deactivate ( ) { } }
|
if ( psu != null ) { try { psu . close ( ) ; } catch ( Exception e ) { // FFDC .
} } logger . log ( Level . INFO , "persistence.service.status" , new Object [ ] { "JPA" , "deactivated" } ) ;
|
public class BitInputStream { /** * Read a Rice Signal Block .
* @ param vals The values to be returned
* @ param pos The starting position in the vals array
* @ param nvals The number of values to return
* @ param parameter The Rice parameter
* @ throws IOException On read error */
public void readRiceSignedBlock ( int [ ] vals , int pos , int nvals , int parameter ) throws IOException { } }
|
int j , valI = 0 ; int cbits = 0 , uval = 0 , msbs = 0 , lsbsLeft = 0 ; byte blurb , saveBlurb ; int state = 0 ; // 0 = getting unary MSBs , 1 = getting binary LSBs
if ( nvals == 0 ) return ; int i = getByte ; long startBits = getByte * 8 + getBit ; // We unroll the main loop to take care of partially consumed blurbs here .
if ( getBit > 0 ) { saveBlurb = blurb = buffer [ i ] ; cbits = getBit ; blurb <<= cbits ; while ( true ) { if ( state == 0 ) { if ( blurb != 0 ) { for ( j = 0 ; ( blurb & BLURB_TOP_BIT_ONE ) == 0 ; j ++ ) blurb <<= 1 ; msbs += j ; // dispose of the unary end bit
blurb <<= 1 ; j ++ ; cbits += j ; uval = 0 ; lsbsLeft = parameter ; state ++ ; // totalBitsRead + = msbs ;
if ( cbits == BITS_PER_BLURB ) { cbits = 0 ; readCRC16 = CRC16 . update ( saveBlurb , readCRC16 ) ; break ; } } else { msbs += BITS_PER_BLURB - cbits ; cbits = 0 ; readCRC16 = CRC16 . update ( saveBlurb , readCRC16 ) ; // totalBitsRead + = msbs ;
break ; } } else { int availableBits = BITS_PER_BLURB - cbits ; if ( lsbsLeft >= availableBits ) { uval <<= availableBits ; uval |= ( ( blurb & 0xff ) >> cbits ) ; cbits = 0 ; readCRC16 = CRC16 . update ( saveBlurb , readCRC16 ) ; // totalBitsRead + = availableBits ;
if ( lsbsLeft == availableBits ) { // compose the value
uval |= ( msbs << parameter ) ; if ( ( uval & 1 ) != 0 ) vals [ pos + valI ++ ] = - ( ( int ) ( uval >> 1 ) ) - 1 ; else vals [ pos + valI ++ ] = ( int ) ( uval >> 1 ) ; if ( valI == nvals ) break ; msbs = 0 ; state = 0 ; } lsbsLeft -= availableBits ; break ; } else { uval <<= lsbsLeft ; uval |= ( ( blurb & 0xff ) >> ( BITS_PER_BLURB - lsbsLeft ) ) ; blurb <<= lsbsLeft ; cbits += lsbsLeft ; // totalBitsRead + = lsbsLeft ;
// compose the value
uval |= ( msbs << parameter ) ; if ( ( uval & 1 ) != 0 ) vals [ pos + valI ++ ] = - ( ( int ) ( uval >> 1 ) ) - 1 ; else vals [ pos + valI ++ ] = ( int ) ( uval >> 1 ) ; if ( valI == nvals ) { // back up one if we exited the for loop because we
// read all nvals but the end came in the middle of
// a blurb
i -- ; break ; } msbs = 0 ; state = 0 ; } } } i ++ ; getByte = i ; getBit = cbits ; // totalConsumedBits = ( i < < BITS _ PER _ BLURB _ LOG2 ) | cbits ;
// totalBitsRead + = ( BITS _ PER _ BLURB ) | cbits ;
} // Now that we are blurb - aligned the logic is slightly simpler
while ( valI < nvals ) { for ( ; i < putByte && valI < nvals ; i ++ ) { saveBlurb = blurb = buffer [ i ] ; cbits = 0 ; while ( true ) { if ( state == 0 ) { if ( blurb != 0 ) { for ( j = 0 ; ( blurb & BLURB_TOP_BIT_ONE ) == 0 ; j ++ ) blurb <<= 1 ; msbs += j ; // dispose of the unary end bit
blurb <<= 1 ; j ++ ; cbits += j ; uval = 0 ; lsbsLeft = parameter ; state ++ ; // totalBitsRead + = msbs ;
if ( cbits == BITS_PER_BLURB ) { cbits = 0 ; readCRC16 = CRC16 . update ( saveBlurb , readCRC16 ) ; break ; } } else { msbs += BITS_PER_BLURB - cbits ; cbits = 0 ; readCRC16 = CRC16 . update ( saveBlurb , readCRC16 ) ; // totalBitsRead + = msbs ;
break ; } } else { int availableBits = BITS_PER_BLURB - cbits ; if ( lsbsLeft >= availableBits ) { uval <<= availableBits ; uval |= ( ( blurb & 0xff ) >> cbits ) ; cbits = 0 ; readCRC16 = CRC16 . update ( saveBlurb , readCRC16 ) ; // totalBitsRead + = availableBits ;
if ( lsbsLeft == availableBits ) { // compose the value
uval |= ( msbs << parameter ) ; if ( ( uval & 1 ) != 0 ) vals [ pos + valI ++ ] = - ( ( int ) ( uval >> 1 ) ) - 1 ; else vals [ pos + valI ++ ] = ( int ) ( uval >> 1 ) ; if ( valI == nvals ) break ; msbs = 0 ; state = 0 ; } lsbsLeft -= availableBits ; break ; } else { uval <<= lsbsLeft ; uval |= ( ( blurb & 0xff ) >> ( BITS_PER_BLURB - lsbsLeft ) ) ; blurb <<= lsbsLeft ; cbits += lsbsLeft ; // totalBitsRead + = lsbsLeft ;
// compose the value
uval |= ( msbs << parameter ) ; if ( ( uval & 1 ) != 0 ) vals [ pos + valI ++ ] = - ( ( int ) ( uval >> 1 ) ) - 1 ; else vals [ pos + valI ++ ] = ( int ) ( uval >> 1 ) ; if ( valI == nvals ) { // back up one if we exited the for loop because
// we read all nvals but the end came in the
// middle of a blurb
i -- ; break ; } msbs = 0 ; state = 0 ; } } } } getByte = i ; getBit = cbits ; // totalConsumedBits = ( i < < BITS _ PER _ BLURB _ LOG2 ) | cbits ;
// totalBitsRead + = ( BITS _ PER _ BLURB ) | cbits ;
if ( valI < nvals ) { long endBits = getByte * 8 + getBit ; // System . out . println ( " SE0 " + startBits + " " + endBits ) ;
totalBitsRead += endBits - startBits ; availBits -= endBits - startBits ; readFromStream ( ) ; // these must be zero because we can only get here if we got to
// the end of the buffer
i = 0 ; startBits = getByte * 8 + getBit ; } } long endBits = getByte * 8 + getBit ; // System . out . println ( " SE1 " + startBits + " " + endBits ) ;
totalBitsRead += endBits - startBits ; availBits -= endBits - startBits ;
|
public class Database { public String [ ] get_class_property_list ( String classname , String wildcard ) throws DevFailed { } }
|
return databaseDAO . get_class_property_list ( this , classname , wildcard ) ;
|
public class BaseProfile { /** * generate MBean code
* @ param def Definition */
void generateMBeanCode ( Definition def ) { } }
|
if ( def . isSupportOutbound ( ) ) { generateClassCode ( def , "MbeanInterface" , "mbean" ) ; generateClassCode ( def , "MbeanImpl" , "mbean" ) ; generatePackageInfo ( def , "main" , "mbean" ) ; }
|
public class XmlBean { /** * Configures the object by setting the value of its properties with the
* values from the xml document . Each element of the xml document represents
* a named property of the object . For example , if " setFirstName " is a property
* of the object , then an element of " < firstName > Joe < / firstName > " would set
* that value to " Joe " .
* @ param xml A string representation of the xml document
* @ param obj The object to configure
* @ throws com . cloudhopper . commons . xbean . XmlBeanException Thrown if an exception
* occurs while configuring the object .
* @ throws java . io . IOException Thrown if an exception occurs while attempting
* to parse the input for the xml document .
* @ throws org . xml . sax . SAXException Thrown if an exception occurs while parsing
* the xml document . */
public void configure ( String xml , Object obj ) throws XmlBeanException , IOException , SAXException { } }
|
configure ( xml , obj , null ) ;
|
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link BigInteger }
* { @ code > } */
@ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "skipCount" , scope = GetRenditions . class ) public JAXBElement < BigInteger > createGetRenditionsSkipCount ( BigInteger value ) { } }
|
return new JAXBElement < BigInteger > ( _GetTypeChildrenSkipCount_QNAME , BigInteger . class , GetRenditions . class , value ) ;
|
public class MavenHelpers { /** * Returns true if the dependency was added or false if its already there */
public static boolean ensureMavenDependencyAdded ( Project project , DependencyInstaller dependencyInstaller , String groupId , String artifactId , String scope ) { } }
|
List < Dependency > dependencies = project . getFacet ( DependencyFacet . class ) . getEffectiveDependencies ( ) ; for ( Dependency d : dependencies ) { if ( groupId . equals ( d . getCoordinate ( ) . getGroupId ( ) ) && artifactId . equals ( d . getCoordinate ( ) . getArtifactId ( ) ) ) { getLOG ( ) . debug ( "Project already includes: " + groupId + ":" + artifactId + " for version: " + d . getCoordinate ( ) . getVersion ( ) ) ; return false ; } } DependencyBuilder component = DependencyBuilder . create ( ) . setGroupId ( groupId ) . setArtifactId ( artifactId ) ; if ( scope != null ) { component . setScopeType ( scope ) ; } String version = MavenHelpers . getVersion ( groupId , artifactId ) ; if ( Strings . isNotBlank ( version ) ) { component = component . setVersion ( version ) ; getLOG ( ) . debug ( "Adding pom.xml dependency: " + groupId + ":" + artifactId + " version: " + version + " scope: " + scope ) ; } else { getLOG ( ) . debug ( "No version could be found for: " + groupId + ":" + artifactId ) ; } dependencyInstaller . install ( project , component ) ; return true ;
|
public class JSONHelpers { /** * Checks the supplied { @ link JSONObject } for a value mapped by an enum ; if it does not exist ,
* or is not an object value , the specified default value will be mapped to the enum . If the
* value does exist , but either ' x ' or ' y ' field is missing , the missing field ( s ) will be set
* using { @ code defPoint } . However , if { @ code allowImplicitPoint } is { @ code true } , and the
* value exists and is a { @ link Number } , then the value is left as - is .
* @ param json { @ code JSONObject } to check for value
* @ param e { @ link Enum } mapping the value to check
* @ param defPoint The value to use as default
* @ param allowImplicitPoint Whether to interpret a { @ code Number } value as implicitly defining
* both fields of a { @ code PointF } .
* @ return The { @ code JSONObject } passed as ' { @ code json } ' , for call - chaining . */
public static < P extends Enum < P > > JSONObject putDefault ( JSONObject json , P e , PointF defPoint , boolean allowImplicitPoint ) { } }
|
if ( json != null ) { JSONObject pointJson = optJSONObject ( json , e ) ; if ( pointJson != null ) { // Check both members ; default if missing
try { if ( ! hasNumber ( pointJson , "x" , true ) ) { pointJson . put ( "x" , defPoint . x ) ; } if ( ! hasNumber ( pointJson , "y" , true ) ) { pointJson . put ( "y" , defPoint . y ) ; } } catch ( JSONException e1 ) { throw new RuntimeException ( e1 ) ; } } else { // Some properties allow a point to be implicitly specified with a single number ,
// which is then used for both ' x ' and ' y ' values .
if ( ! ( allowImplicitPoint && hasNumber ( json , e ) ) ) { put ( json , e , defPoint ) ; } } } return json ;
|
public class JSConsumerSet { /** * / * ( non - Javadoc )
* @ see com . ibm . wsspi . sib . extension . ConsumerSet # setConcurrencyLimit ( int ) */
public void setConcurrencyLimit ( int maxConcurrency ) { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setConcurrencyLimit" , Integer . valueOf ( maxConcurrency ) ) ; boolean resumeConsumers = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "maxActiveMessagePrepareWriteLock.lock(): " + maxActiveMessagePrepareLock ) ; // Fully lock down the active message counting
maxActiveMessagePrepareWriteLock . lock ( ) ; try { synchronized ( maxActiveMessageLock ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Inital active Messages: current: " + currentActiveMessages + ", prepared: " + preparedActiveMessages + ", maximum: " + maxActiveMessages + " (suspended: " + consumerSetSuspended + ")" ) ; // A value of zero indicates no maximum
if ( maxConcurrency == 0 ) { maxActiveMessages = Integer . MAX_VALUE ; resumeThreshold = Integer . MAX_VALUE ; } else { maxActiveMessages = maxConcurrency ; // Set the resumeThreshold to 80 % of this value .
float res = ( maxActiveMessages * 8 ) ; res = Math . round ( res / 10 ) ; this . resumeThreshold = ( int ) res ; } // Check that changing the limit doesn ' t change our current
// suspend state
if ( currentActiveMessages > maxActiveMessages ) consumerSetSuspended = true ; else if ( consumerSetSuspended && ( currentActiveMessages < resumeThreshold ) ) { consumerSetSuspended = false ; resumeConsumers = true ; } } // synchronized
} finally { maxActiveMessagePrepareWriteLock . unlock ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "maxActiveMessagePrepareWriteLock.unlock(): " + maxActiveMessagePrepareLock ) ; } // We may have caused the set to be resumed - wakeup any suspended
// members of the set .
if ( resumeConsumers ) resumeConsumers ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setConcurrencyLimit" ) ;
|
public class Normal { /** * High - accuracy Normal cumulative distribution function .
* @ param x Value .
* @ return Result . */
public static double HighAccuracyFunction ( double x ) { } }
|
if ( x < - 8 || x > 8 ) return 0 ; double sum = x ; double term = 0 ; double nextTerm = x ; double pwr = x * x ; double i = 1 ; // Iterate until adding next terms doesn ' t produce
// any change within the current numerical accuracy .
while ( sum != term ) { term = sum ; // Next term
nextTerm *= pwr / ( i += 2 ) ; sum += nextTerm ; } return 0.5 + sum * Math . exp ( - 0.5 * pwr - 0.5 * Constants . Log2PI ) ;
|
public class ProjectCalendar { /** * Utility method to retrieve the previous working date finish time , given
* a date and time as a starting point .
* @ param date date and time start point
* @ return date and time of previous work finish */
public Date getPreviousWorkFinish ( Date date ) { } }
|
Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( date ) ; updateToPreviousWorkFinish ( cal ) ; return cal . getTime ( ) ;
|
public class DataUtil { /** * big - endian or motorola format . */
public static void writeIntegerBigEndian ( IO . WritableByteStream io , int value ) throws IOException { } }
|
io . write ( ( byte ) ( ( value >> 24 ) & 0xFF ) ) ; io . write ( ( byte ) ( ( value >> 16 ) & 0xFF ) ) ; io . write ( ( byte ) ( ( value >> 8 ) & 0xFF ) ) ; io . write ( ( byte ) ( value & 0xFF ) ) ;
|
public class BeanComparator { /** * Add an order - by property to produce a more refined Comparator . If the
* property does not return a { @ link Comparable } object when
* { @ link # compare compare } is called on the returned comparator , the
* property is ignored . Call { @ link # using using } on the returned
* BeanComparator to specify a Comparator to use for this property instead .
* The specified propery name may refer to sub - properties using a dot
* notation . For example , if the bean being compared contains a property
* named " info " of type " Information " , and " Information " contains a
* property named " text " , then ordering by the info text can be specified
* by " info . text " . Sub - properties of sub - properties may be refered to as
* well , a . b . c . d . e etc .
* If property type is a primitive , ordering is the same as for its
* Comparable object peer . Primitive booleans are ordered false low , true
* high . Floating point primitves are ordered exactly the same way as
* { @ link Float # compareTo ( Float ) Float . compareTo } and
* { @ link Double # compareTo ( Double ) Double . compareTo } .
* As a convenience , property names may have a ' - ' or ' + ' character prefix
* to specify sort order . A prefix of ' - ' indicates that the property
* is to be sorted in reverse ( descending ) . By default , properties are
* sorted in ascending order , and so a prefix of ' + ' has no effect .
* Any previously applied { @ link # reverse reverse - order } , { @ link # nullHigh
* null - order } and { @ link # caseSensitive case - sensitive } settings are not
* carried over , and are reset to the defaults for this order - by property .
* @ throws IllegalArgumentException when property doesn ' t exist or cannot
* be read . */
public BeanComparator < T > orderBy ( String propertyName ) throws IllegalArgumentException { } }
|
int dot = propertyName . indexOf ( '.' ) ; String subName ; if ( dot < 0 ) { subName = null ; } else { subName = propertyName . substring ( dot + 1 ) ; propertyName = propertyName . substring ( 0 , dot ) ; } boolean reverse = false ; if ( propertyName . length ( ) > 0 ) { char prefix = propertyName . charAt ( 0 ) ; switch ( prefix ) { default : break ; case '-' : reverse = true ; // Fall through
case '+' : propertyName = propertyName . substring ( 1 ) ; } } BeanProperty prop = getProperties ( ) . get ( propertyName ) ; if ( prop == null ) { throw new IllegalArgumentException ( "Property '" + propertyName + "' doesn't exist in '" + mBeanClass . getName ( ) + '\'' ) ; } if ( prop . getReadMethod ( ) == null ) { throw new IllegalArgumentException ( "Property '" + propertyName + "' cannot be read" ) ; } if ( propertyName . equals ( mOrderByName ) ) { // Make String unique so that properties can be specified in
// consecutive order - by calls without being eliminated by
// reduceRules . A secondary order - by may wish to further refine an
// ambiguous comparison using a Comparator .
propertyName = new String ( propertyName ) ; } BeanComparator < T > bc = new BeanComparator < T > ( this ) ; bc . mOrderByName = propertyName ; if ( subName != null ) { BeanComparator < ? > subOrder = forClass ( prop . getType ( ) ) ; subOrder . mCollator = mCollator ; bc = bc . using ( subOrder . orderBy ( subName ) ) ; } return reverse ? bc . reverse ( ) : bc ;
|
public class TypeVariableUtils { /** * Shortcut for { @ link # matchVariables ( Type , Type ) } which return map of variable names instaed of raw
* variable objects .
* @ param template type with variables
* @ param real type to compare and resolve variables from
* @ return map of resolved variables or empty map
* @ throws IllegalArgumentException when provided types are nto compatible */
public static Map < String , Type > matchVariableNames ( final Type template , final Type real ) { } }
|
final Map < TypeVariable , Type > match = matchVariables ( template , real ) ; if ( match . isEmpty ( ) ) { return Collections . emptyMap ( ) ; } final Map < String , Type > res = new HashMap < String , Type > ( ) ; for ( Map . Entry < TypeVariable , Type > entry : match . entrySet ( ) ) { res . put ( entry . getKey ( ) . getName ( ) , entry . getValue ( ) ) ; } return res ;
|
public class Tuple { /** * Create new Triple ( Tuple with three elements ) .
* @ param < T1 >
* @ param < T2 >
* @ param < T3 >
* @ param e1
* @ param e2
* @ param e3
* @ return Triple */
public static < T1 , T2 , T3 > Triple < T1 , T2 , T3 > newTuple ( T1 e1 , T2 e2 , T3 e3 ) { } }
|
return new Triple < T1 , T2 , T3 > ( e1 , e2 , e3 ) ;
|
public class HtmlUnitRegExpProxy { /** * { @ inheritDoc } */
@ Override public Scriptable wrapRegExp ( final Context cx , final Scriptable scope , final Object compiled ) { } }
|
return wrapped_ . wrapRegExp ( cx , scope , compiled ) ;
|
public class ZipEntry { /** * Sets the optional comment string for the entry .
* < p > ZIP entry comments have maximum length of 0xffff . If the length of the
* specified comment string is greater than 0xFFFF bytes after encoding , only
* the first 0xFFFF bytes are output to the ZIP file entry .
* @ param comment the comment string
* @ see # getComment ( ) */
public void setComment ( String comment ) { } }
|
// Android - changed : Explicitly allow null comments ( or allow comments to be
// cleared ) .
if ( comment == null ) { this . comment = null ; return ; } // Android - changed : Explicitly use UTF - 8.
if ( comment . getBytes ( StandardCharsets . UTF_8 ) . length > 0xffff ) { throw new IllegalArgumentException ( comment + " too long: " + comment . getBytes ( StandardCharsets . UTF_8 ) . length ) ; } this . comment = comment ;
|
public class HttpPostRequestEncoder { /** * Add a series of Files associated with one File parameter
* @ param name
* the name of the parameter
* @ param file
* the array of files
* @ param contentType
* the array of content Types associated with each file
* @ param isText
* the array of isText attribute ( False meaning binary mode ) for each file
* @ throws IllegalArgumentException
* also throws if array have different sizes
* @ throws ErrorDataEncoderException
* if the encoding is in error or if the finalize were already done */
public void addBodyFileUploads ( String name , File [ ] file , String [ ] contentType , boolean [ ] isText ) throws ErrorDataEncoderException { } }
|
if ( file . length != contentType . length && file . length != isText . length ) { throw new IllegalArgumentException ( "Different array length" ) ; } for ( int i = 0 ; i < file . length ; i ++ ) { addBodyFileUpload ( name , file [ i ] , contentType [ i ] , isText [ i ] ) ; }
|
public class MessageMgr { /** * Returns is the report level is enabled or not .
* @ param type message type to check
* @ return true if the message type is in the list of active message types of the manager and if the associated logger is enabled , false otherwise */
public boolean isEnabledFor ( E_MessageType type ) { } }
|
if ( ! this . messageHandlers . containsKey ( type ) ) { return false ; } return this . messageHandlers . get ( type ) . isEnabled ( ) ;
|
public class RouteFilterRulesInner { /** * Gets all RouteFilterRules in a route filter .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; RouteFilterRuleInner & gt ; object */
public Observable < ServiceResponse < Page < RouteFilterRuleInner > > > listByRouteFilterNextWithServiceResponseAsync ( final String nextPageLink ) { } }
|
return listByRouteFilterNextSinglePageAsync ( nextPageLink ) . concatMap ( new Func1 < ServiceResponse < Page < RouteFilterRuleInner > > , Observable < ServiceResponse < Page < RouteFilterRuleInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < RouteFilterRuleInner > > > call ( ServiceResponse < Page < RouteFilterRuleInner > > page ) { String nextPageLink = page . body ( ) . nextPageLink ( ) ; if ( nextPageLink == null ) { return Observable . just ( page ) ; } return Observable . just ( page ) . concatWith ( listByRouteFilterNextWithServiceResponseAsync ( nextPageLink ) ) ; } } ) ;
|
public class ReflectionUtil { /** * Transpiled code that directly acccess the serialVersionUID field when reflection is stripped
* won ' t compile because this field is also stripped .
* < p > Accessing it via reflection allows the non - stripped code to keep the same behavior and
* allows the stripped code to compile . Note that in the later case , a ReflectionStrippedError
* will be thrown , this is OK because serialization code is not supported when reflection is
* stripped . */
public static long getSerialVersionUID ( Class < ? extends Serializable > clazz ) { } }
|
try { return clazz . getField ( "serialVersionUID" ) . getLong ( null ) ; } catch ( NoSuchFieldException | IllegalAccessException ex ) { // ignored .
return 0 ; }
|
public class SQLite { /** * Get an aliased func ( column ) .
* @ param alias
* may be null for a default alias */
private static String func ( String func , String column , @ Nullable String alias ) { } }
|
if ( alias == null ) { alias = aliased ( column ) ; } return func + '(' + column + ") AS " + alias ;
|
public class EnumHelper { /** * Creates a lookup array based on the " value " associated with an MpxjEnum .
* @ param < E > target enumeration
* @ param c enumeration class
* @ param arraySizeOffset offset to apply to the array size
* @ return lookup array */
@ SuppressWarnings ( { } }
|
"unchecked" } ) public static final < E extends Enum < E > > E [ ] createTypeArray ( Class < E > c , int arraySizeOffset ) { EnumSet < E > set = EnumSet . allOf ( c ) ; E [ ] array = ( E [ ] ) Array . newInstance ( c , set . size ( ) + arraySizeOffset ) ; for ( E e : set ) { int index = ( ( MpxjEnum ) e ) . getValue ( ) ; if ( index >= 0 ) { array [ index ] = e ; } } return array ;
|
public class MpProcedureTask { /** * at the same time ( seems to only be an issue if the parameter to the procedure is a VoltTable ) */
public String toShortString ( ) { } }
|
StringBuilder sb = new StringBuilder ( ) ; taskToString ( sb ) ; if ( m_msg != null ) { sb . append ( "\n" ) ; m_msg . toShortString ( sb ) ; } return sb . toString ( ) ;
|
public class TemplateElement { /** * Sets the fields value for this TemplateElement .
* @ param fields * List of fields to use for this template element .
* These must be the same for all template ads in the
* same template ad union .
* < span class = " constraint Required " > This field is required
* and should not be { @ code null } . < / span > */
public void setFields ( com . google . api . ads . adwords . axis . v201809 . cm . TemplateElementField [ ] fields ) { } }
|
this . fields = fields ;
|
public class JAXBHandle { /** * Returns the root object of the JAXB structure for the content
* cast to a more specific class .
* @ param asthe class of the object
* @ param < T > the type to return
* @ returnthe root JAXB object */
public < T > T get ( Class < T > as ) { } }
|
if ( content == null ) { return null ; } if ( as == null ) { throw new IllegalArgumentException ( "Cannot cast content to null class" ) ; } if ( ! as . isAssignableFrom ( content . getClass ( ) ) ) { throw new IllegalArgumentException ( "Cannot cast " + content . getClass ( ) . getName ( ) + " to " + as . getName ( ) ) ; } @ SuppressWarnings ( "unchecked" ) T content = ( T ) get ( ) ; return content ;
|
public class AbstractRegistry { /** * { @ inheritDoc }
* @ param entries { @ inheritDoc }
* @ return { @ inheritDoc }
* @ throws MultiException { @ inheritDoc }
* @ throws InvalidStateException { @ inheritDoc } */
@ Override public List < ENTRY > removeAll ( Collection < ENTRY > entries ) throws MultiException , InvalidStateException { } }
|
final List < ENTRY > removedEntries = new ArrayList < > ( ) ; ExceptionStack exceptionStack = null ; registryLock . writeLock ( ) . lock ( ) ; try { for ( ENTRY entry : entries ) { // shutdown check is needed because this is not a atomic transaction .
if ( shutdownInitiated ) { throw new InvalidStateException ( "Entry removal canceled because registry is shutting down!" ) ; } try { if ( contains ( entry ) ) { removedEntries . add ( remove ( entry ) ) ; } } catch ( CouldNotPerformException ex ) { exceptionStack = MultiException . push ( this , ex , exceptionStack ) ; } } MultiException . checkAndThrow ( ( ) -> "Could not remove all entries!" , exceptionStack ) ; } finally { registryLock . writeLock ( ) . unlock ( ) ; } return removedEntries ;
|
public class MsgHtmlTagNode { /** * Returns the { @ code RawTextNode } of the given attribute and removes it from the tag if it
* exists , otherwise returns { @ code null } .
* @ param tagNode The owning tag
* @ param name The attribute name
* @ param errorReporter The error reporter */
@ Nullable private static RawTextNode getAttributeValue ( HtmlTagNode tagNode , String name , ErrorReporter errorReporter ) { } }
|
HtmlAttributeNode attribute = tagNode . getDirectAttributeNamed ( name ) ; if ( attribute == null ) { return null ; } RawTextNode value = getAttributeValue ( attribute , name , errorReporter ) ; // Remove it , we don ' t actually want to render it
tagNode . removeChild ( attribute ) ; return value ;
|
public class MessengerFactory { /** * Returns engine URL for another server , using server specification as input .
* Server specification can be one of the following forms
* a ) URL of the form t3 : / / host : port , iiop : / / host : port , rmi : / / host : port , http : / / host : port / context _ and _ path
* b ) a logical server name , in which case the URL is obtained from property mdw . remote . server . < server - name >
* c ) server _ name @ URL
* @ param serverSpec
* @ return URL for the engine
* @ throws NamingException */
public static String getEngineUrl ( String serverSpec ) throws NamingException { } }
|
String url ; int at = serverSpec . indexOf ( '@' ) ; if ( at > 0 ) { url = serverSpec . substring ( at + 1 ) ; } else { int colonDashDash = serverSpec . indexOf ( "://" ) ; if ( colonDashDash > 0 ) { url = serverSpec ; } else { url = PropertyManager . getProperty ( PropertyNames . MDW_REMOTE_SERVER + "." + serverSpec ) ; if ( url == null ) throw new NamingException ( "Cannot find engine URL for " + serverSpec ) ; } } return url ;
|
public class DecimalConvertor { /** * Produces decimal digits for non - zero , finite floating point values .
* The sign of the value is discarded . Passing in Infinity or NaN produces
* invalid digits . The maximum number of decimal digits that this
* function will likely produce is 18.
* @ param v value
* @ param digits buffer to receive decimal digits
* @ param offset offset into digit buffer
* @ param maxDigits maximum number of digits to produce
* @ param maxFractDigits maximum number of fractional digits to produce
* @ param roundMode i . e . ROUND _ HALF _ UP
* @ return Upper 16 bits : decimal point offset ; lower 16 bits : number of
* digits produced */
public static int toDecimalDigits ( double v , char [ ] digits , int offset , int maxDigits , int maxFractDigits , int roundMode ) { } }
|
// NOTE : The value 144115188075855872 is converted to
// 144115188075855870 , which is as correct as possible . Java ' s
// Double . toString method doesn ' t round off the last digit .
long bits = Double . doubleToLongBits ( v ) ; long f = bits & 0xfffffffffffffL ; int e = ( int ) ( ( bits >> 52 ) & 0x7ff ) ; if ( e != 0 ) { // Normalized number .
return toDecimalDigits ( f + 0x10000000000000L , e - 1022 , 53 , digits , offset , maxDigits , maxFractDigits , roundMode ) ; } else { // Denormalized number .
return toDecimalDigits ( f , - 1023 , 52 , digits , offset , maxDigits , maxFractDigits , roundMode ) ; }
|
public class NativeArray { /** * / * Support for generic Array - ish objects . Most of the Array
* functions try to be generic ; anything that has a length
* property is assumed to be an array .
* getLengthProperty returns 0 if obj does not have the length property
* or its value is not convertible to a number . */
static long getLengthProperty ( Context cx , Scriptable obj , boolean throwIfTooLarge ) { } }
|
// These will both give numeric lengths within Uint32 range .
if ( obj instanceof NativeString ) { return ( ( NativeString ) obj ) . getLength ( ) ; } if ( obj instanceof NativeArray ) { return ( ( NativeArray ) obj ) . getLength ( ) ; } Object len = ScriptableObject . getProperty ( obj , "length" ) ; if ( len == Scriptable . NOT_FOUND ) { // toUint32 ( undefined ) = = 0
return 0 ; } double doubleLen = ScriptRuntime . toNumber ( len ) ; if ( doubleLen > NativeNumber . MAX_SAFE_INTEGER ) { if ( throwIfTooLarge ) { String msg = ScriptRuntime . getMessage0 ( "msg.arraylength.bad" ) ; throw ScriptRuntime . constructError ( "RangeError" , msg ) ; } return ( int ) NativeNumber . MAX_SAFE_INTEGER ; } if ( doubleLen < 0 ) { return 0 ; } return ScriptRuntime . toUint32 ( len ) ;
|
public class ViaCEPGWTClient { /** * Executa a consulta de endereços a partir da UF , localidade e logradouro
* @ param uf Unidade Federativa . Precisa ter 2 caracteres .
* @ param localidade Localidade ( p . e . município ) . Precisa ter ao menos 3 caracteres .
* @ param logradouro Logradouro ( p . e . rua , avenida , estrada ) . Precisa ter ao menos 3 caracteres .
* @ param callback O retorno da chamada ao webservice . Erros de validação de campos e de conexão são tratados no callback . */
public void getEnderecos ( String uf , String localidade , String logradouro , final MethodCallback < List < ViaCEPEndereco > > callback ) { } }
|
if ( uf == null || uf . length ( ) != 2 ) { callback . onFailure ( null , new IllegalArgumentException ( "UF inválida - deve conter 2 caracteres: " + uf ) ) ; return ; } if ( localidade == null || localidade . length ( ) < 3 ) { callback . onFailure ( null , new IllegalArgumentException ( "Localidade inválida - deve conter pelo menos 3 caracteres: " + localidade ) ) ; return ; } if ( logradouro == null || logradouro . length ( ) < 3 ) { callback . onFailure ( null , new IllegalArgumentException ( "Logradouro inválido - deve conter pelo menos 3 caracteres: " + logradouro ) ) ; return ; } ViaCEPGWTService service = getService ( ) ; service . getEnderecos ( uf , localidade , logradouro , callback ) ;
|
public class ThreadPool { /** * Wait for a shutdown pool to fully terminate , or until the timeout
* has expired . This method may only be called < em > after < / em > invoking
* shutdownNow or
* shutdownAfterProcessingCurrentlyQueuedTasks .
* @ param maxWaitTime
* the maximum time in milliseconds to wait
* @ return true if the pool has terminated within the max wait period
* @ exception IllegalStateException
* if shutdown has not been requested
* @ exception InterruptedException
* if the current thread has been interrupted in the course of
* waiting
* @ deprecated */
@ Deprecated public synchronized boolean awaitTerminationAfterShutdown ( long maxWaitTime ) throws InterruptedException { } }
|
if ( ! shutdown_ ) throw new IllegalStateException ( ) ; if ( poolSize_ == 0 ) return true ; long waitTime = maxWaitTime ; if ( waitTime <= 0 ) return false ; long start = System . currentTimeMillis ( ) ; for ( ; ; ) { wait ( waitTime ) ; if ( poolSize_ == 0 ) return true ; waitTime = maxWaitTime - ( System . currentTimeMillis ( ) - start ) ; if ( waitTime <= 0 ) return false ; }
|
public class TransformationPerformer { /** * Performs a transformation based merge of the given source object with the given target object based on the given
* TransformationDescription . */
public Object transformObject ( TransformationDescription description , Object source , Object target ) throws InstantiationException , IllegalAccessException , ClassNotFoundException { } }
|
checkNeededValues ( description ) ; Class < ? > sourceClass = modelRegistry . loadModel ( description . getSourceModel ( ) ) ; Class < ? > targetClass = modelRegistry . loadModel ( description . getTargetModel ( ) ) ; if ( ! sourceClass . isAssignableFrom ( source . getClass ( ) ) ) { throw new IllegalArgumentException ( "The given source object does not match the given description" ) ; } this . source = source ; if ( target == null ) { this . target = targetClass . newInstance ( ) ; } else { this . target = target ; } for ( TransformationStep step : description . getTransformingSteps ( ) ) { performTransformationStep ( step ) ; } return this . target ;
|
public class StringUtils { /** * Return a string that is no longer than capSize , and pad with " . . . " if
* returning a substring .
* @ param str
* The string to cap
* @ param capSize
* The maximum cap size
* @ return The string capped at capSize . */
public static String cap ( String str , int capSize ) { } }
|
if ( str . length ( ) <= capSize ) { return str ; } if ( capSize <= 3 ) { return str . substring ( 0 , capSize ) ; } return str . substring ( 0 , capSize - 3 ) + "..." ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.