signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class CreateSimulationApplicationResult { /** * The sources of the simulation application . * @ param sources * The sources of the simulation application . */ public void setSources ( java . util . Collection < Source > sources ) { } }
if ( sources == null ) { this . sources = null ; return ; } this . sources = new java . util . ArrayList < Source > ( sources ) ;
public class StreamParameter { /** * Write stream in text format . * @ param pos database outputStream * @ throws IOException if any error occur when reader stream */ public void writeTo ( final PacketOutputStream pos ) throws IOException { } }
pos . write ( BINARY_INTRODUCER ) ; if ( length == Long . MAX_VALUE ) { pos . write ( is , true , noBackslashEscapes ) ; } else { pos . write ( is , length , true , noBackslashEscapes ) ; } pos . write ( QUOTE ) ;
public class gslbsite { /** * Use this API to delete gslbsite resources of given names . */ public static base_responses delete ( nitro_service client , String sitename [ ] ) throws Exception { } }
base_responses result = null ; if ( sitename != null && sitename . length > 0 ) { gslbsite deleteresources [ ] = new gslbsite [ sitename . length ] ; for ( int i = 0 ; i < sitename . length ; i ++ ) { deleteresources [ i ] = new gslbsite ( ) ; deleteresources [ i ] . sitename = sitename [ i ] ; } result = delete_bulk_request ( client , deleteresources ) ; } return result ;
public class DoubleArraysND { /** * Returns the maximum value in the given array , or * < code > Double . NEGATIVE _ INFINITY < / code > if the given array * has a size of 0. * @ param array The array * @ return The maximum value */ public static double max ( DoubleArrayND array ) { } }
return array . stream ( ) . parallel ( ) . reduce ( Double . NEGATIVE_INFINITY , Math :: max ) ;
public class RequestDetails { /** * Returns the < b > conditional URL < / b > if this request has one , or < code > null < / code > otherwise . For an * update or delete method , this is the part of the URL after the < code > ? < / code > . For a create , this * is the value of the < code > If - None - Exist < / code > header . * @ param theOperationType The operation type to find the conditional URL for * @ return Returns the < b > conditional URL < / b > if this request has one , or < code > null < / code > otherwise */ public String getConditionalUrl ( RestOperationTypeEnum theOperationType ) { } }
if ( theOperationType == RestOperationTypeEnum . CREATE ) { String retVal = this . getHeader ( Constants . HEADER_IF_NONE_EXIST ) ; if ( isBlank ( retVal ) ) { return null ; } if ( retVal . startsWith ( this . getFhirServerBase ( ) ) ) { retVal = retVal . substring ( this . getFhirServerBase ( ) . length ( ) ) ; } return retVal ; } else if ( theOperationType != RestOperationTypeEnum . DELETE && theOperationType != RestOperationTypeEnum . UPDATE ) { return null ; } if ( this . getId ( ) != null && this . getId ( ) . hasIdPart ( ) ) { return null ; } int questionMarkIndex = this . getCompleteUrl ( ) . indexOf ( '?' ) ; if ( questionMarkIndex == - 1 ) { return null ; } return this . getResourceName ( ) + this . getCompleteUrl ( ) . substring ( questionMarkIndex ) ;
public class LTieSrtFuncMemento { /** * < editor - fold desc = " object " > */ public static boolean argEquals ( LTieSrtFuncMemento the , Object that ) { } }
return Null . < LTieSrtFuncMemento > equals ( the , that , ( one , two ) -> { if ( one . getClass ( ) != two . getClass ( ) ) { return false ; } LTieSrtFuncMemento other = ( LTieSrtFuncMemento ) two ; return LObjIntPair . argEquals ( one . function , one . lastValue ( ) , other . function , other . lastValue ( ) ) ; } ) ;
public class SourceAlgorithmMarshaller { /** * Marshall the given parameter object . */ public void marshall ( SourceAlgorithm sourceAlgorithm , ProtocolMarshaller protocolMarshaller ) { } }
if ( sourceAlgorithm == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( sourceAlgorithm . getModelDataUrl ( ) , MODELDATAURL_BINDING ) ; protocolMarshaller . marshall ( sourceAlgorithm . getAlgorithmName ( ) , ALGORITHMNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class RevisionUtils { /** * Splits a revision ID into its generation number and opaque suffix string */ public static int parseRevIDNumber ( String rev ) { } }
int result = - 1 ; int dashPos = rev . indexOf ( '-' ) ; if ( dashPos >= 0 ) { try { result = Integer . parseInt ( rev . substring ( 0 , dashPos ) ) ; } catch ( NumberFormatException e ) { // ignore , let it return - 1 } } return result ;
public class OAuthAuthorization { /** * implementations for Authorization */ @ Override public String getAuthorizationHeader ( HttpRequest req ) { } }
return generateAuthorizationHeader ( req . getMethod ( ) . name ( ) , req . getURL ( ) , req . getParameters ( ) , oauthToken ) ;
public class PhaseFourApplication { /** * { @ inheritDoc } */ @ Override public boolean validCommandLine ( ) { } }
final CommandLineParser parser = new AntelopeParser ( ) ; List < Option > myOpts = getCommandLineOptions ( ) ; final Options options = new Options ( ) ; for ( final Option option : myOpts ) { options . addOption ( option ) ; } CommandLine parse ; try { parse = parser . parse ( options , getCommandLineArguments ( ) , false ) ; } catch ( ParseException e ) { return false ; } // Verify KAM name and description are present . if ( ! parse . hasOption ( SHORT_OPT_KAM_NAME ) ) { if ( getPhaseConfiguration ( ) . getKAMName ( ) == null ) { return false ; } } if ( ! parse . hasOption ( SHORT_OPT_KAM_DESCRIPTION ) ) { if ( getPhaseConfiguration ( ) . getKAMDescription ( ) == null ) { return false ; } } return true ;
public class StyleSheetTrackerService { /** * Listen new style sheet path . * @ param styleSheetPath the style hseet path * @ param scene the root scene */ public void listen ( final String styleSheetPath , final Scene scene ) { } }
final File file = new File ( styleSheetPath ) ; file . lastModified ( ) ; // StyleManager . getInstance ( ) . reloadStylesheets ( scene ) ;
public class FileImageManager { /** * Get file output stream */ @ Override public OutputStream getCheckpointOutputStream ( long imageTxId ) throws IOException { } }
String fileName = NNStorage . getCheckpointImageFileName ( imageTxId ) ; return new FileOutputStream ( new File ( sd . getCurrentDir ( ) , fileName ) ) ;
public class AvatarNode { /** * Help message for a user */ private static void printUsage ( ) { } }
System . err . println ( "Usage: java AvatarNode [" + StartupOption . STANDBY . getName ( ) + "] | [" + StartupOption . NODEZERO . getName ( ) + "] | [" + StartupOption . NODEONE . getName ( ) + "] | [" + StartupOption . FORMAT . getName ( ) + "] | [" + StartupOption . UPGRADE . getName ( ) + "] | [" + StartupOption . ROLLBACK . getName ( ) + "] | [" + StartupOption . FINALIZE . getName ( ) + "] | [" + StartupOption . IMPORT . getName ( ) + "]" ) ;
public class BackupUploadServlet { /** * Extracts value of the parameter with given name . * @ param items * @ param name * @ return parameter value or null . */ private String getParameter ( List < FileItem > items , String name ) { } }
for ( FileItem i : items ) { if ( i . isFormField ( ) && i . getFieldName ( ) . equals ( name ) ) { return i . getString ( ) ; } } return null ;
public class JSONWriter { /** * Append a value . * @ param s A string value . * @ return this */ protected JSONWriter append ( String s ) { } }
if ( s == null ) { throw new JSONException ( "Null pointer" ) ; } return append ( new WritableString ( s ) ) ;
public class Compiler { /** * General API * - > compile each of supplied files * - > recompile any required types for which we have an incomplete principle structure */ private void compile ( ICompilationUnit [ ] sourceUnits , boolean lastRound ) { } }
this . stats . startTime = System . currentTimeMillis ( ) ; try { // build and record parsed units reportProgress ( Messages . compilation_beginningToCompile ) ; if ( this . options . complianceLevel >= ClassFileConstants . JDK9 ) { // in Java 9 the compiler must never ask the oracle for a module that is contained in the input units : sortModuleDeclarationsFirst ( sourceUnits ) ; } if ( this . annotationProcessorManager == null ) { beginToCompile ( sourceUnits ) ; } else { ICompilationUnit [ ] originalUnits = sourceUnits . clone ( ) ; // remember source units in case a source type collision occurs try { beginToCompile ( sourceUnits ) ; if ( ! lastRound ) { processAnnotations ( ) ; } if ( ! this . options . generateClassFiles ) { // - proc : only was set on the command line return ; } } catch ( SourceTypeCollisionException e ) { backupAptProblems ( ) ; reset ( ) ; // a generated type was referenced before it was created // the compiler either created a MissingType or found a BinaryType for it // so add the processor ' s generated files & start over , // but remember to only pass the generated files to the annotation processor int originalLength = originalUnits . length ; int newProcessedLength = e . newAnnotationProcessorUnits . length ; ICompilationUnit [ ] combinedUnits = new ICompilationUnit [ originalLength + newProcessedLength ] ; System . arraycopy ( originalUnits , 0 , combinedUnits , 0 , originalLength ) ; System . arraycopy ( e . newAnnotationProcessorUnits , 0 , combinedUnits , originalLength , newProcessedLength ) ; this . annotationProcessorStartIndex = originalLength ; compile ( combinedUnits , e . isLastRound ) ; return ; } } // Restore the problems before the results are processed and cleaned up . restoreAptProblems ( ) ; processCompiledUnits ( 0 , lastRound ) ; } catch ( AbortCompilation e ) { this . handleInternalException ( e , null ) ; } if ( this . options . verbose ) { if ( this . totalUnits > 1 ) { this . out . println ( Messages . bind ( Messages . compilation_units , String . valueOf ( this . totalUnits ) ) ) ; } else { this . out . println ( Messages . bind ( Messages . compilation_unit , String . valueOf ( this . totalUnits ) ) ) ; } }
public class PropertyUtils { /** * Replaces properties in string . * @ param line * @ param propertyResource * @ return */ public static String replacePropertiesInString ( String line , Resource propertyResource ) { } }
Properties properties = new Properties ( ) ; try { properties . load ( propertyResource . getInputStream ( ) ) ; } catch ( IOException e ) { return line ; } return replacePropertiesInString ( line , properties ) ;
public class XORSwap { /** * Helper method that swaps all the elements of the array . This method runs in * O ( < code > Math . min ( array1 . length , array2 . length < / code > ) time . * @ param shortArray1 one array that will have its values swapped . * @ param shortArray2 other array that will have its values swapped . */ public static void swap ( short [ ] shortArray1 , short [ ] shortArray2 ) { } }
int minLength = Math . min ( shortArray1 . length , shortArray2 . length ) ; for ( int i = 0 ; i < minLength ; i ++ ) { XORSwap . swap ( shortArray1 , shortArray2 , i ) ; }
public class ConnectHandler { /** * ( non - Javadoc ) * @ see org . restcomm . ss7 . management . console . CommandHandler # handle ( org . mobicents . ss7 . management . console . CommandContext , * java . lang . String ) */ @ Override public void handle ( CommandContext ctx , String commandLine ) { } }
// TODO Validate command if ( commandLine . contains ( "--help" ) ) { this . printHelp ( commandLine , ctx ) ; return ; } String [ ] commands = commandLine . split ( " " ) ; if ( commands . length == 1 ) { ctx . connectController ( null , - 1 ) ; } else if ( commands . length == 2 ) { if ( commandLine . contains ( "--help" ) ) { this . printHelp ( "help/connect.txt" , ctx ) ; return ; } } else if ( commands . length == 3 ) { String host = commands [ 1 ] ; try { int port = Integer . parseInt ( commands [ 2 ] ) ; ctx . connectController ( host , port ) ; } catch ( NumberFormatException ne ) { ctx . printLine ( "Port must be from 1 to 65535" ) ; } } else { ctx . printLine ( "Invalid command." ) ; }
public class SarlArtifactImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public NotificationChain basicSetExtends ( JvmParameterizedTypeReference newExtends , NotificationChain msgs ) { } }
JvmParameterizedTypeReference oldExtends = extends_ ; extends_ = newExtends ; if ( eNotificationRequired ( ) ) { ENotificationImpl notification = new ENotificationImpl ( this , Notification . SET , SarlPackage . SARL_ARTIFACT__EXTENDS , oldExtends , newExtends ) ; if ( msgs == null ) msgs = notification ; else msgs . add ( notification ) ; } return msgs ;
public class ServerUtility { /** * Initializes the web client http connection settings . */ private static void initWebClientConfig ( WebClientConfiguration wconf ) { } }
if ( CONFIG == null ) { logger . warn ( "Web client config was null; cannot configure web client for {}" , ServerUtility . class ) ; logger . info ( "FEDORA_HOME is used to configure web client; was set to {}" , Constants . FEDORA_HOME ) ; return ; } if ( CONFIG . getParameter ( "httpClientTimeoutSecs" ) != null ) wconf . setTimeoutSecs ( Integer . parseInt ( CONFIG . getParameter ( "httpClientTimeoutSecs" ) ) ) ; if ( CONFIG . getParameter ( "httpClientSocketTimeoutSecs" ) != null ) wconf . setSockTimeoutSecs ( Integer . parseInt ( CONFIG . getParameter ( "httpClientSocketTimeoutSecs" ) ) ) ; if ( CONFIG . getParameter ( "httpClientMaxConnectionsPerHost" ) != null ) wconf . setMaxConnPerHost ( Integer . parseInt ( CONFIG . getParameter ( "httpClientMaxConnectionsPerHost" ) ) ) ; if ( CONFIG . getParameter ( "httpClientMaxTotalConnections" ) != null ) wconf . setMaxTotalConn ( Integer . parseInt ( CONFIG . getParameter ( "httpClientMaxTotalConnections" ) ) ) ; if ( CONFIG . getParameter ( "httpClientFollowRedirects" ) != null ) wconf . setFollowRedirects ( Boolean . parseBoolean ( CONFIG . getParameter ( "httpClientFollowRedirects" ) ) ) ; if ( CONFIG . getParameter ( "httpClientMaxFollowRedirects" ) != null ) wconf . setMaxRedirects ( Integer . parseInt ( CONFIG . getParameter ( "httpClientMaxFollowRedirects" ) ) ) ; if ( CONFIG . getParameter ( "httpClientUserAgent" ) != null ) wconf . setUserAgent ( CONFIG . getParameter ( "httpClientUserAgent" ) ) ;
public class Matrix4x3d { /** * / * ( non - Javadoc ) * @ see org . joml . Matrix4x3dc # origin ( org . joml . Vector3d ) */ public Vector3d origin ( Vector3d origin ) { } }
double a = m00 * m11 - m01 * m10 ; double b = m00 * m12 - m02 * m10 ; double d = m01 * m12 - m02 * m11 ; double g = m20 * m31 - m21 * m30 ; double h = m20 * m32 - m22 * m30 ; double j = m21 * m32 - m22 * m31 ; origin . x = - m10 * j + m11 * h - m12 * g ; origin . y = m00 * j - m01 * h + m02 * g ; origin . z = - m30 * d + m31 * b - m32 * a ; return origin ;
public class ContextWrapper { /** * @ Override * public Context addExtension ( String moreSpecificStr ) throws KbTypeException , CreateException { * return wrapped ( ) . addExtension ( moreSpecificStr ) ; */ @ Override public Context addExtension ( Context moreSpecific ) throws KbTypeException , CreateException { } }
return wrapped ( ) . addExtension ( moreSpecific ) ;
public class CopticChronology { long calculateFirstDayOfYearMillis ( int year ) { } }
// Java epoch is 1970-01-01 Gregorian which is 1686-04-23 Coptic . // Calculate relative to the nearest leap year and account for the // difference later . int relativeYear = year - 1687 ; int leapYears ; if ( relativeYear <= 0 ) { // Add 3 before shifting right since / 4 and > > 2 behave differently // on negative numbers . leapYears = ( relativeYear + 3 ) >> 2 ; } else { leapYears = relativeYear >> 2 ; // For post 1687 an adjustment is needed as jan1st is before leap day if ( ! isLeapYear ( year ) ) { leapYears ++ ; } } long millis = ( relativeYear * 365L + leapYears ) * ( long ) DateTimeConstants . MILLIS_PER_DAY ; // Adjust to account for difference between 1687-01-01 and 1686-04-23. return millis + ( 365L - 112 ) * DateTimeConstants . MILLIS_PER_DAY ;
public class JniSocketImpl { /** * Returns the remote client ' s inet address . */ @ Override public InetAddress addressRemote ( ) { } }
if ( _remoteAddr == null ) { try { _remoteAddr = InetAddress . getByName ( getRemoteHost ( ) ) ; } catch ( Exception e ) { log . log ( Level . FINE , e . toString ( ) , e ) ; } } return _remoteAddr ;
public class SelectOneMenuRenderer { /** * Parts of this class are an adapted version of InputRenderer # getSelectItems ( ) * of PrimeFaces 5.1. * @ param rw * @ throws IOException */ protected void renderOptions ( FacesContext context , ResponseWriter rw , SelectOneMenu menu ) throws IOException { } }
Converter converter = menu . getConverter ( ) ; List < SelectItemAndComponent > items = SelectItemUtils . collectOptions ( context , menu , converter ) ; SelectItemAndComponent selection = determineSelectedItem ( context , menu , items , converter ) ; for ( int index = 0 ; index < items . size ( ) ; index ++ ) { SelectItemAndComponent option = items . get ( index ) ; if ( option . getSelectItem ( ) . isNoSelectionOption ( ) && menu . isHideNoSelectionOption ( ) && selection != null ) continue ; renderOption ( context , menu , rw , ( option . getSelectItem ( ) ) , index , option . getComponent ( ) , option == selection || ( selection == null && option . getSelectItem ( ) . isNoSelectionOption ( ) ) ) ; }
public class Expressions { /** * Verifies that the arguments are equal * @ param left first argument which will be compared * @ param right second argument which will be compared * @ return new instance of the PredicateDefCmp */ public static PredicateDef cmpEq ( Expression left , Expression right ) { } }
return cmp ( CompareOperation . EQ , left , right ) ;
public class Parser { /** * Parse json to POJO . * @ param text Json string . * @ param clazz POJO Class . * @ return POJO object . */ public < T > T parse ( String text , Class < T > clazz ) { } }
return gson . fromJson ( text , clazz ) ;
public class MVELExprAnalyzer { /** * Analyze an expression . * @ param expr * The expression to analyze . * @ param availableIdentifiers * Total set of declarations available . * @ return The < code > Set < / code > of declarations used by the expression . * @ throws RecognitionException * If an error occurs in the parser . */ @ SuppressWarnings ( "unchecked" ) public static MVELAnalysisResult analyzeExpression ( final PackageBuildContext context , final String expr , final BoundIdentifiers availableIdentifiers , final Map < String , Class < ? > > localTypes , String contextIdentifier , Class kcontextClass ) { } }
if ( expr . trim ( ) . length ( ) <= 0 ) { MVELAnalysisResult result = analyze ( ( Set < String > ) Collections . EMPTY_SET , availableIdentifiers ) ; result . setMvelVariables ( new HashMap < String , Class < ? > > ( ) ) ; result . setTypesafe ( true ) ; return result ; } MVEL . COMPILER_OPT_ALLOW_NAKED_METH_CALL = true ; MVEL . COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING = true ; MVEL . COMPILER_OPT_ALLOW_RESOLVE_INNERCLASSES_WITH_DOTNOTATION = true ; MVEL . COMPILER_OPT_SUPPORT_JAVA_STYLE_CLASS_LITERALS = true ; MVELDialect dialect = ( MVELDialect ) context . getDialect ( "mvel" ) ; ParserConfiguration conf = context . getMVELDialectRuntimeData ( ) . getParserConfiguration ( ) ; conf . setClassLoader ( context . getKnowledgeBuilder ( ) . getRootClassLoader ( ) ) ; // first compilation is for verification only // @ todo proper source file name final ParserContext parserContext1 = new ParserContext ( conf ) ; if ( localTypes != null ) { for ( Entry entry : localTypes . entrySet ( ) ) { parserContext1 . addInput ( ( String ) entry . getKey ( ) , ( Class ) entry . getValue ( ) ) ; } } if ( availableIdentifiers . getThisClass ( ) != null ) { parserContext1 . addInput ( "this" , availableIdentifiers . getThisClass ( ) ) ; } if ( availableIdentifiers . getOperators ( ) != null ) { for ( Entry < String , EvaluatorWrapper > opEntry : availableIdentifiers . getOperators ( ) . entrySet ( ) ) { parserContext1 . addInput ( opEntry . getKey ( ) , opEntry . getValue ( ) . getClass ( ) ) ; } } parserContext1 . setStrictTypeEnforcement ( false ) ; parserContext1 . setStrongTyping ( false ) ; parserContext1 . setInterceptors ( dialect . getInterceptors ( ) ) ; Class < ? > returnType ; try { returnType = MVEL . analyze ( expr , parserContext1 ) ; } catch ( Exception e ) { BaseDescr base = ( context instanceof RuleBuildContext ) ? ( ( RuleBuildContext ) context ) . getRuleDescr ( ) : context . getParentDescr ( ) ; if ( e instanceof CompileException && e . getCause ( ) != null && e . getMessage ( ) . startsWith ( "[Error: null]" ) ) { // rewrite error message in cause original message is null e = new CompileException ( e . getCause ( ) . toString ( ) , ( ( CompileException ) e ) . getExpr ( ) , ( ( CompileException ) e ) . getCursor ( ) , e . getCause ( ) ) ; } DialectUtil . copyErrorLocation ( e , context . getParentDescr ( ) ) ; context . addError ( new DescrBuildError ( base , context . getParentDescr ( ) , null , "Unable to Analyse Expression " + expr + ":\n" + e . getMessage ( ) ) ) ; return null ; } Set < String > requiredInputs = new HashSet < String > ( ) ; requiredInputs . addAll ( parserContext1 . getInputs ( ) . keySet ( ) ) ; HashMap < String , Class < ? > > variables = ( HashMap < String , Class < ? > > ) ( ( Map ) parserContext1 . getVariables ( ) ) ; if ( localTypes != null ) { for ( String str : localTypes . keySet ( ) ) { // we have to do this due to mvel regressions on detecting true local vars variables . remove ( str ) ; } } // MVEL includes direct fields of context object in non - strict mode . so we need to strip those if ( availableIdentifiers . getThisClass ( ) != null ) { requiredInputs . removeIf ( s -> PropertyTools . getFieldOrAccessor ( availableIdentifiers . getThisClass ( ) , s ) != null ) ; } // now , set the required input types and compile again final ParserContext parserContext2 = new ParserContext ( conf ) ; parserContext2 . setStrictTypeEnforcement ( true ) ; parserContext2 . setStrongTyping ( true ) ; parserContext2 . setInterceptors ( dialect . getInterceptors ( ) ) ; for ( String input : requiredInputs ) { if ( "this" . equals ( input ) ) { continue ; } if ( WM_ARGUMENT . equals ( input ) ) { parserContext2 . addInput ( input , InternalWorkingMemory . class ) ; continue ; } Class < ? > cls = availableIdentifiers . resolveType ( input ) ; if ( cls == null ) { if ( input . equals ( contextIdentifier ) || input . equals ( "kcontext" ) ) { cls = kcontextClass ; } else if ( input . equals ( "rule" ) ) { cls = Rule . class ; } else if ( localTypes != null ) { cls = localTypes . get ( input ) ; } } if ( cls != null ) { parserContext2 . addInput ( input , cls ) ; } } if ( availableIdentifiers . getThisClass ( ) != null ) { parserContext2 . addInput ( "this" , availableIdentifiers . getThisClass ( ) ) ; } boolean typesafe = context . isTypesafe ( ) ; try { returnType = MVEL . analyze ( expr , parserContext2 ) ; typesafe = true ; } catch ( Exception e ) { // is this an error , or can we fall back to non - typesafe mode ? if ( typesafe ) { BaseDescr base = ( context instanceof RuleBuildContext ) ? ( ( RuleBuildContext ) context ) . getRuleDescr ( ) : context . getParentDescr ( ) ; DialectUtil . copyErrorLocation ( e , context . getParentDescr ( ) ) ; context . addError ( new DescrBuildError ( base , context . getParentDescr ( ) , null , "Unable to Analyse Expression " + expr + ":\n" + e . getMessage ( ) ) ) ; return null ; } } if ( typesafe ) { requiredInputs = new HashSet < String > ( ) ; requiredInputs . addAll ( parserContext2 . getInputs ( ) . keySet ( ) ) ; requiredInputs . addAll ( variables . keySet ( ) ) ; variables = ( HashMap < String , Class < ? > > ) ( ( Map ) parserContext2 . getVariables ( ) ) ; if ( localTypes != null ) { for ( String str : localTypes . keySet ( ) ) { // we have to do this due to mvel regressions on detecting true local vars variables . remove ( str ) ; } } } MVELAnalysisResult result = analyze ( requiredInputs , availableIdentifiers ) ; result . setReturnType ( returnType ) ; result . setMvelVariables ( variables ) ; result . setTypesafe ( typesafe ) ; return result ;
public class Channel { /** * Initialize the Channel . Starts the channel . event hubs will connect . * @ return this channel . * @ throws InvalidArgumentException * @ throws TransactionException */ public Channel initialize ( ) throws InvalidArgumentException , TransactionException { } }
logger . debug ( format ( "Channel %s initialize shutdown %b" , name , shutdown ) ) ; if ( isInitialized ( ) ) { return this ; } if ( shutdown ) { throw new InvalidArgumentException ( format ( "Channel %s has been shutdown." , name ) ) ; } if ( isNullOrEmpty ( name ) ) { throw new InvalidArgumentException ( "Can not initialize channel without a valid name." ) ; } if ( client == null ) { throw new InvalidArgumentException ( "Can not initialize channel without a client object." ) ; } userContextCheck ( client . getUserContext ( ) ) ; if ( null == sdOrdererAddition ) { setSDOrdererAddition ( new SDOrdererDefaultAddition ( getServiceDiscoveryProperties ( ) ) ) ; } if ( null == sdPeerAddition ) { setSDPeerAddition ( new SDOPeerDefaultAddition ( getServiceDiscoveryProperties ( ) ) ) ; } try { loadCACertificates ( false ) ; // put all MSP certs into cryptoSuite if this fails here we ' ll try again later . } catch ( Exception e ) { logger . warn ( format ( "Channel %s could not load peer CA certificates from any peers." , name ) ) ; } Collection < Peer > serviceDiscoveryPeers = getServiceDiscoveryPeers ( ) ; if ( ! serviceDiscoveryPeers . isEmpty ( ) ) { logger . trace ( "Starting service discovery." ) ; this . serviceDiscovery = new ServiceDiscovery ( this , serviceDiscoveryPeers , getTransactionContext ( ) ) ; serviceDiscovery . fullNetworkDiscovery ( true ) ; serviceDiscovery . run ( ) ; logger . trace ( "Completed. service discovery." ) ; } try { logger . debug ( format ( "Eventque started %s" , "" + eventQueueThread ) ) ; for ( Peer peer : getEventingPeers ( ) ) { peer . initiateEventing ( getTransactionContext ( ) , getPeersOptions ( peer ) ) ; } transactionListenerProcessorHandle = registerTransactionListenerProcessor ( ) ; // Manage transactions . logger . debug ( format ( "Channel %s registerTransactionListenerProcessor completed" , name ) ) ; if ( serviceDiscovery != null ) { chaincodeEventUpgradeListenerHandle = registerChaincodeEventListener ( Pattern . compile ( "^lscc$" ) , Pattern . compile ( "^upgrade$" ) , ( handle , blockEvent , chaincodeEvent ) -> { logger . debug ( format ( "Channel %s got upgrade chaincode event" , name ) ) ; if ( ! isShutdown ( ) && isChaincodeUpgradeEvent ( blockEvent . getBlockNumber ( ) ) ) { getExecutorService ( ) . execute ( ( ) -> serviceDiscovery . fullNetworkDiscovery ( true ) ) ; } } ) ; } startEventQue ( ) ; // Run the event for event messages from event hubs . logger . info ( format ( "Channel %s eventThread started shutdown: %b thread: %s " , toString ( ) , shutdown , eventQueueThread == null ? "null" : eventQueueThread . getName ( ) ) ) ; this . initialized = true ; logger . debug ( format ( "Channel %s initialized" , name ) ) ; return this ; } catch ( Exception e ) { TransactionException exp = new TransactionException ( e ) ; logger . error ( exp . getMessage ( ) , exp ) ; throw exp ; }
public class NumberFilterMarshaller { /** * Marshall the given parameter object . */ public void marshall ( NumberFilter numberFilter , ProtocolMarshaller protocolMarshaller ) { } }
if ( numberFilter == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( numberFilter . getGte ( ) , GTE_BINDING ) ; protocolMarshaller . marshall ( numberFilter . getLte ( ) , LTE_BINDING ) ; protocolMarshaller . marshall ( numberFilter . getEq ( ) , EQ_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class TabbedPaneTargetDragAdapter { /** * { @ inheritDoc } */ @ Override public void dragOver ( final DragEvent dragEvent ) { } }
// System . out . println ( " drag OVER " ) ; if ( dragEvent . getGestureSource ( ) != controller ( ) . view ( ) . getBox ( ) && dragEvent . getDragboard ( ) . hasContent ( CustomDataFormat . DOCKABLE ) ) { dragEvent . acceptTransferModes ( TransferMode . MOVE ) ; controller ( ) . view ( ) . drawMarker ( ( ToggleButton ) dragEvent . getGestureSource ( ) , dragEvent . getX ( ) , dragEvent . getY ( ) ) ; dragEvent . consume ( ) ; }
public class CreateFunctionRequest { /** * A list of < a href = " https : / / docs . aws . amazon . com / lambda / latest / dg / configuration - layers . html " > function layers < / a > to * add to the function ' s execution environment . Specify each layer by its ARN , including the version . * @ return A list of < a href = " https : / / docs . aws . amazon . com / lambda / latest / dg / configuration - layers . html " > function * layers < / a > to add to the function ' s execution environment . Specify each layer by its ARN , including the * version . */ public java . util . List < String > getLayers ( ) { } }
if ( layers == null ) { layers = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return layers ;
public class ParseUtils { /** * Parses the page with the Sweble parser using a SimpleWikiConfiguration * and the provided visitor . * @ return the parsed page . The actual return type depends on the provided * visitor . You have to cast the return type according to the return * type of the go ( ) method of your visitor . * @ throws EngineException if the wiki page could not be compiled by the parser */ private static Object parsePage ( AstVisitor v , String text , String title , long revision ) throws LinkTargetException , EngineException , FileNotFoundException , JAXBException { } }
// Use the provided visitor to parse the page return v . go ( getCompiledPage ( text , title , revision ) . getPage ( ) ) ;
public class ClassReader { /** * Returns the internal of name of the super class ( see * { @ link Type # getInternalName ( ) getInternalName } ) . For interfaces , the * super class is { @ link Object } . * @ return the internal name of super class , or < tt > null < / tt > for * { @ link Object } class . * @ see ClassVisitor # visit ( int , int , String , String , String , String [ ] ) */ public String getSuperName ( ) { } }
int n = items [ readUnsignedShort ( header + 4 ) ] ; return n == 0 ? null : readUTF8 ( n , new char [ maxStringLength ] ) ;
public class GitWagon { /** * / * ( non - Javadoc ) * @ see org . apache . maven . wagon . AbstractWagon # openConnectionInternal ( ) */ @ Override protected void openConnectionInternal ( ) throws ConnectionException , AuthenticationException { } }
if ( checkoutDirectory == null ) { checkoutDirectory = createCheckoutDirectory ( ) ; } if ( checkoutDirectory . exists ( ) && safeCheckout ) { removeCheckoutDirectory ( ) ; } checkoutDirectory . mkdirs ( ) ;
public class SubjectUtils { /** * Returns an iterable with all empty strings replaced by a non - empty human understandable * indicator for an empty string . * < p > Returns the given iterable if it contains no empty strings . */ static < T > Iterable < T > annotateEmptyStrings ( Iterable < T > items ) { } }
if ( Iterables . contains ( items , "" ) ) { List < T > annotatedItems = Lists . newArrayList ( ) ; for ( T item : items ) { if ( Objects . equal ( item , "" ) ) { // This is a safe cast because know that at least one instance of T ( this item ) is a // String . @ SuppressWarnings ( "unchecked" ) T newItem = ( T ) HUMAN_UNDERSTANDABLE_EMPTY_STRING ; annotatedItems . add ( newItem ) ; } else { annotatedItems . add ( item ) ; } } return annotatedItems ; } else { return items ; }
public class PendingReplicationBlocks { /** * One replication request for this block has finished . * Decrement the number of pending replication requests * for this block . */ void remove ( Block block ) { } }
synchronized ( pendingReplications ) { PendingBlockInfo found = pendingReplications . get ( block ) ; if ( found != null ) { if ( FSNamesystem . LOG . isDebugEnabled ( ) ) { FSNamesystem . LOG . debug ( "Removing pending replication for block" + block ) ; } found . decrementReplicas ( ) ; if ( found . getNumReplicas ( ) <= 0 ) { pendingReplications . remove ( block ) ; } } }
public class MethodBuilder { /** * Add proxy method that adds the { @ link remoter . RemoterProxy } methods */ private void addRemoterProxyMethods ( TypeSpec . Builder classBuilder ) { } }
MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "registerProxyListener" ) . addModifiers ( Modifier . PUBLIC ) . returns ( TypeName . VOID ) . addParameter ( ClassName . get ( RemoterProxyListener . class ) , "listener" ) . addStatement ( "unRegisterProxyListener(null)" ) . addStatement ( "proxyListener = new DeathRecipient(listener)" ) . addStatement ( "linkToDeath(proxyListener)" ) . addAnnotation ( Override . class ) ; classBuilder . addMethod ( methodBuilder . build ( ) ) ; methodBuilder = MethodSpec . methodBuilder ( "unRegisterProxyListener" ) . addModifiers ( Modifier . PUBLIC ) . returns ( TypeName . VOID ) . addParameter ( ClassName . get ( RemoterProxyListener . class ) , "listener" ) . beginControlFlow ( "if(proxyListener != null)" ) . addStatement ( "unlinkToDeath(proxyListener)" ) . addStatement ( "proxyListener.proxyListener = null" ) . endControlFlow ( ) . addStatement ( "proxyListener = null" ) . addAnnotation ( Override . class ) ; classBuilder . addMethod ( methodBuilder . build ( ) ) ;
public class Benchmark { /** * Returns a string containing the report as series of CSV lines . * @ return a string with multiple lines */ public final String csv ( ) { } }
StringBuilder sb = new StringBuilder ( ) ; String header = "#RunID, ClientID, MsgCount, MsgBytes, MsgsPerSec, BytesPerSec, DurationSecs" ; sb . append ( String . format ( "%s stats: %s\n" , name , this ) ) ; sb . append ( header ) ; sb . append ( "\n" ) ; sb . append ( csvLines ( subs , "S" ) ) ; sb . append ( csvLines ( pubs , "P" ) ) ; return sb . toString ( ) ;
public class GPX { /** * XML stream object serialization */ private static String name ( final GPX gpx ) { } }
return gpx . getMetadata ( ) . flatMap ( Metadata :: getName ) . orElse ( null ) ;
public class HtmlDocletWriter { /** * Returns a link to the stylesheet file . * @ return an HtmlTree for the lINK tag which provides the stylesheet location */ public HtmlTree getStyleSheetProperties ( ) { } }
String stylesheetfile = configuration . stylesheetfile ; DocPath stylesheet ; if ( stylesheetfile . isEmpty ( ) ) { stylesheet = DocPaths . STYLESHEET ; } else { DocFile file = DocFile . createFileForInput ( configuration , stylesheetfile ) ; stylesheet = DocPath . create ( file . getName ( ) ) ; } HtmlTree link = HtmlTree . LINK ( "stylesheet" , "text/css" , pathToRoot . resolve ( stylesheet ) . getPath ( ) , "Style" ) ; return link ;
public class IOUtils { /** * Skip the requested number of characters or fail if there are not enough left . * This allows for the possibility that { @ link Reader # skip ( long ) } may * not skip as many characters as requested ( most likely because of reaching EOF ) . * @ param input stream to skip * @ param toSkip the number of characters to skip * @ throws IOException if there is a problem reading the file * @ throws IllegalArgumentException if toSkip is negative * @ throws EOFException if the number of characters skipped was incorrect * @ see Reader # skip ( long ) * @ since 2.0 */ public static void skipFully ( Reader input , long toSkip ) throws IOException { } }
long skipped = skip ( input , toSkip ) ; if ( skipped != toSkip ) { throw new EOFException ( "Chars to skip: " + toSkip + " actual: " + skipped ) ; }
public class CreateChannelRequest { /** * A collection of key - value pairs . * @ param tags * A collection of key - value pairs . * @ return Returns a reference to this object so that method calls can be chained together . */ public CreateChannelRequest withTags ( java . util . Map < String , String > tags ) { } }
setTags ( tags ) ; return this ;
public class ClassRef { /** * Gets the common base of two classes . Common base is the most special * class both argument are assignable to . The common base for * different primitive types is null ; the common base for a primitive * type and a reference type is null . * @ param a first class , may be null * @ param b second class * @ return the common base ; b , if a = = null ; */ public static Class < ? > commonBase ( Class < ? > a , Class < ? > b ) { } }
Class < ? > result ; Class < ? > ifc ; if ( b == null ) { throw new IllegalArgumentException ( ) ; } else if ( a == null ) { return b ; } else { result = commonSuperClass ( a , b ) ; if ( Object . class . equals ( result ) ) { ifc = commonInterfaces ( a , b ) ; if ( ifc != null ) { result = ifc ; } } return result ; }
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcTransportElement ( ) { } }
if ( ifcTransportElementEClass == null ) { ifcTransportElementEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 730 ) ; } return ifcTransportElementEClass ;
public class Threads { /** * By default , the spawn ( ) methods use their own * { @ link Executors # newCachedThreadPool ( ) } . This method allows you to use a * different thread pool , if the cached thread pool provides the wrong * semantics or if you want to use a single thread pool for the whole app . * Note that calling this method will have < em > no effect < / em > on any threads * started on the existing thread pool ; they will run to completion in a * totally normal manner . */ public static void setThreadPool ( ExecutorService newThreadPool ) { } }
if ( RUNTIME_ASSERTIONS ) { if ( newThreadPool == null ) { throw Exceptions . IllegalArgument ( "newThreadPool may not be null" ) ; } } threadPool = newThreadPool ;
public class FixedRedirectCookieAuthenticator { /** * Restores credentials from the cookie named { @ link # getCookieName ( ) } if available . The usual * processing is the followed . */ @ Override protected boolean authenticate ( final Request request , final Response response ) { } }
// Restore credentials from the cookie final Cookie credentialsCookie = request . getCookies ( ) . getFirst ( this . getCookieName ( ) ) ; if ( credentialsCookie != null ) { ChallengeResponse credentials = this . parseCredentials ( credentialsCookie . getValue ( ) ) ; if ( credentials == null ) { response . getCookieSettings ( ) . removeAll ( this . getCookieName ( ) ) ; } else { request . setChallengeResponse ( credentials ) ; } } this . log . debug ( "Calling super.authenticate" ) ; return super . authenticate ( request , response ) ;
public class HTMLEntityEscapeSyslogMessageModifier { /** * escapeHtml ( String ) is based partly on the article posted here : http : / / www . owasp . org / index . php / How _ to _ perform _ HTML _ entity _ encoding _ in _ Java * with the addition of common characters and modifications for Java 1.4 support . * @ param message * @ return Returns a message where any HTML entity characters are escaped . */ public static String escapeHtml ( String message ) { } }
StringBuffer b = new StringBuffer ( message . length ( ) ) ; for ( int i = 0 ; i < message . length ( ) ; i ++ ) { char ch = message . charAt ( i ) ; if ( ch == '<' ) { b . append ( "&lt;" ) ; } else if ( ch == '>' ) { b . append ( "&gt;" ) ; } else if ( ch == '"' ) { b . append ( "&quot;" ) ; } else if ( ch == '\'' ) { b . append ( "&#39;" ) ; } else if ( ch == '&' ) { b . append ( "&amp;" ) ; } else if ( ch >= ' ' && ch <= '~' ) { b . append ( ch ) ; } else if ( Character . isWhitespace ( ch ) ) { b . append ( "&#" ) . append ( ( int ) ch ) . append ( ";" ) ; } else if ( Character . isISOControl ( ch ) ) { // Ignore character } else if ( Character . isDefined ( ch ) ) { b . append ( "&#" ) . append ( ( int ) ch ) . append ( ";" ) ; } } return b . toString ( ) ;
public class SecurityInflowContextProviderImpl { /** * ( non - Javadoc ) * @ see com . ibm . wsspi . threadcontext . ThreadContextProvider # captureThreadContext ( java . util . Map , java . util . Map ) */ @ Override public ThreadContext captureThreadContext ( Map < String , String > execProps , Map < String , ? > threadContextConfig ) { } }
throw new UnsupportedOperationException ( "captureThreadContext" ) ;
public class SystemInputDefBuilder { /** * Adds a system annotation . */ public SystemInputDefBuilder has ( String name , Object value ) { } }
systemInputDef_ . setAnnotation ( name , Objects . toString ( value , null ) ) ; return this ;
public class Sprite { /** * Check if this sprite location contains the given x , y position * @ param xp The x position of the sprite * @ param yp The y position of the sprite * @ return True if the sprite contains the point */ public boolean contains ( int xp , int yp ) { } }
if ( xp < x ) { return false ; } if ( yp < y ) { return false ; } if ( xp >= x + width ) { return false ; } if ( yp >= y + height ) { return false ; } return true ;
public class hqlLexer { /** * $ ANTLR start " DIV " */ public final void mDIV ( ) throws RecognitionException { } }
try { int _type = DIV ; int _channel = DEFAULT_TOKEN_CHANNEL ; // hql . g : 758:4 : ( ' / ' ) // hql . g : 758:6 : ' / ' { match ( '/' ) ; if ( state . failed ) return ; } state . type = _type ; state . channel = _channel ; } finally { // do for sure before leaving }
public class UpdateClusterUtils { /** * Updates the existing cluster such that we remove partitions mentioned * from the stealer node and add them to the donor node * @ param currentCluster Existing cluster metadata . Both stealer and donor * node should already exist in this metadata * @ param stealerNodeId Id of node for which we are stealing the partitions * @ param donatedPartitions List of partitions we are moving * @ return Updated cluster metadata */ public static Cluster createUpdatedCluster ( Cluster currentCluster , int stealerNodeId , List < Integer > donatedPartitions ) { } }
Cluster updatedCluster = Cluster . cloneCluster ( currentCluster ) ; // Go over every donated partition one by one for ( int donatedPartition : donatedPartitions ) { // Gets the donor Node that owns this donated partition Node donorNode = updatedCluster . getNodeForPartitionId ( donatedPartition ) ; Node stealerNode = updatedCluster . getNodeById ( stealerNodeId ) ; if ( donorNode == stealerNode ) { // Moving to the same location = No - op continue ; } // Update the list of partitions for this node donorNode = removePartitionFromNode ( donorNode , donatedPartition ) ; stealerNode = addPartitionToNode ( stealerNode , donatedPartition ) ; // Sort the nodes updatedCluster = updateCluster ( updatedCluster , Lists . newArrayList ( donorNode , stealerNode ) ) ; } return updatedCluster ;
public class RunbookDraftsInner { /** * Undo draft edit to last known published state identified by runbook name . * @ param resourceGroupName Name of an Azure Resource group . * @ param automationAccountName The name of the automation account . * @ param runbookName The runbook name . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws ErrorResponseException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the RunbookDraftUndoEditResultInner object if successful . */ public RunbookDraftUndoEditResultInner undoEdit ( String resourceGroupName , String automationAccountName , String runbookName ) { } }
return undoEditWithServiceResponseAsync ( resourceGroupName , automationAccountName , runbookName ) . toBlocking ( ) . single ( ) . body ( ) ;
public class InternalXtextParser { /** * InternalXtext . g : 729:1 : ruleParenthesizedCondition : ( ( rule _ _ ParenthesizedCondition _ _ Group _ _ 0 ) ) ; */ public final void ruleParenthesizedCondition ( ) throws RecognitionException { } }
int stackSize = keepStackSize ( ) ; try { // InternalXtext . g : 733:2 : ( ( ( rule _ _ ParenthesizedCondition _ _ Group _ _ 0 ) ) ) // InternalXtext . g : 734:2 : ( ( rule _ _ ParenthesizedCondition _ _ Group _ _ 0 ) ) { // InternalXtext . g : 734:2 : ( ( rule _ _ ParenthesizedCondition _ _ Group _ _ 0 ) ) // InternalXtext . g : 735:3 : ( rule _ _ ParenthesizedCondition _ _ Group _ _ 0 ) { before ( grammarAccess . getParenthesizedConditionAccess ( ) . getGroup ( ) ) ; // InternalXtext . g : 736:3 : ( rule _ _ ParenthesizedCondition _ _ Group _ _ 0 ) // InternalXtext . g : 736:4 : rule _ _ ParenthesizedCondition _ _ Group _ _ 0 { pushFollow ( FollowSets000 . FOLLOW_2 ) ; rule__ParenthesizedCondition__Group__0 ( ) ; state . _fsp -- ; } after ( grammarAccess . getParenthesizedConditionAccess ( ) . getGroup ( ) ) ; } } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { restoreStackSize ( stackSize ) ; } return ;
public class AppRate { /** * Check and show if showing the view is needed */ @ SuppressLint ( "NewApi" ) public void checkAndShow ( ) { } }
if ( ! Utils . isGooglePlayInstalled ( activity ) ) { if ( debug ) LogD ( "Play Store is not installed. Won't do anything" ) ; return ; } if ( debug ) LogD ( "Last crash: " + ( ( System . currentTimeMillis ( ) - settings . getLong ( KEY_LAST_CRASH , 0L ) ) / 1000 ) + " seconds ago" ) ; if ( ( System . currentTimeMillis ( ) - settings . getLong ( KEY_LAST_CRASH , 0L ) ) < pauseAfterCrash ) { if ( debug ) LogD ( "A recent crash avoids anything to be done." ) ; return ; } if ( settings . getLong ( KEY_MONITOR_TOTAL , 0L ) < minimumMonitoringTime ) { if ( debug ) LogD ( "Monitor time not reached. Nothing will be done" ) ; return ; } if ( ! Utils . isOnline ( activity ) ) { if ( debug ) LogD ( "Device is not online. AppRate try to show up next time." ) ; return ; } if ( ! incrementViews ( ) ) { return ; } if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . GINGERBREAD ) { Date installDate = Utils . installTimeFromPackageManager ( activity . getPackageManager ( ) , this . packageName ) ; if ( installDate == null ) { installDate = Utils . installTimeFromPackageManager ( activity . getPackageManager ( ) , activity . getPackageName ( ) ) ; } Date now = new Date ( ) ; if ( now . getTime ( ) - installDate . getTime ( ) < installedSince ) { if ( debug ) LogD ( "Date not reached. Time elapsed since installation (in sec.): " + ( now . getTime ( ) - installDate . getTime ( ) ) ) ; return ; } } if ( ! settings . getBoolean ( KEY_ELAPSED_TIME , false ) ) { // It ' s the first time the time is elapsed editor . putBoolean ( KEY_ELAPSED_TIME , true ) ; if ( debug ) LogD ( "First time after the time is elapsed" ) ; if ( settings . getInt ( KEY_COUNT , 5 ) > initialLaunchCount ) { if ( debug ) LogD ( "Initial count passed. Resetting to initialLaunchCount" ) ; // Initial count passed . Resetting to initialLaunchCount editor . putInt ( KEY_COUNT , initialLaunchCount ) ; } commitEditor ( ) ; } boolean clicked = settings . getBoolean ( KEY_CLICKED , false ) ; if ( clicked ) return ; int count = settings . getInt ( KEY_COUNT , 0 ) ; if ( count == initialLaunchCount ) { if ( debug ) LogD ( "initialLaunchCount reached" ) ; showAppRate ( ) ; } else if ( policy == RetryPolicy . INCREMENTAL && count % initialLaunchCount == 0 ) { if ( debug ) LogD ( "initialLaunchCount incremental reached" ) ; showAppRate ( ) ; } else if ( policy == RetryPolicy . EXPONENTIAL && count % initialLaunchCount == 0 && Utils . isPowerOfTwo ( count / initialLaunchCount ) ) { if ( debug ) LogD ( "initialLaunchCount exponential reached" ) ; showAppRate ( ) ; } else { if ( debug ) LogD ( "Nothing to show. initialLaunchCount: " + initialLaunchCount + " - Current count: " + count ) ; }
public class StAXUtils { /** * Extract or create an instance of { @ link XMLEventReader } from the provided { @ link Source } . * @ param source the source * @ return the { @ link XMLEventReader } * @ throws XMLStreamException when failing to extract xml event reader */ public static XMLEventReader getXMLEventReader ( Source source ) throws XMLStreamException { } }
XMLEventReader xmlEventReader ; if ( source instanceof StAXSource ) { // StAXSource is not supported by standard XMLInputFactory StAXSource staxSource = ( StAXSource ) source ; if ( staxSource . getXMLEventReader ( ) != null ) { xmlEventReader = staxSource . getXMLEventReader ( ) ; } else { xmlEventReader = new XMLStreamEventReader ( staxSource . getXMLStreamReader ( ) ) ; } } else { xmlEventReader = XML_INPUT_FACTORY . createXMLEventReader ( source ) ; } return xmlEventReader ;
public class DataSynchronizer { /** * Inserts a single document locally and being to synchronize it based on its _ id . Inserting * a document with the same _ id twice will result in a duplicate key exception . * @ param namespace the namespace to put the document in . * @ param document the document to insert . */ void insertOne ( final MongoNamespace namespace , final BsonDocument document ) { } }
this . waitUntilInitialized ( ) ; try { ongoingOperationsGroup . enter ( ) ; // Remove forbidden fields from the document before inserting it into the local collection . final BsonDocument docForStorage = sanitizeDocument ( document ) ; final NamespaceSynchronizationConfig nsConfig = this . syncConfig . getNamespaceConfig ( namespace ) ; final Lock lock = nsConfig . getLock ( ) . writeLock ( ) ; lock . lock ( ) ; final ChangeEvent < BsonDocument > event ; final BsonValue documentId ; try { getLocalCollection ( namespace ) . insertOne ( docForStorage ) ; documentId = BsonUtils . getDocumentId ( docForStorage ) ; event = ChangeEvents . changeEventForLocalInsert ( namespace , docForStorage , true ) ; final CoreDocumentSynchronizationConfig config = syncConfig . addAndGetSynchronizedDocument ( namespace , documentId ) ; config . setSomePendingWritesAndSave ( logicalT , event ) ; } finally { lock . unlock ( ) ; } checkAndInsertNamespaceListener ( namespace ) ; eventDispatcher . emitEvent ( nsConfig , event ) ; } finally { ongoingOperationsGroup . exit ( ) ; }
public class ComplexDouble2DFFT { /** * Return data in wraparound order . * rowspan is used to traverse data ; the new array is in * packed ( rowspan = 2 * ncols ) format . * @ see < a href = " package - summary . html # wraparound " > wraparound format < / A > */ public double [ ] toWraparoundOrder ( double data [ ] , int rowspan ) { } }
if ( rowspan == 2 * ncols ) return data ; double newdata [ ] = new double [ 2 * nrows * ncols ] ; for ( int i = 0 ; i < nrows ; i ++ ) for ( int j = 0 ; j < ncols ; j ++ ) { newdata [ i * 2 * ncols + 2 * j ] = data [ i * rowspan + 2 * j ] ; newdata [ i * 2 * ncols + 2 * j + 1 ] = data [ i * rowspan + 2 * j + 1 ] ; } return newdata ;
public class NotificationManager { /** * Handle a server notification registration . * This method is only invoked by our java client . */ public void handleServerNotificationRegistration ( RESTRequest request , int clientID , ServerNotificationRegistration serverNotificationRegistration , JSONConverter converter ) { } }
// Get the client area ClientNotificationArea clientArea = getInboxIfAvailable ( clientID , converter ) ; if ( serverNotificationRegistration . operation == Operation . RemoveAll ) { // Unregister with our client area ( will also unregister with the MBeanServer ) clientArea . removeServerNotificationListener ( request , serverNotificationRegistration , true , converter , false ) ; } else { if ( serverNotificationRegistration . operation == Operation . Add ) { // Register with our client area ( will also register with the MBeanServer ) clientArea . addServerNotificationListener ( request , serverNotificationRegistration , converter ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Added server-side notification" ) ; } } else { // Unregister with our client area ( will also unregister with the MBeanServer ) clientArea . removeServerNotificationListener ( request , serverNotificationRegistration , false , converter , false ) ; } }
public class RelationalOperationsMatrix { /** * Returns true if the relation holds */ static boolean polygonRelateMultiPoint_ ( Polygon polygon_a , MultiPoint multipoint_b , double tolerance , String scl , ProgressTracker progress_tracker ) { } }
RelationalOperationsMatrix relOps = new RelationalOperationsMatrix ( ) ; relOps . resetMatrix_ ( ) ; relOps . setPredicates_ ( scl ) ; relOps . setAreaPointPredicates_ ( ) ; Envelope2D env_a = new Envelope2D ( ) , env_b = new Envelope2D ( ) ; polygon_a . queryEnvelope2D ( env_a ) ; multipoint_b . queryEnvelope2D ( env_b ) ; boolean bRelationKnown = false ; boolean b_disjoint = RelationalOperations . envelopeDisjointEnvelope_ ( env_a , env_b , tolerance , progress_tracker ) ; if ( b_disjoint ) { relOps . areaPointDisjointPredicates_ ( polygon_a ) ; bRelationKnown = true ; } if ( ! bRelationKnown ) { // Quick rasterize test to see whether the the geometries are // disjoint , or if one is contained in the other . int relation = RelationalOperations . tryRasterizedContainsOrDisjoint_ ( polygon_a , multipoint_b , tolerance , false ) ; if ( relation == RelationalOperations . Relation . disjoint ) { relOps . areaPointDisjointPredicates_ ( polygon_a ) ; bRelationKnown = true ; } else if ( relation == RelationalOperations . Relation . contains ) { relOps . areaPointContainsPredicates_ ( polygon_a ) ; bRelationKnown = true ; } } if ( ! bRelationKnown ) { EditShape edit_shape = new EditShape ( ) ; int geom_a = edit_shape . addGeometry ( polygon_a ) ; int geom_b = edit_shape . addGeometry ( multipoint_b ) ; relOps . setEditShapeCrackAndCluster_ ( edit_shape , tolerance , progress_tracker ) ; relOps . computeMatrixTopoGraphClusters_ ( geom_a , geom_b ) ; relOps . m_topo_graph . removeShape ( ) ; } boolean bRelation = relationCompare_ ( relOps . m_matrix , relOps . m_scl ) ; return bRelation ;
public class ServletHttpRequest { void setRequestedSessionId ( String pathParams ) { } }
_requestedSessionId = null ; // try cookies first if ( _servletHandler . isUsingCookies ( ) ) { Cookie [ ] cookies = _httpRequest . getCookies ( ) ; if ( cookies != null && cookies . length > 0 ) { for ( int i = 0 ; i < cookies . length ; i ++ ) { if ( SessionManager . __SessionCookie . equalsIgnoreCase ( cookies [ i ] . getName ( ) ) ) { if ( _requestedSessionId != null ) { // Multiple jsessionid cookies . Probably due to // multiple paths and / or domains . Pick the first // known session or the last defined cookie . SessionManager manager = _servletHandler . getSessionManager ( ) ; if ( manager != null && manager . getHttpSession ( _requestedSessionId ) != null ) break ; log . debug ( "multiple session cookies" ) ; } _requestedSessionId = cookies [ i ] . getValue ( ) ; _sessionIdState = __SESSIONID_COOKIE ; if ( log . isDebugEnabled ( ) ) log . debug ( "Got Session " + _requestedSessionId + " from cookie" ) ; } } } } // check if there is a url encoded session param . if ( pathParams != null && pathParams . startsWith ( SessionManager . __SessionURL ) ) { String id = pathParams . substring ( SessionManager . __SessionURL . length ( ) + 1 ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Got Session " + id + " from URL" ) ; if ( _requestedSessionId == null ) { _requestedSessionId = id ; _sessionIdState = __SESSIONID_URL ; } else if ( ! id . equals ( _requestedSessionId ) ) log . debug ( "Mismatched session IDs" ) ; } if ( _requestedSessionId == null ) _sessionIdState = __SESSIONID_NONE ;
public class BusGroup { /** * Generates the reply subscription message that should be sent to a * the neighbor on the Bus who sent the request . * @ return a new ReplySubscriptionMessage */ protected SubscriptionMessage generateReplySubscriptionMessage ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "generateReplySubscriptionMessage" ) ; // Get the Message Handler for doing this operation . final SubscriptionMessageHandler messageHandler = iProxyHandler . getMessageHandler ( ) ; // Reset the message . messageHandler . resetReplySubscriptionMessage ( ) ; if ( iLocalSubscriptions . size ( ) > 0 ) // Add the local subscriptions addToMessage ( messageHandler , iLocalSubscriptions ) ; if ( iRemoteSubscriptions . size ( ) > 0 ) // Add the remote Subscriptions addToMessage ( messageHandler , iRemoteSubscriptions ) ; SubscriptionMessage message = messageHandler . getSubscriptionMessage ( ) ; // Add the message back into the pool iProxyHandler . addMessageHandler ( messageHandler ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "generateReplySubscriptionMessage" , message ) ; return message ;
public class CommitsApi { /** * Get a list of repository commit statuses that meet the provided filter . * < pre > < code > GitLab Endpoint : GET / projects / : id / repository / commits / : sha / statuses < / code > < / pre > * @ param projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Project instance * @ param sha the commit SHA * @ param filter the commit statuses file , contains ref , stage , name , all * @ return a List containing the commit statuses for the specified project and sha that meet the provided filter * @ throws GitLabApiException GitLabApiException if any exception occurs during execution */ public List < CommitStatus > getCommitStatuses ( Object projectIdOrPath , String sha , CommitStatusFilter filter ) throws GitLabApiException { } }
return ( getCommitStatuses ( projectIdOrPath , sha , filter , getDefaultPerPage ( ) ) . all ( ) ) ;
public class PravegaTablesStoreHelper { /** * Method to invalidate cached value in the cache for the specified table . * @ param table table name * @ param key key to invalidate */ public void invalidateCache ( String table , String key ) { } }
cache . invalidateCache ( new TableCacheKey < > ( table , key , x -> null ) ) ;
public class RangeDistributionBuilder { /** * Adds an existing Distribution to the current one . * It will create the entries if they don ' t exist . * Can be used to add the values of children resources for example * < br > * The returned distribution will be invalidated in case the given value does not use the same bottom limits * @ param data the data to add to the current one */ public RangeDistributionBuilder add ( String data ) { } }
Map < Double , Double > map = KeyValueFormat . parse ( data , KeyValueFormat . newDoubleConverter ( ) , KeyValueFormat . newDoubleConverter ( ) ) ; if ( bottomLimits == null ) { Number [ ] limits = map . keySet ( ) . toArray ( new Number [ map . size ( ) ] ) ; init ( limits ) ; } else if ( ! areSameLimits ( bottomLimits , map . keySet ( ) ) ) { isValid = false ; } if ( isValid ) { for ( Map . Entry < Double , Double > entry : map . entrySet ( ) ) { addLimitCount ( entry . getKey ( ) , entry . getValue ( ) . intValue ( ) ) ; } } return this ;
public class NetworkInterface { /** * Searches for the network interface with the specified name . * @ param name * The name of the network interface . * @ return A < tt > NetworkInterface < / tt > with the specified name , * or < tt > null < / tt > if there is no network interface * with the specified name . * @ throws SocketException * If an I / O error occurs . * @ throws NullPointerException * If the specified name is < tt > null < / tt > . */ public static NetworkInterface getByName ( String name ) throws SocketException { } }
if ( name == null ) throw new NullPointerException ( ) ; return getByName0 ( name ) ;
public class CmsFlexBucketConfiguration { /** * Adds a flex bucket definition , consisting of a flex bucket name and a list of paths . < p > * @ param key the flex bucket name * @ param values the flex bucket paths */ public void add ( String key , List < String > values ) { } }
if ( m_frozen ) { throw new IllegalStateException ( "Can not modify frozen CmsFlexBucketConfiguration" ) ; } m_bucketNames . add ( key ) ; m_bucketPathLists . add ( values ) ;
public class FileUtil { /** * 获取File的BufferedReader . * @ see { @ link Files # newBufferedReader } */ public static BufferedReader asBufferedReader ( String fileName ) throws IOException { } }
Validate . notBlank ( fileName , "filename is blank" ) ; return asBufferedReader ( getPath ( fileName ) ) ;
public class FunctionTypeBuilder { /** * Infer constructor parameters from the superclass constructor . */ FunctionTypeBuilder inferConstructorParameters ( FunctionType superCtor ) { } }
inferImplicitConstructorParameters ( superCtor . getParametersNode ( ) . cloneTree ( ) ) ; // Look for template parameters in superCtor that are missing from its instance type . setConstructorTemplateTypeNames ( superCtor . getConstructorOnlyTemplateParameters ( ) , null ) ; return this ;
public class SessionDataManager { /** * Save changes log records back in the session changes log . * Case of Session . save error . * @ param cLog */ private void remainChangesBack ( PlainChangesLog cLog ) { } }
changesLog . addAll ( cLog . getAllStates ( ) ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( " ----- rollback ----- \n" + cLog . dump ( ) ) ; }
public class Prepared { /** * Verifies that all required parameters have been set * @ return a map of the parameters */ public Map < String , String > verifyAndGet ( ) { } }
for ( String paramName : required ) { if ( params . get ( paramName ) == null ) { throw new IllegalStateException ( format ( "Param %s is required but has not been supplied" , paramName ) ) ; } } return params ;
public class AstCompatGeneratingVisitor { /** * / / - > ^ ( PARAM _ SEQUENCE pSeqTokens ) */ @ Override public T visitPSeq ( PSeqContext ctx ) { } }
// on ( ctx ) ; appendAst ( ctx , tok ( PARAM_SEQUENCE ) ) ; return super . visitPSeq ( ctx ) ;
public class Pubsub { /** * Create a Pub / Sub topic . * @ param project The Google Cloud project . * @ param topic The name of the topic to create . * @ return A future that is completed when this request is completed . */ public PubsubFuture < Topic > createTopic ( final String project , final String topic ) { } }
return createTopic ( canonicalTopic ( project , topic ) ) ;
public class Messages { /** * Retrieve an message . * Retrieves the detail for a single message . Simply supply the unique identifier for the required message . * @ param id The identifier of the message to be retrieved . * @ throws MailosaurException thrown if the request is rejected by server * @ throws IOException * @ return the Message object if successful . */ public Message get ( String id ) throws IOException , MailosaurException { } }
return client . request ( "GET" , "api/messages/" + id ) . parseAs ( Message . class ) ;
public class HtmlTool { /** * Filters the list of elements to only contain parent elements . This is to avoid both parent * and child being in the list of elements . * @ param elements * @ return */ private static List < Element > filterParents ( List < Element > elements ) { } }
List < Element > filtered = new ArrayList < Element > ( ) ; for ( Element element : elements ) { // get the intersection of parents and selected elements List < Element > parentsInter = element . parents ( ) ; parentsInter . retainAll ( elements ) ; if ( parentsInter . isEmpty ( ) ) { // no intersection - element ' s parents are not in the selected list filtered . add ( element ) ; } } return filtered ;
public class ClassBuilder { /** * Constructs a new ClassBuilder . * @ param context the build context * @ param typeElement the class being documented . * @ param writer the doclet specific writer . * @ return the new ClassBuilder */ public static ClassBuilder getInstance ( Context context , TypeElement typeElement , ClassWriter writer ) { } }
return new ClassBuilder ( context , typeElement , writer ) ;
public class LocaleUtils { /** * < p > Obtains the list of languages supported for a given country . < / p > * < p > This method takes a country code and searches to find the * languages available for that country . Variant locales are removed . < / p > * @ param countryCode the 2 letter country code , null returns empty * @ return an unmodifiable List of Locale objects , not null */ public static List < Locale > languagesByCountry ( final String countryCode ) { } }
if ( countryCode == null ) { return Collections . emptyList ( ) ; } List < Locale > langs = cLanguagesByCountry . get ( countryCode ) ; if ( langs == null ) { langs = new ArrayList < > ( ) ; final List < Locale > locales = availableLocaleList ( ) ; for ( final Locale locale : locales ) { if ( countryCode . equals ( locale . getCountry ( ) ) && locale . getVariant ( ) . isEmpty ( ) ) { langs . add ( locale ) ; } } langs = Collections . unmodifiableList ( langs ) ; cLanguagesByCountry . putIfAbsent ( countryCode , langs ) ; langs = cLanguagesByCountry . get ( countryCode ) ; } return langs ;
public class ProjectClient { /** * Sets metadata common to all instances within the specified project using the data included in * the request . * < p > Sample code : * < pre > < code > * try ( ProjectClient projectClient = ProjectClient . create ( ) ) { * ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ; * Metadata metadataResource = Metadata . newBuilder ( ) . build ( ) ; * Operation response = projectClient . setCommonInstanceMetadataProject ( project . toString ( ) , metadataResource ) ; * < / code > < / pre > * @ param project Project ID for this request . * @ param metadataResource A metadata key / value entry . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final Operation setCommonInstanceMetadataProject ( String project , Metadata metadataResource ) { } }
SetCommonInstanceMetadataProjectHttpRequest request = SetCommonInstanceMetadataProjectHttpRequest . newBuilder ( ) . setProject ( project ) . setMetadataResource ( metadataResource ) . build ( ) ; return setCommonInstanceMetadataProject ( request ) ;
public class BottomSheet { /** * Creates and returns a listener , which allows to observe when the items of a bottom sheet have * been long - clicked . * @ return The listener , which has been created , as an instance of the type { qlink * OnItemLongClickListener } */ private OnItemLongClickListener createItemLongClickListener ( ) { } }
return new OnItemLongClickListener ( ) { @ Override public boolean onItemLongClick ( final AdapterView < ? > parent , final View view , final int position , final long id ) { if ( ! rootView . isDragging ( ) && ! rootView . isAnimationRunning ( ) && itemLongClickListener != null ) { int index = position ; if ( adapter . containsDividers ( ) ) { for ( int i = position ; i >= 0 ; i -- ) { if ( adapter . getItem ( i ) == null || ( adapter . getItem ( i ) instanceof Divider && i % adapter . getColumnCount ( ) > 0 ) ) { index -- ; } } } return itemLongClickListener . onItemLongClick ( parent , view , index , getId ( position ) ) ; } return false ; } } ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EEnum getIfcReflectanceMethodEnum ( ) { } }
if ( ifcReflectanceMethodEnumEEnum == null ) { ifcReflectanceMethodEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 883 ) ; } return ifcReflectanceMethodEnumEEnum ;
public class Util { /** * Replaces all the printf - style escape sequences in a string * with the appropriate characters . * @ param escapedString the string containing escapes * @ return the string with all the escape sequences replaced */ public static String unescapeString ( String escapedString ) { } }
StringBuilder sb = new StringBuilder ( ) ; for ( int i = 1 ; i < escapedString . length ( ) - 1 ; ++ i ) { char c = escapedString . charAt ( i ) ; if ( c == '\\' ) { ++ i ; sb . append ( unescapeChar ( escapedString . charAt ( i ) ) ) ; } else { sb . append ( c ) ; } } return sb . toString ( ) ;
public class ShadowEffect { /** * Apply blurring to the generate image * @ param image The image to be blurred */ private void blur ( BufferedImage image ) { } }
float [ ] matrix = GAUSSIAN_BLUR_KERNELS [ blurKernelSize - 1 ] ; Kernel gaussianBlur1 = new Kernel ( matrix . length , 1 , matrix ) ; Kernel gaussianBlur2 = new Kernel ( 1 , matrix . length , matrix ) ; RenderingHints hints = new RenderingHints ( RenderingHints . KEY_RENDERING , RenderingHints . VALUE_RENDER_SPEED ) ; ConvolveOp gaussianOp1 = new ConvolveOp ( gaussianBlur1 , ConvolveOp . EDGE_NO_OP , hints ) ; ConvolveOp gaussianOp2 = new ConvolveOp ( gaussianBlur2 , ConvolveOp . EDGE_NO_OP , hints ) ; BufferedImage scratchImage = EffectUtil . getScratchImage ( ) ; for ( int i = 0 ; i < blurPasses ; i ++ ) { gaussianOp1 . filter ( image , scratchImage ) ; gaussianOp2 . filter ( scratchImage , image ) ; }
public class Hoarde { /** * calls given function round robin . typical use : * hoarde . ordered ( actor - > actor . decode ( byte [ ] ) ) . onResult ( decodedObj - > businesslogic ( decodedObj ) ) ; * after * @ param toCall * @ return */ public IPromise ordered ( Function < T , IPromise > toCall ) { } }
final IPromise result = toCall . apply ( ( T ) actors [ index ] ) ; index ++ ; if ( index == actors . length ) index = 0 ; if ( prev == null ) { prev = new Promise ( ) ; result . then ( prev ) ; return prev ; } else { Promise p = new Promise ( ) ; prev . getNext ( ) . finallyDo ( ( res , err ) -> result . then ( ( res1 , err1 ) -> p . complete ( res1 , err1 ) ) ) ; prev = p ; return p ; }
public class DetectorFactory { /** * Get set of all BugPatterns this detector reports . An empty set means that * we don ' t know what kind of bug patterns might be reported . */ public Set < BugPattern > getReportedBugPatterns ( ) { } }
Set < BugPattern > result = new TreeSet < > ( ) ; StringTokenizer tok = new StringTokenizer ( reports , "," ) ; while ( tok . hasMoreTokens ( ) ) { String type = tok . nextToken ( ) ; BugPattern bugPattern = DetectorFactoryCollection . instance ( ) . lookupBugPattern ( type ) ; if ( bugPattern != null ) { result . add ( bugPattern ) ; } } return result ;
public class GobblinMetrics { /** * Get a { @ link Counter } with the given name prefix and suffixes . * @ param prefix the given name prefix * @ param suffixes the given name suffixes * @ return a { @ link Counter } with the given name prefix and suffixes */ public Counter getCounter ( String prefix , String ... suffixes ) { } }
return this . metricContext . counter ( MetricRegistry . name ( prefix , suffixes ) ) ;
public class UpdateCrawlerScheduleRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateCrawlerScheduleRequest updateCrawlerScheduleRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateCrawlerScheduleRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateCrawlerScheduleRequest . getCrawlerName ( ) , CRAWLERNAME_BINDING ) ; protocolMarshaller . marshall ( updateCrawlerScheduleRequest . getSchedule ( ) , SCHEDULE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class BucketCounter { /** * Creates a distribution summary object that manages a set of counters based on the bucket * function supplied . Calling record will increment the appropriate counter . * @ param id * Identifier for the metric being registered . * @ param f * Function to map values to buckets . * @ return * Distribution summary that manages sub - counters based on the bucket function . */ public static BucketCounter get ( Id id , BucketFunction f ) { } }
return get ( Spectator . globalRegistry ( ) , id , f ) ;
public class EndpointDelegate { /** * { @ inheritDoc } */ @ Override public void onError ( Session session , Throwable thr ) { } }
meta . onError ( session , thr ) ;
public class MSSQLDialect { /** * TDS converts a number of important data types to String . This isn ' t what we want , nor helpful . Here , we change them back . */ @ Override public Object overrideDriverTypeConversion ( MetaModel mm , String attributeName , Object value ) { } }
if ( value instanceof String && ! Util . blank ( value ) ) { String typeName = mm . getColumnMetadata ( ) . get ( attributeName ) . getTypeName ( ) ; if ( "date" . equalsIgnoreCase ( typeName ) ) { return java . sql . Date . valueOf ( ( String ) value ) ; } else if ( "datetime2" . equalsIgnoreCase ( typeName ) ) { return java . sql . Timestamp . valueOf ( ( String ) value ) ; } } return value ;
public class PutRetentionConfigurationRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( PutRetentionConfigurationRequest putRetentionConfigurationRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( putRetentionConfigurationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( putRetentionConfigurationRequest . getRetentionPeriodInDays ( ) , RETENTIONPERIODINDAYS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class JSONCompareResult { /** * Identify unexpected field * @ param field unexpected field * @ param actual actual result * @ return result of comparison */ public JSONCompareResult unexpected ( String field , Object actual ) { } }
_fieldUnexpected . add ( new FieldComparisonFailure ( field , null , actual ) ) ; fail ( formatUnexpected ( field , actual ) ) ; return this ;
public class HttpContext { /** * / * request - thread local cookies - > other webapp */ public void writeTo ( HttpRequest request ) { } }
if ( ! initialized . get ( ) ) { // to avoid npe init ( null ) ; } long time = System . currentTimeMillis ( ) ; long processTime = time - contextTsCurrent . get ( ) ; contextMsProcess . set ( contextMsProcess . get ( ) + processTime ) ; contextTsCurrent . set ( time ) ; final String uri = request . getRequestLine ( ) . getUri ( ) ; contextRequest . set ( uri ) ; List < Cookie > cookiez = new ArrayList < > ( ) ; StringBuilder cookiesDump = new StringBuilder ( ) ; for ( String name : forwardedCookies ) { Cookie c = requestCookies . get ( ) . get ( name ) ; if ( c != null ) { cookiez . add ( c ) ; cookiesDump . append ( c . toString ( ) ) . append ( ";" ) ; } } if ( ! cookiez . isEmpty ( ) ) { // . . . or formatCookies ( ) throws error for ( Header h : cookieSpec . formatCookies ( cookiez ) ) { request . addHeader ( h ) ; } } request . setHeader ( HEADER_X_FORWARDED_FOR , clientIp . get ( ) ) ; if ( verbose ) log . info ( " Time " + String . valueOf ( time - contextTsStart . get ( ) ) + " (+" + processTime + "p) >>> [" + contextUrl . get ( ) + "] >>> " + uri + ". thread local cookies " + cookiesDump . toString ( ) ) ;
public class CUDA_MEMSET_NODE_PARAMS { /** * Creates and returns a string representation of this object , * using the given separator for the fields * @ param f Separator * @ return A String representation of this object */ private String createString ( String f ) { } }
return "dst=" + dst + f + "pitch=" + pitch + f + "value=" + value + f + "elementSize=" + elementSize + f + "width=" + width + f + "height=" + height ;
public class DualInputSemanticProperties { /** * Adds , to the existing information , a field that is forwarded directly * from the source record ( s ) in the first input to multiple fields in * the destination record ( s ) . * @ param sourceField the position in the source record ( s ) * @ param destinationFields the position in the destination record ( s ) */ public void addForwardedField1 ( int sourceField , FieldSet destinationFields ) { } }
FieldSet fs ; if ( ( fs = this . forwardedFields1 . get ( sourceField ) ) != null ) { fs . addAll ( destinationFields ) ; } else { fs = new FieldSet ( destinationFields ) ; this . forwardedFields1 . put ( sourceField , fs ) ; }
public class SystemViewContentExporter { /** * ( non - Javadoc ) * @ see * org . exoplatform . services . jcr . dataflow . ItemDataTraversingVisitor # leaving ( org . exoplatform . services * . jcr . datamodel . PropertyData , int ) */ @ Override protected void leaving ( PropertyData property , int level ) throws RepositoryException { } }
try { contentHandler . endElement ( getSvNamespaceUri ( ) , "property" , "sv:property" ) ; } catch ( SAXException e ) { throw new RepositoryException ( e ) ; }
public class ResourceHandler { public void handle ( String pathInContext , String pathParams , HttpRequest request , HttpResponse response ) throws HttpException , IOException { } }
Resource resource = getResource ( pathInContext ) ; if ( resource == null ) return ; // Is the method allowed ? if ( ! isMethodAllowed ( request . getMethod ( ) ) ) { if ( log . isDebugEnabled ( ) ) log . debug ( "Method not allowed: " + request . getMethod ( ) ) ; if ( resource . exists ( ) ) { setAllowHeader ( response ) ; response . sendError ( HttpResponse . __405_Method_Not_Allowed ) ; } return ; } // Handle the request try { if ( log . isDebugEnabled ( ) ) log . debug ( "PATH=" + pathInContext + " RESOURCE=" + resource ) ; // check filename String method = request . getMethod ( ) ; if ( method . equals ( HttpRequest . __GET ) || method . equals ( HttpRequest . __POST ) || method . equals ( HttpRequest . __HEAD ) ) handleGet ( request , response , pathInContext , pathParams , resource ) ; else if ( method . equals ( HttpRequest . __PUT ) ) handlePut ( request , response , pathInContext , resource ) ; else if ( method . equals ( HttpRequest . __DELETE ) ) handleDelete ( request , response , pathInContext , resource ) ; else if ( method . equals ( HttpRequest . __OPTIONS ) ) handleOptions ( response , pathInContext ) ; else if ( method . equals ( HttpRequest . __MOVE ) ) handleMove ( request , response , pathInContext , resource ) ; else if ( method . equals ( HttpRequest . __TRACE ) ) handleTrace ( request , response ) ; else { if ( log . isDebugEnabled ( ) ) log . debug ( "Unknown action:" + method ) ; // anything else . . . try { if ( resource . exists ( ) ) response . sendError ( HttpResponse . __501_Not_Implemented ) ; } catch ( Exception e ) { LogSupport . ignore ( log , e ) ; } } } catch ( IllegalArgumentException e ) { LogSupport . ignore ( log , e ) ; } finally { if ( resource != null && ! ( resource instanceof CachedResource ) ) resource . release ( ) ; }
public class UpdateProvisioningPreferences { /** * One or more AWS accounts that will have access to the provisioned product . * Applicable only to a < code > CFN _ STACKSET < / code > provisioned product type . * The AWS accounts specified should be within the list of accounts in the < code > STACKSET < / code > constraint . To get * the list of accounts in the < code > STACKSET < / code > constraint , use the < code > DescribeProvisioningParameters < / code > * operation . * If no values are specified , the default value is all accounts from the < code > STACKSET < / code > constraint . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setStackSetAccounts ( java . util . Collection ) } or { @ link # withStackSetAccounts ( java . util . Collection ) } if you * want to override the existing values . * @ param stackSetAccounts * One or more AWS accounts that will have access to the provisioned product . < / p > * Applicable only to a < code > CFN _ STACKSET < / code > provisioned product type . * The AWS accounts specified should be within the list of accounts in the < code > STACKSET < / code > constraint . * To get the list of accounts in the < code > STACKSET < / code > constraint , use the * < code > DescribeProvisioningParameters < / code > operation . * If no values are specified , the default value is all accounts from the < code > STACKSET < / code > constraint . * @ return Returns a reference to this object so that method calls can be chained together . */ public UpdateProvisioningPreferences withStackSetAccounts ( String ... stackSetAccounts ) { } }
if ( this . stackSetAccounts == null ) { setStackSetAccounts ( new java . util . ArrayList < String > ( stackSetAccounts . length ) ) ; } for ( String ele : stackSetAccounts ) { this . stackSetAccounts . add ( ele ) ; } return this ;
public class ExchangeAttributeParser { /** * Parses the provided value string , and turns it into a list of exchange attributes . * Tokens are created according to the following rules : * % a - % followed by single character . % % is an escape for a literal % * % { . * } a ? - % plus curly braces with any amount of content inside , followed by an optional character * $ { . * } - $ followed by a curly braces to reference an item from the predicate context * @ param valueString * @ return */ public ExchangeAttribute parse ( final String valueString ) { } }
final List < ExchangeAttribute > attributes = new ArrayList < > ( ) ; int pos = 0 ; int state = 0 ; // 0 = literal , 1 = % , 2 = % { , 3 = $ , 4 = $ { for ( int i = 0 ; i < valueString . length ( ) ; ++ i ) { char c = valueString . charAt ( i ) ; switch ( state ) { case 0 : { if ( c == '%' || c == '$' ) { if ( pos != i ) { attributes . add ( wrap ( parseSingleToken ( valueString . substring ( pos , i ) ) ) ) ; pos = i ; } if ( c == '%' ) { state = 1 ; } else { state = 3 ; } } break ; } case 1 : { if ( c == '{' ) { state = 2 ; } else if ( c == '%' ) { // literal percent attributes . add ( wrap ( new ConstantExchangeAttribute ( "%" ) ) ) ; pos = i + 1 ; state = 0 ; } else { attributes . add ( wrap ( parseSingleToken ( valueString . substring ( pos , i + 1 ) ) ) ) ; pos = i + 1 ; state = 0 ; } break ; } case 2 : { if ( c == '}' ) { attributes . add ( wrap ( parseSingleToken ( valueString . substring ( pos , i + 1 ) ) ) ) ; pos = i + 1 ; state = 0 ; } break ; } case 3 : { if ( c == '{' ) { state = 4 ; } else if ( c == '$' ) { // literal dollars attributes . add ( wrap ( new ConstantExchangeAttribute ( "$" ) ) ) ; pos = i + 1 ; state = 0 ; } else { attributes . add ( wrap ( parseSingleToken ( valueString . substring ( pos , i + 1 ) ) ) ) ; pos = i + 1 ; state = 0 ; } break ; } case 4 : { if ( c == '}' ) { attributes . add ( wrap ( parseSingleToken ( valueString . substring ( pos , i + 1 ) ) ) ) ; pos = i + 1 ; state = 0 ; } break ; } } } switch ( state ) { case 0 : case 1 : case 3 : { if ( pos != valueString . length ( ) ) { attributes . add ( wrap ( parseSingleToken ( valueString . substring ( pos ) ) ) ) ; } break ; } case 2 : case 4 : { throw UndertowMessages . MESSAGES . mismatchedBraces ( valueString ) ; } } if ( attributes . size ( ) == 1 ) { return attributes . get ( 0 ) ; } return new CompositeExchangeAttribute ( attributes . toArray ( new ExchangeAttribute [ attributes . size ( ) ] ) ) ;