signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Version { /** * obtains the MQ Light version information from the manifest .
* @ return The MQ Light version . */
public static String getVersion ( ) { } } | String version = "unknown" ; final URLClassLoader cl = ( URLClassLoader ) cclass . getClassLoader ( ) ; try { final URL url = cl . findResource ( "META-INF/MANIFEST.MF" ) ; final Manifest manifest = new Manifest ( url . openStream ( ) ) ; for ( Entry < Object , Object > entry : manifest . getMainAttributes ( ) . entrySet ( ) ) { final Attributes . Name key = ( Attributes . Name ) entry . getKey ( ) ; if ( Attributes . Name . IMPLEMENTATION_VERSION . equals ( key ) ) { version = ( String ) entry . getValue ( ) ; } } } catch ( IOException e ) { logger . error ( "Unable to determine the product version due to error" , e ) ; } return version ; |
public class ApiOvhMe { /** * Create a new sub - account
* REST : POST / me / subAccount
* @ param description [ required ] Description of the new sub - account */
public Long subAccount_POST ( String description ) throws IOException { } } | String qPath = "/me/subAccount" ; StringBuilder sb = path ( qPath ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "description" , description ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , Long . class ) ; |
public class KbTypeException { /** * Converts a Throwable to a KbTypeException . If the Throwable is a
* KbTypeException , it will be passed through unmodified ; otherwise , it will be wrapped
* in a new KbTypeException .
* @ param cause the Throwable to convert
* @ return a KbTypeException */
public static KbTypeException fromThrowable ( Throwable cause ) { } } | return ( cause instanceof KbTypeException ) ? ( KbTypeException ) cause : new KbTypeException ( cause ) ; |
public class ReaderInputStream { /** * Reads up to len bytes of data from the input stream into an array of bytes . Returns the number of bytes read or - 1
* if end of stream was reached .
* This method simple copy { @ link # bytesBuffer } into given bytes buffer . If stream buffer is empty delegates
* { @ link # fillBytesBuffer ( ) } to fill it from underlying reader .
* @ param bytes the bytes buffer to read into ,
* @ param off the offset to start reading bytes into ,
* @ param len the number of bytes to read .
* @ return the number of bytes read or < code > - 1 < / code > if the end of the stream has been reached .
* @ throws IllegalArgumentException if < code > bytes < / code > argument is null .
* @ throws IndexOutOfBoundsException if offset or length is negative or sum of offset and length exceeds buffer size .
* @ throws IOException if read from underlying source fails . */
@ Override public int read ( byte [ ] bytes , int off , int len ) throws IOException { } } | Params . notNull ( bytes , "Bytes" ) ; if ( len < 0 || off < 0 || ( off + len ) > bytes . length ) { throw new IndexOutOfBoundsException ( Strings . concat ( "Array Size=" , bytes . length , ", offset=" , off , ", length=" , len ) ) ; } if ( len == 0 ) { return 0 ; // Always return 0 if len = = 0
} int bytesRead = 0 ; while ( len > 0 ) { if ( bytesBuffer . hasRemaining ( ) ) { int count = Math . min ( bytesBuffer . remaining ( ) , len ) ; bytesBuffer . get ( bytes , off , count ) ; off += count ; len -= count ; bytesRead += count ; } else { fillBytesBuffer ( ) ; if ( endOfInput && ! bytesBuffer . hasRemaining ( ) ) { break ; } } } return bytesRead == 0 && endOfInput ? EOF : bytesRead ; |
public class HibernateProjectDao { /** * { @ inheritDoc } */
public Project update ( String oldProjectName , Project project ) throws GreenPepperServerException { } } | if ( ! oldProjectName . equals ( project . getName ( ) ) && getByName ( project . getName ( ) ) != null ) throw new GreenPepperServerException ( GreenPepperServerErrorKey . PROJECT_ALREADY_EXISTS , "Project already exists" ) ; Project projectToUpdate = getByName ( oldProjectName ) ; if ( projectToUpdate == null ) throw new GreenPepperServerException ( GreenPepperServerErrorKey . PROJECT_NOT_FOUND , "Project not found" ) ; projectToUpdate . setName ( project . getName ( ) ) ; sessionService . getSession ( ) . update ( projectToUpdate ) ; return projectToUpdate ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcSweptSurface ( ) { } } | if ( ifcSweptSurfaceEClass == null ) { ifcSweptSurfaceEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 587 ) ; } return ifcSweptSurfaceEClass ; |
public class Subcursor { /** * Advances the cursor to the next physical link . The method name is specifically not next ( )
* because that method name has already been used extensively in this class and it was getting
* confusing . This would be a private method if it were not used by unit tests .
* @ return the next link in the chain , or null if none . */
public final Link advance ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "advance" ) ; Link replyLink = null ; Link newLastLink = null ; synchronized ( _parent ) { // We start our search from either the lastLink we found , or the dummyHead .
Link lookAt = _lastLink ; if ( null == lookAt ) { lookAt = _parent . getDummyHead ( ) ; } // We now move to the first link that we have not seen .
lookAt = lookAt . getNextPhysicalLink ( ) ; // this loop will move through list until it finds a link that is
// in the linked state . If none is found replyLink will be null
// after the loop . Note that the Tail link is not counted
while ( null != lookAt && null == replyLink ) { if ( lookAt . isTail ( ) ) { // we do not count the dummy tail . Signal an end to the search with a null
lookAt = null ; } else { // this is the last link we have examined , so we save it , so we do not need
// to traverse it again
newLastLink = lookAt ; if ( lookAt . isLinked ( ) ) { // the link we are looking at is valid , so we return it
replyLink = lookAt ; } else { // the link we are looking at is not valid , so we move to the next
lookAt = lookAt . getNextPhysicalLink ( ) ; } } } if ( null != newLastLink ) { // we have found a new ' lastLink ' and so must move the reference
// and adjust cursor counters as needed . We may not find a new
// link - if the original ' lastLink ' was at the end of a list .
// NOTE that we do not move in the special case that jumpback has been
// disabled and we don ' t have a link to return . This makes it less likely
// that items which are changing state will be skipped over by a cursor
// with jumpback disabled , obviously at the cost of looking at them
// again and again .
if ( _jumpbackEnabled || ( replyLink != null ) ) { if ( null != _lastLink ) { _lastLink . decrementCursorCount ( ) ; } _lastLink = newLastLink ; _lastLink . incrementCursorCount ( ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "advance" , replyLink ) ; return replyLink ; |
public class ServerBuilder { /** * Adds the < a href = " https : / / en . wikipedia . org / wiki / Virtual _ hosting # Name - based " > name - based virtual host < / a >
* specified by { @ link VirtualHost } .
* @ param hostnamePattern virtual host name regular expression
* @ return { @ link VirtualHostBuilder } for build the virtual host */
public ChainedVirtualHostBuilder withVirtualHost ( String hostnamePattern ) { } } | final ChainedVirtualHostBuilder virtualHostBuilder = new ChainedVirtualHostBuilder ( hostnamePattern , this ) ; virtualHostBuilders . add ( virtualHostBuilder ) ; return virtualHostBuilder ; |
public class SyncGroupsInner { /** * Gets a collection of sync group logs .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; SyncGroupLogPropertiesInner & gt ; object */
public Observable < ServiceResponse < Page < SyncGroupLogPropertiesInner > > > listLogsNextWithServiceResponseAsync ( final String nextPageLink ) { } } | return listLogsNextSinglePageAsync ( nextPageLink ) . concatMap ( new Func1 < ServiceResponse < Page < SyncGroupLogPropertiesInner > > , Observable < ServiceResponse < Page < SyncGroupLogPropertiesInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < SyncGroupLogPropertiesInner > > > call ( ServiceResponse < Page < SyncGroupLogPropertiesInner > > page ) { String nextPageLink = page . body ( ) . nextPageLink ( ) ; if ( nextPageLink == null ) { return Observable . just ( page ) ; } return Observable . just ( page ) . concatWith ( listLogsNextWithServiceResponseAsync ( nextPageLink ) ) ; } } ) ; |
public class Matrix { /** * Multiply a row vector by this matrix : rv * this
* @ param rv the row vector
* @ return the product row vector
* @ throws numbercruncher . MatrixException for invalid size */
public RowVector multiply ( RowVector rv ) throws MatrixException { } } | // Validate rv ' s size .
if ( nCols != rv . nCols ) { throw new MatrixException ( MatrixException . INVALID_DIMENSIONS ) ; } double pv [ ] = new double [ nRows ] ; // product values
// Compute the values of the product .
for ( int c = 0 ; c < nCols ; ++ c ) { double dot = 0 ; for ( int r = 0 ; r < nRows ; ++ r ) { dot += rv . values [ 0 ] [ r ] * values [ r ] [ c ] ; } pv [ c ] = dot ; } return new RowVector ( pv ) ; |
public class WordDataReader { /** * / * ( non - Javadoc )
* @ see jvntextpro . data . DataReader # readString ( java . lang . String ) */
public List < Sentence > readString ( String dataStr ) { } } | String [ ] lines = dataStr . split ( "\n" ) ; List < Sentence > data = new ArrayList < Sentence > ( ) ; for ( String line : lines ) { Sentence sentence = new Sentence ( ) ; if ( line . startsWith ( "#" ) ) continue ; StringTokenizer tk = new StringTokenizer ( line , " " ) ; while ( tk . hasMoreTokens ( ) ) { String word = "" , tag = null ; if ( ! isTrainReading ) { String token = tk . nextToken ( ) ; word = token ; sentence . addTWord ( word , tag ) ; } else { String token = tk . nextToken ( ) ; StringTokenizer sltk = new StringTokenizer ( token , "/" ) ; word = sltk . nextToken ( ) ; tag = sltk . nextToken ( ) ; sentence . addTWord ( word , tag ) ; } } data . add ( sentence ) ; } return data ; |
public class CacheHashMap { /** * Copied from DatabaseHashMap .
* Attempts to get the requested attr from the cache
* Returns null if attr doesn ' t exist
* We consider populatedAppData as well
* populatedAppData is true when session is new or when the entire session is read into memory
* in those cases , we don ' t want to go to the backend to retrieve the attribute
* @ see com . ibm . ws . session . store . common . BackedHashMap # loadOneValue ( java . lang . String , com . ibm . ws . session . store . common . BackedSession ) */
@ Override @ FFDCIgnore ( Exception . class ) // manually logged
@ Trivial // return value contains customer data
protected Object loadOneValue ( String attrName , BackedSession sess ) { } } | @ SuppressWarnings ( "static-access" ) final boolean hideValues = _smc . isHideSessionValues ( ) ; final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "loadOneValue" , attrName , sess ) ; Object value = null ; try { if ( ! ( ( CacheSession ) sess ) . getPopulatedAppData ( ) ) { String id = sess . getId ( ) ; String key = createSessionAttributeKey ( id , attrName ) ; if ( trace && tc . isDebugEnabled ( ) ) tcInvoke ( tcSessionAttrCache , "get" , key ) ; byte [ ] bytes = sessionAttributeCache . get ( key ) ; if ( bytes == null || bytes . length == 0 ) { if ( trace && tc . isDebugEnabled ( ) ) tcReturn ( tcSessionAttrCache , "get" , bytes ) ; } else { long startTime = System . nanoTime ( ) ; try { value = deserialize ( bytes ) ; if ( trace && tc . isDebugEnabled ( ) ) if ( hideValues ) tcReturn ( tcSessionAttrCache , "get" , "byte[" + bytes . length + "]" ) ; else tcReturn ( tcSessionAttrCache , "get" , bytes , value ) ; } catch ( Exception x ) { if ( trace && tc . isDebugEnabled ( ) ) tcReturn ( tcSessionAttrCache , "get" , hideValues ? "byte[" + bytes . length + "]" : bytes ) ; FFDCFilter . processException ( x , getClass ( ) . getName ( ) , "197" , sess , new Object [ ] { hideValues ? bytes . length : TypeConversion . limitedBytesToString ( bytes ) } ) ; throw x ; } SessionStatistics pmiStats = getIStore ( ) . getSessionStatistics ( ) ; if ( pmiStats != null ) { pmiStats . readTimes ( bytes == null ? 0 : bytes . length , TimeUnit . NANOSECONDS . toMillis ( System . nanoTime ( ) - startTime ) ) ; } } // Before returning the value , confirm that the session hasn ' t expired
if ( trace && tc . isDebugEnabled ( ) ) tcInvoke ( tcSessionMetaCache , "containsKey" , id ) ; boolean contains = sessionMetaCache . containsKey ( id ) ; if ( trace && tc . isDebugEnabled ( ) ) tcReturn ( tcSessionMetaCache , "containsKey" , contains ) ; if ( ! contains ) { value = null ; } } } catch ( Exception ex ) { FFDCFilter . processException ( ex , "com.ibm.ws.session.store.cache.CacheHashMap.loadOneValue" , "778" , this , new Object [ ] { sess } ) ; Tr . error ( tc , "LOAD_VALUE_ERROR" , ex ) ; throw new RuntimeException ( Tr . formatMessage ( tc , "INTERNAL_SERVER_ERROR" ) ) ; } if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "loadOneValue" , hideValues ? ( value == null ? null : "not null" ) : value ) ; return value ; |
public class ConstantPool { /** * Adds a float constant . */
public FloatConstant addFloat ( float value ) { } } | FloatConstant entry = getFloatByValue ( value ) ; if ( entry != null ) return entry ; entry = new FloatConstant ( this , _entries . size ( ) , value ) ; addConstant ( entry ) ; return entry ; |
public class AppLogger { /** * Building Message
* @ param msg The message you would like logged .
* @ return Message String */
protected static String buildMessage ( String msg ) { } } | StackTraceElement caller = new Throwable ( ) . fillInStackTrace ( ) . getStackTrace ( ) [ 2 ] ; return caller . getClassName ( ) + "." + caller . getMethodName ( ) + "(): \n" + msg ; |
public class FindByIndexOptions { /** * Specify a specific index to run the query against
* @ param designDocument set the design document to use
* @ param indexName set the index name to use
* @ return this to set additional options */
public FindByIndexOptions useIndex ( String designDocument , String indexName ) { } } | assertNotNull ( designDocument , "designDocument" ) ; assertNotNull ( indexName , "indexName" ) ; JsonArray index = new JsonArray ( ) ; index . add ( new JsonPrimitive ( designDocument ) ) ; index . add ( new JsonPrimitive ( indexName ) ) ; this . useIndex = index ; return this ; |
public class AmazonMQClient { /** * Returns information about the specified configuration .
* @ param describeConfigurationRequest
* @ return Result of the DescribeConfiguration operation returned by the service .
* @ throws NotFoundException
* HTTP Status Code 404 : Resource not found due to incorrect input . Correct your request and then retry it .
* @ throws BadRequestException
* HTTP Status Code 400 : Bad request due to incorrect input . Correct your request and then retry it .
* @ throws InternalServerErrorException
* HTTP Status Code 500 : Unexpected internal server error . Retrying your request might resolve the issue .
* @ throws ForbiddenException
* HTTP Status Code 403 : Access forbidden . Correct your credentials and then retry your request .
* @ sample AmazonMQ . DescribeConfiguration
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / mq - 2017-11-27 / DescribeConfiguration " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DescribeConfigurationResult describeConfiguration ( DescribeConfigurationRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeConfiguration ( request ) ; |
public class ImmutableRoaringBitmap { /** * Bitwise ANDNOT ( difference ) operation for the given range , rangeStart ( inclusive ) and rangeEnd
* ( exclusive ) . The provided bitmaps are * not * modified . This operation is thread - safe as long as
* the provided bitmaps remain unchanged .
* @ param x1 first bitmap
* @ param x2 other bitmap
* @ param rangeStart beginning of the range ( inclusive )
* @ param rangeEnd end of range ( exclusive )
* @ return result of the operation
* @ deprecated use the version where longs specify the range . Negative values for range
* endpoints are not allowed . */
@ Deprecated public static MutableRoaringBitmap andNot ( final ImmutableRoaringBitmap x1 , final ImmutableRoaringBitmap x2 , final int rangeStart , final int rangeEnd ) { } } | return andNot ( x1 , x2 , ( long ) rangeStart , ( long ) rangeEnd ) ; |
public class StringUtil { /** * Converts the first character to lower case .
* Empty strings are ignored .
* @ param s the given string
* @ return the converted string . */
public static String lowerCaseFirstChar ( String s ) { } } | if ( s . isEmpty ( ) ) { return s ; } char first = s . charAt ( 0 ) ; if ( isLowerCase ( first ) ) { return s ; } return toLowerCase ( first ) + s . substring ( 1 ) ; |
public class GenericEditableStyledDocumentBase { /** * Copy of org . reactfx . util . Lists . commonPrefixSuffixLengths ( )
* that uses reference comparison instead of equals ( ) . */
private static Tuple2 < Integer , Integer > commonPrefixSuffixLengths ( List < ? > l1 , List < ? > l2 ) { } } | int n1 = l1 . size ( ) ; int n2 = l2 . size ( ) ; if ( n1 == 0 || n2 == 0 ) { return Tuples . t ( 0 , 0 ) ; } int pref = commonPrefixLength ( l1 , l2 ) ; if ( pref == n1 || pref == n2 ) { return Tuples . t ( pref , 0 ) ; } int suff = commonSuffixLength ( l1 , l2 ) ; return Tuples . t ( pref , suff ) ; |
public class LiveData { /** * Adds the given observer to the observers list within the lifespan of the given
* owner . The events are dispatched on the main thread . If LiveData already has data
* set , it will be delivered to the observer .
* The observer will only receive events if the owner is in { @ link Lifecycle . State # STARTED }
* or { @ link Lifecycle . State # RESUMED } state ( active ) .
* If the owner moves to the { @ link Lifecycle . State # DESTROYED } state , the observer will
* automatically be removed .
* When data changes while the { @ code owner } is not active , it will not receive any updates .
* If it becomes active again , it will receive the last available data automatically .
* LiveData keeps a strong reference to the observer and the owner as long as the
* given LifecycleOwner is not destroyed . When it is destroyed , LiveData removes references to
* the observer & amp ; the owner .
* If the given owner is already in { @ link Lifecycle . State # DESTROYED } state , LiveData
* ignores the call .
* If the given owner , observer tuple is already in the list , the call is ignored .
* If the observer is already in the list with another owner , LiveData throws an
* { @ link IllegalArgumentException } .
* @ param owner The LifecycleOwner which controls the observer
* @ param observer The observer that will receive the events */
@ MainThread public void observe ( @ NonNull LifecycleOwner owner , @ NonNull Observer < ? super T > observer ) { } } | assertMainThread ( "observe" ) ; if ( owner . getLifecycle ( ) . getCurrentState ( ) == DESTROYED ) { // ignore
return ; } LifecycleBoundObserver wrapper = new LifecycleBoundObserver ( owner , observer ) ; ObserverWrapper existing = mObservers . putIfAbsent ( observer , wrapper ) ; if ( existing != null && ! existing . isAttachedTo ( owner ) ) { throw new IllegalArgumentException ( "Cannot add the same observer" + " with different lifecycles" ) ; } if ( existing != null ) { return ; } owner . getLifecycle ( ) . addObserver ( wrapper ) ; |
public class WhileyFileParser { /** * Parse an additive expression .
* @ param scope
* The enclosing scope for this statement , which determines the
* set of visible ( i . e . declared ) variables and also the current
* indentation level .
* @ param terminated
* This indicates that the expression is known to be terminated
* ( or not ) . An expression that ' s known to be terminated is one
* which is guaranteed to be followed by something . This is
* important because it means that we can ignore any newline
* characters encountered in parsing this expression , and that
* we ' ll never overrun the end of the expression ( i . e . because
* there ' s guaranteed to be something which terminates this
* expression ) . A classic situation where terminated is true is
* when parsing an expression surrounded in braces . In such case ,
* we know the right - brace will always terminate this expression .
* @ return */
private Expr parseAdditiveExpression ( EnclosingScope scope , boolean terminated ) { } } | int start = index ; Expr lhs = parseMultiplicativeExpression ( scope , terminated ) ; Token lookahead ; while ( ( lookahead = tryAndMatch ( terminated , Plus , Minus ) ) != null ) { Expr rhs = parseMultiplicativeExpression ( scope , terminated ) ; switch ( lookahead . kind ) { case Plus : lhs = new Expr . IntegerAddition ( Type . Void , lhs , rhs ) ; break ; case Minus : lhs = new Expr . IntegerSubtraction ( Type . Void , lhs , rhs ) ; break ; default : throw new RuntimeException ( "deadcode" ) ; // dead - code
} lhs = annotateSourceLocation ( lhs , start ) ; } return lhs ; |
public class Boxing { /** * Transforms any array into a primitive array .
* @ param < T >
* @ param src source array
* @ param type target type
* @ return primitive array */
public static < T > T unboxAllAs ( Object src , Class < T > type ) { } } | return ( T ) unboxAll ( type , src , 0 , - 1 ) ; |
public class XmlRepositoryFactory { /** * Reads XML document and returns it content as list of queries ( as { @ link Element } )
* @ param document document which would be read
* @ return list of queries ( as { @ link Element } ) */
private static List < Element > getElements ( Document document ) { } } | List < Element > result = new ArrayList < Element > ( ) ; Element root = document . getDocumentElement ( ) ; NodeList nodeList = root . getChildNodes ( ) ; Node node = null ; Element nodeElement = null ; for ( int i = 0 ; i < nodeList . getLength ( ) ; i ++ ) { node = nodeList . item ( i ) ; if ( node instanceof Element ) { nodeElement = ( Element ) node ; if ( nodeElement . hasAttribute ( "id" ) == false ) { throw new MjdbcRuntimeException ( "Found XML element without ID attribute. Parsing is interrupted" ) ; } else { result . add ( nodeElement ) ; } } } return result ; |
public class Efficiencies { /** * Runoff coefficient error ROCE
* @ param obs
* @ param sim
* @ param precip
* @ return */
public static double runoffCoefficientError ( double [ ] obs , double [ ] sim , double [ ] precip ) { } } | sameArrayLen ( sim , obs , precip ) ; double mean_pred = Stats . mean ( sim ) ; double mean_val = Stats . mean ( obs ) ; double mean_ppt = Stats . mean ( precip ) ; double error = Math . abs ( ( mean_pred / mean_ppt ) - ( mean_val / mean_ppt ) ) ; return Math . sqrt ( error ) ; |
public class ChatApplet { /** * Add any applet sub - panel ( s ) now . */
public boolean addSubPanels ( Container parent , int options ) { } } | FieldList record = null ; JBasePanel baseScreen = new ChatScreen ( this , record ) ; super . addSubPanels ( parent , options ) ; return this . changeSubScreen ( parent , baseScreen , null , options ) ; |
public class PKIXCertPathValidator { /** * Validates a certification path consisting exclusively of
* < code > X509Certificate < / code > s using the PKIX validation algorithm ,
* which uses the specified input parameter set .
* The input parameter set must be a < code > PKIXParameters < / code > object .
* @ param cp the X509 certification path
* @ param params the input PKIX parameter set
* @ return the result
* @ throws CertPathValidatorException if cert path does not validate .
* @ throws InvalidAlgorithmParameterException if the specified
* parameters are inappropriate for this CertPathValidator */
@ Override public CertPathValidatorResult engineValidate ( CertPath cp , CertPathParameters params ) throws CertPathValidatorException , InvalidAlgorithmParameterException { } } | ValidatorParams valParams = PKIX . checkParams ( cp , params ) ; return validate ( valParams ) ; |
public class EC2MetadataUtils { /** * Returns the host address of the Amazon EC2 Instance Metadata Service . */
public static String getHostAddressForEC2MetadataService ( ) { } } | String host = System . getProperty ( EC2_METADATA_SERVICE_OVERRIDE_SYSTEM_PROPERTY ) ; return host != null ? host : EC2_METADATA_SERVICE_URL ; |
public class HsqlProperties { /** * Saves the properties . */
public void save ( ) throws Exception { } } | if ( fileName == null || fileName . length ( ) == 0 ) { throw new java . io . FileNotFoundException ( Error . getMessage ( ErrorCode . M_HsqlProperties_load ) ) ; } String filestring = fileName + ".properties" ; save ( filestring ) ; |
public class FastStr { /** * Wrapper of { @ link String # equalsIgnoreCase ( String ) }
* @ param x the char sequence to be compared
* @ return { @ code true } if the argument is not { @ code null } and it
* represents an equivalent { @ code String } ignoring case ; { @ code
* false } otherwise */
public boolean equalsIgnoreCase ( CharSequence x ) { } } | if ( x == this ) return true ; if ( null == x || size ( ) != x . length ( ) ) return false ; if ( isEmpty ( ) && x . length ( ) == 0 ) return true ; return regionMatches ( true , 0 , x , 0 , size ( ) ) ; |
public class ComputationGraph { /** * Feed - forward through the network - returning all array activations detached from any workspace .
* Note that no workspace should be active externally when calling this method ( an exception will be thrown
* if a workspace is open externally )
* @ param train Training mode ( true ) or test / inference mode ( false )
* @ param fwdPassType Type of forward pass to perform ( STANDARD or RNN _ ACTIVATE _ WITH _ STORED _ STATE only )
* @ param storeLastForTBPTT ONLY used if fwdPassType = = FwdPassType . RNN _ ACTIVATE _ WITH _ STORED _ STATE
* @ param layerIndex Index ( inclusive ) to stop forward pass at . For all layers , use numLayers - 1
* @ param excludeIdxs Layers ( vertices ) to exclude from forward pass . These layers will be skipped , and hence
* are usually output layers or at the end of the network . May be null .
* @ param features Input feature arrays
* @ param fMask Feature mask arrays . May be null .
* @ param lMask Label mask array . May be null .
* @ param clearLayers Whether the layer inputs should be cleared
* @ return Map of activations ( including the input ) , detached from any workspace */
protected synchronized Map < String , INDArray > ffToLayerActivationsDetached ( boolean train , @ NonNull FwdPassType fwdPassType , boolean storeLastForTBPTT , int layerIndex , int [ ] excludeIdxs , @ NonNull INDArray [ ] features , INDArray [ ] fMask , INDArray [ ] lMask , boolean clearLayers ) { } } | if ( layerIndex < 0 || layerIndex >= topologicalOrder . length ) { throw new IllegalArgumentException ( "Invalid layer index - index must be >= 0 and < " + topologicalOrder . length + ", got index " + layerIndex ) ; } setInputs ( features ) ; setLayerMaskArrays ( fMask , lMask ) ; // Verify that no workspace is open externally
WorkspaceUtils . assertNoWorkspacesOpen ( "Expected no workspace active before call to ffToLayerActivationsDetached" , true ) ; LayerWorkspaceMgr workspaceMgr ; WorkspaceMode wsm = ( train ? configuration . getTrainingWorkspaceMode ( ) : configuration . getInferenceWorkspaceMode ( ) ) ; if ( wsm == WorkspaceMode . NONE ) { workspaceMgr = LayerWorkspaceMgr . noWorkspaces ( ) ; } else { workspaceMgr = LayerWorkspaceMgr . builder ( ) . noWorkspaceFor ( ArrayType . ACTIVATIONS ) . with ( ArrayType . INPUT , WS_LAYER_WORKING_MEM , WS_LAYER_WORKING_MEM_CONFIG ) . with ( ArrayType . FF_WORKING_MEM , WS_LAYER_WORKING_MEM , WS_LAYER_WORKING_MEM_CONFIG ) . with ( ArrayType . RNN_FF_LOOP_WORKING_MEM , WS_RNN_LOOP_WORKING_MEM , WS_RNN_LOOP_WORKING_MEM_CONFIG ) . build ( ) ; if ( features [ 0 ] . isAttached ( ) ) { // Don ' t leverage out of async DataMultiSetIterator workspaces
workspaceMgr . setNoLeverageOverride ( features [ 0 ] . data ( ) . getParentWorkspace ( ) . getId ( ) ) ; } } workspaceMgr . setHelperWorkspacePointers ( helperWorkspaces ) ; Map < String , INDArray > activations = new HashMap < > ( ) ; // Add the inputs :
for ( int i = 0 ; i < features . length ; i ++ ) { activations . put ( configuration . getNetworkInputs ( ) . get ( i ) , features [ i ] ) ; } // Do forward pass according to the topological ordering of the network
for ( int i = 0 ; i <= layerIndex ; i ++ ) { GraphVertex current = vertices [ topologicalOrder [ i ] ] ; String vName = current . getVertexName ( ) ; int vIdx = current . getVertexIndex ( ) ; if ( excludeIdxs != null && ArrayUtils . contains ( excludeIdxs , vIdx ) ) { continue ; } try ( MemoryWorkspace wsFFWorking = workspaceMgr . notifyScopeEntered ( ArrayType . FF_WORKING_MEM ) ) { VertexIndices [ ] inputsTo = current . getOutputVertices ( ) ; INDArray out ; if ( current . isInputVertex ( ) ) { out = inputs [ vIdx ] ; } else { if ( fwdPassType == FwdPassType . STANDARD ) { // Standard feed - forward case
out = current . doForward ( train , workspaceMgr ) ; } else if ( fwdPassType == FwdPassType . RNN_TIMESTEP ) { if ( current . hasLayer ( ) ) { // Layer
INDArray input = current . getInputs ( ) [ 0 ] ; Layer l = current . getLayer ( ) ; if ( l instanceof RecurrentLayer ) { out = ( ( RecurrentLayer ) l ) . rnnTimeStep ( reshapeTimeStepInput ( input ) , workspaceMgr ) ; } else if ( l instanceof org . deeplearning4j . nn . layers . wrapper . BaseWrapperLayer && ( ( org . deeplearning4j . nn . layers . wrapper . BaseWrapperLayer ) l ) . getUnderlying ( ) instanceof RecurrentLayer ) { RecurrentLayer rl = ( ( RecurrentLayer ) ( ( org . deeplearning4j . nn . layers . wrapper . BaseWrapperLayer ) l ) . getUnderlying ( ) ) ; out = rl . rnnTimeStep ( reshapeTimeStepInput ( input ) , workspaceMgr ) ; } else if ( l instanceof MultiLayerNetwork ) { out = ( ( MultiLayerNetwork ) l ) . rnnTimeStep ( reshapeTimeStepInput ( input ) ) ; } else { // non - recurrent layer
out = current . doForward ( train , workspaceMgr ) ; } } else { // GraphNode
out = current . doForward ( train , workspaceMgr ) ; } } else if ( fwdPassType == FwdPassType . RNN_ACTIVATE_WITH_STORED_STATE ) { if ( current . hasLayer ( ) ) { Layer l = current . getLayer ( ) ; if ( l instanceof RecurrentLayer ) { out = ( ( RecurrentLayer ) l ) . rnnActivateUsingStoredState ( current . getInputs ( ) [ 0 ] , train , storeLastForTBPTT , workspaceMgr ) ; } else if ( l instanceof org . deeplearning4j . nn . layers . wrapper . BaseWrapperLayer && ( ( org . deeplearning4j . nn . layers . wrapper . BaseWrapperLayer ) l ) . getUnderlying ( ) instanceof RecurrentLayer ) { RecurrentLayer rl = ( RecurrentLayer ) ( ( org . deeplearning4j . nn . layers . wrapper . BaseWrapperLayer ) l ) . getUnderlying ( ) ; out = rl . rnnActivateUsingStoredState ( current . getInputs ( ) [ 0 ] , train , storeLastForTBPTT , workspaceMgr ) ; } else if ( l instanceof MultiLayerNetwork ) { List < INDArray > temp = ( ( MultiLayerNetwork ) l ) . rnnActivateUsingStoredState ( current . getInputs ( ) [ 0 ] , train , storeLastForTBPTT ) ; out = temp . get ( temp . size ( ) - 1 ) ; } else { // non - recurrent layer
out = current . doForward ( train , workspaceMgr ) ; } } else { out = current . doForward ( train , workspaceMgr ) ; } } else { throw new IllegalArgumentException ( "Unsupported forward pass type for this method: " + fwdPassType ) ; } validateArrayWorkspaces ( workspaceMgr , out , ArrayType . ACTIVATIONS , vName , false , "Feed forward (inference)" ) ; } activations . put ( current . getVertexName ( ) , out ) ; if ( inputsTo != null ) { // May be null for output vertices ( which don ' t feed into any other vertices )
for ( VertexIndices v : inputsTo ) { // Note that we don ' t have to do anything special here : the activations are always detached in
// this method
int inputToIndex = v . getVertexIndex ( ) ; int vIdxEdge = v . getVertexEdgeNumber ( ) ; vertices [ inputToIndex ] . setInput ( vIdxEdge , out , workspaceMgr ) ; } } if ( clearLayers ) { current . clear ( ) ; } } } return activations ; |
public class PortletWindowData { /** * / * ( non - Javadoc )
* @ see org . apereo . portal . portlet . om . IPortletWindowData # setPublicRenderParameters ( java . util . Map ) */
public void setPublicRenderParameters ( Map < String , String [ ] > publicRenderParameters ) { } } | Validate . notNull ( publicRenderParameters , "publicRenderParameters can not be null" ) ; this . publicRenderParameters = publicRenderParameters ; |
public class RepeatedFieldBuilder { /** * Gets a view of the builder as a list of builders . This returned list is live and will reflect
* any changes to the underlying builder .
* @ return the builders in the list */
public List < BType > getBuilderList ( ) { } } | if ( externalBuilderList == null ) { externalBuilderList = new BuilderExternalList < MType , BType , IType > ( this ) ; } return externalBuilderList ; |
public class AbstractGraph { /** * { @ inheritDoc }
* < p > This method is sensitive to the vertex ordering ; a call will check
* whether the edge set for { @ code e . from ( ) } contains { @ code e } . Subclasses
* should override this method if their { @ link EdgeSet } implementations are
* sensitive to the ordering of the vertex indices , or if a more advanced
* behavior is needed . */
public boolean contains ( Edge e ) { } } | EdgeSet < T > e1 = getEdgeSet ( e . from ( ) ) ; return e1 != null && e1 . contains ( e ) ; |
public class PaxWicketBundleListener { /** * { @ inheritDoc } */
@ Override public ExtendedBundle addingBundle ( Bundle bundle , BundleEvent event ) { } } | ExtendedBundle extendedBundle = new ExtendedBundle ( extendedBundleContext , bundle ) ; if ( extendedBundle . isImportingPAXWicketAPI ( ) || extendedBundle . isImportingWicket ( ) ) { addRelevantBundle ( extendedBundle ) ; LOGGER . info ( "{} is added as a relevant bundle for pax wicket" , bundle . getSymbolicName ( ) ) ; return extendedBundle ; } else { // No need to track this . . .
return null ; } |
public class AbstractIteratingActionContainer { /** * Check aborting condition .
* @ return */
protected boolean checkCondition ( TestContext context ) { } } | if ( conditionExpression != null ) { return conditionExpression . evaluate ( index , context ) ; } // replace dynamic content with each iteration
String conditionString = condition ; if ( conditionString . indexOf ( Citrus . VARIABLE_PREFIX + indexName + Citrus . VARIABLE_SUFFIX ) != - 1 ) { Properties props = new Properties ( ) ; props . put ( indexName , String . valueOf ( index ) ) ; conditionString = new PropertyPlaceholderHelper ( Citrus . VARIABLE_PREFIX , Citrus . VARIABLE_SUFFIX ) . replacePlaceholders ( conditionString , props ) ; } conditionString = context . replaceDynamicContentInString ( conditionString ) ; if ( ValidationMatcherUtils . isValidationMatcherExpression ( conditionString ) ) { try { ValidationMatcherUtils . resolveValidationMatcher ( "iteratingCondition" , String . valueOf ( index ) , conditionString , context ) ; return true ; } catch ( AssertionError e ) { return false ; } } if ( conditionString . indexOf ( indexName ) != - 1 ) { conditionString = conditionString . replaceAll ( indexName , String . valueOf ( index ) ) ; } return BooleanExpressionParser . evaluate ( conditionString ) ; |
public class ExecutorFilter { /** * < pre >
* function to register the static remaining flow size filter .
* NOTE : this is a static filter which means the filter will be filtering based on the system
* standard which is not
* Coming for the passed flow .
* Ideally this filter will make sure only the executor hasn ' t reached the Max allowed #
* of
* executing flows .
* < / pre > */
private static FactorFilter < Executor , ExecutableFlow > getStaticRemainingFlowSizeFilter ( ) { } } | return FactorFilter . create ( STATICREMAININGFLOWSIZE_FILTER_NAME , ( filteringTarget , referencingObject ) -> { if ( null == filteringTarget ) { logger . debug ( String . format ( "%s : filtering out the target as it is null." , STATICREMAININGFLOWSIZE_FILTER_NAME ) ) ; return false ; } final ExecutorInfo stats = filteringTarget . getExecutorInfo ( ) ; if ( null == stats ) { logger . debug ( String . format ( "%s : filtering out %s as it's stats is unavailable." , STATICREMAININGFLOWSIZE_FILTER_NAME , filteringTarget . toString ( ) ) ) ; return false ; } return stats . getRemainingFlowCapacity ( ) > 0 ; } ) ; |
public class MisoScenePanel { /** * Returns the base tile for the specified tile coordinate . */
protected BaseTile getBaseTile ( int tx , int ty ) { } } | SceneBlock block = getBlock ( tx , ty ) ; return ( block == null ) ? null : block . getBaseTile ( tx , ty ) ; |
public class InputStreamReader { /** * Indicates whether this reader is ready to be read without blocking . If
* the result is { @ code true } , the next { @ code read ( ) } will not block . If
* the result is { @ code false } then this reader may or may not block when
* { @ code read ( ) } is called . This implementation returns { @ code true } if
* there are bytes available in the buffer or the source stream has bytes
* available .
* @ return { @ code true } if the receiver will not block when { @ code read ( ) }
* is called , { @ code false } if unknown or blocking will occur .
* @ throws IOException
* if this reader is closed or some other I / O error occurs . */
@ Override public boolean ready ( ) throws IOException { } } | synchronized ( lock ) { if ( in == null ) { throw new IOException ( "InputStreamReader is closed." ) ; } try { return bytes . hasRemaining ( ) || in . available ( ) > 0 ; } catch ( IOException e ) { return false ; } } |
public class LocaleSelectorImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . LOCALE_SELECTOR__LOC_FLGS : return getLocFlgs ( ) ; case AfplibPackage . LOCALE_SELECTOR__LANG_CODE : return getLangCode ( ) ; case AfplibPackage . LOCALE_SELECTOR__SCRPT_CDE : return getScrptCde ( ) ; case AfplibPackage . LOCALE_SELECTOR__REG_CDE : return getRegCde ( ) ; case AfplibPackage . LOCALE_SELECTOR__RESERVED : return getReserved ( ) ; case AfplibPackage . LOCALE_SELECTOR__VAR_CDE : return getVarCde ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class SseBuilder { /** * Get credentials by the credentials id . Then set the user name and password into the SsePoxySetting . */
private void setProxyCredentials ( Run < ? , ? > run ) { } } | if ( proxySettings != null && proxySettings . getFsProxyCredentialsId ( ) != null ) { UsernamePasswordCredentials up = CredentialsProvider . findCredentialById ( proxySettings . getFsProxyCredentialsId ( ) , StandardUsernamePasswordCredentials . class , run , URIRequirementBuilder . create ( ) . build ( ) ) ; if ( up != null ) { proxySettings . setFsProxyUserName ( up . getUsername ( ) ) ; proxySettings . setFsProxyPassword ( up . getPassword ( ) ) ; } } |
public class PlacesLocationFeedData { /** * Gets the oAuthInfo value for this PlacesLocationFeedData .
* @ return oAuthInfo * Required authentication token ( from OAuth API ) for the email . < / br >
* Use the following values when populating the oAuthInfo :
* < ul >
* < li > httpMethod : { @ code GET } < / li >
* < li > httpRequestUrl : { @ code https : / / www . googleapis . com / auth / adwords } < / li >
* < li >
* httpAuthorizationHeader : { @ code Bearer * ACCESS _ TOKEN * }
* ( where * ACCESS _ TOKEN * is generated from OAuth credentials for the
* emailAddress and a scope matching httpRequestUrl )
* < / li >
* < / ul > */
public com . google . api . ads . adwords . axis . v201809 . cm . OAuthInfo getOAuthInfo ( ) { } } | return oAuthInfo ; |
public class CommerceOrderPersistenceImpl { /** * Removes all the commerce orders where groupId = & # 63 ; and commerceAccountId = & # 63 ; from the database .
* @ param groupId the group ID
* @ param commerceAccountId the commerce account ID */
@ Override public void removeByG_C ( long groupId , long commerceAccountId ) { } } | for ( CommerceOrder commerceOrder : findByG_C ( groupId , commerceAccountId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( commerceOrder ) ; } |
public class JSONUtils { /** * Escape a string to be surrounded in double quotes in JSON .
* @ param unsafeStr
* The string to escape .
* @ return The escaped string . */
public static String escapeJSONString ( final String unsafeStr ) { } } | final StringBuilder buf = new StringBuilder ( unsafeStr . length ( ) * 2 ) ; escapeJSONString ( unsafeStr , buf ) ; return buf . toString ( ) ; |
public class DefaultOperationCandidatesProvider { /** * / * ( non - Javadoc )
* @ see org . jboss . as . cli . CandidatesProvider # getNodeNames ( org . jboss . as . cli . Prefix ) */
@ Override public List < String > getNodeNames ( CommandContext ctx , OperationRequestAddress prefix ) { } } | ModelControllerClient client = ctx . getModelControllerClient ( ) ; if ( client == null ) { return Collections . emptyList ( ) ; } if ( prefix . isEmpty ( ) ) { throw new IllegalArgumentException ( "The prefix must end on a type but it's empty." ) ; } if ( ! prefix . endsOnType ( ) ) { throw new IllegalArgumentException ( "The prefix doesn't end on a type." ) ; } final ModelNode request ; DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder ( prefix ) ; try { builder . setOperationName ( Util . READ_CHILDREN_NAMES ) ; builder . addProperty ( Util . CHILD_TYPE , prefix . getNodeType ( ) ) ; builder . addProperty ( Util . INCLUDE_SINGLETONS , "true" ) ; request = builder . buildRequest ( ) ; } catch ( OperationFormatException e1 ) { throw new IllegalStateException ( "Failed to build operation" , e1 ) ; } List < String > result ; try { ModelNode outcome = client . execute ( request ) ; if ( ! Util . isSuccess ( outcome ) ) { // TODO logging . . . exception ?
result = Collections . emptyList ( ) ; } else { result = Util . getList ( outcome ) ; } } catch ( Exception e ) { result = Collections . emptyList ( ) ; } return result ; |
public class Formatter { /** * Writes a formatted string to this object ' s destination using the
* specified format string and arguments .
* @ param conf
* The formatter configuration , provides additional formats and
* the default locale . If { @ code null } , the configuration specified
* at the construction of this formatter is used .
* @ param locale
* The { @ linkplain java . util . Locale locale } to apply during
* formatting . If { @ code null } , the configuration will be used to
* obtain a locale .
* @ param format
* A format string as described in Format string syntax . If the
* object does not implement { @ link Localizable } , it is converted
* into a string .
* @ param start
* The index where parsing the format string begins .
* @ param end
* The index where parsing the format string ends
* ( - 1 for the entire string ) .
* @ param args
* Arguments referenced by the format specifiers in the format
* string .
* @ throws IllegalFormatException
* If a format string contains an illegal syntax , a format
* specifier that is incompatible with the given arguments ,
* insufficient arguments given the format string , or other
* illegal conditions .
* @ throws FormatterClosedException
* If this formatter has been closed by invoking its { @ link
* # close ( ) } method
* @ return This formatter
* @ see java . util . Formatter # format ( java . lang . String , java . lang . Object [ ] ) */
protected Formatter format ( FormatterConfiguration conf , Locale locale , Object format , int start , int end , FormatArgs args ) { } } | try { if ( conf == null ) conf = this . conf ; if ( locale == null ) locale = conf . locale ( ) ; if ( locale == null ) locale = Locale . ROOT ; String fString = toFormatString ( format , locale ) ; if ( end < 0 ) end = fString . length ( ) - end - 1 ; new Parser ( conf , locale , args ) . parse ( fString , start , end ) ; } catch ( IOException ex ) { lastIOException = ex ; } return this ; |
public class Toml { /** * Populates the current Toml instance with values from tomlString .
* @ param tomlString String to be read .
* @ return this instance
* @ throws IllegalStateException If tomlString is not valid TOML */
public Toml read ( String tomlString ) throws IllegalStateException { } } | Results results = TomlParser . run ( tomlString ) ; if ( results . errors . hasErrors ( ) ) { throw new IllegalStateException ( results . errors . toString ( ) ) ; } this . values = results . consume ( ) ; return this ; |
public class PoolOperations { /** * Lists pool usage metrics .
* @ param startTime
* The start time of the aggregation interval covered by this entry .
* @ param endTime
* The end time of the aggregation interval for this entry .
* @ return A list of { @ link PoolUsageMetrics } objects .
* @ throws BatchErrorException
* Exception thrown when an error response is received from the
* Batch service .
* @ throws IOException
* Exception thrown when there is an error in
* serialization / deserialization of data sent to / received from the
* Batch service . */
public PagedList < PoolUsageMetrics > listPoolUsageMetrics ( DateTime startTime , DateTime endTime ) throws BatchErrorException , IOException { } } | return listPoolUsageMetrics ( startTime , endTime , null , null ) ; |
public class HttpServerUpgradeHandler { /** * Creates the 101 Switching Protocols response message . */
private static FullHttpResponse createUpgradeResponse ( CharSequence upgradeProtocol ) { } } | DefaultFullHttpResponse res = new DefaultFullHttpResponse ( HTTP_1_1 , SWITCHING_PROTOCOLS , Unpooled . EMPTY_BUFFER , false ) ; res . headers ( ) . add ( HttpHeaderNames . CONNECTION , HttpHeaderValues . UPGRADE ) ; res . headers ( ) . add ( HttpHeaderNames . UPGRADE , upgradeProtocol ) ; return res ; |
public class ADStarNodeExpander { /** * Updates a node in inconsistent state ( V < = G ) , evaluating all the predecessors of the current node
* and updating the parent to the node which combination of cost and transition is minimal .
* @ param node inconsistent { @ link es . usc . citius . hipster . algorithm . ADStarForward } node to update
* @ param predecessorMap map containing the the predecessor nodes and
* @ return true if the node has changed its { @ link es . usc . citius . hipster . model . impl . ADStarNodeImpl . Key } */
private boolean updateInconsistent ( N node , Map < Transition < A , S > , N > predecessorMap ) { } } | C minValue = add . getIdentityElem ( ) ; N minParent = null ; Transition < A , S > minTransition = null ; for ( Map . Entry < Transition < A , S > , N > current : predecessorMap . entrySet ( ) ) { C value = add . apply ( current . getValue ( ) . getV ( ) , costFunction . evaluate ( current . getKey ( ) ) ) ; // T value = current . getValue ( ) . v . add ( this . costFunction . evaluate ( current . getKey ( ) ) ) ;
if ( value . compareTo ( minValue ) < 0 ) { minValue = value ; minParent = current . getValue ( ) ; minTransition = current . getKey ( ) ; } } node . setPreviousNode ( minParent ) ; // node . previousNode = minParent ;
node . setG ( minValue ) ; node . setState ( minTransition . getState ( ) ) ; node . setAction ( minTransition . getAction ( ) ) ; // node . state = minTransition ;
node . getKey ( ) . update ( node . getG ( ) , node . getV ( ) , heuristicFunction . estimate ( minTransition . getState ( ) ) , epsilon , add , scale ) ; return true ; |
public class SpdyCodecUtil { /** * Validate a SPDY header value . Does not validate max length . */
static void validateHeaderValue ( CharSequence value ) { } } | if ( value == null ) { throw new NullPointerException ( "value" ) ; } for ( int i = 0 ; i < value . length ( ) ; i ++ ) { char c = value . charAt ( i ) ; if ( c == 0 ) { throw new IllegalArgumentException ( "value contains null character: " + value ) ; } } |
public class SpatialReferenceSystemDao { /** * Creates the required Undefined Cartesian Spatial Reference System ( spec
* Requirement 11)
* @ return spatial reference system
* @ throws SQLException
* upon creation failure */
public SpatialReferenceSystem createUndefinedCartesian ( ) throws SQLException { } } | SpatialReferenceSystem srs = new SpatialReferenceSystem ( ) ; srs . setSrsName ( GeoPackageProperties . getProperty ( PropertyConstants . UNDEFINED_CARTESIAN , PropertyConstants . SRS_NAME ) ) ; srs . setSrsId ( GeoPackageProperties . getIntegerProperty ( PropertyConstants . UNDEFINED_CARTESIAN , PropertyConstants . SRS_ID ) ) ; srs . setOrganization ( GeoPackageProperties . getProperty ( PropertyConstants . UNDEFINED_CARTESIAN , PropertyConstants . ORGANIZATION ) ) ; srs . setOrganizationCoordsysId ( GeoPackageProperties . getIntegerProperty ( PropertyConstants . UNDEFINED_CARTESIAN , PropertyConstants . ORGANIZATION_COORDSYS_ID ) ) ; srs . setDefinition ( GeoPackageProperties . getProperty ( PropertyConstants . UNDEFINED_CARTESIAN , PropertyConstants . DEFINITION ) ) ; srs . setDescription ( GeoPackageProperties . getProperty ( PropertyConstants . UNDEFINED_CARTESIAN , PropertyConstants . DESCRIPTION ) ) ; create ( srs ) ; if ( hasDefinition_12_063 ( ) ) { srs . setDefinition_12_063 ( GeoPackageProperties . getProperty ( PropertyConstants . UNDEFINED_CARTESIAN , PropertyConstants . DEFINITION_12_063 ) ) ; crsWktExtension . updateDefinition ( srs . getSrsId ( ) , srs . getDefinition_12_063 ( ) ) ; } return srs ; |
public class LinearGradientColorPalette { /** * Creates a linear Gradient between two colors
* @ param color1
* start color
* @ param color2
* end color
* @ param gradientSteps
* specifies the amount of colors in this gradient between color1
* and color2 , this includes both color1 and color2
* @ return List of colors in this gradient */
private static List < Color > createLinearGradient ( final Color color1 , final Color color2 , final int gradientSteps ) { } } | final List < Color > colors = new ArrayList < > ( gradientSteps + 1 ) ; // add beginning color to the gradient
colors . add ( color1 ) ; for ( int i = 1 ; i < gradientSteps ; i ++ ) { float ratio = ( float ) i / ( float ) gradientSteps ; final float red = color2 . getRed ( ) * ratio + color1 . getRed ( ) * ( 1 - ratio ) ; final float green = color2 . getGreen ( ) * ratio + color1 . getGreen ( ) * ( 1 - ratio ) ; final float blue = color2 . getBlue ( ) * ratio + color1 . getBlue ( ) * ( 1 - ratio ) ; colors . add ( new Color ( Math . round ( red ) , Math . round ( green ) , Math . round ( blue ) ) ) ; } // add end color to the gradient
colors . add ( color2 ) ; return colors ; |
public class CloneStackRequest { /** * A list of stack attributes and values as key / value pairs to be added to the cloned stack .
* @ param attributes
* A list of stack attributes and values as key / value pairs to be added to the cloned stack .
* @ return Returns a reference to this object so that method calls can be chained together . */
public CloneStackRequest withAttributes ( java . util . Map < String , String > attributes ) { } } | setAttributes ( attributes ) ; return this ; |
public class MatlabSparseMatrixBuilder { /** * { @ inheritDoc } Once this method has been called , any subsequent calls will
* have no effect and will not throw an exception . */
public synchronized void finish ( ) { } } | if ( ! isFinished ) { if ( LOGGER . isLoggable ( Level . FINE ) ) { LOGGER . fine ( "Finished writing matrix in MATLAB_SPARSE format " + "with " + curColumn + " columns" ) ; } isFinished = true ; matrixWriter . close ( ) ; } |
public class RESTDocBuilder { /** * Whether the method is annotated with @ ResponseBody . */
private boolean isAnnotatedResponseBody ( MethodDoc method ) { } } | AnnotationDesc [ ] annotations = method . annotations ( ) ; for ( int i = 0 ; i < annotations . length ; i ++ ) { if ( annotations [ i ] . annotationType ( ) . name ( ) . equals ( "ResponseBody" ) ) { return true ; } } return false ; |
public class SanitizedContents { /** * Loads assumed - safe content from a Java resource .
* < p > This performs ZERO VALIDATION of the data , and takes you on your word that the input is
* valid . We assume that resources should be safe because they are part of the binary , and
* therefore not attacker controlled , unless the source code is compromised ( in which there ' s
* nothing we can do ) .
* @ param contextClass Class relative to which to load the resource .
* @ param resourceName The name of the resource , relative to the context class .
* @ param charset The character set to use , usually Charsets . UTF _ 8.
* @ param kind The content kind of the resource . */
public static SanitizedContent fromResource ( Class < ? > contextClass , String resourceName , Charset charset , ContentKind kind ) throws IOException { } } | pretendValidateResource ( resourceName , kind ) ; return SanitizedContent . create ( Resources . toString ( Resources . getResource ( contextClass , resourceName ) , charset ) , kind , // Text resources are usually localized , so one might think that the locale direction should
// be assumed for them . We do not do that because :
// - We do not know the locale direction here .
// - Some messages do not get translated .
// - This method currently can ' t be used for text resources ( see pretendValidateResource ( ) ) .
kind . getDefaultDir ( ) ) ; |
public class BaseApplet { /** * Get the display preference for the help window .
* @ return */
public int getHelpPageOptions ( int iOptions ) { } } | String strPreference = this . getProperty ( ThinMenuConstants . USER_HELP_DISPLAY ) ; if ( ( strPreference == null ) || ( strPreference . length ( ) == 0 ) ) strPreference = this . getProperty ( ThinMenuConstants . HELP_DISPLAY ) ; if ( this . getHelpView ( ) == null ) if ( ThinMenuConstants . HELP_PANE . equalsIgnoreCase ( strPreference ) ) strPreference = null ; if ( ( strPreference == null ) || ( strPreference . length ( ) == 0 ) ) { // if ( this . getAppletScreen ( ) ! = null )
// strPreference = MenuConstants . HELP _ WEB ;
// else if ( ( applet . getHelpView ( ) ! = null ) & & ( applet . getHelpView ( ) . getBaseApplet ( ) = = applet ) )
strPreference = ThinMenuConstants . HELP_PANE ; // else
// strPreference = MenuConstants . HELP _ WINDOW ;
} if ( ThinMenuConstants . HELP_WEB . equalsIgnoreCase ( strPreference ) ) iOptions = ThinMenuConstants . HELP_WEB_OPTION ; else if ( ThinMenuConstants . HELP_PANE . equalsIgnoreCase ( strPreference ) ) iOptions = ThinMenuConstants . HELP_PANE_OPTION ; else if ( ThinMenuConstants . HELP_WINDOW . equalsIgnoreCase ( strPreference ) ) iOptions = ThinMenuConstants . HELP_WINDOW_OPTION ; else iOptions = ThinMenuConstants . HELP_PANE_OPTION ; // Default
return iOptions ; |
public class ExcelTransformer { /** * When set , only columns contained in the String [ ] will
* be exported out to Excel .
* @ param exportOnlyColumns the exportOnlyColumns to set */
public void setExportOnlyColumns ( final String [ ] exportOnlyColumns ) { } } | if ( exportOnlyColumns != null ) { this . exportOnlyColumns = exportOnlyColumns . clone ( ) ; } else { this . exportOnlyColumns = null ; } |
public class ViewData { /** * Constructs a new { @ link ViewData } .
* @ param view the { @ link View } associated with this { @ link ViewData } .
* @ param map the mapping from { @ link TagValue } list to { @ link AggregationData } .
* @ param start the start { @ link Timestamp } for this { @ link ViewData } .
* @ param end the end { @ link Timestamp } for this { @ link ViewData } .
* @ return a { @ code ViewData } .
* @ throws IllegalArgumentException if the types of { @ code Aggregation } and { @ code
* AggregationData } don ' t match .
* @ since 0.13 */
public static ViewData create ( View view , Map < ? extends List < /* @ Nullable */
TagValue > , ? extends AggregationData > map , Timestamp start , Timestamp end ) { } } | Map < List < /* @ Nullable */
TagValue > , AggregationData > deepCopy = new HashMap < List < /* @ Nullable */
TagValue > , AggregationData > ( ) ; for ( Entry < ? extends List < /* @ Nullable */
TagValue > , ? extends AggregationData > entry : map . entrySet ( ) ) { checkAggregation ( view . getAggregation ( ) , entry . getValue ( ) , view . getMeasure ( ) ) ; deepCopy . put ( Collections . unmodifiableList ( new ArrayList < /* @ Nullable */
TagValue > ( entry . getKey ( ) ) ) , entry . getValue ( ) ) ; } return createInternal ( view , Collections . unmodifiableMap ( deepCopy ) , AggregationWindowData . CumulativeData . create ( start , end ) , start , end ) ; |
public class GregorianCalendar { /** * Returns the Julian calendar system instance ( singleton ) . ' jcal '
* and ' jeras ' are set upon the return . */
private static synchronized BaseCalendar getJulianCalendarSystem ( ) { } } | if ( jcal == null ) { jcal = ( JulianCalendar ) CalendarSystem . forName ( "julian" ) ; jeras = jcal . getEras ( ) ; } return jcal ; |
public class AbstractFixture { /** * < p > getGetter . < / p >
* @ param type a { @ link java . lang . Class } object .
* @ param name a { @ link java . lang . String } object .
* @ return a { @ link java . lang . reflect . Method } object . */
protected Method getGetter ( Class type , String name ) { } } | return introspector ( type ) . getGetter ( toJavaIdentifierForm ( name ) ) ; |
public class TermsByQueryResponse { /** * Deserialize
* @ param in the input
* @ throws IOException */
@ Override public void readFrom ( StreamInput in ) throws IOException { } } | super . readFrom ( in ) ; isPruned = in . readBoolean ( ) ; size = in . readVInt ( ) ; termsEncoding = TermsByQueryRequest . TermsEncoding . values ( ) [ in . readVInt ( ) ] ; encodedTerms = in . readBytesRef ( ) ; |
public class ExampleUtils { /** * Converts { @ code data } into a list of { @ code Example } s . Each element of
* { @ code data } should be an array of length 2 , where the first value is the
* inputVar and the second value is the outputVar of the corresponding example .
* @ param data
* @ return */
public static List < Example < String , String > > exampleArrayToList ( String [ ] [ ] data ) { } } | List < Example < String , String > > pairs = Lists . newArrayList ( ) ; for ( int i = 0 ; i < data . length ; i ++ ) { pairs . add ( new Example < String , String > ( data [ i ] [ 0 ] , data [ i ] [ 1 ] ) ) ; } return pairs ; |
public class VirtualRangeModel { /** * Informs the virtual range model the extent of the area over which
* we can scroll . */
public void setScrollableArea ( int x , int y , int width , int height ) { } } | Rectangle vb = _panel . getViewBounds ( ) ; int hmax = x + width , vmax = y + height , value ; if ( width > vb . width ) { value = MathUtil . bound ( x , _hrange . getValue ( ) , hmax - vb . width ) ; _hrange . setRangeProperties ( value , vb . width , x , hmax , false ) ; } else { // Let ' s center it and lock it down .
int newx = x - ( vb . width - width ) / 2 ; _hrange . setRangeProperties ( newx , 0 , newx , newx , false ) ; } if ( height > vb . height ) { value = MathUtil . bound ( y , _vrange . getValue ( ) , vmax - vb . height ) ; _vrange . setRangeProperties ( value , vb . height , y , vmax , false ) ; } else { // Let ' s center it and lock it down .
int newy = y - ( vb . height - height ) / 2 ; _vrange . setRangeProperties ( newy , 0 , newy , newy , false ) ; } |
public class CssSmartSpritesResourceReader { /** * ( non - Javadoc )
* @ see net . jawr . web . resource . handler . reader . StreamResourceReader #
* getResourceAsStream ( net . jawr . web . resource . bundle . JoinableResourceBundle ,
* java . lang . String , boolean ) */
@ Override public InputStream getResourceAsStream ( String resourceName , boolean processingBundle ) { } } | String path = resourceName ; GeneratorRegistry generatorRegistry = jawrConfig . getGeneratorRegistry ( ) ; if ( generatorRegistry . isGeneratedBinaryResource ( path ) ) { path = path . replace ( ':' , '/' ) ; path = JawrConstant . SPRITE_GENERATED_IMG_DIR + path ; } return ( ( StreamResourceReader ) resourceReader ) . getResourceAsStream ( path , processingBundle ) ; |
public class AmazonEC2Client { /** * When you no longer want to use an On - Demand Dedicated Host it can be released . On - Demand billing is stopped and
* the host goes into < code > released < / code > state . The host ID of Dedicated Hosts that have been released can no
* longer be specified in another request , for example , to modify the host . You must stop or terminate all instances
* on a host before it can be released .
* When Dedicated Hosts are released , it may take some time for them to stop counting toward your limit and you may
* receive capacity errors when trying to allocate new Dedicated Hosts . Wait a few minutes and then try again .
* Released hosts still appear in a < a > DescribeHosts < / a > response .
* @ param releaseHostsRequest
* @ return Result of the ReleaseHosts operation returned by the service .
* @ sample AmazonEC2 . ReleaseHosts
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / ReleaseHosts " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public ReleaseHostsResult releaseHosts ( ReleaseHostsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeReleaseHosts ( request ) ; |
public class WMessagesProxy { /** * Utility method that searches for the WMessages instance for the given component . If not found , a warning will be
* logged and null returned .
* @ return the WMessages instance for the given component , or null if not found . */
private WMessages getWMessageInstance ( ) { } } | MessageContainer container = getMessageContainer ( component ) ; WMessages result = null ; if ( container == null ) { LOG . warn ( "No MessageContainer as ancestor of " + component + ". Messages will not be added" ) ; } else { result = container . getMessages ( ) ; if ( result == null ) { LOG . warn ( "No messages in container of " + component + ". Messages will not be added" ) ; } } return result ; |
public class NumberExpression { /** * Create a { @ code min ( this ) } expression
* < p > Get the minimum value of this expression ( aggregation ) < / p >
* @ return min ( this ) */
@ SuppressWarnings ( "unchecked" ) public NumberExpression < T > min ( ) { } } | if ( min == null ) { min = Expressions . numberOperation ( getType ( ) , Ops . AggOps . MIN_AGG , mixin ) ; } return min ; |
public class TcasesMojo { /** * If the given path is not absolute , returns it as an absolute path relative to the
* project base directory . Otherwise , returns the given absolute path . */
private File getBaseDir ( File path ) { } } | return path == null ? baseDir_ : path . isAbsolute ( ) ? path : new File ( baseDir_ , path . getPath ( ) ) ; |
public class EndpointUtils { /** * Get the list of all eureka service urls from properties file for the eureka client to talk to .
* @ param clientConfig the clientConfig to use
* @ param instanceZone The zone in which the client resides
* @ param preferSameZone true if we have to prefer the same zone as the client , false otherwise
* @ return The list of all eureka service urls for the eureka client to talk to */
public static List < String > getServiceUrlsFromConfig ( EurekaClientConfig clientConfig , String instanceZone , boolean preferSameZone ) { } } | List < String > orderedUrls = new ArrayList < String > ( ) ; String region = getRegion ( clientConfig ) ; String [ ] availZones = clientConfig . getAvailabilityZones ( clientConfig . getRegion ( ) ) ; if ( availZones == null || availZones . length == 0 ) { availZones = new String [ 1 ] ; availZones [ 0 ] = DEFAULT_ZONE ; } logger . debug ( "The availability zone for the given region {} are {}" , region , availZones ) ; int myZoneOffset = getZoneOffset ( instanceZone , preferSameZone , availZones ) ; List < String > serviceUrls = clientConfig . getEurekaServerServiceUrls ( availZones [ myZoneOffset ] ) ; if ( serviceUrls != null ) { orderedUrls . addAll ( serviceUrls ) ; } int currentOffset = myZoneOffset == ( availZones . length - 1 ) ? 0 : ( myZoneOffset + 1 ) ; while ( currentOffset != myZoneOffset ) { serviceUrls = clientConfig . getEurekaServerServiceUrls ( availZones [ currentOffset ] ) ; if ( serviceUrls != null ) { orderedUrls . addAll ( serviceUrls ) ; } if ( currentOffset == ( availZones . length - 1 ) ) { currentOffset = 0 ; } else { currentOffset ++ ; } } if ( orderedUrls . size ( ) < 1 ) { throw new IllegalArgumentException ( "DiscoveryClient: invalid serviceUrl specified!" ) ; } return orderedUrls ; |
public class ST_Reverse3DLine { /** * Reverses a multilinestring according to z value . If asc : the z first
* point must be lower than the z end point if desc : the z first point must
* be greater than the z end point
* @ param multiLineString
* @ return */
public static MultiLineString reverse3D ( MultiLineString multiLineString , String order ) { } } | int num = multiLineString . getNumGeometries ( ) ; LineString [ ] lineStrings = new LineString [ num ] ; for ( int i = 0 ; i < multiLineString . getNumGeometries ( ) ; i ++ ) { lineStrings [ i ] = reverse3D ( ( LineString ) multiLineString . getGeometryN ( i ) , order ) ; } return FACTORY . createMultiLineString ( lineStrings ) ; |
public class GroovyInternalPosixParser { /** * Add the special token " < b > - - < / b > " and the current < code > value < / code >
* to the processed tokens list . Then add all the remaining
* < code > argument < / code > values to the processed tokens list .
* @ param value The current token */
private void processNonOptionToken ( String value , boolean stopAtNonOption ) { } } | if ( stopAtNonOption && ( currentOption == null || ! currentOption . hasArg ( ) ) ) { eatTheRest = true ; tokens . add ( "--" ) ; } tokens . add ( value ) ; currentOption = null ; |
public class AbstractMemberWriter { /** * Return true if the given < code > ProgramElement < / code > is inherited
* by the class that is being documented .
* @ param ped The < code > ProgramElement < / code > being checked .
* return true if the < code > ProgramElement < / code > is being inherited and
* false otherwise . */
protected boolean isInherited ( ProgramElementDoc ped ) { } } | if ( ped . isPrivate ( ) || ( ped . isPackagePrivate ( ) && ! ped . containingPackage ( ) . equals ( classdoc . containingPackage ( ) ) ) ) { return false ; } return true ; |
public class SingleOutputStreamOperator { /** * Sets the parallelism and maximum parallelism of this operator to one .
* And mark this operator cannot set a non - 1 degree of parallelism .
* @ return The operator with only one parallelism . */
@ PublicEvolving public SingleOutputStreamOperator < T > forceNonParallel ( ) { } } | transformation . setParallelism ( 1 ) ; transformation . setMaxParallelism ( 1 ) ; nonParallel = true ; return this ; |
public class ContentSpec { /** * Sets the DTD for a Content Specification .
* @ param format The DTD of the Content Specification . */
public void setFormat ( final String format ) { } } | if ( format == null && this . format == null ) { return ; } else if ( format == null ) { removeChild ( this . format ) ; this . format = null ; } else if ( this . format == null ) { this . format = new KeyValueNode < String > ( CommonConstants . CS_FORMAT_TITLE , format ) ; appendChild ( this . format , false ) ; } else { this . format . setValue ( format ) ; } |
public class EntityAssociationUpdater { /** * Returns the object referenced by the specified property ( which represents an association ) . */
private Object getReferencedEntity ( int propertyIndex ) { } } | Object referencedEntity = null ; GridType propertyType = persister . getGridPropertyTypes ( ) [ propertyIndex ] ; Serializable id = ( Serializable ) propertyType . hydrate ( resultset , persister . getPropertyColumnNames ( propertyIndex ) , session , null ) ; if ( id != null ) { EntityPersister hostingEntityPersister = session . getFactory ( ) . getMetamodel ( ) . entityPersister ( propertyType . getReturnedClass ( ) ) ; // OGM - 931 Loading the entity through Session # get ( ) to make sure it is fetched from the store if it is
// detached atm . but also to benefit from 2L caching etc .
Class < ? > entityType = hostingEntityPersister . getMappedClass ( ) ; referencedEntity = ( ( Session ) session ) . get ( entityType , id ) ; // In case the entity is scheduled for deletion , obtain it from the PC
if ( referencedEntity == null ) { referencedEntity = session . getPersistenceContext ( ) . getEntity ( session . generateEntityKey ( id , hostingEntityPersister ) ) ; } } return referencedEntity ; |
public class MapBuilder { /** * Adds the number value to the provided map under the provided field name ,
* if it should be included . The supplier is only invoked if the field is to be included . */
public MapBuilder addNumber ( String fieldName , boolean include , Supplier < Number > supplier ) { } } | if ( include ) { Number value = supplier . get ( ) ; if ( value != null ) { map . put ( getFieldName ( fieldName ) , value ) ; } } return this ; |
public class AbstractPositioning { /** * Calls { @ link # draw ( com . itextpdf . text . pdf . PdfContentByte , float , float , float , float , String ) } with rect . getLeft ( )
* + getShiftx ( ) , rect . getTop ( ) + getShifty ( ) , rect . getWidth ( ) , rect . getHeight ( ) , genericTag . When { @ link # isShadow ( )
* } is true { @ link # isDrawShadow ( ) } will be set to true , prior to calling
* { @ link # draw ( com . itextpdf . text . pdf . PdfContentByte , float , float , float , float , java . lang . String ) } and to false
* afterwards .
* @ param rect
* @ param genericTag passed on to abstract method
* @ throws VectorPrintException
* @ see EventHelper # onGenericTag ( com . itextpdf . text . pdf . PdfWriter , com . itextpdf . text . Document ,
* com . itextpdf . text . Rectangle , java . lang . String ) */
@ Override public final void draw ( Rectangle rect , String genericTag ) throws VectorPrintException { } } | if ( getValue ( SHADOW , Boolean . class ) ) { drawShadow ( rect . getLeft ( ) + getShiftx ( ) , rect . getTop ( ) + getShifty ( ) , rect . getWidth ( ) , rect . getHeight ( ) , genericTag ) ; } PdfContentByte canvas = getPreparedCanvas ( ) ; draw ( canvas , rect . getLeft ( ) + getShiftx ( ) , rect . getTop ( ) + getShifty ( ) , rect . getWidth ( ) , rect . getHeight ( ) , genericTag ) ; resetCanvas ( canvas ) ; |
public class Math { /** * L2 vector norm . */
public static double norm2 ( double [ ] x ) { } } | double norm = 0.0 ; for ( double n : x ) { norm += n * n ; } norm = Math . sqrt ( norm ) ; return norm ; |
public class JsonIOUtil { /** * Creates a { @ link UTF8JsonGenerator } for the outputstream with the supplied buf { @ code outBuffer } to use . */
public static UTF8JsonGenerator newJsonGenerator ( OutputStream out , byte [ ] buf ) { } } | return newJsonGenerator ( out , buf , 0 , false , new IOContext ( DEFAULT_JSON_FACTORY . _getBufferRecycler ( ) , out , false ) ) ; |
public class CmsObject { /** * Replaces the content , type and properties of a resource . < p >
* @ param resourcename the name of the resource to replace ( full current site relative path )
* @ param type the new type of the resource
* @ param content the new content of the resource
* @ param properties the new properties of the resource
* @ throws CmsException if something goes wrong
* @ deprecated
* Use { @ link # replaceResource ( String , I _ CmsResourceType , byte [ ] , List ) } instead .
* Resource types should always be referenced either by its type class ( preferred ) or by type name .
* Use of int based resource type references will be discontinued in a future OpenCms release . */
@ Deprecated public void replaceResource ( String resourcename , int type , byte [ ] content , List < CmsProperty > properties ) throws CmsException { } } | replaceResource ( resourcename , getResourceType ( type ) , content , properties ) ; |
public class StateController { /** * Restricts state ' s translation and zoom bounds .
* @ param state State to be restricted
* @ param prevState Previous state to calculate overscroll and overzoom ( optional )
* @ param pivotX Pivot ' s X coordinate
* @ param pivotY Pivot ' s Y coordinate
* @ param allowOverscroll Whether overscroll is allowed
* @ param allowOverzoom Whether overzoom is allowed
* @ param restrictRotation Whether rotation should be restricted to a nearest N * 90 angle
* @ return End state to animate changes or null if no changes are required . */
@ SuppressWarnings ( "SameParameterValue" ) // Using same method params as in restrictStateBounds
@ Nullable State restrictStateBoundsCopy ( State state , State prevState , float pivotX , float pivotY , boolean allowOverscroll , boolean allowOverzoom , boolean restrictRotation ) { } } | tmpState . set ( state ) ; boolean changed = restrictStateBounds ( tmpState , prevState , pivotX , pivotY , allowOverscroll , allowOverzoom , restrictRotation ) ; return changed ? tmpState . copy ( ) : null ; |
public class RetryHandlingMetaMasterMasterClient { /** * Registers with the leader master .
* @ param masterId the master id of the standby master registering
* @ param configList the configuration of this master */
public void register ( final long masterId , final List < ConfigProperty > configList ) throws IOException { } } | retryRPC ( ( ) -> { mClient . registerMaster ( RegisterMasterPRequest . newBuilder ( ) . setMasterId ( masterId ) . setOptions ( RegisterMasterPOptions . newBuilder ( ) . addAllConfigs ( configList ) . build ( ) ) . build ( ) ) ; return null ; } ) ; |
public class BoxFile { /** * Checks if the file can be successfully uploaded by using the preflight check .
* @ param name the name to give the uploaded file or null to use existing name .
* @ param fileSize the size of the file used for account capacity calculations .
* @ param parentID the ID of the parent folder that the new version is being uploaded to .
* @ deprecated This method will be removed in future versions of the SDK ; use canUploadVersion ( String , long ) instead */
@ Deprecated public void canUploadVersion ( String name , long fileSize , String parentID ) { } } | URL url = CONTENT_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( this . getAPI ( ) , url , "OPTIONS" ) ; JsonObject parent = new JsonObject ( ) ; parent . add ( "id" , parentID ) ; JsonObject preflightInfo = new JsonObject ( ) ; preflightInfo . add ( "parent" , parent ) ; if ( name != null ) { preflightInfo . add ( "name" , name ) ; } preflightInfo . add ( "size" , fileSize ) ; request . setBody ( preflightInfo . toString ( ) ) ; BoxAPIResponse response = request . send ( ) ; response . disconnect ( ) ; |
public class ManagerConnectionImpl { /** * This method is called by the reader whenever a { @ link ManagerResponse } is
* received . The response is dispatched to the associated
* { @ link SendActionCallback } .
* @ param response the response received by the reader
* @ see ManagerReader */
public void dispatchResponse ( ManagerResponse response ) { } } | final String actionId ; String internalActionId ; SendActionCallback listener ; // shouldn ' t happen
if ( response == null ) { logger . error ( "Unable to dispatch null response. This should never happen. Please file a bug." ) ; return ; } actionId = response . getActionId ( ) ; internalActionId = null ; listener = null ; if ( actionId != null ) { internalActionId = ManagerUtil . getInternalActionId ( actionId ) ; response . setActionId ( ManagerUtil . stripInternalActionId ( actionId ) ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Dispatching response with internalActionId '" + internalActionId + "':\n" + response ) ; } if ( internalActionId != null ) { synchronized ( this . responseListeners ) { listener = responseListeners . get ( internalActionId ) ; if ( listener != null ) { this . responseListeners . remove ( internalActionId ) ; } else { // when using the async sendAction it ' s ok not to register a
// callback so if we don ' t find a response handler thats ok
logger . debug ( "No response listener registered for " + "internalActionId '" + internalActionId + "'" ) ; } } } else { logger . error ( "Unable to retrieve internalActionId from response: " + "actionId '" + actionId + "':\n" + response ) ; } if ( listener != null ) { try { listener . onResponse ( response ) ; } catch ( Exception e ) { logger . warn ( "Unexpected exception in response listener " + listener . getClass ( ) . getName ( ) , e ) ; } } |
public class FilteredAggregatorFactory { /** * See https : / / github . com / apache / incubator - druid / pull / 6219 # pullrequestreview - 148919845 */
@ JsonProperty @ Override public String getName ( ) { } } | String name = this . name ; if ( Strings . isNullOrEmpty ( name ) ) { name = delegate . getName ( ) ; } return name ; |
public class AndroidCryptoUtils { /** * / * ( non - Javadoc )
* @ see zorg . platform . CryptoUtils # createHMACSHA1 ( byte [ ] ) */
@ Override public HMAC createHMACSHA1 ( byte [ ] hmacKey ) throws CryptoException { } } | try { return new BCHmacAdapter ( hmacKey , "SHA1" ) ; } catch ( Exception e ) { AndroidPlatform . getInstance ( ) . getLogger ( ) . logException ( e . getMessage ( ) ) ; return null ; } |
public class Parser { /** * A { @ link Parser } that undoes any partial match if { @ code this } fails . In other words , the
* parser either fully matches , or matches none . */
public final Parser < T > atomic ( ) { } } | return new Parser < T > ( ) { @ Override public Parser < T > label ( String name ) { return Parser . this . label ( name ) . atomic ( ) ; } @ Override boolean apply ( ParseContext ctxt ) { int at = ctxt . at ; int step = ctxt . step ; boolean r = Parser . this . apply ( ctxt ) ; if ( r ) ctxt . step = step + 1 ; else ctxt . setAt ( step , at ) ; return r ; } @ Override public String toString ( ) { return Parser . this . toString ( ) ; } } ; |
public class WebSocketExtension { /** * Compose a String from a list of extensions to be used in the response of a protocol negotiation .
* @ see io . undertow . util . Headers
* @ param extensions list of { @ link WebSocketExtension }
* @ return a string representation of the extensions */
public static String toExtensionHeader ( final List < WebSocketExtension > extensions ) { } } | StringBuilder extensionsHeader = new StringBuilder ( ) ; if ( extensions != null && extensions . size ( ) > 0 ) { Iterator < WebSocketExtension > it = extensions . iterator ( ) ; while ( it . hasNext ( ) ) { WebSocketExtension extension = it . next ( ) ; extensionsHeader . append ( extension . getName ( ) ) ; for ( Parameter param : extension . getParameters ( ) ) { extensionsHeader . append ( "; " ) . append ( param . getName ( ) ) ; if ( param . getValue ( ) != null && param . getValue ( ) . length ( ) > 0 ) { extensionsHeader . append ( "=" ) . append ( param . getValue ( ) ) ; } } if ( it . hasNext ( ) ) { extensionsHeader . append ( ", " ) ; } } } return extensionsHeader . toString ( ) ; |
public class JmsTransporter { /** * - - - PUBLISH - - - */
@ Override public void publish ( String channel , Tree message ) { } } | if ( client != null ) { try { if ( debug && ( debugHeartbeats || ! channel . endsWith ( heartbeatChannel ) ) ) { logger . info ( "Submitting message to channel \"" + channel + "\":\r\n" + message . toString ( ) ) ; } TopicPublisher publisher = createOrGetPublisher ( channel ) ; BytesMessage msg = session . createBytesMessage ( ) ; msg . writeBytes ( serializer . write ( message ) ) ; if ( transacted ) { synchronized ( this ) { try { publisher . send ( msg , deliveryMode , priority , ttl ) ; session . commit ( ) ; } catch ( Exception cause ) { try { session . rollback ( ) ; } catch ( Exception ignored ) { } throw cause ; } } } else { publisher . send ( msg , deliveryMode , priority , ttl ) ; } } catch ( Exception cause ) { logger . warn ( "Unable to send message to JMS server!" , cause ) ; } } |
public class ModelsImpl { /** * Gets information about the application version models .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param listModelsOptionalParameter the object representing the optional parameters to be set before calling this API
* @ 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 List & lt ; ModelInfoResponse & gt ; object if successful . */
public List < ModelInfoResponse > listModels ( UUID appId , String versionId , ListModelsOptionalParameter listModelsOptionalParameter ) { } } | return listModelsWithServiceResponseAsync ( appId , versionId , listModelsOptionalParameter ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class Quaterniond { /** * / * ( non - Javadoc )
* @ see org . joml . Quaterniondc # rotateAxis ( double , org . joml . Vector3dc , org . joml . Quaterniond ) */
public Quaterniond rotateAxis ( double angle , Vector3dc axis , Quaterniond dest ) { } } | return rotateAxis ( angle , axis . x ( ) , axis . y ( ) , axis . z ( ) , dest ) ; |
public class ServerSessionManager { /** * Unregisters a session . */
ServerSessionContext unregisterSession ( long sessionId ) { } } | ServerSessionContext session = sessions . remove ( sessionId ) ; if ( session != null ) { clients . remove ( session . client ( ) , session ) ; connections . remove ( session . client ( ) , session . getConnection ( ) ) ; } return session ; |
public class MariaDbStatement { /** * Executes the given SQL statement and signals the driver with the given flag about whether the
* auto - generated keys produced by this < code > Statement < / code > object should be made available for
* retrieval . The driver will ignore the flag if the SQL statement is not an
* < code > INSERT < / code > statement , or an SQL statement able to return auto - generated keys ( the
* list of such statements is vendor - specific ) .
* @ param sql an SQL Data Manipulation Language ( DML ) statement , such as
* < code > INSERT < / code > ,
* < code > UPDATE < / code > or < code > DELETE < / code > ; or an
* SQL statement that returns nothing , such as a DDL statement .
* @ param autoGeneratedKeys a flag indicating whether auto - generated keys should be made available
* for retrieval ; one of the following constants :
* < code > Statement . RETURN _ GENERATED _ KEYS < / code > < code > Statement . NO _ GENERATED _ KEYS < / code >
* @ return either ( 1 ) the row count for SQL Data Manipulation Language ( DML ) statements or ( 2 ) 0
* for SQL statements that return nothing
* @ throws SQLException if a database access error occurs , this method is
* called on a closed
* < code > Statement < / code > , the given SQL
* statement returns a < code > ResultSet < / code > object , or
* the given constant is not one of those allowed */
public int executeUpdate ( final String sql , final int autoGeneratedKeys ) throws SQLException { } } | if ( executeInternal ( sql , fetchSize , autoGeneratedKeys ) ) { return 0 ; } return getUpdateCount ( ) ; |
public class Defaultr { /** * Top level standalone Defaultr method .
* @ param input JSON object to have defaults applied to . This will be modified .
* @ return the modified input */
@ Override public Object transform ( Object input ) { } } | if ( input == null ) { // if null , assume HashMap
input = new HashMap ( ) ; } // TODO : Make copy of the defaultee or like shiftr create a new output object
if ( input instanceof List ) { if ( arrayRoot == null ) { throw new TransformException ( "The Spec provided can not handle input that is a top level Json Array." ) ; } arrayRoot . applyChildren ( input ) ; } else { mapRoot . applyChildren ( input ) ; } return input ; |
public class TopicAclTraversalResults { /** * Method checkPermission
* Used to determine whether a user is allowed to perform a particular
* operation .
* @ param user The user
* @ param operation The subscribe or publish operation
* @ return boolean The result of the permission check . */
public boolean checkPermission ( Principal user , int operation ) { } } | if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "checkPermission" , new Object [ ] { user , new Integer ( operation ) } ) ; boolean allowed = false ; if ( operation == 1 ) // a publish operation
{ // check whether permission has been granted to special group Everyone .
// We can do this before we check whether the user is authenticated
if ( accumGroupAllowedToPublish . size ( ) > 0 && accumGroupAllowedToPublish . contains ( everyone ) ) { allowed = true ; } // Now check whether the user is authenticated , ie we have a username
else if ( user . getName ( ) != null && user . getName ( ) . length ( ) > 0 ) { // User is authenticated
// Check user list next
if ( accumUsersAllowedToPublish . size ( ) > 0 && accumUsersAllowedToPublish . contains ( user ) ) { allowed = true ; } else // Now check the groups
{ if ( accumGroupAllowedToPublish . size ( ) > 0 ) { // user hasn ' t been granted access directly , check the groups
// check for AllAuthenticated first
if ( accumGroupAllowedToPublish . contains ( allAuthenticated ) ) { allowed = true ; } else { Iterator itr = accumGroupAllowedToPublish . iterator ( ) ; while ( itr . hasNext ( ) ) { Group group = ( Group ) itr . next ( ) ; if ( group . isMember ( user ) ) { allowed = true ; break ; } } // eof while
} } } } } else // a subscribe operation
{ // check whether permission has been granted to special group Everyone .
// We can do this before we check whether the user is authenticated
if ( accumGroupAllowedToSubscribe . size ( ) > 0 && accumGroupAllowedToSubscribe . contains ( everyone ) ) { allowed = true ; } // Now check whether the user is authenticated , ie we have a username
else if ( user . getName ( ) != null && user . getName ( ) . length ( ) > 0 ) { // User is authenticated
// Check user list next
if ( accumUsersAllowedToSubscribe . size ( ) > 0 && accumUsersAllowedToSubscribe . contains ( user ) ) { allowed = true ; } else // Now check the groups
{ if ( accumGroupAllowedToSubscribe . size ( ) > 0 ) { // user hasn ' t been granted access directly , check the groups
// check for AllAuthenticated first
if ( accumGroupAllowedToSubscribe . contains ( allAuthenticated ) ) { allowed = true ; } else { Iterator itr = accumGroupAllowedToSubscribe . iterator ( ) ; while ( itr . hasNext ( ) ) { Group group = ( Group ) itr . next ( ) ; if ( group . isMember ( user ) ) { allowed = true ; break ; } } } } } } } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "checkPermission" , new Boolean ( allowed ) ) ; return allowed ; |
public class GreenPepperXmlRpcClient { /** * { @ inheritDoc } */
@ SuppressWarnings ( "unchecked" ) public RequirementSummary getSummary ( Requirement requirement , String identifier ) throws GreenPepperServerException { } } | Vector params = CollectionUtil . toVector ( requirement . marshallize ( ) ) ; Vector < Object > compilParams = ( Vector < Object > ) execute ( XmlRpcMethodName . getRequirementSummary , params , identifier ) ; log . debug ( "Getting Requirement " + requirement . getName ( ) + " summary" ) ; return XmlRpcDataMarshaller . toRequirementSummary ( compilParams ) ; |
public class GSAConfiguration { /** * Adds a data set as a broadcast set to the apply function .
* @ param name The name under which the broadcast data is available in the apply function .
* @ param data The data set to be broadcast . */
public void addBroadcastSetForApplyFunction ( String name , DataSet < ? > data ) { } } | this . bcVarsApply . add ( new Tuple2 < > ( name , data ) ) ; |
public class DataUnitBuilder { /** * Returns the transport layer service of a given protocol data unit .
* @ param tpdu transport layer protocol data unit
* @ return TPDU service code */
public static int getTPDUService ( final byte [ ] tpdu ) { } } | final int ctrl = tpdu [ 0 ] & 0xff ; if ( ( ctrl & 0xFC ) == 0 ) return 0 ; // 0x04 is tag _ group service code , not used by us
if ( ( ctrl & 0xFC ) == 0x04 ) return 0x04 ; if ( ( ctrl & 0xC0 ) == 0x40 ) return T_DATA_CONNECTED ; if ( ctrl == T_CONNECT ) return T_CONNECT ; if ( ctrl == T_DISCONNECT ) return T_DISCONNECT ; if ( ( ctrl & 0xC3 ) == T_ACK ) return T_ACK ; if ( ( ctrl & 0xC3 ) == T_NAK ) return T_NAK ; logger . warn ( "unknown TPCI service code 0x" + Integer . toHexString ( ctrl ) ) ; return ctrl ; |
public class AsyncTwitterImpl { /** * / * Favorites Resources */
@ Override public void getFavorites ( ) { } } | getDispatcher ( ) . invokeLater ( new AsyncTask ( FAVORITES , listeners ) { @ Override public void invoke ( List < TwitterListener > listeners ) throws TwitterException { ResponseList < Status > statuses = twitter . getFavorites ( ) ; for ( TwitterListener listener : listeners ) { try { listener . gotFavorites ( statuses ) ; } catch ( Exception e ) { logger . warn ( "Exception at getFavorites" , e ) ; } } } } ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.