signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class Helper { /** * Converts back the integer value .
* @ return the degree value of the specified integer */
public static final double intToDegree ( int storedInt ) { } }
|
if ( storedInt == Integer . MAX_VALUE ) return Double . MAX_VALUE ; if ( storedInt == - Integer . MAX_VALUE ) return - Double . MAX_VALUE ; return ( double ) storedInt / DEGREE_FACTOR ;
|
public class SocketBase { /** * to be later retrieved by getSocketOpt . */
private void extractFlags ( Msg msg ) { } }
|
// Test whether IDENTITY flag is valid for this socket type .
if ( msg . isIdentity ( ) ) { assert ( options . recvIdentity ) ; } // Remove MORE flag .
rcvmore = msg . hasMore ( ) ;
|
public class PoolInfoStrings { /** * Returns true if field corresponding to fieldID is set ( has been assigned a value ) and false otherwise */
public boolean isSet ( _Fields field ) { } }
|
if ( field == null ) { throw new IllegalArgumentException ( ) ; } switch ( field ) { case POOL_GROUP_NAME : return isSetPoolGroupName ( ) ; case POOL_NAME : return isSetPoolName ( ) ; } throw new IllegalStateException ( ) ;
|
public class Transforms { /** * Signum function of this ndarray
* @ param toSign
* @ return */
public static INDArray sign ( INDArray toSign , boolean dup ) { } }
|
return exec ( dup ? new Sign ( toSign , toSign . ulike ( ) ) : new Sign ( toSign ) ) ;
|
public class VdmModel { /** * ( non - Javadoc )
* @ see org . overture . ide . core . ast . IVdmElement # getRootElementList ( ) */
public synchronized List < INode > getRootElementList ( ) { } }
|
List < INode > list = new Vector < INode > ( ) ; for ( IVdmSourceUnit unit : vdmSourceUnits ) { list . addAll ( unit . getParseList ( ) ) ; } return list ;
|
public class LCAGraphManager { /** * Get the lowest common ancestor of two nodes in O ( 1 ) time
* Query by Chris Lewis
* 1 . Find the lowest common ancestor b in the binary tree of nodes I ( x ) and I ( y ) .
* 2 . Find the smallest position j & ge ; h ( b ) such that both numbers A x and A y have 1 - bits in position j .
* This gives j = h ( I ( z ) ) .
* 3 . Find node x ' , the closest node to x on the same run as z :
* a . Find the position l of the right - most 1 bit in A x
* b . If l = j , then set x ' = x { x and z are on the same run in the general graph } and go to step 4.
* c . Find the position k of the left - most 1 - bit in A x that is to the right of position j .
* Form the number consisting of the bits of I ( x ) to the left of the position k ,
* followed by a 1 - bit in position k , followed by all zeros . { That number will be I ( w ) }
* Look up node L ( I ( w ) ) , which must be node w . Set node x ' to be the parent of node w in the general tree .
* 4 . Find node y ' , the closest node to y on the same run as z using the approach described in step 3.
* 5 . If x ' < y ' then set z to x ' else set z to y '
* @ param x node dfs number
* @ param y node dfs number
* @ return the dfs number of the lowest common ancestor of a and b in the dfs tree */
private int getLCADFS ( int x , int y ) { } }
|
// trivial cases
if ( x == y || x == father [ y ] ) { return x ; } if ( y == father [ x ] ) { return y ; } // step 1
int b = BitOperations . binaryLCA ( I [ x ] + 1 , I [ y ] + 1 ) ; // step 2
int hb = BitOperations . getFirstExp ( b ) ; if ( hb == - 1 ) { throw new UnsupportedOperationException ( ) ; } int j = BitOperations . getFirstExpInBothXYfromI ( A [ x ] , A [ y ] , hb ) ; if ( j == - 1 ) { throw new UnsupportedOperationException ( ) ; } // step 3 & 4
int xPrim = closestFrom ( x , j ) ; int yPrim = closestFrom ( y , j ) ; // step 5
if ( xPrim < yPrim ) { return xPrim ; } return yPrim ;
|
public class StaleSecurityGroup { /** * Information about the stale outbound rules in the security group .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setStaleIpPermissionsEgress ( java . util . Collection ) } or
* { @ link # withStaleIpPermissionsEgress ( java . util . Collection ) } if you want to override the existing values .
* @ param staleIpPermissionsEgress
* Information about the stale outbound rules in the security group .
* @ return Returns a reference to this object so that method calls can be chained together . */
public StaleSecurityGroup withStaleIpPermissionsEgress ( StaleIpPermission ... staleIpPermissionsEgress ) { } }
|
if ( this . staleIpPermissionsEgress == null ) { setStaleIpPermissionsEgress ( new com . amazonaws . internal . SdkInternalList < StaleIpPermission > ( staleIpPermissionsEgress . length ) ) ; } for ( StaleIpPermission ele : staleIpPermissionsEgress ) { this . staleIpPermissionsEgress . add ( ele ) ; } return this ;
|
public class MultivaluedPersonAttributeUtils { /** * Takes a { @ link Collection } and creates a flattened { @ link Collection } out
* of it .
* @ param < T > Type of collection ( extends Object )
* @ param source The { @ link Collection } to flatten .
* @ return A flattened { @ link Collection } that contains all entries from all levels of < code > source < / code > . */
@ SuppressWarnings ( "unchecked" ) public static < T > Collection < T > flattenCollection ( final Collection < ? extends Object > source ) { } }
|
Validate . notNull ( source , "Cannot flatten a null collection." ) ; final Collection < T > result = new LinkedList < > ( ) ; for ( final Object value : source ) { if ( value instanceof Collection ) { final Collection < Object > flatCollection = flattenCollection ( ( Collection < Object > ) value ) ; result . addAll ( ( Collection < T > ) flatCollection ) ; } else { result . add ( ( T ) value ) ; } } return result ;
|
public class EJSWrapperCommon { /** * d195605 */
public void unpin ( ) { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "unpin: " + ivBeanId ) ; synchronized ( ivBucket ) { if ( pinned > 0 ) { pinned -- ; // Touch the LRU flag ; since an object cannot be evicted when
// pinned , this is the only time when we bother to set the
// flag
( ( WrapperBucket ) ivBucket ) . ivWrapperCache . touch ( this ) ; } else { // If the application has been stopped / uninstalled , the wrapper
// will have been forcibly evicted from the cache , so just
// trace , but ignore this condition .
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "unpin: Not pinned : " + pinned ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "unpin" ) ;
|
public class MatchResultsBase { /** * Converts an { @ link Intermediate } into the final value .
* @ param o
* @ return final value */
protected static Object complete ( Object o ) { } }
|
if ( o instanceof Intermediate ) { o = ( ( Intermediate ) o ) . complete ( ) ; } return o ;
|
public class AbstractDLock { /** * Lock ' s custom properties .
* @ param lockProps
* @ return */
public AbstractDLock setLockProperties ( Properties lockProps ) { } }
|
this . lockProps = lockProps != null ? new Properties ( lockProps ) : new Properties ( ) ; return this ;
|
public class NavigationHelper { /** * Given the current { @ link DirectionsRoute } and leg / step index ,
* return a list of { @ link Point } representing the current step .
* This method is only used on a per - step basis as { @ link PolylineUtils # decode ( String , int ) }
* can be a heavy operation based on the length of the step .
* Returns null if index is invalid .
* @ param directionsRoute for list of steps
* @ param legIndex to get current step list
* @ param stepIndex to get current step
* @ return list of { @ link Point } representing the current step */
static List < Point > decodeStepPoints ( DirectionsRoute directionsRoute , List < Point > currentPoints , int legIndex , int stepIndex ) { } }
|
List < RouteLeg > legs = directionsRoute . legs ( ) ; if ( hasInvalidLegs ( legs ) ) { return currentPoints ; } List < LegStep > steps = legs . get ( legIndex ) . steps ( ) ; if ( hasInvalidSteps ( steps ) ) { return currentPoints ; } boolean invalidStepIndex = stepIndex < 0 || stepIndex > steps . size ( ) - 1 ; if ( invalidStepIndex ) { return currentPoints ; } LegStep step = steps . get ( stepIndex ) ; if ( step == null ) { return currentPoints ; } String stepGeometry = step . geometry ( ) ; if ( stepGeometry != null ) { return PolylineUtils . decode ( stepGeometry , PRECISION_6 ) ; } return currentPoints ;
|
public class MongoService { /** * Call security code to read the subject name from the key in the keystore
* @ param serviceRef
* @ param sslProperties
* @ return */
private String getCerticateSubject ( AtomicServiceReference < Object > serviceRef , Properties sslProperties ) { } }
|
String certificateDN = null ; try { certificateDN = sslHelper . getClientKeyCertSubject ( serviceRef , sslProperties ) ; } catch ( KeyStoreException ke ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . error ( tc , "CWKKD0020.ssl.get.certificate.user" , MONGO , id , ke ) ; } throw new RuntimeException ( Tr . formatMessage ( tc , "CWKKD0020.ssl.get.certificate.user" , MONGO , id , ke ) ) ; } catch ( CertificateException ce ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . error ( tc , "CWKKD0020.ssl.get.certificate.user" , MONGO , id , ce ) ; } throw new RuntimeException ( Tr . formatMessage ( tc , "CWKKD0020.ssl.get.certificate.user" , MONGO , id , ce ) ) ; } // handle null . . . . cannot find the client key
if ( certificateDN == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . error ( tc , "CWKKD0026.ssl.certificate.exception" , MONGO , id ) ; } throw new RuntimeException ( Tr . formatMessage ( tc , "CWKKD0026.ssl.certificate.exception" , MONGO , id ) ) ; } return certificateDN ;
|
public class ObjectCounter { /** * Returns the element that currently has the smallest count . If no objects
* have been counted , { @ code null } is returned . Ties in counts are
* arbitrarily broken . */
public T min ( ) { } }
|
TObjectIntIterator < T > iter = counts . iterator ( ) ; int minCount = Integer . MAX_VALUE ; T min = null ; while ( iter . hasNext ( ) ) { iter . advance ( ) ; int count = iter . value ( ) ; if ( count < minCount ) { min = iter . key ( ) ; minCount = count ; } } return min ;
|
public class RandomVariable { /** * / * ( non - Javadoc )
* @ see net . finmath . stochastic . RandomVariableInterface # getHistogram ( int , double ) */
@ Override public double [ ] [ ] getHistogram ( int numberOfPoints , double standardDeviations ) { } }
|
double [ ] intervalPoints = new double [ numberOfPoints ] ; double [ ] anchorPoints = new double [ numberOfPoints + 1 ] ; double center = getAverage ( ) ; double radius = standardDeviations * getStandardDeviation ( ) ; double stepSize = ( numberOfPoints - 1 ) / 2.0 ; for ( int i = 0 ; i < numberOfPoints ; i ++ ) { double alpha = ( - ( double ) ( numberOfPoints - 1 ) / 2.0 + i ) / stepSize ; intervalPoints [ i ] = center + alpha * radius ; anchorPoints [ i ] = center + alpha * radius - radius / ( 2 * stepSize ) ; } anchorPoints [ numberOfPoints ] = center + 1 * radius + radius / ( 2 * stepSize ) ; double [ ] [ ] result = new double [ 2 ] [ ] ; result [ 0 ] = anchorPoints ; result [ 1 ] = getHistogram ( intervalPoints ) ; return result ;
|
public class RuleModel { /** * This uses a deceptively simple algorithm to determine what bound
* variables are in scope for a given constraint ( including connectives ) .
* Does not take into account globals . */
public List < String > getBoundVariablesInScope ( final BaseSingleFieldConstraint con ) { } }
|
final List < String > result = new ArrayList < String > ( ) ; for ( int i = 0 ; i < this . lhs . length ; i ++ ) { IPattern pat = this . lhs [ i ] ; if ( findBoundVariableNames ( con , result , pat ) ) { return result ; } } return result ;
|
public class ExternalEventHandlerBase { /** * This method replaces place holders embedded in the given value
* by either meta parameter or XPath expression operated on the
* given XML Bean . Meta parameter is identified by a " $ " followed
* by the parameter name .
* @ param value
* @ param metainfo
* @ return */
protected String placeHolderTranslation ( String value , Map < String , String > metainfo , XmlObject xmlbean ) { } }
|
int k , i , n ; StringBuffer sb = new StringBuffer ( ) ; n = value . length ( ) ; for ( i = 0 ; i < n ; i ++ ) { char ch = value . charAt ( i ) ; if ( ch == '{' ) { k = i + 1 ; while ( k < n ) { ch = value . charAt ( k ) ; if ( ch == '}' ) break ; k ++ ; } if ( k < n ) { String placeHolder = value . substring ( i + 1 , k ) ; String v ; if ( placeHolder . charAt ( 0 ) == '$' ) { v = metainfo . get ( placeHolder . substring ( 1 ) ) ; } else { // assume is an XPath expression
v = XmlPath . evaluate ( xmlbean , placeHolder ) ; } if ( v != null ) sb . append ( v ) ; } // else ' { ' without ' } ' - ignore string after ' { '
i = k ; } else sb . append ( ch ) ; } return sb . toString ( ) ;
|
public class RestTemplate { /** * general execution */
public < T > T execute ( String url , HttpMethod method , RequestCallback requestCallback , ResponseExtractor < T > responseExtractor , Object ... urlVariables ) throws RestClientException { } }
|
URI expanded = new UriTemplate ( url ) . expand ( urlVariables ) ; return doExecute ( expanded , method , requestCallback , responseExtractor ) ;
|
public class StreamMetrics { /** * This method increments the global and Stream - specific counters of Stream creations , initializes other
* stream - specific metrics and reports the latency of the operation .
* @ param scope Scope .
* @ param streamName Name of the Stream .
* @ param minNumSegments Initial number of segments for the Stream .
* @ param latency Latency of the createStream operation . */
public void createStream ( String scope , String streamName , int minNumSegments , Duration latency ) { } }
|
DYNAMIC_LOGGER . incCounterValue ( CREATE_STREAM , 1 ) ; DYNAMIC_LOGGER . reportGaugeValue ( OPEN_TRANSACTIONS , 0 , streamTags ( scope , streamName ) ) ; DYNAMIC_LOGGER . reportGaugeValue ( SEGMENTS_COUNT , minNumSegments , streamTags ( scope , streamName ) ) ; DYNAMIC_LOGGER . incCounterValue ( SEGMENTS_SPLITS , 0 , streamTags ( scope , streamName ) ) ; DYNAMIC_LOGGER . incCounterValue ( SEGMENTS_MERGES , 0 , streamTags ( scope , streamName ) ) ; createStreamLatency . reportSuccessValue ( latency . toMillis ( ) ) ;
|
public class CountHashMap { /** * Compress the count map - remove entries for which the value is 0. */
public void compress ( ) { } }
|
for ( Iterator < int [ ] > itr = values ( ) . iterator ( ) ; itr . hasNext ( ) ; ) { if ( itr . next ( ) [ 0 ] == 0 ) { itr . remove ( ) ; } }
|
public class KeyVaultClientBaseImpl { /** * Sets a secret in a specified key vault .
* The SET operation adds a secret to the Azure Key Vault . If the named secret already exists , Azure Key Vault creates a new version of that secret . This operation requires the secrets / set permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param secretName The name of the secret .
* @ param value The value of the secret .
* @ param tags Application specific metadata in the form of key - value pairs .
* @ param contentType Type of the secret value such as a password .
* @ param secretAttributes The secret management attributes .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the SecretBundle object */
public Observable < SecretBundle > setSecretAsync ( String vaultBaseUrl , String secretName , String value , Map < String , String > tags , String contentType , SecretAttributes secretAttributes ) { } }
|
return setSecretWithServiceResponseAsync ( vaultBaseUrl , secretName , value , tags , contentType , secretAttributes ) . map ( new Func1 < ServiceResponse < SecretBundle > , SecretBundle > ( ) { @ Override public SecretBundle call ( ServiceResponse < SecretBundle > response ) { return response . body ( ) ; } } ) ;
|
public class BitcoinTransactionHashSegwitUDF { /** * Read list of Bitcoin ScriptWitness items from a table in Hive in any format ( e . g . ORC , Parquet )
* @ param loi ObjectInspector for processing the Object containing a list
* @ param listOfScriptWitnessItemObject object containing the list of scriptwitnessitems of a Bitcoin Transaction
* @ return a list of BitcoinScriptWitnessItem */
private List < BitcoinScriptWitnessItem > readListOfBitcoinScriptWitnessFromTable ( ListObjectInspector loi , Object listOfScriptWitnessItemObject ) { } }
|
int listLength = loi . getListLength ( listOfScriptWitnessItemObject ) ; List < BitcoinScriptWitnessItem > result = new ArrayList < > ( listLength ) ; StructObjectInspector listOfScriptwitnessItemElementObjectInspector = ( StructObjectInspector ) loi . getListElementObjectInspector ( ) ; for ( int i = 0 ; i < listLength ; i ++ ) { Object currentlistofscriptwitnessitemObject = loi . getListElement ( listOfScriptWitnessItemObject , i ) ; StructField stackitemcounterSF = listOfScriptwitnessItemElementObjectInspector . getStructFieldRef ( "stackitemcounter" ) ; StructField scriptwitnesslistSF = listOfScriptwitnessItemElementObjectInspector . getStructFieldRef ( "scriptwitnesslist" ) ; boolean scriptwitnessitemNull = ( stackitemcounterSF == null ) || ( scriptwitnesslistSF == null ) ; if ( scriptwitnessitemNull ) { LOG . warn ( "Invalid BitcoinScriptWitnessItem detected at position " + i ) ; return new ArrayList < > ( ) ; } byte [ ] stackItemCounter = wboi . getPrimitiveJavaObject ( listOfScriptwitnessItemElementObjectInspector . getStructFieldData ( currentlistofscriptwitnessitemObject , stackitemcounterSF ) ) ; Object listofscriptwitnessObject = soi . getStructFieldData ( currentlistofscriptwitnessitemObject , scriptwitnesslistSF ) ; ListObjectInspector loiScriptWitness = ( ListObjectInspector ) scriptwitnesslistSF . getFieldObjectInspector ( ) ; StructObjectInspector listOfScriptwitnessElementObjectInspector = ( StructObjectInspector ) loiScriptWitness . getListElementObjectInspector ( ) ; int listWitnessLength = loiScriptWitness . getListLength ( listofscriptwitnessObject ) ; List < BitcoinScriptWitness > currentScriptWitnessList = new ArrayList < > ( listWitnessLength ) ; for ( int j = 0 ; j < listWitnessLength ; j ++ ) { Object currentlistofscriptwitnessObject = loi . getListElement ( listofscriptwitnessObject , j ) ; StructField witnessscriptlengthSF = listOfScriptwitnessElementObjectInspector . getStructFieldRef ( "witnessscriptlength" ) ; StructField witnessscriptSF = listOfScriptwitnessElementObjectInspector . getStructFieldRef ( "witnessscript" ) ; boolean scriptwitnessNull = ( witnessscriptlengthSF == null ) || ( witnessscriptSF == null ) ; if ( scriptwitnessNull ) { LOG . warn ( "Invalid BitcoinScriptWitness detected at position " + j + "for BitcoinScriptWitnessItem " + i ) ; return new ArrayList < > ( ) ; } byte [ ] scriptWitnessLength = wboi . getPrimitiveJavaObject ( listOfScriptwitnessElementObjectInspector . getStructFieldData ( currentlistofscriptwitnessObject , witnessscriptlengthSF ) ) ; byte [ ] scriptWitness = wboi . getPrimitiveJavaObject ( listOfScriptwitnessElementObjectInspector . getStructFieldData ( currentlistofscriptwitnessObject , witnessscriptSF ) ) ; currentScriptWitnessList . add ( new BitcoinScriptWitness ( scriptWitnessLength , scriptWitness ) ) ; } BitcoinScriptWitnessItem currentBitcoinScriptWitnessItem = new BitcoinScriptWitnessItem ( stackItemCounter , currentScriptWitnessList ) ; result . add ( currentBitcoinScriptWitnessItem ) ; } return result ;
|
public class CriteriaReader { /** * Process a single criteria block .
* @ param list parent criteria list
* @ param block current block */
private void processBlock ( List < GenericCriteria > list , byte [ ] block ) { } }
|
if ( block != null ) { if ( MPPUtility . getShort ( block , 0 ) > 0x3E6 ) { addCriteria ( list , block ) ; } else { switch ( block [ 0 ] ) { case ( byte ) 0x0B : { processBlock ( list , getChildBlock ( block ) ) ; break ; } case ( byte ) 0x06 : { processBlock ( list , getListNextBlock ( block ) ) ; break ; } case ( byte ) 0xED : // EQUALS
{ addCriteria ( list , block ) ; break ; } case ( byte ) 0x19 : // AND
case ( byte ) 0x1B : { addBlock ( list , block , TestOperator . AND ) ; break ; } case ( byte ) 0x1A : // OR
case ( byte ) 0x1C : { addBlock ( list , block , TestOperator . OR ) ; break ; } } } }
|
public class UnitOfWorkAwareProxyFactory { /** * Creates a new < b > @ UnitOfWork < / b > aware proxy of a class with an one - parameter constructor .
* @ param clazz the specified class definition
* @ param constructorParamType the type of the constructor parameter
* @ param constructorArguments the argument passed to the constructor
* @ param < T > the type of the class
* @ return a new proxy */
public < T > T create ( Class < T > clazz , Class < ? > constructorParamType , Object constructorArguments ) { } }
|
return create ( clazz , new Class < ? > [ ] { constructorParamType } , new Object [ ] { constructorArguments } ) ;
|
public class CreateSymbols { /** * < editor - fold defaultstate = " collapsed " desc = " Create Symbol Description " > */
public void createBaseLine ( List < VersionDescription > versions , ExcludeIncludeList excludesIncludes , Path descDest , Path jdkRoot ) throws IOException { } }
|
ClassList classes = new ClassList ( ) ; for ( VersionDescription desc : versions ) { ClassList currentVersionClasses = new ClassList ( ) ; try ( BufferedReader descIn = Files . newBufferedReader ( Paths . get ( desc . classes ) ) ) { String classFileData ; while ( ( classFileData = descIn . readLine ( ) ) != null ) { ByteArrayOutputStream data = new ByteArrayOutputStream ( ) ; for ( int i = 0 ; i < classFileData . length ( ) ; i += 2 ) { data . write ( Integer . parseInt ( classFileData . substring ( i , i + 2 ) , 16 ) ) ; } try ( InputStream in = new ByteArrayInputStream ( data . toByteArray ( ) ) ) { inspectClassFile ( in , currentVersionClasses , excludesIncludes , desc . version ) ; } catch ( IOException | ConstantPoolException ex ) { throw new IllegalStateException ( ex ) ; } } } Set < String > includedClasses = new HashSet < > ( ) ; boolean modified ; do { modified = false ; for ( ClassDescription clazz : currentVersionClasses ) { ClassHeaderDescription header = clazz . header . get ( 0 ) ; if ( includeEffectiveAccess ( currentVersionClasses , clazz ) ) { modified |= include ( includedClasses , currentVersionClasses , clazz . name ) ; } if ( includedClasses . contains ( clazz . name ) ) { modified |= include ( includedClasses , currentVersionClasses , header . extendsAttr ) ; for ( String i : header . implementsAttr ) { modified |= include ( includedClasses , currentVersionClasses , i ) ; } modified |= includeOutputType ( Collections . singleton ( header ) , h -> "" , includedClasses , currentVersionClasses ) ; modified |= includeOutputType ( clazz . fields , f -> f . descriptor , includedClasses , currentVersionClasses ) ; modified |= includeOutputType ( clazz . methods , m -> m . descriptor , includedClasses , currentVersionClasses ) ; } } } while ( modified ) ; for ( ClassDescription clazz : currentVersionClasses ) { if ( ! includedClasses . contains ( clazz . name ) ) { continue ; } ClassHeaderDescription header = clazz . header . get ( 0 ) ; if ( header . innerClasses != null ) { Iterator < InnerClassInfo > innerClassIt = header . innerClasses . iterator ( ) ; while ( innerClassIt . hasNext ( ) ) { InnerClassInfo ici = innerClassIt . next ( ) ; if ( ! includedClasses . contains ( ici . innerClass ) ) innerClassIt . remove ( ) ; } } ClassDescription existing = classes . find ( clazz . name , true ) ; if ( existing != null ) { addClassHeader ( existing , header , desc . version ) ; for ( MethodDescription currentMethod : clazz . methods ) { addMethod ( existing , currentMethod , desc . version ) ; } for ( FieldDescription currentField : clazz . fields ) { addField ( existing , currentField , desc . version ) ; } } else { classes . add ( clazz ) ; } } } classes . sort ( ) ; Map < String , String > package2Modules = buildPackage2Modules ( jdkRoot ) ; Map < String , List < ClassDescription > > module2Classes = new HashMap < > ( ) ; for ( ClassDescription clazz : classes ) { String pack ; int lastSlash = clazz . name . lastIndexOf ( '/' ) ; if ( lastSlash != ( - 1 ) ) { pack = clazz . name . substring ( 0 , lastSlash ) . replace ( '/' , '.' ) ; } else { pack = "" ; } String module = package2Modules . get ( pack ) ; if ( module == null ) { module = "java.base" ; OUTER : while ( ! pack . isEmpty ( ) ) { for ( Entry < String , String > p2M : package2Modules . entrySet ( ) ) { if ( p2M . getKey ( ) . startsWith ( pack ) ) { module = p2M . getValue ( ) ; break OUTER ; } } int dot = pack . lastIndexOf ( '.' ) ; if ( dot == ( - 1 ) ) break ; pack = pack . substring ( 0 , dot ) ; } } module2Classes . computeIfAbsent ( module , m -> new ArrayList < > ( ) ) . add ( clazz ) ; } Path symbolsFile = descDest . resolve ( "symbols" ) ; Files . createDirectories ( symbolsFile . getParent ( ) ) ; try ( Writer symbolsOut = Files . newBufferedWriter ( symbolsFile ) ) { Map < VersionDescription , List < Path > > outputFiles = new LinkedHashMap < > ( ) ; for ( Entry < String , List < ClassDescription > > e : module2Classes . entrySet ( ) ) { for ( VersionDescription desc : versions ) { Path f = descDest . resolve ( e . getKey ( ) + "-" + desc . version + ".sym.txt" ) ; try ( Writer out = Files . newBufferedWriter ( f ) ) { for ( ClassDescription clazz : e . getValue ( ) ) { clazz . write ( out , desc . primaryBaseline , desc . version ) ; } } outputFiles . computeIfAbsent ( desc , d -> new ArrayList < > ( ) ) . add ( f ) ; } } symbolsOut . append ( "generate platforms " ) . append ( versions . stream ( ) . map ( v -> v . version ) . collect ( Collectors . joining ( ":" ) ) ) . append ( "\n" ) ; for ( Entry < VersionDescription , List < Path > > versionFileEntry : outputFiles . entrySet ( ) ) { symbolsOut . append ( "platform version " ) . append ( versionFileEntry . getKey ( ) . version ) ; if ( versionFileEntry . getKey ( ) . primaryBaseline != null ) { symbolsOut . append ( " base " ) . append ( versionFileEntry . getKey ( ) . primaryBaseline ) ; } symbolsOut . append ( " files " ) . append ( versionFileEntry . getValue ( ) . stream ( ) . map ( p -> p . getFileName ( ) . toString ( ) ) . sorted ( ) . collect ( Collectors . joining ( ":" ) ) ) . append ( "\n" ) ; } }
|
public class GenericType { /** * Substitutes a free type variable with an actual type . See { @ link GenericType this class ' s
* javadoc } for an example . */
@ NonNull public final < X > GenericType < T > where ( @ NonNull GenericTypeParameter < X > freeVariable , @ NonNull GenericType < X > actualType ) { } }
|
TypeResolver resolver = new TypeResolver ( ) . where ( freeVariable . getTypeVariable ( ) , actualType . __getToken ( ) . getType ( ) ) ; Type resolvedType = resolver . resolveType ( this . token . getType ( ) ) ; @ SuppressWarnings ( "unchecked" ) TypeToken < T > resolvedToken = ( TypeToken < T > ) TypeToken . of ( resolvedType ) ; return new GenericType < > ( resolvedToken ) ;
|
public class UsbConnection { /** * Scans for USB device connection changes , so subsequent traversals provide an updated view of attached USB
* interfaces .
* @ throws SecurityException on restricted access to USB services indicated as security violation
* @ throws UsbException on error with USB services */
public static void updateDeviceList ( ) throws SecurityException , UsbException { } }
|
( ( org . usb4java . javax . Services ) UsbHostManager . getUsbServices ( ) ) . scan ( ) ;
|
public class SiteTool { /** * Transforms simple { @ code < img > } elements to { @ code < figure > } elements .
* This will wrap { @ code < img > } elements with a { @ code < figure > } element ,
* and add a { @ code < figcaption > } with the contents of the image ' s
* { @ code alt } attribute , if said attribute exists .
* Only { @ code < img > } elements inside a { @ code < section > } will be
* transformed .
* @ param root
* root element with images to transform */
public final void transformImagesToFigures ( final Element root ) { } }
|
final Collection < Element > images ; // Image elements from the < body >
Element figure ; // < figure > element
Element caption ; // < figcaption > element
checkNotNull ( root , "Received a null pointer as root element" ) ; images = root . select ( "section img" ) ; if ( ! images . isEmpty ( ) ) { for ( final Element img : images ) { figure = new Element ( Tag . valueOf ( "figure" ) , "" ) ; img . replaceWith ( figure ) ; figure . appendChild ( img ) ; if ( img . hasAttr ( "alt" ) ) { caption = new Element ( Tag . valueOf ( "figcaption" ) , "" ) ; caption . text ( img . attr ( "alt" ) ) ; figure . appendChild ( caption ) ; } } }
|
public class BaseXmlImporter { /** * Set new ancestorToSave .
* @ param newAncestorToSave */
public void setAncestorToSave ( QPath newAncestorToSave ) { } }
|
if ( ! ancestorToSave . equals ( newAncestorToSave ) ) { isNeedReloadAncestorToSave = true ; } this . ancestorToSave = newAncestorToSave ;
|
public class Utility { /** * multi - field string */
public String [ ] parseMFString ( String mfString ) { } }
|
Vector < String > strings = new Vector < String > ( ) ; StringReader sr = new StringReader ( mfString ) ; StreamTokenizer st = new StreamTokenizer ( sr ) ; st . quoteChar ( '"' ) ; st . quoteChar ( '\'' ) ; String [ ] mfStrings = null ; int tokenType ; try { while ( ( tokenType = st . nextToken ( ) ) != StreamTokenizer . TT_EOF ) { strings . add ( st . sval ) ; } } catch ( IOException e ) { Log . d ( TAG , "String parsing Error: " + e ) ; e . printStackTrace ( ) ; } mfStrings = new String [ strings . size ( ) ] ; for ( int i = 0 ; i < strings . size ( ) ; i ++ ) { mfStrings [ i ] = strings . get ( i ) ; } return mfStrings ;
|
public class SQLParser { /** * Make sure that the batch starts with an appropriate DDL verb . We do not
* look further than the first token of the first non - comment and non - whitespace line .
* Empty batches are considered to be trivially valid .
* @ param batch A SQL string containing multiple statements separated by semicolons
* @ return true if the first keyword of the first statement is a DDL verb
* like CREATE , ALTER , DROP , PARTITION , DR , SET or EXPORT ,
* or if the batch is empty .
* See the official list of DDL verbs in the " / / Supported verbs " section of
* the static initializer for SQLLexer . VERB _ TOKENS ) */
public static boolean appearsToBeValidDDLBatch ( String batch ) { } }
|
BufferedReader reader = new BufferedReader ( new StringReader ( batch ) ) ; String line ; try { while ( ( line = reader . readLine ( ) ) != null ) { if ( isWholeLineComment ( line ) ) { continue ; } line = line . trim ( ) ; if ( line . equals ( "" ) ) continue ; // we have a non - blank line that contains more than just a comment .
return queryIsDDL ( line ) ; } } catch ( IOException e ) { // This should never happen for a StringReader
assert ( false ) ; } // trivial empty batch : no lines are non - blank or non - comments
return true ;
|
public class RandomVariableAAD { /** * / * ( non - Javadoc )
* @ see net . finmath . stochastic . RandomVariable # add ( net . finmath . stochastic . RandomVariable ) */
@ Override public RandomVariable add ( RandomVariable randomVariable ) { } }
|
return apply ( OperatorType . ADD , new RandomVariable [ ] { this , randomVariable } ) ;
|
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcTextTransformation ( ) { } }
|
if ( ifcTextTransformationEClass == null ) { ifcTextTransformationEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 878 ) ; } return ifcTextTransformationEClass ;
|
public class ConstantsSummaryWriterImpl { /** * Get the table caption and header for the constant summary table
* @ param cd classdoc to be documented
* @ return constant members header content */
public Content getConstantMembersHeader ( ClassDoc cd ) { } }
|
// generate links backward only to public classes .
Content classlink = ( cd . isPublic ( ) || cd . isProtected ( ) ) ? getLink ( new LinkInfoImpl ( configuration , LinkInfoImpl . Kind . CONSTANT_SUMMARY , cd ) ) : new StringContent ( cd . qualifiedName ( ) ) ; String name = cd . containingPackage ( ) . name ( ) ; if ( name . length ( ) > 0 ) { Content cb = new ContentBuilder ( ) ; cb . addContent ( name ) ; cb . addContent ( "." ) ; cb . addContent ( classlink ) ; return getClassName ( cb ) ; } else { return getClassName ( classlink ) ; }
|
public class Synchronizer { /** * Reads one chunk from the file . It is possible that the chunk is not complete because the end of the file is
* reached . In this case the maximum number of { @ link AbstractKVStorable } will be retrieved .
* @ return a chunk from the file
* @ throws IOException */
private boolean readNextChunkFromFile ( ) throws IOException { } }
|
if ( readOffset >= filledUpToWhenStarted || readOffset < 0 ) { return false ; } bufferedReader . clear ( ) ; dataFile . read ( readOffset , bufferedReader ) ; bufferedReader . position ( 0 ) ; if ( bufferedReader . limit ( ) > 0 ) { readOffset += bufferedReader . limit ( ) ; while ( bufferedReader . remaining ( ) > 0 ) { byte [ ] dst = new byte [ elementSize ] ; bufferedReader . get ( dst ) ; pendingElements . add ( dst ) ; } } return true ;
|
public class BugInstance { /** * Add a non - specific source line annotation . This will result in the entire
* source file being displayed .
* @ param className
* the class name
* @ param sourceFile
* the source file name
* @ return this object */
@ Nonnull public BugInstance addUnknownSourceLine ( String className , String sourceFile ) { } }
|
SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation . createUnknown ( className , sourceFile ) ; if ( sourceLineAnnotation != null ) { add ( sourceLineAnnotation ) ; } return this ;
|
public class JSInternalConsole { /** * Performs an action on the text area . */
@ Override public void actionPerformed ( ActionEvent e ) { } }
|
String cmd = e . getActionCommand ( ) ; if ( cmd . equals ( "Cut" ) ) { consoleTextArea . cut ( ) ; } else if ( cmd . equals ( "Copy" ) ) { consoleTextArea . copy ( ) ; } else if ( cmd . equals ( "Paste" ) ) { consoleTextArea . paste ( ) ; }
|
public class SAXRecords { /** * Get all indexes , sorted .
* @ return all the indexes . */
public ArrayList < Integer > getAllIndices ( ) { } }
|
ArrayList < Integer > res = new ArrayList < Integer > ( this . realTSindex . size ( ) ) ; res . addAll ( this . realTSindex . keySet ( ) ) ; Collections . sort ( res ) ; return res ;
|
public class JobExecutionsInner { /** * Starts an elastic job execution .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server .
* @ param jobAgentName The name of the job agent .
* @ param jobName The name of the job to get .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < ServiceResponse < JobExecutionInner > > createWithServiceResponseAsync ( String resourceGroupName , String serverName , String jobAgentName , String jobName ) { } }
|
if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( serverName == null ) { throw new IllegalArgumentException ( "Parameter serverName is required and cannot be null." ) ; } if ( jobAgentName == null ) { throw new IllegalArgumentException ( "Parameter jobAgentName is required and cannot be null." ) ; } if ( jobName == null ) { throw new IllegalArgumentException ( "Parameter jobName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } Observable < Response < ResponseBody > > observable = service . create ( resourceGroupName , serverName , jobAgentName , jobName , this . client . subscriptionId ( ) , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) ; return client . getAzureClient ( ) . getPostOrDeleteResultAsync ( observable , new TypeToken < JobExecutionInner > ( ) { } . getType ( ) ) ;
|
public class RuleDto { /** * Used in MyBatis mapping . */
private void setUpdatedAtFromDefinition ( @ Nullable Long updatedAt ) { } }
|
if ( updatedAt != null && updatedAt > definition . getUpdatedAt ( ) ) { setUpdatedAt ( updatedAt ) ; }
|
public class SocketCache { /** * Give an unused socket to the cache .
* @ param sock Socket not used by anyone . */
public void put ( Socket sock ) { } }
|
Preconditions . checkNotNull ( sock ) ; SocketAddress remoteAddr = sock . getRemoteSocketAddress ( ) ; if ( remoteAddr == null ) { LOG . warn ( "Cannot cache (unconnected) socket with no remote address: " + sock ) ; IOUtils . closeSocket ( sock ) ; return ; } Socket oldestSock = null ; synchronized ( multimap ) { if ( capacity == multimap . size ( ) ) { oldestSock = evictOldest ( ) ; } multimap . put ( remoteAddr , sock ) ; } if ( oldestSock != null ) { IOUtils . closeSocket ( oldestSock ) ; }
|
public class Framework { /** * Gets the version for a folder by searching for a pom . xml in the folder and its folders .
* @ param path
* Path to a folder
* @ return Found version or { @ code null } */
private static String getVersionFromPom ( final Path path ) { } }
|
Path folder = path ; Path file ; while ( true ) { file = folder . resolve ( "pom.xml" ) ; if ( Files . exists ( file ) ) { break ; } folder = folder . getParent ( ) ; if ( folder == null ) { Logger . error ( "pom.xml is missing for \"{}\"" , path ) ; return null ; } } String content ; try { content = new String ( Files . readAllBytes ( file ) , StandardCharsets . UTF_8 ) ; } catch ( IOException ex ) { Logger . error ( ex , "Failed reading \"{}\"" , path ) ; return null ; } Matcher matcher = POM_VERSION . matcher ( content ) ; if ( matcher . find ( ) ) { return matcher . group ( 1 ) ; } else { Logger . error ( "POM \"{}\" does not contain a version" , file ) ; return null ; }
|
public class FastSafeIterableMap { /** * / * ( non - Javadoc )
* @ see android . arch . core . internal . SafeIterableMap # get ( java . lang . Object ) */
@ Override protected Entry < K , V > get ( K k ) { } }
|
return mHashMap . get ( k ) ;
|
public class JsonUtils { /** * Expands a JSON object into a java object
* @ param input the object to be expanded
* @ return the expanded object containing java types like { @ link Map } and { @ link List } */
public Object expand ( Object input ) { } }
|
if ( input instanceof List ) { expandList ( ( List < Object > ) input ) ; return input ; } else if ( input instanceof Map ) { expandMap ( ( Map < String , Object > ) input ) ; return input ; } else if ( input instanceof String ) { return getJson ( ( String ) input ) ; } else { return input ; }
|
public class WindowsProcessFaxClientSpi { /** * This function creates and returns the command line arguments for the fax4j
* external exe when running an action on an existing fax job .
* @ param faxActionTypeArgument
* The fax action type argument
* @ param faxJob
* The fax job object
* @ return The full command line arguments line */
protected String createProcessCommandArgumentsForExistingFaxJob ( String faxActionTypeArgument , FaxJob faxJob ) { } }
|
// get values from fax job
String faxJobID = faxJob . getID ( ) ; // init buffer
StringBuilder buffer = new StringBuilder ( ) ; // create command line arguments
this . addCommandLineArgument ( buffer , Fax4jExeConstants . ACTION_FAX4J_EXE_COMMAND_LINE_ARGUMENT . toString ( ) , faxActionTypeArgument ) ; this . addCommandLineArgument ( buffer , Fax4jExeConstants . SERVER_FAX4J_EXE_COMMAND_LINE_ARGUMENT . toString ( ) , this . faxServerName ) ; this . addCommandLineArgument ( buffer , Fax4jExeConstants . FAX_JOB_ID_FAX4J_EXE_COMMAND_LINE_ARGUMENT . toString ( ) , String . valueOf ( faxJobID ) ) ; // get text
String commandArguments = buffer . toString ( ) ; return commandArguments ;
|
public class IpHelper { /** * Determines if a specified host or IP refers to the local machine
* @ param addr
* String The host / IP
* @ return boolean True if the input points to the local machine , otherwise false Checks by enumerating the NetworkInterfaces
* available to Java . */
public static boolean isLocalAddress ( final InetAddress addr ) { } }
|
if ( addr . isLoopbackAddress ( ) ) { return true ; } try { Enumeration < NetworkInterface > nics = NetworkInterface . getNetworkInterfaces ( ) ; while ( nics . hasMoreElements ( ) ) { Enumeration < InetAddress > addrs = nics . nextElement ( ) . getInetAddresses ( ) ; while ( addrs . hasMoreElements ( ) ) { if ( addrs . nextElement ( ) . equals ( addr ) ) { return true ; // Search successful
} } } } catch ( SocketException e ) { log . debug ( e . getMessage ( ) , e ) ; } log . debug ( "[FileHelper] {isLocalAddress} not local: " + addr . getHostAddress ( ) ) ; // Search failed
return false ;
|
public class JawrSassResolver { /** * Return the content of the resource using the base path and the relative
* URI
* @ param base
* the base path
* @ param uri
* the relative URI
* @ return the content of the resource using the base path and the relative
* URI
* @ throws ResourceNotFoundException
* if the resource is not found
* @ throws IOException
* if an IOException occurs */
public String findRelative ( String base , String uri ) throws ResourceNotFoundException , IOException { } }
|
String path = getPath ( base , uri ) ; String source = resolveAndNormalize ( path ) ; if ( source != null ) { return source ; } // Try to find partial import ( _ identifier . scss )
path = PathNormalizer . getParentPath ( path ) + "_" + PathNormalizer . getPathName ( path ) ; source = resolveAndNormalize ( path ) ; if ( source != null ) { return source ; } return resolveAndNormalize ( uri ) ;
|
public class JMXContext { /** * Get the { @ link MemoryPoolMXBean } with the given name . If no memory pool
* exists for the given name , then < code > null < / code > is returned .
* @ param name The name of the memory pool to retrieve
* @ return The associated memory pool or < code > null < / code >
* @ see # getMemoryPoolMXBeans ( ) */
public MemoryPoolMXBean getMemoryPoolMXBean ( String name ) { } }
|
for ( MemoryPoolMXBean bean : getMemoryPoolMXBeans ( ) ) { if ( bean . getName ( ) . equals ( name ) ) { return bean ; } } return null ;
|
public class SynonymMap { /** * the following utility methods below are copied from Apache style Nux library - see http : / / dsd . lbl . gov / nux */
private static byte [ ] toByteArray ( InputStream input ) throws IOException { } }
|
try { // safe and fast even if input . available ( ) behaves weird or buggy
int len = Math . max ( 256 , input . available ( ) ) ; byte [ ] buffer = new byte [ len ] ; byte [ ] output = new byte [ len ] ; len = 0 ; int n ; while ( ( n = input . read ( buffer ) ) >= 0 ) { if ( len + n > output . length ) { // grow capacity
byte tmp [ ] = new byte [ Math . max ( output . length << 1 , len + n ) ] ; System . arraycopy ( output , 0 , tmp , 0 , len ) ; System . arraycopy ( buffer , 0 , tmp , len , n ) ; buffer = output ; // use larger buffer for future larger bulk reads
output = tmp ; } else { System . arraycopy ( buffer , 0 , output , len , n ) ; } len += n ; } if ( len == output . length ) return output ; buffer = null ; // help gc
buffer = new byte [ len ] ; System . arraycopy ( output , 0 , buffer , 0 , len ) ; return buffer ; } finally { input . close ( ) ; }
|
public class AzureBatchEvaluatorShimManager { /** * Event handler method for { @ link ResourceReleaseEvent } . Sends a TERMINATE command to the appropriate evaluator shim .
* @ param resourceReleaseEvent */
public void onResourceReleased ( final ResourceReleaseEvent resourceReleaseEvent ) { } }
|
String resourceRemoteId = getResourceRemoteId ( resourceReleaseEvent . getIdentifier ( ) ) ; // REEF Common will trigger a ResourceReleaseEvent even if the resource has failed . Since we know that the shim
// has already failed , we can safely ignore this .
if ( this . failedResources . remove ( resourceReleaseEvent . getIdentifier ( ) ) != null ) { LOG . log ( Level . INFO , "Received a ResourceReleaseEvent for a failed shim with resourceId = {0}. Ignoring." , resourceReleaseEvent . getIdentifier ( ) ) ; } else if ( this . evaluators . get ( resourceReleaseEvent . getIdentifier ( ) ) . isPresent ( ) ) { EventHandler < EvaluatorShimProtocol . EvaluatorShimControlProto > handler = this . remoteManager . getHandler ( resourceRemoteId , EvaluatorShimProtocol . EvaluatorShimControlProto . class ) ; LOG . log ( Level . INFO , "Sending TERMINATE command to the shim with remoteId = {0}." , resourceRemoteId ) ; handler . onNext ( EvaluatorShimProtocol . EvaluatorShimControlProto . newBuilder ( ) . setCommand ( EvaluatorShimProtocol . EvaluatorShimCommand . TERMINATE ) . build ( ) ) ; this . updateRuntimeStatus ( ) ; }
|
public class BuilderSpec { /** * Determines if the { @ code @ AutoValue } class for this instance has a correct nested
* { @ code @ AutoValue . Builder } class or interface and return a representation of it in an { @ code
* Optional } if so . */
Optional < Builder > getBuilder ( ) { } }
|
Optional < TypeElement > builderTypeElement = Optional . empty ( ) ; for ( TypeElement containedClass : ElementFilter . typesIn ( autoValueClass . getEnclosedElements ( ) ) ) { if ( hasAnnotationMirror ( containedClass , AUTO_VALUE_BUILDER_NAME ) ) { if ( ! CLASS_OR_INTERFACE . contains ( containedClass . getKind ( ) ) ) { errorReporter . reportError ( "@AutoValue.Builder can only apply to a class or an interface" , containedClass ) ; } else if ( ! containedClass . getModifiers ( ) . contains ( Modifier . STATIC ) ) { errorReporter . reportError ( "@AutoValue.Builder cannot be applied to a non-static class" , containedClass ) ; } else if ( builderTypeElement . isPresent ( ) ) { errorReporter . reportError ( autoValueClass + " already has a Builder: " + builderTypeElement . get ( ) , containedClass ) ; } else { builderTypeElement = Optional . of ( containedClass ) ; } } } if ( builderTypeElement . isPresent ( ) ) { return builderFrom ( builderTypeElement . get ( ) ) ; } else { return Optional . empty ( ) ; }
|
public class PoliciedServiceLevelEvaluator { /** * Builds a Violation from a list of breaches ( for the case when the term has policies ) */
private IViolation newViolation ( final IAgreement agreement , final IGuaranteeTerm term , final IPolicy policy , final String kpiName , final List < IBreach > breaches , final Date timestamp ) { } }
|
String actualValue = actualValueBuilder . fromBreaches ( breaches ) ; String expectedValue = null ; IViolation v = newViolation ( agreement , term , policy , kpiName , actualValue , expectedValue , timestamp ) ; return v ;
|
public class PollThread { @ Override public void run ( ) { } }
|
int received ; // noinspection InfiniteLoopStatement
while ( true ) { // System . out . println ( " In PollThread loop ( sleep = " + sleep +
try { if ( sleep != 0 ) { received = get_command ( sleep ) ; } else { received = POLL_TIME_OUT ; } long ctm = System . currentTimeMillis ( ) ; now . tv_sec = ( int ) ( ctm / 1000 ) ; now . tv_usec = ( int ) ( ctm - 1000 * now . tv_sec ) * 1000 ; now . tv_sec = now . tv_sec - Tango_DELTA_T ; switch ( received ) { case POLL_COMMAND : execute_cmd ( ) ; break ; case POLL_TIME_OUT : one_more_poll ( ) ; break ; case POLL_TRIGGER : one_more_trigg ( ) ; break ; } ctm = System . currentTimeMillis ( ) ; after . tv_sec = ( int ) ( ctm / 1000 ) ; after . tv_usec = ( int ) ( ctm - 1000 * after . tv_sec ) * 1000 ; after . tv_sec = after . tv_sec - Tango_DELTA_T ; compute_sleep_time ( ) ; } catch ( final DevFailed e ) { Util . out2 . println ( "OUPS !! A thread fatal exception !!!!!!!!" ) ; Except . print_exception ( e ) ; Util . out2 . println ( "Trying to re-enter the main loop" ) ; } }
|
public class I18nSpecificsOfItemGroup { /** * < p > Setter for hasName . < / p >
* @ param pHasName reference */
@ Override public final void setHasName ( final SpecificsOfItemGroup pHasName ) { } }
|
this . hasName = pHasName ; if ( this . itsId == null ) { this . itsId = new IdI18nSpecificsOfItemGroup ( ) ; } this . itsId . setHasName ( this . hasName ) ;
|
public class OrtcClient { /** * Subscribe the specified channel in order to receive messages in that
* channel
* @ param channel
* Channel to be subscribed
* @ param subscribeOnReconnect
* Indicates if the channel should be subscribe if the event on
* reconnected is fired
* @ param onMessage
* Event handler that will be called when a message will be
* received on the subscribed channel */
public void subscribe ( String channel , boolean subscribeOnReconnect , OnMessage onMessage ) { } }
|
ChannelSubscription subscribedChannel = subscribedChannels . get ( channel ) ; Pair < Boolean , String > subscribeValidation = isSubscribeValid ( channel , subscribedChannel ) ; if ( subscribeValidation != null && subscribeValidation . first ) { subscribedChannel = new ChannelSubscription ( subscribeOnReconnect , onMessage ) ; subscribedChannel . setSubscribing ( true ) ; subscribedChannels . put ( channel , subscribedChannel ) ; subscribe ( channel , subscribeValidation . second , false , "" ) ; }
|
public class ServletDefinition { /** * Create a new instance of the servlet and initialize it .
* @ param servletClass the servlet class
* @ param servletConfig the servlet config
* @ throws ServletException if a servlet exception occurs . */
public HttpServlet initServlet ( ) throws Exception { } }
|
servlet = ( HttpServlet ) servletClass . newInstance ( ) ; servlet . init ( servletConfig ) ; return servlet ;
|
public class AbstractWizard { /** * { @ inheritDoc } */
public WizardPage getPage ( String pageId ) { } }
|
Iterator it = pages . iterator ( ) ; while ( it . hasNext ( ) ) { WizardPage page = ( WizardPage ) it . next ( ) ; if ( page . getId ( ) . equals ( pageId ) ) { return page ; } } return null ;
|
public class AbstractConnectionManager { /** * Get a connection listener
* @ param credential The credential
* @ return The listener
* @ throws ResourceException Thrown in case of an error */
protected org . ironjacamar . core . connectionmanager . listener . ConnectionListener getConnectionListener ( Credential credential ) throws ResourceException { } }
|
org . ironjacamar . core . connectionmanager . listener . ConnectionListener result = null ; Exception failure = null ; // First attempt
boolean isInterrupted = Thread . interrupted ( ) ; boolean innerIsInterrupted = false ; try { result = pool . getConnectionListener ( credential ) ; if ( supportsLazyAssociation == null ) { supportsLazyAssociation = ( result . getManagedConnection ( ) instanceof DissociatableManagedConnection ) ? Boolean . TRUE : Boolean . FALSE ; } return result ; } catch ( ResourceException e ) { failure = e ; // Retry ?
if ( cmConfiguration . getAllocationRetry ( ) != 0 || e instanceof RetryableException ) { int to = cmConfiguration . getAllocationRetry ( ) ; long sleep = cmConfiguration . getAllocationRetryWaitMillis ( ) ; if ( to == 0 && e instanceof RetryableException ) to = 1 ; for ( int i = 0 ; i < to ; i ++ ) { if ( shutdown . get ( ) ) { throw new ResourceException ( ) ; } if ( Thread . currentThread ( ) . isInterrupted ( ) ) { Thread . interrupted ( ) ; innerIsInterrupted = true ; } try { if ( sleep > 0 ) Thread . sleep ( sleep ) ; return pool . getConnectionListener ( credential ) ; } catch ( ResourceException re ) { failure = re ; } catch ( InterruptedException ie ) { failure = ie ; innerIsInterrupted = true ; } } } } catch ( Exception e ) { failure = e ; } finally { if ( isInterrupted || innerIsInterrupted ) { Thread . currentThread ( ) . interrupt ( ) ; if ( innerIsInterrupted ) throw new ResourceException ( failure ) ; } } if ( cmConfiguration . isSharable ( ) && Boolean . TRUE . equals ( supportsLazyAssociation ) ) return associateConnectionListener ( credential , null ) ; // If we get here all retries failed , throw the lastest failure
throw new ResourceException ( failure ) ;
|
public class ServerOperations { /** * Finds the last entry of the address list and returns it as a property .
* @ param address the address to get the last part of
* @ return the last part of the address
* @ throws IllegalArgumentException if the address is not of type { @ link ModelType # LIST } or is empty */
public static Property getChildAddress ( final ModelNode address ) { } }
|
if ( address . getType ( ) != ModelType . LIST ) { throw new IllegalArgumentException ( "The address type must be a list." ) ; } final List < Property > addressParts = address . asPropertyList ( ) ; if ( addressParts . isEmpty ( ) ) { throw new IllegalArgumentException ( "The address is empty." ) ; } return addressParts . get ( addressParts . size ( ) - 1 ) ;
|
public class AbstractInstanceManager { /** * Return the proxy instance which corresponds to the given datastore type for
* reading .
* @ param datastoreType
* The datastore type .
* @ param < T >
* The instance type .
* @ return The instance . */
@ Override public < T > T readInstance ( DatastoreType datastoreType ) { } }
|
return getInstance ( datastoreType , TransactionalCache . Mode . READ ) ;
|
public class TempFileHandler { /** * Resets the input and output file before writing to the output again
* @ throws IOException
* An IOException is thrown if TempFileHandler has been
* closed or if the output file is open or empty . */
public void reset ( ) throws IOException { } }
|
if ( t1 == null || t2 == null ) { throw new IllegalStateException ( "Cannot swap after close." ) ; } if ( getOutput ( ) . length ( ) > 0 ) { toggle = ! toggle ; // reset the new output to length ( ) = 0
try ( OutputStream unused = new FileOutputStream ( getOutput ( ) ) ) { // this is empty because we only need to close it
} } else { throw new IOException ( "Cannot swap to an empty file." ) ; }
|
public class GlobalSuffixFinders { /** * Transforms a suffix index returned by a { @ link LocalSuffixFinder } into a list containing the single
* distinguishing suffix . */
public static < I , D > List < Word < I > > suffixesForLocalOutput ( Query < I , D > ceQuery , int localSuffixIdx ) { } }
|
return suffixesForLocalOutput ( ceQuery , localSuffixIdx , false ) ;
|
public class MonitorWebController { /** * Prepare polling for the named broker at the given polling address .
* @ param brokerName
* @ param address
* @ return
* @ throws Exception */
protected String prepareBrokerPoller ( String brokerName , String address ) throws Exception { } }
|
MBeanAccessConnectionFactory mBeanAccessConnectionFactory = this . jmxActiveMQUtil . getLocationConnectionFactory ( address ) ; if ( brokerName . equals ( "*" ) ) { String [ ] brokersAtLocation = this . jmxActiveMQUtil . queryBrokerNames ( address ) ; if ( brokersAtLocation == null ) { throw new Exception ( "unable to locate broker at " + address ) ; } else if ( brokersAtLocation . length != 1 ) { throw new Exception ( "found more than one broker at " + address + "; count=" + brokersAtLocation . length ) ; } else { brokerName = brokersAtLocation [ 0 ] ; } } this . brokerRegistry . put ( address , new BrokerInfo ( "unknown-broker-id" , brokerName , "unknown-broker-url" ) ) ; ActiveMQBrokerPoller brokerPoller = this . brokerPollerFactory . createPoller ( brokerName , mBeanAccessConnectionFactory , this . websocketBrokerStatsFeed ) ; brokerPoller . setQueueRegistry ( this . queueRegistry ) ; brokerPoller . setTopicRegistry ( this . topicRegistry ) ; // TBD : one automic update for brokerPollerMap and locations ( is there an echo in here ? )
synchronized ( this . brokerPollerMap ) { if ( ! this . brokerPollerMap . containsKey ( address ) ) { this . brokerPollerMap . put ( address , brokerPoller ) ; } else { log . info ( "ignoring duplicate add of broker address {}" , address ) ; return "already exists" ; } } // No need to synchronize to avoid races here ; the poller will not start if either already started , or already
// stopped .
if ( this . started . get ( ) ) { brokerPoller . start ( ) ; } // Add auto - discovery of Queues for this broker , if enabled
if ( this . autoDiscoverQueues ) { this . prepareBrokerQueueDiscoverer ( brokerName , address , mBeanAccessConnectionFactory ) ; } return address + " = " + brokerName ;
|
public class Proxy { /** * Apply the matching client UUID for the request
* @ param httpServletRequest
* @ param history */
private void processClientId ( HttpServletRequest httpServletRequest , History history ) { } }
|
// get the client id from the request header if applicable . . otherwise set to default
// also set the client uuid in the history object
if ( httpServletRequest . getHeader ( Constants . PROFILE_CLIENT_HEADER_NAME ) != null && ! httpServletRequest . getHeader ( Constants . PROFILE_CLIENT_HEADER_NAME ) . equals ( "" ) ) { history . setClientUUID ( httpServletRequest . getHeader ( Constants . PROFILE_CLIENT_HEADER_NAME ) ) ; } else { history . setClientUUID ( Constants . PROFILE_CLIENT_DEFAULT_ID ) ; } logger . info ( "Client UUID is: {}" , history . getClientUUID ( ) ) ;
|
public class JedisRedisClient { /** * { @ inheritDoc } */
@ Override public void hashDelete ( String mapName , String ... fieldName ) { } }
|
redisClient . hdel ( mapName , fieldName ) ;
|
public class Features { /** * Add the required feature id .
* @ param id feature id */
public void addRequire ( final String id ) { } }
|
final PluginRequirement requirement = new PluginRequirement ( ) ; requirement . addPlugins ( id ) ; requireList . add ( requirement ) ;
|
public class LR0ItemSetCollection { /** * From Dragon Book :
* < pre >
* void items ( G ' ) {
* C = { CLOSURE ( { [ S0 - - > . S ] } ) } ;
* repeat
* for ( jede Item - Menge I in C )
* for ( jedes Grammatiksymbol X )
* if ( GOTO ( I , X ) ist nicht leer und nicht in C )
* fuege GOTO ( I , X ) zu C hinzu ;
* until es werden keine neuen Item - Mengen mehr in einer Runde zu C hinzugefuegt .
* < / pre >
* This method was extended to save also all transitions found and to handle
* ambiguous grammars .
* @ throws GrammarException */
private void calculate ( ) throws GrammarException { } }
|
addState ( closure0 . calc ( new LR0Item ( grammar . getProductions ( ) . get ( 0 ) , 0 ) ) ) ; int currentSize ; do { currentSize = itemSetCollection . size ( ) ; int currentItemSetCount = itemSetCollection . size ( ) ; for ( int stateId = 0 ; stateId < currentItemSetCount ; stateId ++ ) { LR0ItemSet itemSet = itemSetCollection . get ( stateId ) ; for ( Construction grammarSymbol : itemSet . getAllGrammarSymbols ( ) ) { LR0ItemSet gotoSet = goto0 . calc ( itemSet , grammarSymbol ) ; if ( gotoSet . getSize ( ) > 0 ) { addState ( gotoSet ) ; } } } } while ( currentSize < itemSetCollection . size ( ) ) ;
|
public class FunctionRegistry { /** * Registers a function class . */
static public void putFunction ( String name , Class < ? extends Function > functionClazz ) { } }
|
FunctionRegistry . functionClazzes . put ( Objects . requireNonNull ( name ) , checkClass ( functionClazz ) ) ;
|
public class AtmosphereHandlerPubSub { /** * Retrieve the { @ link Broadcaster } based on the request ' s path info .
* @ param ar
* @ return the { @ link Broadcaster } based on the request ' s path info . */
Broadcaster lookupBroadcaster ( AtmosphereResource ar ) { } }
|
String pathInfo = ar . getRequest ( ) . getPathInfo ( ) ; String [ ] decodedPath = pathInfo . split ( "/" ) ; Broadcaster b = ar . getAtmosphereConfig ( ) . getBroadcasterFactory ( ) . lookup ( decodedPath [ decodedPath . length - 1 ] , true ) ; return b ;
|
public class JavaConverter { /** * unserialize a serialized Object
* @ param str
* @ return unserialized Object
* @ throws IOException
* @ throws ClassNotFoundException
* @ throws CoderException */
public static Object deserialize ( String str ) throws IOException , ClassNotFoundException , CoderException { } }
|
ByteArrayInputStream bais = new ByteArrayInputStream ( Base64Coder . decode ( str ) ) ; return deserialize ( bais ) ;
|
public class IntegrationAccountAssembliesInner { /** * Get the content callback url for an integration account assembly .
* @ param resourceGroupName The resource group name .
* @ param integrationAccountName The integration account name .
* @ param assemblyArtifactName The assembly artifact name .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < WorkflowTriggerCallbackUrlInner > listContentCallbackUrlAsync ( String resourceGroupName , String integrationAccountName , String assemblyArtifactName , final ServiceCallback < WorkflowTriggerCallbackUrlInner > serviceCallback ) { } }
|
return ServiceFuture . fromResponse ( listContentCallbackUrlWithServiceResponseAsync ( resourceGroupName , integrationAccountName , assemblyArtifactName ) , serviceCallback ) ;
|
public class MediaHttpDownloader { /** * Executes the current request .
* @ param currentRequestLastBytePos last byte position for current request
* @ param requestUrl request URL where the download requests will be sent
* @ param requestHeaders request headers or { @ code null } to ignore
* @ param outputStream destination output stream
* @ return HTTP response */
private HttpResponse executeCurrentRequest ( long currentRequestLastBytePos , GenericUrl requestUrl , HttpHeaders requestHeaders , OutputStream outputStream ) throws IOException { } }
|
// prepare the GET request
HttpRequest request = requestFactory . buildGetRequest ( requestUrl ) ; // add request headers
if ( requestHeaders != null ) { request . getHeaders ( ) . putAll ( requestHeaders ) ; } // set Range header ( if necessary )
if ( bytesDownloaded != 0 || currentRequestLastBytePos != - 1 ) { StringBuilder rangeHeader = new StringBuilder ( ) ; rangeHeader . append ( "bytes=" ) . append ( bytesDownloaded ) . append ( "-" ) ; if ( currentRequestLastBytePos != - 1 ) { rangeHeader . append ( currentRequestLastBytePos ) ; } request . getHeaders ( ) . setRange ( rangeHeader . toString ( ) ) ; } // execute the request and copy into the output stream
HttpResponse response = request . execute ( ) ; try { ByteStreams . copy ( response . getContent ( ) , outputStream ) ; } finally { response . disconnect ( ) ; } return response ;
|
public class FilterLdap { /** * public Boolean REQUIRE _ RETURNED _ ATTRS = Boolean . FALSE ; */
@ Override public void init ( FilterConfig filterConfig ) { } }
|
String m = "L init() " ; try { logger . debug ( m + ">" ) ; super . init ( filterConfig ) ; m = FilterSetup . getFilterNameAbbrev ( FILTER_NAME ) + " init() " ; inited = false ; if ( ! initErrors ) { Set < String > temp = new HashSet < String > ( ) ; if ( ATTRIBUTES2RETURN == null ) { ATTRIBUTES2RETURN = EMPTY_STRING_ARRAY ; } else { for ( String element : ATTRIBUTES2RETURN ) { temp . add ( element ) ; } } if ( AUTHENTICATE && PASSWORD != null && ! PASSWORD . isEmpty ( ) ) { temp . add ( PASSWORD ) ; } DIRECTORY_ATTRIBUTES_NEEDED = ( String [ ] ) temp . toArray ( StringArrayPrototype ) ; boolean haveBindMethod = false ; if ( SECURITY_AUTHENTICATION != null && ! SECURITY_AUTHENTICATION . isEmpty ( ) ) { haveBindMethod = true ; } boolean haveSuperUser = false ; if ( SECURITY_PRINCIPAL != null && ! SECURITY_PRINCIPAL . isEmpty ( ) ) { haveSuperUser = true ; } boolean haveSuperUserPassword = false ; if ( SECURITY_CREDENTIALS != null && ! SECURITY_CREDENTIALS . isEmpty ( ) ) { haveSuperUserPassword = true ; } if ( haveBindMethod && haveSuperUserPassword ) { initErrors = ! haveSuperUser ; } } if ( initErrors ) { logger . error ( m + "not initialized; see previous error" ) ; } inited = true ; } finally { logger . debug ( "{}<" , m ) ; }
|
public class ByteBuffer { /** * Append a long as an eight byte number . */
public void appendLong ( long x ) { } }
|
ByteArrayOutputStream buffer = new ByteArrayOutputStream ( 8 ) ; DataOutputStream bufout = new DataOutputStream ( buffer ) ; try { bufout . writeLong ( x ) ; appendBytes ( buffer . toByteArray ( ) , 0 , 8 ) ; } catch ( IOException e ) { throw new AssertionError ( "write" ) ; }
|
public class CheckClassAdapter { /** * Checks a type variable signature .
* @ param signature
* a string containing the signature that must be checked .
* @ param pos
* index of first character to be checked .
* @ return the index of the first character after the checked part . */
private static int checkTypeVariableSignature ( final String signature , int pos ) { } }
|
// TypeVariableSignature :
// T Identifier ;
pos = checkChar ( 'T' , signature , pos ) ; pos = checkIdentifier ( signature , pos ) ; return checkChar ( ';' , signature , pos ) ;
|
public class LoadingLayout { /** * create a LoadingLayout to wrap and replace the targetView .
* Note : if you attachTo targetView on ' onCreate ' method , targetView may be not layout complete .
* @ param targetView
* @ return */
public static LoadingLayout wrap ( final View targetView ) { } }
|
return wrap ( targetView , android . R . attr . progressBarStyleLarge ) ;
|
public class CmsSetupStep03Database { /** * Creates DB and tables when necessary . < p >
* @ throws Exception in case creating DB or tables fails */
public void setupDb ( boolean createDb , boolean createTables , boolean dropDb ) throws Exception { } }
|
if ( m_setupBean . isInitialized ( ) ) { System . out . println ( "Setup-Bean initialized successfully." ) ; CmsSetupDb db = new CmsSetupDb ( m_setupBean . getWebAppRfsPath ( ) ) ; try { // try to connect as the runtime user
db . setConnection ( m_setupBean . getDbDriver ( ) , m_setupBean . getDbWorkConStr ( ) , m_setupBean . getDbConStrParams ( ) , m_setupBean . getDbWorkUser ( ) , m_setupBean . getDbWorkPwd ( ) , false ) ; if ( ! db . noErrors ( ) ) { // try to connect as the setup user
db . closeConnection ( ) ; db . clearErrors ( ) ; db . setConnection ( m_setupBean . getDbDriver ( ) , m_setupBean . getDbCreateConStr ( ) , m_setupBean . getDbConStrParams ( ) , m_setupBean . getDbCreateUser ( ) , m_setupBean . getDbCreatePwd ( ) ) ; } if ( ! db . noErrors ( ) || ! m_setupBean . validateJdbc ( ) ) { throw new DBException ( "DB connection test failed." , db . getErrors ( ) ) ; } } finally { db . clearErrors ( ) ; db . closeConnection ( ) ; } } System . out . println ( "DB connection tested successfully." ) ; CmsSetupDb db = null ; boolean dbExists = false ; if ( m_setupBean . isInitialized ( ) ) { if ( createDb || createTables ) { db = new CmsSetupDb ( m_setupBean . getWebAppRfsPath ( ) ) ; // check if database exists
if ( m_setupBean . getDatabase ( ) . startsWith ( "oracle" ) || m_setupBean . getDatabase ( ) . startsWith ( "db2" ) || m_setupBean . getDatabase ( ) . startsWith ( "as400" ) ) { setWorkConnection ( db ) ; } else { db . setConnection ( m_setupBean . getDbDriver ( ) , m_setupBean . getDbWorkConStr ( ) , m_setupBean . getDbConStrParams ( ) , m_setupBean . getDbCreateUser ( ) , m_setupBean . getDbCreatePwd ( ) , false ) ; dbExists = db . noErrors ( ) ; if ( dbExists ) { db . closeConnection ( ) ; } else { db . clearErrors ( ) ; } } if ( ! dbExists || dropDb ) { db . closeConnection ( ) ; if ( ! m_setupBean . getDatabase ( ) . startsWith ( "db2" ) && ! m_setupBean . getDatabase ( ) . startsWith ( "as400" ) ) { db . setConnection ( m_setupBean . getDbDriver ( ) , m_setupBean . getDbCreateConStr ( ) , m_setupBean . getDbConStrParams ( ) , m_setupBean . getDbCreateUser ( ) , m_setupBean . getDbCreatePwd ( ) ) ; } } } } if ( ! createDb && ! createTables && ! dbExists ) { throw new Exception ( "You have not created the Alkacon OpenCms database." ) ; } if ( dbExists && createTables && ! dropDb && ( db != null ) ) { throw new Exception ( "You have selected to not drop existing DBs, but a DB with the given name exists." ) ; } if ( dbExists && createDb && dropDb && ( db != null ) ) { // drop the DB
db . closeConnection ( ) ; db . setConnection ( m_setupBean . getDbDriver ( ) , m_setupBean . getDbCreateConStr ( ) , m_setupBean . getDbConStrParams ( ) , m_setupBean . getDbCreateUser ( ) , m_setupBean . getDbCreatePwd ( ) ) ; db . dropDatabase ( m_setupBean . getDatabase ( ) , m_setupBean . getReplacer ( ) ) ; if ( ! db . noErrors ( ) ) { List < String > errors = new ArrayList < > ( db . getErrors ( ) ) ; db . clearErrors ( ) ; throw new DBException ( "Error occurred while dropping the DB!" , errors ) ; } System . out . println ( "Database dropped successfully." ) ; } if ( createDb && ( db != null ) ) { // Create Database
db . createDatabase ( m_setupBean . getDatabase ( ) , m_setupBean . getReplacer ( ) ) ; if ( ! db . noErrors ( ) ) { DBException ex = new DBException ( "Error occurred while creating the DB!" , db . getErrors ( ) ) ; db . clearErrors ( ) ; throw ex ; } db . closeConnection ( ) ; System . out . println ( "Database created successfully." ) ; } if ( createTables && ( db != null ) ) { setWorkConnection ( db ) ; // Drop Tables ( intentionally quiet )
db . dropTables ( m_setupBean . getDatabase ( ) ) ; db . clearErrors ( ) ; db . closeConnection ( ) ; // reopen the connection in order to display errors
setWorkConnection ( db ) ; // Create Tables
db . createTables ( m_setupBean . getDatabase ( ) , m_setupBean . getReplacer ( ) ) ; if ( ! db . noErrors ( ) ) { DBException ex = new DBException ( "Error occurred while creating the DB!" , db . getErrors ( ) ) ; db . clearErrors ( ) ; throw ex ; } db . closeConnection ( ) ; System . out . println ( "Tables created successfully." ) ; } if ( db != null ) { db . closeConnection ( ) ; } System . out . println ( "Database setup was successful." ) ; m_context . stepForward ( ) ;
|
public class ActivityUtils { /** * All activites that have been opened are finished . */
public void finishOpenedActivities ( ) { } }
|
// Stops the activityStack listener
activitySyncTimer . cancel ( ) ; if ( ! config . trackActivities ) { useGoBack ( 3 ) ; return ; } ArrayList < Activity > activitiesOpened = getAllOpenedActivities ( ) ; // Finish all opened activities
for ( int i = activitiesOpened . size ( ) - 1 ; i >= 0 ; i -- ) { sleeper . sleep ( MINISLEEP ) ; finishActivity ( activitiesOpened . get ( i ) ) ; } activitiesOpened = null ; sleeper . sleep ( MINISLEEP ) ; // Finish the initial activity , pressing Back for good measure
finishActivity ( getCurrentActivity ( true , false ) ) ; stopActivityMonitor ( ) ; setRegisterActivities ( false ) ; this . activity = null ; sleeper . sleepMini ( ) ; useGoBack ( 1 ) ; clearActivityStack ( ) ;
|
public class TargetsApi { /** * Get a specific target by type and ID . Targets can be agents , agent groups , queues , route points , skills , and custom contacts .
* @ param id The ID of the target .
* @ param type The type of target to retrieve . The possible values are AGENT , AGENT _ GROUP , ACD _ QUEUE , ROUTE _ POINT , SKILL , and CUSTOM _ CONTACT .
* @ return Target */
public Target getTarget ( long id , TargetType type ) throws WorkspaceApiException { } }
|
try { TargetsResponse resp = targetsApi . getTarget ( new BigDecimal ( id ) , type . getValue ( ) ) ; Util . throwIfNotOk ( resp . getStatus ( ) ) ; Target target = null ; if ( resp . getData ( ) != null ) { List < com . genesys . internal . workspace . model . Target > targets = resp . getData ( ) . getTargets ( ) ; if ( targets != null && targets . size ( ) > 0 ) { target = Target . fromTarget ( targets . get ( 0 ) ) ; } } return target ; } catch ( ApiException ex ) { throw new WorkspaceApiException ( "Cannot get target" , ex ) ; }
|
public class Language { /** * Get the location of the rule file ( s ) in a form like { @ code / org / languagetool / rules / de / grammar . xml } ,
* i . e . a path in the classpath . The files must exist or an exception will be thrown , unless the filename
* contains the string { @ code - test - } . */
public List < String > getRuleFileNames ( ) { } }
|
List < String > ruleFiles = new ArrayList < > ( ) ; ResourceDataBroker dataBroker = JLanguageTool . getDataBroker ( ) ; ruleFiles . add ( dataBroker . getRulesDir ( ) + "/" + getShortCode ( ) + "/" + JLanguageTool . PATTERN_FILE ) ; if ( getShortCodeWithCountryAndVariant ( ) . length ( ) > 2 ) { String fileName = getShortCode ( ) + "/" + getShortCodeWithCountryAndVariant ( ) + "/" + JLanguageTool . PATTERN_FILE ; if ( dataBroker . ruleFileExists ( fileName ) ) { ruleFiles . add ( dataBroker . getRulesDir ( ) + "/" + fileName ) ; } } return ruleFiles ;
|
public class ConfigValidator { /** * Validates the given { @ link CacheConfig } .
* @ param cacheConfig the { @ link CacheConfig } to check
* @ param mergePolicyProvider the { @ link CacheMergePolicyProvider } to resolve merge policy classes */
public static void checkCacheConfig ( CacheConfig cacheConfig , CacheMergePolicyProvider mergePolicyProvider ) { } }
|
checkCacheConfig ( cacheConfig . getInMemoryFormat ( ) , cacheConfig . getEvictionConfig ( ) , cacheConfig . getMergePolicy ( ) , cacheConfig , mergePolicyProvider ) ;
|
public class AsyncLookupDoFn { /** * Flush pending errors and results */
private void flush ( Consumer < Result > outputFn ) { } }
|
Result r = results . poll ( ) ; while ( r != null ) { outputFn . accept ( r ) ; resultCount ++ ; r = results . poll ( ) ; }
|
public class RepositoryApplicationConfiguration { /** * { @ link JpaDeploymentManagement } bean .
* @ return a new { @ link DeploymentManagement } */
@ Bean @ ConditionalOnMissingBean DeploymentManagement deploymentManagement ( final EntityManager entityManager , final ActionRepository actionRepository , final DistributionSetRepository distributionSetRepository , final TargetRepository targetRepository , final ActionStatusRepository actionStatusRepository , final TargetManagement targetManagement , final AuditorAware < String > auditorProvider , final ApplicationEventPublisher eventPublisher , final BusProperties bus , final AfterTransactionCommitExecutor afterCommit , final VirtualPropertyReplacer virtualPropertyReplacer , final PlatformTransactionManager txManager , final TenantConfigurationManagement tenantConfigurationManagement , final QuotaManagement quotaManagement , final SystemSecurityContext systemSecurityContext , final TenantAware tenantAware , final JpaProperties properties ) { } }
|
return new JpaDeploymentManagement ( entityManager , actionRepository , distributionSetRepository , targetRepository , actionStatusRepository , targetManagement , auditorProvider , eventPublisher , bus , afterCommit , virtualPropertyReplacer , txManager , tenantConfigurationManagement , quotaManagement , systemSecurityContext , tenantAware , properties . getDatabase ( ) ) ;
|
public class HttpUtil { /** * 发送post请求 < br >
* 请求体body参数支持两种类型 :
* < pre >
* 1 . 标准参数 , 例如 a = 1 & amp ; b = 2 这种格式
* 2 . Rest模式 , 此时body需要传入一个JSON或者XML字符串 , Hutool会自动绑定其对应的Content - Type
* < / pre >
* @ param urlString 网址
* @ param body post表单数据
* @ return 返回数据 */
public static String post ( String urlString , String body ) { } }
|
return post ( urlString , body , HttpRequest . TIMEOUT_DEFAULT ) ;
|
public class IfcStructuralLoadConfigurationImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public EList < ListOfIfcLengthMeasure > getLocations ( ) { } }
|
return ( EList < ListOfIfcLengthMeasure > ) eGet ( Ifc4Package . Literals . IFC_STRUCTURAL_LOAD_CONFIGURATION__LOCATIONS , true ) ;
|
public class ChangeRoomNameImpl { /** * / * ( non - Javadoc )
* @ see com . tvd12 . ezyfox . core . command . BaseCommand # execute ( ) */
@ SuppressWarnings ( "unchecked" ) @ Override public Boolean execute ( ) { } }
|
try { api . changeRoomName ( CommandUtil . getSfsUser ( owner , api ) , CommandUtil . getSfsRoom ( targetRoom , extension ) , roomName ) ; } catch ( SFSRoomException e ) { throw new IllegalStateException ( e ) ; } return Boolean . TRUE ;
|
public class Util { /** * Report .
* @ param fragments the fragments
* @ throws IOException the io exception */
public static void report ( @ javax . annotation . Nonnull final Stream < String > fragments ) throws IOException { } }
|
@ javax . annotation . Nonnull final File outDir = new File ( "reports" ) ; outDir . mkdirs ( ) ; final StackTraceElement caller = com . simiacryptus . util . Util . getLast ( Arrays . stream ( Thread . currentThread ( ) . getStackTrace ( ) ) . filter ( x -> x . getClassName ( ) . contains ( "simiacryptus" ) ) ) ; @ javax . annotation . Nonnull final File report = new File ( outDir , caller . getClassName ( ) + "_" + caller . getLineNumber ( ) + ".html" ) ; @ javax . annotation . Nonnull final PrintStream out = new PrintStream ( new FileOutputStream ( report ) ) ; out . println ( "<html><head></head><body>" ) ; fragments . forEach ( out :: println ) ; out . println ( "</body></html>" ) ; out . close ( ) ; Desktop . getDesktop ( ) . browse ( report . toURI ( ) ) ;
|
public class Matrix4x3f { /** * / * ( non - Javadoc )
* @ see org . joml . Matrix4x3fc # determinant ( ) */
public float determinant ( ) { } }
|
return ( m00 * m11 - m01 * m10 ) * m22 + ( m02 * m10 - m00 * m12 ) * m21 + ( m01 * m12 - m02 * m11 ) * m20 ;
|
public class CreateInstanceCommandExecution { /** * Verifies a new VM model can be created according to a given context .
* @ param executionContext
* @ param component
* @ throws CommandException */
public static void verify ( CommandExecutionContext executionContext , Component component ) throws CommandException { } }
|
if ( executionContext != null && Constants . TARGET_INSTALLER . equalsIgnoreCase ( component . getInstallerName ( ) ) && executionContext . getMaxVm ( ) > 0 && executionContext . getMaxVm ( ) <= executionContext . getGlobalVmNumber ( ) . get ( ) && executionContext . isStrictMaxVm ( ) ) throw new CommandException ( "The maximum number of VM created by the autonomic has been reached." ) ;
|
public class CacheLookupHelper { /** * Returns the default cache name associated to the given method according to JSR - 107.
* @ param method the method .
* @ return the default cache name for the given method . */
private static String getDefaultMethodCacheName ( Method method ) { } }
|
int i = 0 ; int nbParameters = method . getParameterTypes ( ) . length ; StringBuilder cacheName = new StringBuilder ( ) . append ( method . getDeclaringClass ( ) . getName ( ) ) . append ( "." ) . append ( method . getName ( ) ) . append ( "(" ) ; for ( Class < ? > oneParameterType : method . getParameterTypes ( ) ) { cacheName . append ( oneParameterType . getName ( ) ) ; if ( i < ( nbParameters - 1 ) ) { cacheName . append ( "," ) ; } i ++ ; } return cacheName . append ( ")" ) . toString ( ) ;
|
public class VpnTunnelClient { /** * Creates a VpnTunnel resource in the specified project and region using the data included in the
* request .
* < p > Sample code :
* < pre > < code >
* try ( VpnTunnelClient vpnTunnelClient = VpnTunnelClient . create ( ) ) {
* ProjectRegionName region = ProjectRegionName . of ( " [ PROJECT ] " , " [ REGION ] " ) ;
* VpnTunnel vpnTunnelResource = VpnTunnel . newBuilder ( ) . build ( ) ;
* Operation response = vpnTunnelClient . insertVpnTunnel ( region , vpnTunnelResource ) ;
* < / code > < / pre >
* @ param region Name of the region for this request .
* @ param vpnTunnelResource VPN tunnel resource . ( = = resource _ for beta . vpnTunnels = = ) ( = =
* resource _ for v1 . vpnTunnels = = )
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final Operation insertVpnTunnel ( ProjectRegionName region , VpnTunnel vpnTunnelResource ) { } }
|
InsertVpnTunnelHttpRequest request = InsertVpnTunnelHttpRequest . newBuilder ( ) . setRegion ( region == null ? null : region . toString ( ) ) . setVpnTunnelResource ( vpnTunnelResource ) . build ( ) ; return insertVpnTunnel ( request ) ;
|
public class SQLExpressions { /** * Add the given amount of weeks to the date
* @ param date datetime
* @ param weeks weeks to add
* @ return converted date */
public static < D extends Comparable > DateTimeExpression < D > addWeeks ( DateTimeExpression < D > date , int weeks ) { } }
|
return Expressions . dateTimeOperation ( date . getType ( ) , Ops . DateTimeOps . ADD_WEEKS , date , ConstantImpl . create ( weeks ) ) ;
|
public class RaygunSettings { /** * Set your proxy information , if your proxy server requires authentication set a
* default Authenticator in your code :
* Authenticator authenticator = new Authenticator ( ) {
* public PasswordAuthentication getPasswordAuthentication ( ) {
* return ( new PasswordAuthentication ( " user " ,
* " password " . toCharArray ( ) ) ) ;
* Authenticator . setDefault ( authenticator ) ;
* This will allow different proxy authentication credentials to be used for different
* target urls .
* @ param host The host name
* @ param port The TCP port */
public void setHttpProxy ( String host , int port ) { } }
|
if ( host == null ) { this . proxy = null ; } else { this . proxy = new Proxy ( Proxy . Type . HTTP , new InetSocketAddress ( host , port ) ) ; }
|
public class Client { /** * Creates and posts an activity to a user .
* @ param verb
* @ param title
* @ param content
* @ param category
* @ param user
* @ param object
* @ param objectType
* @ param objectName
* @ param objectContent
* @ return */
public ApiResponse postUserActivity ( String verb , String title , String content , String category , User user , Entity object , String objectType , String objectName , String objectContent ) { } }
|
Activity activity = Activity . newActivity ( verb , title , content , category , user , object , objectType , objectName , objectContent ) ; return postUserActivity ( user . getUuid ( ) . toString ( ) , activity ) ;
|
public class Record { /** * FIXME Better way of accessing the variables ? */
public Long getId ( ) { } }
|
if ( this . genericRecordAttributes . getId ( ) != null ) { return this . genericRecordAttributes . getId ( ) ; } else if ( this . typeARecordAttributes . getId ( ) != null ) { return this . typeARecordAttributes . getId ( ) ; } else if ( this . typeAAAARecordAttributes . getId ( ) != null ) { return this . typeAAAARecordAttributes . getId ( ) ; } else if ( this . typeNSRecordAttributes . getId ( ) != null ) { return this . typeNSRecordAttributes . getId ( ) ; } else if ( this . typeSOARecordAttributes . getId ( ) != null ) { return this . typeSOARecordAttributes . getId ( ) ; } else if ( this . typeMXRecordAttributes . getId ( ) != null ) { return this . typeMXRecordAttributes . getId ( ) ; } else if ( this . typePTRRecordAttributes . getId ( ) != null ) { return this . typePTRRecordAttributes . getId ( ) ; } else if ( this . typeTXTRecordAttributes . getId ( ) != null ) { return this . typeTXTRecordAttributes . getId ( ) ; } else { return null ; }
|
public class ChainingAWSCredentialsProvider { /** * Gets instance .
* @ param credentialAccessKey the credential access key
* @ param credentialSecretKey the credential secret key
* @ return the instance */
public static AWSCredentialsProvider getInstance ( final String credentialAccessKey , final String credentialSecretKey ) { } }
|
return getInstance ( credentialAccessKey , credentialSecretKey , null , null , null ) ;
|
public class SmtpMailService { /** * Sends message out via SMTP
* @ param message to construct mail message
* @ return result of send */
@ Override public MailSendResult send ( MailMessage message ) { } }
|
Assert . notNull ( message , "Missing mail message!" ) ; Properties props = new Properties ( ) ; props . put ( "mail.transport.protocol" , "smtp" ) ; props . put ( "mail.smtp.host" , smtpHost ) ; props . put ( "mail.smtp.port" , smtpPort ) ; Session session = getSession ( props , smtpUsername , smtpPassword ) ; try { // build mime message
Message msg = message . getMessage ( session ) ; Enumeration enumer = msg . getAllHeaders ( ) ; while ( enumer . hasMoreElements ( ) ) { Header header = ( Header ) enumer . nextElement ( ) ; log . info ( header . getName ( ) + ": " + header . getValue ( ) ) ; } log . info ( "Getting transport..." ) ; Transport transport = session . getTransport ( "smtp" ) ; log . info ( "Connecting to SMTP server: " + smtpHost + ":" + smtpPort ) ; transport . connect ( ) ; transport . sendMessage ( msg , msg . getAllRecipients ( ) ) ; log . info ( "Closing transport..." ) ; transport . close ( ) ; } catch ( Exception e ) { log . error ( e . getMessage ( ) , e ) ; return MailSendResult . fail ( ) ; } return MailSendResult . ok ( ) ;
|
public class ProgressWheel { protected void onDraw ( Canvas canvas ) { } }
|
super . onDraw ( canvas ) ; canvas . drawArc ( circleBounds , 360 , 360 , false , rimPaint ) ; boolean mustInvalidate = false ; if ( ! shouldAnimate ) { return ; } if ( isSpinning ) { // Draw the spinning bar
mustInvalidate = true ; long deltaTime = ( SystemClock . uptimeMillis ( ) - lastTimeAnimated ) ; float deltaNormalized = deltaTime * spinSpeed / 1000.0f ; updateBarLength ( deltaTime ) ; mProgress += deltaNormalized ; if ( mProgress > 360 ) { mProgress -= 360f ; // A full turn has been completed
// we run the callback with - 1 in case we want to
// do something , like changing the color
runCallback ( - 1.0f ) ; } lastTimeAnimated = SystemClock . uptimeMillis ( ) ; float from = mProgress - 90 ; float length = barLength + barExtraLength ; if ( isInEditMode ( ) ) { from = 0 ; length = 135 ; } canvas . drawArc ( circleBounds , from , length , false , barPaint ) ; } else { float oldProgress = mProgress ; if ( mProgress != mTargetProgress ) { // We smoothly increase the progress bar
mustInvalidate = true ; float deltaTime = ( float ) ( SystemClock . uptimeMillis ( ) - lastTimeAnimated ) / 1000 ; float deltaNormalized = deltaTime * spinSpeed ; mProgress = Math . min ( mProgress + deltaNormalized , mTargetProgress ) ; lastTimeAnimated = SystemClock . uptimeMillis ( ) ; } if ( oldProgress != mProgress ) { runCallback ( ) ; } float offset = 0.0f ; float progress = mProgress ; if ( ! linearProgress ) { float factor = 2.0f ; offset = ( float ) ( 1.0f - Math . pow ( 1.0f - mProgress / 360.0f , 2.0f * factor ) ) * 360.0f ; progress = ( float ) ( 1.0f - Math . pow ( 1.0f - mProgress / 360.0f , factor ) ) * 360.0f ; } if ( isInEditMode ( ) ) { progress = 360 ; } canvas . drawArc ( circleBounds , offset - 90 , progress , false , barPaint ) ; } if ( mustInvalidate ) { invalidate ( ) ; }
|
public class QuartzClientHandler { /** * { @ inheritDoc } */
@ Override public Envelope convertResponse ( HttpResponse response ) throws ResponseConversionException { } }
|
if ( ! ( response instanceof HttpContent ) ) { throw new ResponseConversionException ( response ) ; } HttpContent content = ( HttpContent ) response ; try { return Envelope . PARSER . parseFrom ( ByteBufUtil . getBytes ( content . content ( ) ) ) ; } catch ( InvalidProtocolBufferException ipbe ) { throw new ResponseConversionException ( String . format ( "HTTP status: %d, Content: %s" , response . getStatus ( ) . code ( ) , content . content ( ) . toString ( Charsets . UTF_8 ) ) , ipbe ) ; }
|
public class DualRouter { public RouterLike CONNECT ( String path , T target ) { } }
|
return pattern ( CONNECT ( ) , path , target ) ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.