signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class TangoAttribute { /** * Extract data and format it as followed : \ n SCALAR : ex : 1 SPECTRUM : one
* line separated by separator . \ n ex : 1 3 5 IMAGE : x lines and y colums
* separated by endSeparator . \ n ex : 3 5 8 5 6 9
* @ param separator
* @ param endSeparator
* @ return
* @ throws DevFailed */
public String extractToString ( final String separator , final String endSeparator ) throws DevFailed { } }
|
logger . debug ( LOG_EXTRACTING , this ) ; return attributeImpl . extractToString ( separator , endSeparator ) ;
|
public class ApplicationHostService { /** * Returns the set of application hosts with the given query parameters .
* @ param applicationId The application id
* @ param queryParams The query parameters
* @ return The set of application hosts */
public Collection < ApplicationHost > list ( long applicationId , List < String > queryParams ) { } }
|
return HTTP . GET ( String . format ( "/v2/applications/%d/hosts.json" , applicationId ) , null , queryParams , APPLICATION_HOSTS ) . get ( ) ;
|
public class RRBudget10V1_3Generator { /** * This method gets BudgetYearDataType details like
* BudgetPeriodStartDate , BudgetPeriodEndDate , BudgetPeriod
* KeyPersons , OtherPersonnel , TotalCompensation , Equipment , ParticipantTraineeSupportCosts , Travel , OtherDirectCosts
* DirectCosts , IndirectCosts , CognizantFederalAgency , TotalCosts based on
* BudgetPeriodInfo for the RRBudget1013.
* @ param periodInfo
* ( BudgetPeriodInfo ) budget period entry . */
private void setBudgetYearDataType ( RRBudget1013 rrBudget , BudgetPeriodDto periodInfo ) { } }
|
BudgetYearDataType budgetYear = rrBudget . addNewBudgetYear ( ) ; if ( periodInfo != null ) { budgetYear . setBudgetPeriodStartDate ( s2SDateTimeService . convertDateToCalendar ( periodInfo . getStartDate ( ) ) ) ; budgetYear . setBudgetPeriodEndDate ( s2SDateTimeService . convertDateToCalendar ( periodInfo . getEndDate ( ) ) ) ; budgetYear . setKeyPersons ( getKeyPersons ( periodInfo ) ) ; budgetYear . setOtherPersonnel ( getOtherPersonnel ( periodInfo ) ) ; if ( periodInfo . getTotalCompensation ( ) != null ) { budgetYear . setTotalCompensation ( periodInfo . getTotalCompensation ( ) . bigDecimalValue ( ) ) ; } budgetYear . setEquipment ( getEquipment ( periodInfo ) ) ; budgetYear . setTravel ( getTravel ( periodInfo ) ) ; budgetYear . setParticipantTraineeSupportCosts ( getParticipantTraineeSupportCosts ( periodInfo ) ) ; budgetYear . setOtherDirectCosts ( getOtherDirectCosts ( periodInfo ) ) ; BigDecimal directCosts = periodInfo . getDirectCostsTotal ( ) . bigDecimalValue ( ) ; budgetYear . setDirectCosts ( directCosts ) ; IndirectCosts indirectCosts = getIndirectCosts ( periodInfo ) ; if ( indirectCosts != null ) { budgetYear . setIndirectCosts ( indirectCosts ) ; budgetYear . setTotalCosts ( periodInfo . getDirectCostsTotal ( ) . bigDecimalValue ( ) . add ( indirectCosts . getTotalIndirectCosts ( ) ) ) ; } else { budgetYear . setTotalCosts ( periodInfo . getDirectCostsTotal ( ) . bigDecimalValue ( ) ) ; } budgetYear . setCognizantFederalAgency ( periodInfo . getCognizantFedAgency ( ) ) ; }
|
public class AmazonEC2Waiters { /** * Builds a VolumeInUse waiter by using custom parameters waiterParameters and other parameters defined in the
* waiters specification , and then polls until it determines whether the resource entered the desired state or not ,
* where polling criteria is bound by either default polling strategy or custom polling strategy . */
public Waiter < DescribeVolumesRequest > volumeInUse ( ) { } }
|
return new WaiterBuilder < DescribeVolumesRequest , DescribeVolumesResult > ( ) . withSdkFunction ( new DescribeVolumesFunction ( client ) ) . withAcceptors ( new VolumeInUse . IsInuseMatcher ( ) , new VolumeInUse . IsDeletedMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ;
|
public class RecurlyClient { /** * Lookup all coupon redemptions on an invoice given query params .
* @ deprecated Prefer using Invoice # getId ( ) as the id param ( which is a String )
* @ param invoiceNumber invoice number
* @ param params { @ link QueryParams }
* @ return the coupon redemptions for this invoice on success , null otherwise */
@ Deprecated public Redemptions getCouponRedemptionsByInvoice ( final Integer invoiceNumber , final QueryParams params ) { } }
|
return getCouponRedemptionsByInvoice ( invoiceNumber . toString ( ) , params ) ;
|
public class RegExpImpl { /** * Used by js _ split to find the next split point in target ,
* starting at offset ip and looking either for the given
* separator substring , or for the next re match . ip and
* matchlen must be reference variables ( assumed to be arrays of
* length 1 ) so they can be updated in the leading whitespace or
* re case .
* Return - 1 on end of string , > = 0 for a valid index of the next
* separator occurrence if found , or the string length if no
* separator is found . */
private static int find_split ( Context cx , Scriptable scope , String target , String separator , int version , RegExpProxy reProxy , Scriptable re , int [ ] ip , int [ ] matchlen , boolean [ ] matched , String [ ] [ ] parensp ) { } }
|
int i = ip [ 0 ] ; int length = target . length ( ) ; /* * Perl4 special case for str . split ( ' ' ) , only if the user has selected
* JavaScript1.2 explicitly . Split on whitespace , and skip leading w / s .
* Strange but true , apparently modeled after awk . */
if ( version == Context . VERSION_1_2 && re == null && separator . length ( ) == 1 && separator . charAt ( 0 ) == ' ' ) { /* Skip leading whitespace if at front of str . */
if ( i == 0 ) { while ( i < length && Character . isWhitespace ( target . charAt ( i ) ) ) i ++ ; ip [ 0 ] = i ; } /* Don ' t delimit whitespace at end of string . */
if ( i == length ) return - 1 ; /* Skip over the non - whitespace chars . */
while ( i < length && ! Character . isWhitespace ( target . charAt ( i ) ) ) i ++ ; /* Now skip the next run of whitespace . */
int j = i ; while ( j < length && Character . isWhitespace ( target . charAt ( j ) ) ) j ++ ; /* Update matchlen to count delimiter chars . */
matchlen [ 0 ] = j - i ; return i ; } /* * Stop if past end of string . If at end of string , we will
* return target length , so that
* " ab , " . split ( ' , ' ) = > new Array ( " ab " , " " )
* and the resulting array converts back to the string " ab , "
* for symmetry . NB : This differs from perl , which drops the
* trailing empty substring if the LIMIT argument is omitted . */
if ( i > length ) return - 1 ; /* * Match a regular expression against the separator at or
* above index i . Return - 1 at end of string instead of
* trying for a match , so we don ' t get stuck in a loop . */
if ( re != null ) { return reProxy . find_split ( cx , scope , target , separator , re , ip , matchlen , matched , parensp ) ; } /* * Deviate from ECMA by never splitting an empty string by any separator
* string into a non - empty array ( an array of length 1 that contains the
* empty string ) . */
if ( version != Context . VERSION_DEFAULT && version < Context . VERSION_1_3 && length == 0 ) return - 1 ; /* * Special case : if sep is the empty string , split str into
* one character substrings . Let our caller worry about
* whether to split once at end of string into an empty
* substring .
* For 1.2 compatibility , at the end of the string , we return the length as
* the result , and set the separator length to 1 - - this allows the caller
* to include an additional null string at the end of the substring list . */
if ( separator . length ( ) == 0 ) { if ( version == Context . VERSION_1_2 ) { if ( i == length ) { matchlen [ 0 ] = 1 ; return i ; } return i + 1 ; } return ( i == length ) ? - 1 : i + 1 ; } /* Punt to j . l . s . indexOf ; return target length if separator is
* not found . */
if ( ip [ 0 ] >= length ) return length ; i = target . indexOf ( separator , ip [ 0 ] ) ; return ( i != - 1 ) ? i : length ;
|
public class MolecularFormulaManipulator { /** * Checks a set of Nodes for the occurrence of the isotopes in the
* molecular formula from a particular IElement . It returns 0 if the
* element does not exist . The search is based only on the IElement .
* @ param formula The MolecularFormula to check
* @ param element The IElement object
* @ return The occurrence of this element in this molecular formula */
public static int getElementCount ( IMolecularFormula formula , IElement element ) { } }
|
int count = 0 ; for ( IIsotope isotope : formula . isotopes ( ) ) { if ( isotope . getSymbol ( ) . equals ( element . getSymbol ( ) ) ) count += formula . getIsotopeCount ( isotope ) ; } return count ;
|
public class F4 { /** * Applies this partial function to the given argument when it is contained in the function domain .
* Applies fallback function where this partial function is not defined .
* @ param p1
* the first argument
* @ param p2
* the second argument
* @ param p3
* the third argument
* @ param p4
* the fourth argument
* @ param fallback
* the failover function to be called if application of this function failed with any
* runtime exception
* @ return a composite function that apply to this function first and if failed apply to the callback function */
public R applyOrElse ( P1 p1 , P2 p2 , P3 p3 , P4 p4 , F4 < ? super P1 , ? super P2 , ? super P3 , ? super P4 , ? extends R > fallback ) { } }
|
try { return apply ( p1 , p2 , p3 , p4 ) ; } catch ( RuntimeException e ) { return fallback . apply ( p1 , p2 , p3 , p4 ) ; }
|
public class OffHeapCache { /** * TODO : performance tuning for concurrent put . */
private AvaialbeSegment getAvailableSegment ( int size ) { } }
|
Deque < Segment > queue = null ; int blockSize = 0 ; if ( size <= 256 ) { queue = _queue256 ; blockSize = 256 ; } else if ( size <= 384 ) { queue = _queue384 ; blockSize = 384 ; } else if ( size <= 512 ) { queue = _queue512 ; blockSize = 512 ; } else if ( size <= 640 ) { queue = _queue640 ; blockSize = 640 ; } else if ( size <= 768 ) { queue = _queue768 ; blockSize = 768 ; } else if ( size <= 896 ) { queue = _queue896 ; blockSize = 896 ; } else if ( size <= 1024 ) { queue = _queue1024 ; blockSize = 1024 ; } else if ( size <= 1280 ) { queue = _queue1280 ; blockSize = 1280 ; } else if ( size <= 1536 ) { queue = _queue1536 ; blockSize = 1536 ; } else if ( size <= 1792 ) { queue = _queue1792 ; blockSize = 1792 ; } else if ( size <= 2048 ) { queue = _queue2048 ; blockSize = 2048 ; } else if ( size <= 2560 ) { queue = _queue2560 ; blockSize = 2560 ; } else if ( size <= 3072 ) { queue = _queue3072 ; blockSize = 3072 ; } else if ( size <= 3584 ) { queue = _queue3584 ; blockSize = 3584 ; } else if ( size <= 4096 ) { queue = _queue4096 ; blockSize = 4096 ; } else if ( size <= 5120 ) { queue = _queue5120 ; blockSize = 5120 ; } else if ( size <= 6144 ) { queue = _queue6144 ; blockSize = 6144 ; } else if ( size <= 7168 ) { queue = _queue7168 ; blockSize = 7168 ; } else if ( size <= 8192 ) { queue = _queue8192 ; blockSize = 8192 ; } else { throw new RuntimeException ( "Unsupported object size: " + size ) ; } Segment segment = null ; int availableBlockIndex = - 1 ; synchronized ( queue ) { Iterator < Segment > iterator = queue . iterator ( ) ; Iterator < Segment > descendingIterator = queue . descendingIterator ( ) ; int half = queue . size ( ) / 2 + 1 ; int cnt = 0 ; while ( iterator . hasNext ( ) && half -- > 0 ) { cnt ++ ; segment = iterator . next ( ) ; if ( ( availableBlockIndex = segment . allocate ( ) ) >= 0 ) { if ( cnt > 3 ) { iterator . remove ( ) ; queue . addFirst ( segment ) ; } break ; } segment = descendingIterator . next ( ) ; if ( ( availableBlockIndex = segment . allocate ( ) ) >= 0 ) { if ( cnt > 3 ) { descendingIterator . remove ( ) ; queue . addFirst ( segment ) ; } break ; } } if ( availableBlockIndex < 0 ) { synchronized ( _segmentBitSet ) { int nextSegmentIndex = _segmentBitSet . nextClearBit ( 0 ) ; if ( nextSegmentIndex >= _segments . length ) { return null ; // No space available ;
} segment = _segments [ nextSegmentIndex ] ; _segmentBitSet . set ( nextSegmentIndex ) ; _segmentQueueMap . put ( nextSegmentIndex , queue ) ; segment . sizeOfBlock = blockSize ; queue . addFirst ( segment ) ; availableBlockIndex = segment . allocate ( ) ; } } } return new AvaialbeSegment ( segment , availableBlockIndex ) ;
|
public class NNLatencyBenchmark { /** * Sets up clients before each benchmark */
private void setUp ( ) throws Exception { } }
|
try { fileSystem = ( DistributedFileSystem ) FileSystem . get ( StorageServiceConfigKeys . translateToOldSchema ( conf , nameserviceId ) , conf ) ; InetSocketAddress nameNodeAddr = fileSystem . getClient ( ) . getNameNodeAddr ( ) ; metaInfo = new RequestMetaInfo ( clusterId , nameserviceId , RequestMetaInfo . NO_NAMESPACE_ID , RequestMetaInfo . NO_APPLICATION_ID , ( UnixUserGroupInformation ) UserGroupInformation . getUGI ( this . conf ) ) ; directClientProtocol = RPC . getProxy ( ClientProtocol . class , ClientProtocol . versionID , nameNodeAddr , conf ) ; directClientProxyProtocol = RPC . getProxy ( ClientProxyProtocol . class , ClientProxyProtocol . versionID , nameNodeAddr , conf ) ; clientManager = new ThriftClientManager ( ) ; FramedClientConnector connector = new FramedClientConnector ( HostAndPort . fromParts ( proxyHostname , proxyPortThrift ) ) ; proxyTClientProxyProtocol = clientManager . createClient ( connector , TClientProxyProtocol . class ) . get ( ) ; proxyClientProxyProtocol = RPC . getProxy ( ClientProxyProtocol . class , ClientProxyProtocol . versionID , new InetSocketAddress ( proxyHostname , proxyPortRPC ) , conf ) ; fileSystem . mkdirs ( new Path ( ROOT ) ) ; } catch ( Exception e ) { tearDown ( ) ; throw e ; }
|
public class JavaParser { /** * src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1187:1 : additiveExpression : multiplicativeExpression ( ( ' + ' | ' - ' ) multiplicativeExpression ) * ; */
public final void additiveExpression ( ) throws RecognitionException { } }
|
int additiveExpression_StartIndex = input . index ( ) ; try { if ( state . backtracking > 0 && alreadyParsedRule ( input , 122 ) ) { return ; } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1188:5 : ( multiplicativeExpression ( ( ' + ' | ' - ' ) multiplicativeExpression ) * )
// src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1188:9 : multiplicativeExpression ( ( ' + ' | ' - ' ) multiplicativeExpression ) *
{ pushFollow ( FOLLOW_multiplicativeExpression_in_additiveExpression5410 ) ; multiplicativeExpression ( ) ; state . _fsp -- ; if ( state . failed ) return ; // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1188:34 : ( ( ' + ' | ' - ' ) multiplicativeExpression ) *
loop154 : while ( true ) { int alt154 = 2 ; int LA154_0 = input . LA ( 1 ) ; if ( ( LA154_0 == 40 || LA154_0 == 44 ) ) { alt154 = 1 ; } switch ( alt154 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1188:36 : ( ' + ' | ' - ' ) multiplicativeExpression
{ if ( input . LA ( 1 ) == 40 || input . LA ( 1 ) == 44 ) { input . consume ( ) ; state . errorRecovery = false ; state . failed = false ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } MismatchedSetException mse = new MismatchedSetException ( null , input ) ; throw mse ; } pushFollow ( FOLLOW_multiplicativeExpression_in_additiveExpression5422 ) ; multiplicativeExpression ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; default : break loop154 ; } } } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { // do for sure before leaving
if ( state . backtracking > 0 ) { memoize ( input , 122 , additiveExpression_StartIndex ) ; } }
|
public class OracleHelper { /** * < p > This method is used to reset a connection before it is returned to the connection pool for reuse .
* This method is called only if at least one of the following Oracle connection setter methods is invoked . < / p >
* < ul >
* < li > setDefaultExecuteBatch
* < li > setDefaultRowPrefetch
* < li > setDefaultTimeZone
* < li > setIncludeSynonyms
* < li > setRemarksReporting
* < li > setRestrictGetTables
* < li > setSessionTimeZone
* < / ul >
* @ param sqlConn the connection to attempt to cleanup
* @ param props the default properties to be applied to the connection
* @ return true if properties were successfully applied
* @ throws SQLException If an error occurs while cleaning up the connection . */
public boolean doConnectionVendorPropertyReset ( Connection sqlConn , Map < String , Object > props ) throws SQLException { } }
|
try { Class < ? > c = OracleConnection . get ( ) ; if ( c == null ) OracleConnection . set ( c = WSManagedConnectionFactoryImpl . priv . loadClass ( mcf . jdbcDriverLoader , oracle_jdbc_OracleConnection ) ) ; Method m ; m = setDefaultExecuteBatch . get ( ) ; if ( m == null ) setDefaultExecuteBatch . set ( m = c . getMethod ( "setDefaultExecuteBatch" , int . class ) ) ; m . invoke ( sqlConn , props . get ( "DefaultExecuteBatch" ) ) ; m = setDefaultRowPrefetch . get ( ) ; if ( m == null ) setDefaultRowPrefetch . set ( m = c . getMethod ( "setDefaultRowPrefetch" , int . class ) ) ; m . invoke ( sqlConn , props . get ( "DefaultRowPrefetch" ) ) ; if ( driverMajorVersion > 10 ) { m = setDefaultTimeZone . get ( ) ; if ( m == null ) setDefaultTimeZone . set ( m = c . getMethod ( "setDefaultTimeZone" , TimeZone . class ) ) ; m . invoke ( sqlConn , props . get ( "DefaultTimeZone" ) ) ; } m = setIncludeSynonyms . get ( ) ; if ( m == null ) setIncludeSynonyms . set ( m = c . getMethod ( "setIncludeSynonyms" , boolean . class ) ) ; m . invoke ( sqlConn , props . get ( "IncludeSynonyms" ) ) ; m = setRemarksReporting . get ( ) ; if ( m == null ) setRemarksReporting . set ( m = c . getMethod ( "setRemarksReporting" , boolean . class ) ) ; m . invoke ( sqlConn , props . get ( "RemarksReporting" ) ) ; m = setRestrictGetTables . get ( ) ; if ( m == null ) setRestrictGetTables . set ( m = c . getMethod ( "setRestrictGetTables" , boolean . class ) ) ; m . invoke ( sqlConn , props . get ( "RestrictGetTables" ) ) ; String s = ( String ) props . get ( "SessionTimeZone" ) ; if ( s == null ) { s = TimeZone . getDefault ( ) . getID ( ) ; } m = setSessionTimeZone . get ( ) ; if ( m == null ) setSessionTimeZone . set ( m = c . getMethod ( "setSessionTimeZone" , String . class ) ) ; m . invoke ( sqlConn , s ) ; } catch ( RuntimeException x ) { throw x ; } catch ( Exception x ) { throw AdapterUtil . toSQLException ( x ) ; } return true ;
|
public class WampSession { /** * Expose the object to synchronize on for the underlying session .
* @ return the session mutex to use ( never { @ code null } ) */
public Object getSessionMutex ( ) { } }
|
Object mutex = getAttribute ( SESSION_MUTEX_NAME ) ; if ( mutex == null ) { mutex = this . webSocketSession . getAttributes ( ) ; } return mutex ;
|
public class BindingValidator { /** * Validate if the { @ code configurationBean } object was bound successfully
* @ param configurationBean configurationBean to validate
* @ param type interface used to access { @ code configurationBean }
* @ param < T > type of the validated bean
* @ throws IllegalStateException when unable to access one of the methods
* @ throws NoSuchElementException when an invocation of one of the { @ code configurationBean } methods failed with an
* underlying exception of type { @ link NoSuchElementException }
* @ throws IllegalArgumentException when an invocation of one of the { @ code configurationBean } methods failed with an
* underlying exception of type { @ link IllegalArgumentException } */
public < T > void validate ( T configurationBean , Class < T > type ) { } }
|
LOG . debug ( "Validating configuration bean of type " + type ) ; for ( Method declaredMethod : type . getDeclaredMethods ( ) ) { try { LOG . debug ( "Validating method: " + declaredMethod . getName ( ) ) ; declaredMethod . invoke ( configurationBean ) ; } catch ( InvocationTargetException e ) { if ( e . getCause ( ) != null ) { if ( e . getCause ( ) instanceof NoSuchElementException ) { throw ( NoSuchElementException ) e . getCause ( ) ; } if ( e . getCause ( ) instanceof IllegalArgumentException ) { throw ( IllegalArgumentException ) e . getCause ( ) ; } } throw new IllegalStateException ( "Can't bind method " + declaredMethod . getName ( ) , e ) ; } catch ( IllegalAccessException e ) { throw new IllegalStateException ( "Can't bind method " + declaredMethod . getName ( ) , e ) ; } }
|
public class ApplicationProperties { /** * Get the specified property as an { @ link InputStream } .
* If the property is not set , then the specified default filename
* is searched for in the following locations , in order of precedence :
* 1 . Atlas configuration directory specified by the { @ link # ATLAS _ CONFIGURATION _ DIRECTORY _ PROPERTY } system property
* 2 . relative to the working directory if { @ link # ATLAS _ CONFIGURATION _ DIRECTORY _ PROPERTY } is not set
* 3 . as a classloader resource
* @ param configuration
* @ param propertyName
* @ param defaultFileName name of file to use by default if specified property is not set in the configuration - if null ,
* an { @ link AtlasException } is thrown if the property is not set
* @ return an { @ link InputStream }
* @ throws AtlasException if no file was found or if there was an error loading the file */
public static InputStream getFileAsInputStream ( Configuration configuration , String propertyName , String defaultFileName ) throws AtlasException { } }
|
File fileToLoad = null ; String fileName = configuration . getString ( propertyName ) ; if ( fileName == null ) { if ( defaultFileName == null ) { throw new AtlasException ( propertyName + " property not set and no default value specified" ) ; } fileName = defaultFileName ; String atlasConfDir = System . getProperty ( ATLAS_CONFIGURATION_DIRECTORY_PROPERTY ) ; if ( atlasConfDir != null ) { // Look for default filename in Atlas config directory
fileToLoad = new File ( atlasConfDir , fileName ) ; } else { // Look for default filename under the working directory
fileToLoad = new File ( fileName ) ; } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "{} property not set - defaulting to {}" , propertyName , fileToLoad . getPath ( ) ) ; } } else { // Look for configured filename
fileToLoad = new File ( fileName ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Using {} property setting: {}" , propertyName , fileToLoad . getPath ( ) ) ; } } InputStream inStr = null ; if ( fileToLoad . exists ( ) ) { try { inStr = new FileInputStream ( fileToLoad ) ; } catch ( FileNotFoundException e ) { throw new AtlasException ( "Error loading file " + fileName , e ) ; } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Loaded file from : {}" , fileToLoad . getPath ( ) ) ; } } else { // Look for file as class loader resource
inStr = Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( fileName ) ; if ( inStr == null ) { String msg = fileName + " not found in file system or as class loader resource" ; LOG . error ( msg ) ; throw new AtlasException ( msg ) ; } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Loaded {} as resource from : {}" , fileName , Thread . currentThread ( ) . getContextClassLoader ( ) . getResource ( fileName ) . toString ( ) ) ; } } return inStr ;
|
public class SemanticSearchServiceImpl { /** * A helper function to create a list of queryTerms based on the information from the
* targetAttribute as well as user defined searchTerms . If the user defined searchTerms exist , the
* targetAttribute information will not be used .
* @ return list of queryTerms */
public Set < String > createLexicalSearchQueryTerms ( Attribute targetAttribute , Set < String > searchTerms ) { } }
|
Set < String > queryTerms = new HashSet < > ( ) ; if ( searchTerms != null && ! searchTerms . isEmpty ( ) ) { queryTerms . addAll ( searchTerms ) ; } if ( queryTerms . isEmpty ( ) ) { if ( StringUtils . isNotBlank ( targetAttribute . getLabel ( ) ) ) { queryTerms . add ( targetAttribute . getLabel ( ) ) ; } if ( StringUtils . isNotBlank ( targetAttribute . getDescription ( ) ) ) { queryTerms . add ( targetAttribute . getDescription ( ) ) ; } } return queryTerms ;
|
public class ConstrainableInputStream { /** * Reads this inputstream to a ByteBuffer . The supplied max may be less than the inputstream ' s max , to support
* reading just the first bytes . */
public ByteBuffer readToByteBuffer ( int max ) throws IOException { } }
|
Validate . isTrue ( max >= 0 , "maxSize must be 0 (unlimited) or larger" ) ; final boolean localCapped = max > 0 ; // still possibly capped in total stream
final int bufferSize = localCapped && max < DefaultSize ? max : DefaultSize ; final byte [ ] readBuffer = new byte [ bufferSize ] ; final ByteArrayOutputStream outStream = new ByteArrayOutputStream ( bufferSize ) ; int read ; int remaining = max ; while ( true ) { read = read ( readBuffer ) ; if ( read == - 1 ) break ; if ( localCapped ) { // this local byteBuffer cap may be smaller than the overall maxSize ( like when reading first bytes )
if ( read >= remaining ) { outStream . write ( readBuffer , 0 , remaining ) ; break ; } remaining -= read ; } outStream . write ( readBuffer , 0 , read ) ; } return ByteBuffer . wrap ( outStream . toByteArray ( ) ) ;
|
public class JapaneseEra { /** * Obtains an instance of { @ code JapaneseEra } from a date .
* @ param date the date , not null
* @ return the Era singleton , never null */
static JapaneseEra from ( LocalDate date ) { } }
|
if ( date . isBefore ( MEIJI . since ) ) { throw new DateTimeException ( "Date too early: " + date ) ; } JapaneseEra [ ] known = KNOWN_ERAS . get ( ) ; for ( int i = known . length - 1 ; i >= 0 ; i -- ) { JapaneseEra era = known [ i ] ; if ( date . compareTo ( era . since ) >= 0 ) { return era ; } } return null ;
|
public class ZMatrixTools { /** * Takes the given Z Matrix coordinates and converts them to cartesian coordinates .
* The first Atom end up in the origin , the second on on the x axis , and the third
* one in the XY plane . The rest is added by applying the Zmatrix distances , angles
* and dihedrals . Angles are in degrees .
* @ param distances Array of distance variables of the Z matrix
* @ param angles Array of angle variables of the Z matrix
* @ param dihedrals Array of distance variables of the Z matrix
* @ param first _ atoms Array of atom ids of the first invoked atom in distance , angle and dihedral
* @ param second _ atoms Array of atom ids of the second invoked atom in angle and dihedral
* @ param third _ atoms Array of atom ids of the third invoked atom in dihedral
* @ cdk . dictref blue - obelisk : zmatrixCoordinatesIntoCartesianCoordinates */
public static Point3d [ ] zmatrixToCartesian ( double [ ] distances , int [ ] first_atoms , double [ ] angles , int [ ] second_atoms , double [ ] dihedrals , int [ ] third_atoms ) { } }
|
Point3d [ ] cartesianCoords = new Point3d [ distances . length ] ; for ( int index = 0 ; index < distances . length ; index ++ ) { if ( index == 0 ) { cartesianCoords [ index ] = new Point3d ( 0d , 0d , 0d ) ; } else if ( index == 1 ) { cartesianCoords [ index ] = new Point3d ( distances [ 1 ] , 0d , 0d ) ; } else if ( index == 2 ) { cartesianCoords [ index ] = new Point3d ( - Math . cos ( ( angles [ 2 ] / 180 ) * Math . PI ) * distances [ 2 ] + distances [ 1 ] , Math . sin ( ( angles [ 2 ] / 180 ) * Math . PI ) * distances [ 2 ] , 0d ) ; if ( first_atoms [ index ] == 0 ) cartesianCoords [ index ] . x = ( cartesianCoords [ index ] . x - distances [ 1 ] ) * - 1 ; } else { Vector3d cd = new Vector3d ( ) ; cd . sub ( cartesianCoords [ third_atoms [ index ] ] , cartesianCoords [ second_atoms [ index ] ] ) ; Vector3d bc = new Vector3d ( ) ; bc . sub ( cartesianCoords [ second_atoms [ index ] ] , cartesianCoords [ first_atoms [ index ] ] ) ; Vector3d n1 = new Vector3d ( ) ; n1 . cross ( cd , bc ) ; Vector3d n2 = rotate ( n1 , bc , - dihedrals [ index ] ) ; Vector3d ba = rotate ( bc , n2 , - angles [ index ] ) ; ba . normalize ( ) ; ba . scale ( distances [ index ] ) ; Point3d result = new Point3d ( ) ; result . add ( cartesianCoords [ first_atoms [ index ] ] , ba ) ; cartesianCoords [ index ] = result ; } } return cartesianCoords ;
|
public class User { /** * Lazy loader for getting the context to which this user corresponds .
* @ return the context */
public Context getContext ( ) { } }
|
if ( context == null ) { context = Model . getSingleton ( ) . getSession ( ) . getContext ( this . contextId ) ; } return context ;
|
public class ToStream { /** * Begin the scope of a prefix - URI Namespace mapping
* just before another element is about to start .
* This call will close any open tags so that the prefix mapping
* will not apply to the current element , but the up comming child .
* @ see org . xml . sax . ContentHandler # startPrefixMapping
* @ param prefix The Namespace prefix being declared .
* @ param uri The Namespace URI the prefix is mapped to .
* @ throws org . xml . sax . SAXException The client may throw
* an exception during processing . */
public void startPrefixMapping ( String prefix , String uri ) throws org . xml . sax . SAXException { } }
|
// the " true " causes the flush of any open tags
startPrefixMapping ( prefix , uri , true ) ;
|
public class SnapshotDaemon { /** * Process responses to sysproc invocations generated by this daemon
* via processPeriodicWork
* @ param response
* @ return */
public Future < Void > processClientResponse ( final Callable < ClientResponseImpl > response ) { } }
|
return m_es . submit ( new Callable < Void > ( ) { @ Override public Void call ( ) throws Exception { try { ClientResponseImpl resp = response . call ( ) ; long handle = resp . getClientHandle ( ) ; m_procedureCallbacks . remove ( handle ) . clientCallback ( resp ) ; } catch ( Exception e ) { SNAP_LOG . warn ( "Error when SnapshotDaemon invoked callback for a procedure invocation" , e ) ; /* * Don ' t think it is productive to propagate any exceptions here , Ideally
* they should be handled by the procedure callbacks */
} return null ; } } ) ;
|
public class BeanWrapperUtils { /** * Get the whole list of read { @ link Method } s using introspection .
* @ param bean
* the bean to introspect
* @ return the map of bean property getters ( indexed by property name ) */
public static Map < String , Method > getReadMethods ( Object bean ) { } }
|
Class < ? extends Object > beanClass = bean . getClass ( ) ; try { Map < String , Method > readMethods = new HashMap < > ( ) ; final BeanInfo beanInfo = Introspector . getBeanInfo ( beanClass ) ; final PropertyDescriptor [ ] propertyDescriptors = beanInfo . getPropertyDescriptors ( ) ; if ( propertyDescriptors != null ) { for ( final PropertyDescriptor propertyDescriptor : propertyDescriptors ) { if ( propertyDescriptor != null ) { final String name = propertyDescriptor . getName ( ) ; final Method readMethod = propertyDescriptor . getReadMethod ( ) ; if ( readMethod != null ) { readMethods . put ( name , readMethod ) ; } } } } return readMethods ; } catch ( final IntrospectionException e ) { throw new BeanWrapperException ( "Failed to initialize bean wrapper on " + beanClass , e ) ; }
|
public class EidPreconditions { /** * Ensures that { @ code index } specifies a valid < i > element < / i > in an array ,
* list or string of size { @ code size } . An element index may range from
* zero , inclusive , to { @ code size } , exclusive .
* Please , note that for performance reasons , Eid is not evaluated until
* it ' s needed . If you are using { @ code Validator } ,
* please use { @ link # checkElementIndex ( int , int , Eid ) } instead .
* @ param index a user - supplied index identifying an element of an array ,
* list or string
* @ param size the size of that array , list or string
* @ param eid the text to use to describe this index in an error message
* @ return the value of { @ code index }
* @ throws EidIndexOutOfBoundsException if { @ code index } is negative or is
* not less than { @ code size }
* @ throws EidIllegalArgumentException if { @ code size } is negative */
public static int checkElementIndex ( int index , int size , final String eid ) { } }
|
if ( isSizeIllegal ( size ) ) { throw new EidIllegalArgumentException ( ensureEid ( eid ) ) ; } if ( isIndexAndSizeIllegal ( index , size ) ) { throw new EidIndexOutOfBoundsException ( ensureEid ( eid ) ) ; } return index ;
|
public class OTMJCAManagedConnection { /** * Section 6.5.6 of the JCA 1.5 spec instructs ManagedConnection instances to notify connection listeners with
* close / error and local transaction - related events to its registered set of listeners .
* The events for begin / commit / rollback are only sent if the application server did NOT
* initiate the actions .
* This method dispatchs all events to the listeners based on the eventType
* @ param eventType as enumerated in the ConnectionEvents interface
* @ param ex an optional exception if we are sending an error message
* @ param connectionHandle an optional connectionHandle if we have access to it . */
void sendEvents ( int eventType , Exception ex , Object connectionHandle ) { } }
|
ConnectionEvent ce = null ; if ( ex == null ) { ce = new ConnectionEvent ( this , eventType ) ; } else { ce = new ConnectionEvent ( this , eventType , ex ) ; } ce . setConnectionHandle ( connectionHandle ) ; Collection copy = null ; synchronized ( m_connectionEventListeners ) { copy = new ArrayList ( m_connectionEventListeners ) ; } switch ( ce . getId ( ) ) { case ConnectionEvent . CONNECTION_CLOSED : for ( Iterator i = copy . iterator ( ) ; i . hasNext ( ) ; ) { ConnectionEventListener cel = ( ConnectionEventListener ) i . next ( ) ; cel . connectionClosed ( ce ) ; } break ; case ConnectionEvent . LOCAL_TRANSACTION_STARTED : for ( Iterator i = copy . iterator ( ) ; i . hasNext ( ) ; ) { ConnectionEventListener cel = ( ConnectionEventListener ) i . next ( ) ; cel . localTransactionStarted ( ce ) ; } break ; case ConnectionEvent . LOCAL_TRANSACTION_COMMITTED : for ( Iterator i = copy . iterator ( ) ; i . hasNext ( ) ; ) { ConnectionEventListener cel = ( ConnectionEventListener ) i . next ( ) ; cel . localTransactionCommitted ( ce ) ; } break ; case ConnectionEvent . LOCAL_TRANSACTION_ROLLEDBACK : for ( Iterator i = copy . iterator ( ) ; i . hasNext ( ) ; ) { ConnectionEventListener cel = ( ConnectionEventListener ) i . next ( ) ; cel . localTransactionRolledback ( ce ) ; } break ; case ConnectionEvent . CONNECTION_ERROR_OCCURRED : for ( Iterator i = copy . iterator ( ) ; i . hasNext ( ) ; ) { ConnectionEventListener cel = ( ConnectionEventListener ) i . next ( ) ; cel . connectionErrorOccurred ( ce ) ; } break ; default : throw new IllegalArgumentException ( "Illegal eventType: " + ce . getId ( ) ) ; }
|
public class XNodeSet { /** * Cast result object to a number , but allow side effects , such as the
* incrementing of an iterator .
* @ return numeric value of the string conversion from the
* next node in the NodeSetDTM , or NAN if no node was found */
public double numWithSideEffects ( ) { } }
|
int node = nextNode ( ) ; return ( node != DTM . NULL ) ? getNumberFromNode ( node ) : Double . NaN ;
|
public class SubscriptionDefinitionVersionMarshaller { /** * Marshall the given parameter object . */
public void marshall ( SubscriptionDefinitionVersion subscriptionDefinitionVersion , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( subscriptionDefinitionVersion == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( subscriptionDefinitionVersion . getSubscriptions ( ) , SUBSCRIPTIONS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class AlwaysSampleSampler { /** * Returns always makes a " yes " decision on { @ link Span } sampling . */
@ Override public boolean shouldSample ( @ Nullable SpanContext parentContext , @ Nullable Boolean hasRemoteParent , TraceId traceId , SpanId spanId , String name , List < Span > parentLinks ) { } }
|
return true ;
|
public class AmazonLightsailClient { /** * Returns information about a specific database in Amazon Lightsail .
* @ param getRelationalDatabaseRequest
* @ return Result of the GetRelationalDatabase operation returned by the service .
* @ throws ServiceException
* A general service exception .
* @ throws InvalidInputException
* Lightsail throws this exception when user input does not conform to the validation rules of an input
* field . < / p > < note >
* Domain - related APIs are only available in the N . Virginia ( us - east - 1 ) Region . Please set your AWS Region
* configuration to us - east - 1 to create , view , or edit these resources .
* @ throws NotFoundException
* Lightsail throws this exception when it cannot find a resource .
* @ throws OperationFailureException
* Lightsail throws this exception when an operation fails to execute .
* @ throws AccessDeniedException
* Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to
* access a resource .
* @ throws AccountSetupInProgressException
* Lightsail throws this exception when an account is still in the setup in progress state .
* @ throws UnauthenticatedException
* Lightsail throws this exception when the user has not been authenticated .
* @ sample AmazonLightsail . GetRelationalDatabase
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / lightsail - 2016-11-28 / GetRelationalDatabase "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public GetRelationalDatabaseResult getRelationalDatabase ( GetRelationalDatabaseRequest request ) { } }
|
request = beforeClientExecution ( request ) ; return executeGetRelationalDatabase ( request ) ;
|
public class EmailIntentBuilder { /** * Set the subject line for this email intent .
* @ param subject
* the email subject line
* @ return This { @ code EmailIntentBuilder } for method chaining */
@ NonNull public EmailIntentBuilder subject ( @ NonNull String subject ) { } }
|
checkNotNull ( subject ) ; checkNoLineBreaks ( subject ) ; this . subject = subject ; return this ;
|
public class WorkerHeartbeatRunable { /** * do heartbeat and update LocalState */
public void doHeartbeat ( ) throws IOException { } }
|
int curTime = TimeUtils . current_time_secs ( ) ; WorkerHeartbeat hb = new WorkerHeartbeat ( curTime , topologyId , taskIds , port ) ; LOG . debug ( "Doing heartbeat:" + workerId + ",port:" + port + ",hb" + hb . toString ( ) ) ; LocalState state = getWorkerState ( ) ; state . put ( Common . LS_WORKER_HEARTBEAT , hb ) ;
|
public class FromElementsFunction { @ Override public void snapshotState ( FunctionSnapshotContext context ) throws Exception { } }
|
Preconditions . checkState ( this . checkpointedState != null , "The " + getClass ( ) . getSimpleName ( ) + " has not been properly initialized." ) ; this . checkpointedState . clear ( ) ; this . checkpointedState . add ( this . numElementsEmitted ) ;
|
public class JsonUtil { /** * Create a JCR value from string value for the designated JCR type .
* @ param node the node of the property
* @ param type the JCR type according to the types declared in PropertyType
* @ param object the value in the right type or a string representation of the value ,
* for binary values a input stream can be used as parameter or a string
* with the base64 encoded data for the binary property
* @ return */
public static Value makeJcrValue ( Node node , int type , Object object , MappingRules mapping ) throws PropertyValueFormatException , RepositoryException { } }
|
Session session = node . getSession ( ) ; ValueFactory factory = session . getValueFactory ( ) ; Value value = null ; if ( object != null ) { switch ( type ) { case PropertyType . BINARY : if ( mapping . propertyFormat . binary != MappingRules . PropertyFormat . Binary . skip ) { InputStream input = null ; if ( object instanceof InputStream ) { input = ( InputStream ) object ; } else if ( object instanceof String ) { if ( mapping . propertyFormat . binary == MappingRules . PropertyFormat . Binary . base64 ) { byte [ ] decoded = Base64 . decodeBase64 ( ( String ) object ) ; input = new ByteArrayInputStream ( decoded ) ; } } if ( input != null ) { Binary binary = factory . createBinary ( input ) ; value = factory . createValue ( binary ) ; } } break ; case PropertyType . BOOLEAN : value = factory . createValue ( object instanceof Boolean ? ( Boolean ) object : Boolean . parseBoolean ( object . toString ( ) ) ) ; break ; case PropertyType . DATE : Date date = object instanceof Date ? ( Date ) object : null ; if ( date == null ) { String string = object . toString ( ) ; date = mapping . dateParser . parse ( string ) ; } if ( date != null ) { GregorianCalendar cal = new GregorianCalendar ( ) ; cal . setTime ( date ) ; value = factory . createValue ( cal ) ; } else { throw new PropertyValueFormatException ( "invalid date/time value: " + object ) ; } break ; case PropertyType . DECIMAL : value = factory . createValue ( object instanceof BigDecimal ? ( BigDecimal ) object : new BigDecimal ( object . toString ( ) ) ) ; break ; case PropertyType . DOUBLE : value = factory . createValue ( object instanceof Double ? ( Double ) object : Double . parseDouble ( object . toString ( ) ) ) ; break ; case PropertyType . LONG : value = factory . createValue ( object instanceof Long ? ( Long ) object : Long . parseLong ( object . toString ( ) ) ) ; break ; case PropertyType . REFERENCE : case PropertyType . WEAKREFERENCE : final Node refNode = session . getNodeByIdentifier ( object . toString ( ) ) ; final String identifier = refNode . getIdentifier ( ) ; value = factory . createValue ( identifier , type ) ; break ; case PropertyType . NAME : case PropertyType . PATH : case PropertyType . STRING : case PropertyType . URI : value = factory . createValue ( object . toString ( ) , type ) ; break ; case PropertyType . UNDEFINED : break ; } } return value ;
|
public class DocumentTable { /** * { @ inheritDoc } */
@ Override protected void _to ( ObjectOutput out ) throws IOException { } }
|
// 1 : write the number of document headers
out . writeInt ( headers . size ( ) ) ; for ( DocumentHeader header : headers ) { // 1 : write each document header
header . writeExternal ( out ) ; }
|
public class InterproceduralCallGraph { /** * ( non - Javadoc )
* @ see
* edu . umd . cs . findbugs . graph . AbstractGraph # allocateEdge ( edu . umd . cs . findbugs
* . graph . AbstractVertex , edu . umd . cs . findbugs . graph . AbstractVertex ) */
@ Override protected InterproceduralCallGraphEdge allocateEdge ( InterproceduralCallGraphVertex source , InterproceduralCallGraphVertex target ) { } }
|
return new InterproceduralCallGraphEdge ( source , target ) ;
|
public class AbstractCentralDogmaBuilder { /** * Adds the { @ link URI } of the Central Dogma server .
* @ deprecated Use { @ link # host ( String ) } or { @ link # profile ( String . . . ) } .
* @ param uri the URI of the Central Dogma server . e . g .
* { @ code tbinary + http : / / example . com : 36462 / cd / thrift / v1} */
@ Deprecated public final B uri ( String uri ) { } }
|
final URI parsed = URI . create ( requireNonNull ( uri , "uri" ) ) ; final String host = parsed . getHost ( ) ; final int port = parsed . getPort ( ) ; checkArgument ( host != null , "uri: %s (must contain a host part)" , uri ) ; if ( port < 0 ) { host ( host ) ; } else { host ( host , port ) ; } return self ( ) ;
|
public class ErrorHandling { /** * This method will return the first < code > ErrorReporter < / code > in the parental chain of the
* tag . Searching starts with this tag .
* @ return an < code > ErrorReporter < / code > if one is found in the parental chain , otherwise null . */
private static IErrorReporter getErrorReporter ( JspTag tag ) { } }
|
if ( tag instanceof IErrorReporter && ( ( IErrorReporter ) tag ) . isReporting ( ) ) return ( IErrorReporter ) tag ; // check to see if this tag has is an ErrorReporter or has an ErrorReporter as a parent
IErrorReporter er = ( IErrorReporter ) SimpleTagSupport . findAncestorWithClass ( tag , IErrorReporter . class ) ; while ( er != null ) { if ( er . isReporting ( ) ) return er ; er = ( IErrorReporter ) SimpleTagSupport . findAncestorWithClass ( ( JspTag ) er , IErrorReporter . class ) ; } return null ;
|
public class EntityUtilities { /** * Checks to see if a Content Spec Meta Data element has changed .
* @ param metaDataName The Content Spec Meta Data name .
* @ param currentValue The expected current value of the Meta Data node .
* @ param contentSpecEntity The Content Spec Entity to check against .
* @ return True if the meta data node has changed , otherwise false . */
public static boolean hasContentSpecMetaDataChanged ( final String metaDataName , final String currentValue , final ContentSpecWrapper contentSpecEntity ) { } }
|
final CSNodeWrapper metaData = contentSpecEntity . getMetaData ( metaDataName ) ; if ( metaData != null && metaData . getAdditionalText ( ) != null && ! metaData . getAdditionalText ( ) . equals ( currentValue ) ) { // The values no longer match
return true ; } else if ( ( metaData == null || metaData . getAdditionalText ( ) == null ) && currentValue != null ) { // The meta data node doesn ' t exist but it exists now
return true ; } else { return false ; }
|
public class Writer { /** * Configure the name of the sheet to be written . The default is Sheet0.
* @ param sheetName sheet name
* @ return Writer */
public Writer sheet ( String sheetName ) { } }
|
if ( StringUtil . isEmpty ( sheetName ) ) { throw new IllegalArgumentException ( "sheet cannot be empty" ) ; } this . sheetName = sheetName ; return this ;
|
public class HttpUtil { /** * 从请求参数的body中判断请求的Content - Type类型 , 支持的类型有 :
* < pre >
* 1 . application / json
* 1 . application / xml
* < / pre >
* @ param body 请求参数体
* @ return Content - Type类型 , 如果无法判断返回null
* @ since 3.2.0
* @ see ContentType # get ( String ) */
public static String getContentTypeByRequestBody ( String body ) { } }
|
final ContentType contentType = ContentType . get ( body ) ; return ( null == contentType ) ? null : contentType . toString ( ) ;
|
public class MutableDocument { /** * Set an Array value for the given key
* @ param key the key .
* @ param key the Array value .
* @ return this MutableDocument instance */
@ NonNull @ Override public MutableDocument setArray ( @ NonNull String key , Array value ) { } }
|
return setValue ( key , value ) ;
|
public class ToFachwertSerializer { /** * Fuer die Serialisierung wird der uebergebenen Fachwert nach seinen
* einzelnen Elementen aufgeteilt und serialisiert .
* @ param fachwert Fachwert
* @ param jgen Json - Generator
* @ param provider Provider
* @ throws IOException sollte nicht auftreten */
@ Override public void serialize ( Fachwert fachwert , JsonGenerator jgen , SerializerProvider provider ) throws IOException { } }
|
serialize ( fachwert . toMap ( ) , jgen , provider ) ;
|
public class MetaService { /** * { @ inheritDoc } */
@ Override public void write ( IMetaData < ? , ? > meta ) throws IOException { } }
|
// Get cue points , FLV reader and writer
IMetaCue [ ] metaArr = meta . getMetaCue ( ) ; FLVReader reader = new FLVReader ( file , false ) ; FLVWriter writer = new FLVWriter ( file , false ) ; ITag tag = null ; // Read first tag
if ( reader . hasMoreTags ( ) ) { tag = reader . readTag ( ) ; if ( tag . getDataType ( ) == IoConstants . TYPE_METADATA ) { if ( ! reader . hasMoreTags ( ) ) { throw new IOException ( "File we're writing is metadata only?" ) ; } } } if ( tag == null ) { throw new IOException ( "Tag was null" ) ; } meta . setDuration ( ( ( double ) reader . getDuration ( ) / 1000 ) ) ; meta . setVideoCodecId ( reader . getVideoCodecId ( ) ) ; meta . setAudioCodecId ( reader . getAudioCodecId ( ) ) ; ITag injectedTag = injectMetaData ( meta , tag ) ; injectedTag . setPreviousTagSize ( 0 ) ; tag . setPreviousTagSize ( injectedTag . getBodySize ( ) ) ; // TODO look into why this fails in the unit test
try { writer . writeTag ( injectedTag ) ; writer . writeTag ( tag ) ; } catch ( Exception e ) { log . warn ( "Metadata insert failed" , e ) ; return ; } int cuePointTimeStamp = 0 ; int counter = 0 ; if ( metaArr != null ) { Arrays . sort ( metaArr ) ; cuePointTimeStamp = getTimeInMilliseconds ( metaArr [ 0 ] ) ; } while ( reader . hasMoreTags ( ) ) { tag = reader . readTag ( ) ; // if there are cuePoints in the array
if ( counter < metaArr . length ) { // If the tag has a greater timestamp than the
// cuePointTimeStamp , then inject the tag
while ( tag . getTimestamp ( ) > cuePointTimeStamp ) { injectedTag = injectMetaCue ( metaArr [ counter ] , tag ) ; writer . writeTag ( injectedTag ) ; tag . setPreviousTagSize ( injectedTag . getBodySize ( ) ) ; // Advance to the next CuePoint
counter ++ ; if ( counter > ( metaArr . length - 1 ) ) { break ; } cuePointTimeStamp = getTimeInMilliseconds ( metaArr [ counter ] ) ; } } if ( tag . getDataType ( ) != IoConstants . TYPE_METADATA ) { writer . writeTag ( tag ) ; } } writer . close ( ) ;
|
public class CmsSitemapDNDController { /** * Handles a dropped detail page . < p >
* @ param createItem the detail page which was dropped into the sitemap
* @ param parent the parent sitemap entry */
private void handleDropNewEntry ( CmsCreatableListItem createItem , final CmsClientSitemapEntry parent ) { } }
|
final CmsNewResourceInfo typeInfo = createItem . getResourceTypeInfo ( ) ; final CmsClientSitemapEntry entry = new CmsClientSitemapEntry ( ) ; entry . setNew ( true ) ; entry . setVfsPath ( null ) ; entry . setPosition ( m_insertIndex ) ; entry . setInNavigation ( true ) ; Map < String , CmsClientProperty > defaultFileProps = Maps . newHashMap ( ) ; entry . setDefaultFileProperties ( defaultFileProps ) ; String name ; final boolean appendSlash ; switch ( createItem . getNewEntryType ( ) ) { case detailpage : name = CmsDetailPageInfo . removeFunctionPrefix ( typeInfo . getResourceType ( ) ) ; appendSlash = true ; entry . setDetailpageTypeName ( typeInfo . getResourceType ( ) ) ; entry . setVfsModeIcon ( typeInfo . getBigIconClasses ( ) ) ; if ( typeInfo . isFunction ( ) ) { CmsClientProperty titleProp = new CmsClientProperty ( CmsClientProperty . PROPERTY_TITLE , typeInfo . getTitle ( ) , null ) ; CmsClientProperty navtextProp = new CmsClientProperty ( CmsClientProperty . PROPERTY_NAVTEXT , typeInfo . getTitle ( ) , null ) ; entry . getOwnProperties ( ) . put ( titleProp . getName ( ) , titleProp ) ; entry . getDefaultFileProperties ( ) . put ( titleProp . getName ( ) , titleProp ) ; entry . getOwnProperties ( ) . put ( navtextProp . getName ( ) , navtextProp ) ; } entry . setResourceTypeName ( "folder" ) ; break ; case redirect : name = typeInfo . getResourceType ( ) ; entry . setEntryType ( EntryType . redirect ) ; entry . setVfsModeIcon ( typeInfo . getBigIconClasses ( ) ) ; entry . setResourceTypeName ( typeInfo . getResourceType ( ) ) ; appendSlash = false ; break ; default : name = CmsSitemapController . NEW_ENTRY_NAME ; appendSlash = true ; entry . setResourceTypeName ( "folder" ) ; entry . setVfsModeIcon ( typeInfo . getBigIconClasses ( ) ) ; } m_controller . ensureUniqueName ( parent , name , new I_CmsSimpleCallback < String > ( ) { public void execute ( String uniqueName ) { entry . setName ( uniqueName ) ; String sitepath = m_insertPath + uniqueName ; if ( appendSlash ) { sitepath += "/" ; } entry . setSitePath ( sitepath ) ; m_controller . create ( entry , parent . getId ( ) , typeInfo . getId ( ) , typeInfo . getCopyResourceId ( ) , typeInfo . getCreateParameter ( ) , false ) ; } } ) ;
|
public class StorageDescriptor { /** * A list of reducer grouping columns , clustering columns , and bucketing columns in the table .
* @ param bucketColumns
* A list of reducer grouping columns , clustering columns , and bucketing columns in the table . */
public void setBucketColumns ( java . util . Collection < String > bucketColumns ) { } }
|
if ( bucketColumns == null ) { this . bucketColumns = null ; return ; } this . bucketColumns = new java . util . ArrayList < String > ( bucketColumns ) ;
|
public class InjectionFuture { /** * < p > create . < / p >
* @ param type a { @ link java . lang . Class } object .
* @ param locator a { @ link org . ops4j . pax . wicket . spi . ProxyTargetLocator } object .
* @ param < T > a T object .
* @ return a { @ link org . ops4j . pax . wicket . internal . injection . InjectionFuture } object . */
public static < T > InjectionFuture < T > create ( Class < T > type , ProxyTargetLocator locator ) { } }
|
return new InjectionFuture < T > ( type , locator ) ;
|
public class EvaluationCalibration { /** * Get the residual plot for all classes combined . The residual plot is defined as a histogram of < br >
* | label _ i - prob ( class _ i | input ) | for all classes i and examples . < br >
* In general , small residuals indicate a superior classifier to large residuals .
* @ return Residual plot ( histogram ) - all predictions / classes */
public Histogram getResidualPlotAllClasses ( ) { } }
|
String title = "Residual Plot - All Predictions and Classes" ; int [ ] counts = residualPlotOverall . data ( ) . asInt ( ) ; return new Histogram ( title , 0.0 , 1.0 , counts ) ;
|
public class Sharded { /** * A key tag is a special pattern inside a key that , if preset , is the only part of the key hashed
* in order to select the server for this key .
* @ see < a href = " http : / / redis . io / topics / partitioning " > partitioning < / a >
* @ param key
* @ return The tag if it exists , or the original key */
public String getKeyTag ( String key ) { } }
|
if ( tagPattern != null ) { Matcher m = tagPattern . matcher ( key ) ; if ( m . find ( ) ) return m . group ( 1 ) ; } return key ;
|
public class MyPOSDictionary { void addTags ( String word , String ... tags ) { } }
|
super . addTags ( word , tags ) ; for ( String t : tags ) { knwonTags . add ( t ) ; }
|
public class OWLObjectPropertyDomainAxiomImpl_CustomFieldSerializer { /** * Deserializes the content of the object from the
* { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } .
* @ param streamReader the { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } to read the
* object ' s content from
* @ param instance the object instance to deserialize
* @ throws com . google . gwt . user . client . rpc . SerializationException
* if the deserialization operation is not
* successful */
@ Override public void deserializeInstance ( SerializationStreamReader streamReader , OWLObjectPropertyDomainAxiomImpl instance ) throws SerializationException { } }
|
deserialize ( streamReader , instance ) ;
|
public class CmsRemovableFormRow { /** * Method to remove row . < p > */
void removeRow ( ) { } }
|
HasComponents parent = CmsRemovableFormRow . this . getParent ( ) ; if ( parent instanceof ComponentContainer ) { ( ( ComponentContainer ) parent ) . removeComponent ( CmsRemovableFormRow . this ) ; } if ( m_remove != null ) { m_remove . run ( ) ; }
|
public class UnCheckOutCommand { /** * Webdav Uncheckout method implementation .
* @ param session current session
* @ param path resource path
* @ return the instance of javax . ws . rs . core . Response */
public Response uncheckout ( Session session , String path ) { } }
|
try { Node node = session . getRootNode ( ) . getNode ( TextUtil . relativizePath ( path ) ) ; Version restoreVersion = node . getBaseVersion ( ) ; node . restore ( restoreVersion , true ) ; return Response . ok ( ) . header ( HttpHeaders . CACHE_CONTROL , "no-cache" ) . build ( ) ; } catch ( UnsupportedRepositoryOperationException exc ) { return Response . status ( HTTPStatus . CONFLICT ) . entity ( exc . getMessage ( ) ) . build ( ) ; } catch ( LockException exc ) { return Response . status ( HTTPStatus . LOCKED ) . entity ( exc . getMessage ( ) ) . build ( ) ; } catch ( PathNotFoundException exc ) { return Response . status ( HTTPStatus . NOT_FOUND ) . entity ( exc . getMessage ( ) ) . build ( ) ; } catch ( RepositoryException exc ) { LOG . error ( exc . getMessage ( ) , exc ) ; return Response . serverError ( ) . entity ( exc . getMessage ( ) ) . build ( ) ; }
|
public class PlayEngine { /** * Send an RTMP message
* @ param messageIn
* incoming RTMP message */
private void sendMessage ( RTMPMessage messageIn ) { } }
|
IRTMPEvent eventIn = messageIn . getBody ( ) ; IRTMPEvent event ; switch ( eventIn . getDataType ( ) ) { case Constants . TYPE_AGGREGATE : event = new Aggregate ( ( ( Aggregate ) eventIn ) . getData ( ) ) ; break ; case Constants . TYPE_AUDIO_DATA : event = new AudioData ( ( ( AudioData ) eventIn ) . getData ( ) ) ; break ; case Constants . TYPE_VIDEO_DATA : event = new VideoData ( ( ( VideoData ) eventIn ) . getData ( ) ) ; break ; default : event = new Notify ( ( ( Notify ) eventIn ) . getData ( ) ) ; break ; } // get the incoming event time
int eventTime = eventIn . getTimestamp ( ) ; // get the incoming event source type and set on the outgoing event
event . setSourceType ( eventIn . getSourceType ( ) ) ; // instance the outgoing message
RTMPMessage messageOut = RTMPMessage . build ( event , eventTime ) ; if ( log . isTraceEnabled ( ) ) { log . trace ( "Source type - in: {} out: {}" , eventIn . getSourceType ( ) , messageOut . getBody ( ) . getSourceType ( ) ) ; long delta = System . currentTimeMillis ( ) - playbackStart ; log . trace ( "sendMessage: streamStartTS {}, length {}, streamOffset {}, timestamp {} last timestamp {} delta {} buffered {}" , new Object [ ] { streamStartTS . get ( ) , currentItem . get ( ) . getLength ( ) , streamOffset , eventTime , lastMessageTs , delta , lastMessageTs - delta } ) ; } if ( playDecision == 1 ) { // 1 = = vod / file
if ( eventTime > 0 && streamStartTS . compareAndSet ( - 1 , eventTime ) ) { log . debug ( "sendMessage: set streamStartTS" ) ; messageOut . getBody ( ) . setTimestamp ( 0 ) ; } long length = currentItem . get ( ) . getLength ( ) ; if ( length >= 0 ) { int duration = eventTime - streamStartTS . get ( ) ; if ( log . isTraceEnabled ( ) ) { log . trace ( "sendMessage duration={} length={}" , duration , length ) ; } if ( duration - streamOffset >= length ) { // sent enough data to client
stop ( ) ; return ; } } } else { // don ' t reset streamStartTS to 0 for live streams
if ( eventTime > 0 && streamStartTS . compareAndSet ( - 1 , eventTime ) ) { log . debug ( "sendMessage: set streamStartTS" ) ; } // relative timestamp adjustment for live streams
int startTs = streamStartTS . get ( ) ; if ( startTs > 0 ) { // subtract the offset time of when the stream started playing for the client
eventTime -= startTs ; messageOut . getBody ( ) . setTimestamp ( eventTime ) ; if ( log . isTraceEnabled ( ) ) { log . trace ( "sendMessage (updated): streamStartTS={}, length={}, streamOffset={}, timestamp={}" , new Object [ ] { startTs , currentItem . get ( ) . getLength ( ) , streamOffset , eventTime } ) ; } } } doPushMessage ( messageOut ) ;
|
public class SassVaadinGenerator { /** * ( non - Javadoc )
* @ see
* net . jawr . web . resource . bundle . generator . AbstractCachedGenerator # setConfig (
* net . jawr . web . config . JawrConfig ) */
@ Override public void setConfig ( JawrConfig config ) { } }
|
super . setConfig ( config ) ; String value = this . config . getProperty ( JawrConstant . SASS_GENERATOR_URL_MODE , SASS_GENERATOR_DEFAULT_URL_MODE ) ; urlMode = UrlMode . valueOf ( value . toUpperCase ( ) ) ;
|
public class DisconfMgrBean { /** * register aspectJ for disconf get request
* @ param registry */
private void registerAspect ( BeanDefinitionRegistry registry ) { } }
|
GenericBeanDefinition beanDefinition = new GenericBeanDefinition ( ) ; beanDefinition . setBeanClass ( DisconfAspectJ . class ) ; beanDefinition . setLazyInit ( false ) ; beanDefinition . setAbstract ( false ) ; beanDefinition . setAutowireCandidate ( true ) ; beanDefinition . setScope ( "singleton" ) ; registry . registerBeanDefinition ( "disconfAspectJ" , beanDefinition ) ;
|
public class Rollbar { /** * report an exception to Rollbar , specifying the level .
* @ param throwable the exception that occurred .
* @ param level the severity level . */
@ Deprecated public static void reportException ( final Throwable throwable , final String level ) { } }
|
reportException ( throwable , level , null , null ) ;
|
public class Util { /** * if an href with terminating " / " the name part is that between the
* ending " / " and the one before .
* < p > Otherwise it ' s the part after the last " / " < / p >
* @ param href to split
* @ return name split into path and name part */
public static String [ ] splitName ( final String href ) { } }
|
if ( ( href == null ) || ( href . length ( ) == 0 ) ) { return null ; } final String stripped ; if ( href . endsWith ( "/" ) ) { stripped = href . substring ( 0 , href . length ( ) - 1 ) ; } else { stripped = href ; } final int pos = stripped . lastIndexOf ( "/" ) ; if ( pos <= 0 ) { return null ; } return new String [ ] { stripped . substring ( 0 , pos ) , stripped . substring ( pos + 1 ) } ;
|
public class ST_ClosestPoint { /** * Returns the 2D point on geometry A that is closest to geometry B .
* @ param geomA Geometry A
* @ param geomB Geometry B
* @ return The 2D point on geometry A that is closest to geometry B */
public static Point closestPoint ( Geometry geomA , Geometry geomB ) { } }
|
if ( geomA == null || geomB == null ) { return null ; } // Return the closest point on geomA . ( We would have used index
// 1 to return the closest point on geomB . )
return geomA . getFactory ( ) . createPoint ( DistanceOp . nearestPoints ( geomA , geomB ) [ 0 ] ) ;
|
public class FSNamesystem { /** * This is called from the ReplicationMonitor to process over
* replicated blocks . */
private void processOverReplicatedBlocksAsync ( ) { } }
|
// blocks should not be scheduled for deletion during safemode
if ( isInSafeMode ( ) ) { return ; } if ( delayOverreplicationMonitorTime > now ( ) ) { LOG . info ( "Overreplication monitor delayed for " + ( ( delayOverreplicationMonitorTime - now ( ) ) / 1000 ) + " seconds" ) ; return ; } nameNode . clearOutstandingNodes ( ) ; final int nodes = heartbeats . size ( ) ; List < Block > blocksToProcess = new ArrayList < Block > ( Math . min ( overReplicatedBlocks . size ( ) , ReplicationConfigKeys . overreplicationWorkMultiplier * nodes ) ) ; for ( int i = 0 ; i < ReplicationConfigKeys . overreplicationWorkMultiplier ; i ++ ) { writeLock ( ) ; try { NameNode . getNameNodeMetrics ( ) . numOverReplicatedBlocks . set ( overReplicatedBlocks . size ( ) ) ; overReplicatedBlocks . pollNToList ( nodes , blocksToProcess ) ; if ( overReplicatedBlocks . isEmpty ( ) ) { break ; } } finally { writeUnlock ( ) ; } } for ( Block block : blocksToProcess ) { if ( NameNode . stateChangeLog . isDebugEnabled ( ) ) { NameNode . stateChangeLog . debug ( "BLOCK* NameSystem.processOverReplicatedBlocksAsync: " + block ) ; } if ( block instanceof OverReplicatedBlock ) { OverReplicatedBlock opb = ( OverReplicatedBlock ) block ; processOverReplicatedBlock ( block , ( short ) - 1 , opb . addedNode , opb . delNodeHint ) ; } else { processOverReplicatedBlock ( block , ( short ) - 1 , null , null ) ; } }
|
public class PrimeConnections { /** * Prime connections , blocking until configured percentage ( default is 100 % ) of target servers are primed
* or max time is reached .
* @ see CommonClientConfigKey # MinPrimeConnectionsRatio
* @ see CommonClientConfigKey # MaxTotalTimeToPrimeConnections */
public void primeConnections ( List < Server > servers ) { } }
|
if ( servers == null || servers . size ( ) == 0 ) { logger . debug ( "No server to prime" ) ; return ; } for ( Server server : servers ) { server . setReadyToServe ( false ) ; } int totalCount = ( int ) ( servers . size ( ) * primeRatio ) ; final CountDownLatch latch = new CountDownLatch ( totalCount ) ; final AtomicInteger successCount = new AtomicInteger ( 0 ) ; final AtomicInteger failureCount = new AtomicInteger ( 0 ) ; primeConnectionsAsync ( servers , new PrimeConnectionListener ( ) { @ Override public void primeCompleted ( Server s , Throwable lastException ) { if ( lastException == null ) { successCount . incrementAndGet ( ) ; s . setReadyToServe ( true ) ; } else { failureCount . incrementAndGet ( ) ; } latch . countDown ( ) ; } } ) ; Stopwatch stopWatch = initialPrimeTimer . start ( ) ; try { latch . await ( maxTotalTimeToPrimeConnections , TimeUnit . MILLISECONDS ) ; } catch ( InterruptedException e ) { logger . error ( "Priming connection interrupted" , e ) ; } finally { stopWatch . stop ( ) ; } stats = new PrimeConnectionEndStats ( totalCount , successCount . get ( ) , failureCount . get ( ) , stopWatch . getDuration ( TimeUnit . MILLISECONDS ) ) ; printStats ( stats ) ;
|
public class Postconditions { /** * < p > A version of { @ link # checkPostcondition ( boolean , String ) } that
* constructs a description message from the given format string and
* arguments . < / p >
* < p > Note that the use of variadic arguments may entail allocating memory on
* virtual machines that fail to eliminate the allocations with < i > escape
* analysis < / i > . < / p >
* @ param condition The predicate
* @ param format The format string
* @ param objects The format string arguments
* @ since 1.1.0 */
public static void checkPostconditionV ( final boolean condition , final String format , final Object ... objects ) { } }
|
checkPostconditionV ( "<unspecified>" , condition , format , objects ) ;
|
public class DajlabScene { /** * Create an instance of { @ link DajlabModel } containing all models from
* controllers .
* @ return a DajlabModel instance */
private DajlabModel getModel ( ) { } }
|
DajlabModel model = new DajlabModel ( ) ; for ( DajlabControllerExtensionInterface < DajlabModelInterface > controller : controllers ) { DajlabModelInterface subModel = controller . getModel ( ) ; model . put ( subModel ) ; } return model ;
|
public class Expression { /** * Create a negated expression to represent the negated result of the given expression .
* @ param expression the expression to be negated .
* @ return a negated expression . */
@ NonNull public static Expression not ( @ NonNull Expression expression ) { } }
|
if ( expression == null ) { throw new IllegalArgumentException ( "expression cannot be null." ) ; } return negated ( expression ) ;
|
public class ListDomainAssociationsResult { /** * List of Domain Associations .
* @ param domainAssociations
* List of Domain Associations . */
public void setDomainAssociations ( java . util . Collection < DomainAssociation > domainAssociations ) { } }
|
if ( domainAssociations == null ) { this . domainAssociations = null ; return ; } this . domainAssociations = new java . util . ArrayList < DomainAssociation > ( domainAssociations ) ;
|
public class NotesDao { /** * Retrieve all notes in the given area and feed them to the given handler .
* @ see # getAll ( BoundingBox , String , Handler , int , int ) */
public void getAll ( BoundingBox bounds , Handler < Note > handler , int limit , int hideClosedNoteAfter ) { } }
|
getAll ( bounds , null , handler , limit , hideClosedNoteAfter ) ;
|
public class PropertiesEscape { /** * Perform a Java Properties Key level 1 ( only basic set ) < strong > escape < / strong > operation
* on a < tt > char [ ] < / tt > input .
* < em > Level 1 < / em > means this method will only escape the Java Properties Key basic escape set :
* < ul >
* < li > The < em > Single Escape Characters < / em > :
* < tt > & # 92 ; t < / tt > ( < tt > U + 0009 < / tt > ) ,
* < tt > & # 92 ; n < / tt > ( < tt > U + 000A < / tt > ) ,
* < tt > & # 92 ; f < / tt > ( < tt > U + 000C < / tt > ) ,
* < tt > & # 92 ; r < / tt > ( < tt > U + 000D < / tt > ) ,
* < tt > & # 92 ; & nbsp ; < / tt > ( < tt > U + 0020 < / tt > ) ,
* < tt > & # 92 ; : < / tt > ( < tt > U + 003A < / tt > ) ,
* < tt > & # 92 ; = < / tt > ( < tt > U + 003D < / tt > ) and
* < tt > & # 92 ; & # 92 ; < / tt > ( < tt > U + 005C < / tt > ) .
* < / li >
* < li >
* Two ranges of non - displayable , control characters ( some of which are already part of the
* < em > single escape characters < / em > list ) : < tt > U + 0000 < / tt > to < tt > U + 001F < / tt >
* and < tt > U + 007F < / tt > to < tt > U + 009F < / tt > .
* < / li >
* < / ul >
* This method calls { @ link # escapePropertiesKey ( char [ ] , int , int , java . io . Writer , PropertiesKeyEscapeLevel ) }
* with the following preconfigured values :
* < ul >
* < li > < tt > level < / tt > :
* { @ link PropertiesKeyEscapeLevel # LEVEL _ 1 _ BASIC _ ESCAPE _ SET } < / li >
* < / ul >
* This method is < strong > thread - safe < / strong > .
* @ param text the < tt > char [ ] < / tt > to be escaped .
* @ param offset the position in < tt > text < / tt > at which the escape operation should start .
* @ param len the number of characters in < tt > text < / tt > that should be escaped .
* @ param writer the < tt > java . io . Writer < / tt > to which the escaped result will be written . Nothing will
* be written at all to this writer if input is < tt > null < / tt > .
* @ throws IOException if an input / output exception occurs */
public static void escapePropertiesKeyMinimal ( final char [ ] text , final int offset , final int len , final Writer writer ) throws IOException { } }
|
escapePropertiesKey ( text , offset , len , writer , PropertiesKeyEscapeLevel . LEVEL_1_BASIC_ESCAPE_SET ) ;
|
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertWindowSpecificationRES3ToString ( EDataType eDataType , Object instanceValue ) { } }
|
return instanceValue == null ? null : instanceValue . toString ( ) ;
|
public class CreateAppRequest { /** * Tag for an Amplify App
* @ param tags
* Tag for an Amplify App
* @ return Returns a reference to this object so that method calls can be chained together . */
public CreateAppRequest withTags ( java . util . Map < String , String > tags ) { } }
|
setTags ( tags ) ; return this ;
|
public class Matchers { /** * Equivalent of { @ code allOf ( containsString ( . . . ) , . . . ) } matcher combination
* @ see org . hamcrest . Matchers # allOf ( Iterable )
* @ see org . hamcrest . Matchers # containsString ( String )
* @ param strings all the strings to match against
* @ return the matcher */
public static Matcher < String > containsStrings ( String ... strings ) { } }
|
List < Matcher < ? super String > > matchers = new ArrayList < Matcher < ? super String > > ( ) ; for ( String string : strings ) { matchers . add ( containsString ( string ) ) ; } return allOf ( matchers ) ;
|
public class DraweeView { /** * Use this method only when using this class as an ordinary ImageView .
* @ deprecated Use { @ link # setController ( DraweeController ) } instead . */
@ Override @ Deprecated public void setImageDrawable ( Drawable drawable ) { } }
|
init ( getContext ( ) ) ; mDraweeHolder . setController ( null ) ; super . setImageDrawable ( drawable ) ;
|
public class AbstractSecurityController { /** * Update a controlled object based on the given authorization state .
* @ param controlledObject Object being controlled
* @ param authorized state that has been installed on controlledObject */
protected void updateControlledObject ( Authorizable controlledObject , boolean authorized ) { } }
|
if ( logger . isDebugEnabled ( ) ) { logger . debug ( "setAuthorized( " + authorized + ") on: " + controlledObject ) ; } controlledObject . setAuthorized ( authorized ) ; runPostProcessorActions ( controlledObject , authorized ) ;
|
public class AdapterUtil { /** * Converts any generic Exception to a SQLException .
* @ param ex the exception to convert .
* @ return SQLException containing the original Exception class , message , and stack trace . */
public static SQLException toSQLException ( Throwable ex ) { } }
|
if ( ex == null ) return null ; if ( ex instanceof SQLException ) return ( SQLException ) ex ; if ( ex instanceof ResourceException ) return toSQLException ( ( ResourceException ) ex ) ; // Link the original exception to the new SQLException .
SQLException sqlX = new SQLException ( ex . getClass ( ) . getName ( ) + ": " + ex . getMessage ( ) ) ; sqlX . initCause ( ex ) ; return sqlX ;
|
public class ValueDataUtil { /** * Returns < code > String < / code > value . */
public static QPath getPath ( ValueData valueData ) throws RepositoryException { } }
|
if ( valueData instanceof TransientValueData ) { return getPath ( ( ( TransientValueData ) valueData ) . delegate ) ; } return ( ( AbstractValueData ) valueData ) . getPath ( ) ;
|
public class ViewDragHelper { /** * Check if any pointer tracked in the current gesture has crossed
* the required slop threshold .
* < p > This depends on internal state populated by
* { @ link # shouldInterceptTouchEvent ( android . view . MotionEvent ) } or
* { @ link # processTouchEvent ( android . view . MotionEvent ) } . You should only rely on
* the results of this method after all currently available touch data
* has been provided to one of these two methods . < / p >
* @ param directions Combination of direction flags , see { @ link # DIRECTION _ HORIZONTAL } ,
* { @ link # DIRECTION _ VERTICAL } , { @ link # DIRECTION _ ALL }
* @ return true if the slop threshold has been crossed , false otherwise */
public boolean checkTouchSlop ( int directions ) { } }
|
final int count = mInitialMotionX . length ; for ( int i = 0 ; i < count ; i ++ ) { if ( checkTouchSlop ( directions , i ) ) { return true ; } } return false ;
|
public class ColorUtils { /** * Create a HSL color .
* @ param color argb color
* @ return the HSL */
static HSL toHSL ( double color ) { } }
|
long argb = Double . doubleToRawLongBits ( color ) ; double a = alpha ( color ) ; double r = clamp ( ( ( argb >> 32 ) & 0xFFFF ) / ( double ) 0xFF00 ) ; double g = clamp ( ( ( argb >> 16 ) & 0xFFFF ) / ( double ) 0xFF00 ) ; double b = clamp ( ( ( argb >> 0 ) & 0xFFFF ) / ( double ) 0xFF00 ) ; double max = Math . max ( Math . max ( r , g ) , b ) ; double min = Math . min ( Math . min ( r , g ) , b ) ; double h , s , l = ( max + min ) / 2 , d = max - min ; if ( max == min ) { h = s = 0 ; } else { s = l > 0.5 ? d / ( 2 - max - min ) : d / ( max + min ) ; if ( max == r ) { h = ( g - b ) / d + ( g < b ? 6 : 0 ) ; } else if ( max == g ) { h = ( b - r ) / d + 2 ; } else { h = ( r - g ) / d + 4 ; } h /= 6 ; } return new HSL ( h * 360 , s , l , a ) ;
|
public class FkAgent { /** * Extract tokens from request .
* @ param req Request .
* @ return List of user agent tokens .
* @ throws IOException If some problems inside . */
private static List < String > tokens ( final Request req ) throws IOException { } }
|
final List < String > tokens = new LinkedList < > ( ) ; final Iterable < String > headers = new RqHeaders . Base ( req ) . header ( "User-Agent" ) ; for ( final String header : headers ) { final Matcher matcher = PATTERN . matcher ( header ) ; if ( matcher . matches ( ) ) { tokens . add ( matcher . group ( ) ) ; } } return tokens ;
|
public class ServerRequest { /** * < p > Converts a { @ link JSONObject } object containing keys stored as key - value pairs into
* a { @ link ServerRequest } . < / p >
* @ param json A { @ link JSONObject } object containing post data stored as key - value pairs
* @ param context Application context .
* @ return A { @ link ServerRequest } object with the { @ link # POST _ KEY }
* values set if not null ; this can be one or the other . If both values in the
* supplied { @ link JSONObject } are null , null is returned instead of an object . */
public static ServerRequest fromJSON ( JSONObject json , Context context ) { } }
|
JSONObject post = null ; String requestPath = "" ; try { if ( json . has ( POST_KEY ) ) { post = json . getJSONObject ( POST_KEY ) ; } } catch ( JSONException e ) { // it ' s OK for post to be null
} try { if ( json . has ( POST_PATH_KEY ) ) { requestPath = json . getString ( POST_PATH_KEY ) ; } } catch ( JSONException e ) { // it ' s OK for post to be null
} if ( requestPath != null && requestPath . length ( ) > 0 ) { return getExtendedServerRequest ( requestPath , post , context ) ; } return null ;
|
public class MathUtilities { /** * Calculate the minimum value from an array of values .
* @ param values Array of values .
* @ return minimum value of the provided set . */
public static BigInteger minimum ( BigInteger ... values ) { } }
|
int len = values . length ; if ( len == 1 ) { if ( values [ 0 ] == null ) { throw new IllegalArgumentException ( "Cannot passed null BigInteger entry to minimum()" ) ; } return values [ 0 ] ; } BigInteger current = values [ 0 ] ; for ( int i = 1 ; i < len ; i ++ ) { if ( values [ i ] == null ) { throw new IllegalArgumentException ( "Cannot passed null BigInteger entry to minimum()" ) ; } current = values [ i ] . min ( current ) ; } return current ;
|
public class Hashes { /** * Preprocesses a bit vector so that MurmurHash 64 - bit can be computed in
* constant time on all prefixes .
* @ param bv
* a bit vector .
* @ param seed
* a seed for the hash .
* @ return an array containing the state of the variables < code > h < / code >
* during the hash computation ; these vector must be passed to
* { @ link # murmur ( BitVector , long , long [ ] ) } ( and analogous methods )
* in this order .
* @ see # murmur ( BitVector , long ) */
public static long [ ] preprocessMurmur ( final BitVector bv , final long seed ) { } }
|
long h = seed , k ; long from = 0 ; final long length = bv . length ( ) ; final int wordLength = ( int ) ( length / Long . SIZE ) ; final long state [ ] = new long [ wordLength + 1 ] ; int i = 0 ; state [ i ++ ] = h ; for ( ; length - from >= Long . SIZE ; i ++ ) { k = bv . getLong ( from , from += Long . SIZE ) ; k *= M ; k ^= k >>> R ; k *= M ; h ^= k ; h *= M ; state [ i ] = h ; } return state ;
|
public class PortalEventDimensionPopulatorImpl { /** * Creates a date dimension , handling the quarter and term lookup logic */
protected void createDateDimension ( List < QuarterDetail > quartersDetails , List < AcademicTermDetail > academicTermDetails , DateMidnight date ) { } }
|
final QuarterDetail quarterDetail = EventDateTimeUtils . findDateRangeSorted ( date , quartersDetails ) ; final AcademicTermDetail termDetail = EventDateTimeUtils . findDateRangeSorted ( date , academicTermDetails ) ; this . dateDimensionDao . createDateDimension ( date , quarterDetail . getQuarterId ( ) , termDetail != null ? termDetail . getTermName ( ) : null ) ;
|
public class CmsFlexCacheClearDialog { /** * Creates the list of widgets for this dialog . < p > */
@ Override protected void defineWidgets ( ) { } }
|
setKeyPrefix ( KEY_PREFIX ) ; // initialize the cache object to use for the dialog
CmsFlexController controller = ( CmsFlexController ) getJsp ( ) . getRequest ( ) . getAttribute ( CmsFlexController . ATTRIBUTE_NAME ) ; CmsFlexCache cache = controller . getCmsCache ( ) ; setOffline ( true ) ; setOnline ( true ) ; setMode ( MODE_ALL ) ; // widgets to display
if ( cache . cacheOffline ( ) ) { addWidget ( new CmsWidgetDialogParameter ( this , "offline" , PAGES [ 0 ] , new CmsCheckboxWidget ( ) ) ) ; } addWidget ( new CmsWidgetDialogParameter ( this , "online" , PAGES [ 0 ] , new CmsCheckboxWidget ( ) ) ) ; addWidget ( new CmsWidgetDialogParameter ( this , "mode" , PAGES [ 0 ] , new CmsRadioSelectWidget ( getModes ( ) ) ) ) ;
|
public class HandleConstructor { /** * For each field which is not final and has no initializer that gets ' removed ' by { @ code @ Builder . Default } there is no need to
* write an explicit ' this . x = foo ' in the constructor , so strip them away here . */
private static List < JavacNode > fieldsNeedingBuilderDefaults ( JavacNode typeNode , List < JavacNode > fieldsToParam ) { } }
|
ListBuffer < JavacNode > out = new ListBuffer < JavacNode > ( ) ; top : for ( JavacNode node : typeNode . down ( ) ) { if ( node . getKind ( ) != Kind . FIELD ) continue top ; JCVariableDecl varDecl = ( JCVariableDecl ) node . get ( ) ; if ( ( varDecl . mods . flags & Flags . STATIC ) != 0 ) continue top ; for ( JavacNode ftp : fieldsToParam ) if ( node == ftp ) continue top ; if ( JavacHandlerUtil . hasAnnotation ( Builder . Default . class , node ) ) out . append ( node ) ; } return out . toList ( ) ;
|
public class SystemReader { /** * Main method of the class , which handles all the process to create all
* tests .
* @ param storyFilePath
* , it is the folder where the plain text given by the client is
* stored
* @ param platformName
* , to choose the MAS platform ( JADE , JADEX , etc . )
* @ param src _ test _ dir
* , the folder where our classes are created
* @ param tests _ package
* , the name of the package where the stories are created
* @ param casemanager _ package
* , the path where casemanager must be created
* @ param loggingPropFile
* , properties file
* @ throws Exception
* , if any error is found in the configuration */
public static void generateJavaFilesForOneStory ( String storyFilePath , String platformName , String src_test_dir , String tests_package , String casemanager_package , String loggingPropFile ) throws Exception { } }
|
/* * This map has the following structure : { Scenario1ID = >
* [ GivenDescription1 , WhenDescription1 , ThenDescription1 ] , Scenario2ID
* = > [ GivenDescription2 , WhenDescription2 , ThenDescription2 ] , . . . } */
HashMap < String , String [ ] > scenarios = new HashMap < String , String [ ] > ( ) ; String storyName = null ; String story_user = null ; String user_feature = null ; String user_benefit = null ; BufferedReader fileReader = createFileReader ( storyFilePath ) ; if ( fileReader == null ) { logger . severe ( "ERROR Reading the file " + storyFilePath ) ; } else { // Starting with the CaseManager
// Shall I perish , may $ Deity have mercy on my soul , and on those
// who should finish this
File caseManager = CreateSystemCaseManager . startSystemCaseManager ( casemanager_package , src_test_dir ) ; try { String nextLine = null ; // TYPES :
// As a - > 1
// I want to - > 2
// So that - > 3
int lineType = 0 ; while ( ( nextLine = fileReader . readLine ( ) ) != null ) { // Again , why am I using class variables to store the data
// I only fucking use in this method ?
if ( nextLine . startsWith ( "Story" ) ) { String aux = nextLine . replaceFirst ( "Story" , "" ) . trim ( ) ; if ( aux . startsWith ( ":" ) || aux . startsWith ( "-" ) ) { aux = aux . substring ( 1 ) . trim ( ) ; } storyName = aux ; } else if ( nextLine . startsWith ( "As a" ) ) { story_user = nextLine . replaceFirst ( "As a" , "" ) . trim ( ) ; lineType = 1 ; } else if ( nextLine . startsWith ( "I want to" ) ) { user_feature = nextLine . replaceFirst ( "I want to" , "" ) . trim ( ) ; lineType = 2 ; } else if ( nextLine . startsWith ( "So that" ) ) { user_benefit = nextLine . replaceFirst ( "So that" , "" ) . trim ( ) ; lineType = 3 ; } else if ( nextLine . startsWith ( "And" ) ) { switch ( lineType ) { case 1 : story_user = story_user + " and " + nextLine . replaceFirst ( "And" , "" ) . trim ( ) ; break ; case 2 : user_feature = user_feature + " and " + nextLine . replaceFirst ( "And" , "" ) . trim ( ) ; break ; case 3 : user_benefit = user_benefit + " and " + nextLine . replaceFirst ( "And" , "" ) . trim ( ) ; break ; default : break ; } } else if ( nextLine . startsWith ( "Scenario" ) ) { // I am assuming that the file is properly formated
// TODO : Check that it actually is properly formated .
String aux = nextLine . replaceFirst ( "Scenario" , "" ) . trim ( ) ; if ( aux . startsWith ( ":" ) || aux . startsWith ( "-" ) ) { aux = aux . substring ( 1 ) . trim ( ) ; } aux . toLowerCase ( ) ; String scenarioID = createClassName ( aux ) ; while ( ! fileReader . ready ( ) ) { Thread . yield ( ) ; } nextLine = fileReader . readLine ( ) ; String givenDescription = nextLine . replaceFirst ( "Given" , "" ) . trim ( ) ; while ( ! fileReader . ready ( ) ) { Thread . yield ( ) ; } nextLine = fileReader . readLine ( ) ; while ( nextLine . startsWith ( "And" ) ) { givenDescription = givenDescription + " and " + nextLine . replaceFirst ( "And" , "" ) . trim ( ) ; while ( ! fileReader . ready ( ) ) { Thread . yield ( ) ; } nextLine = fileReader . readLine ( ) ; } String whenDescription = nextLine . replaceFirst ( "When" , "" ) . trim ( ) ; while ( ! fileReader . ready ( ) ) { Thread . yield ( ) ; } nextLine = fileReader . readLine ( ) ; while ( nextLine . startsWith ( "And" ) ) { whenDescription = whenDescription + " and " + nextLine . replaceFirst ( "And" , "" ) . trim ( ) ; while ( ! fileReader . ready ( ) ) { Thread . yield ( ) ; } nextLine = fileReader . readLine ( ) ; } String thenDescription = nextLine . replaceFirst ( "Then" , "" ) . trim ( ) ; nextLine = fileReader . readLine ( ) ; while ( nextLine != null && nextLine . startsWith ( "And" ) ) { thenDescription = thenDescription + " and " + nextLine . replaceFirst ( "And" , "" ) . trim ( ) ; nextLine = fileReader . readLine ( ) ; } String [ ] scenarioData = new String [ 3 ] ; scenarioData [ 0 ] = givenDescription ; scenarioData [ 1 ] = whenDescription ; scenarioData [ 2 ] = thenDescription ; scenarios . put ( scenarioID , scenarioData ) ; } else if ( ! nextLine . trim ( ) . isEmpty ( ) ) { // Is not an empty line , but has not been recognized .
logger . severe ( "ERROR: The test writen in the plain text can not be handed" ) ; logger . severe ( "Try again whit the following key-words: {Story -," + " As a, I want to, So that, Scenario:, Given, When, Then}" ) ; } // The only possibility here is to get an empty line ,
// so I don ' t have to do anything .
} fileReader . close ( ) ; // Now , I should have all the variables set .
if ( storyName != null ) { // / / I have a story , so . . .
if ( fileDoesNotExist ( createClassName ( storyName ) + ".java" , tests_package , src_test_dir ) ) { CreateSystemTestSuite . createSystemTestSuite ( storyName , platformName , tests_package , src_test_dir , loggingPropFile , story_user , user_feature , user_benefit , scenarios ) ; } CreateSystemCaseManager . addStory ( caseManager , storyName , tests_package , story_user , user_feature , user_benefit ) ; } else { // This should not happen , since this class should only be
// used
// to create System tests , ( i . e . " story " should never be
// null )
logger . severe ( "ERROR: No Story found in :" + storyFilePath ) ; } CreateSystemCaseManager . closeSystemCaseManager ( caseManager ) ; } catch ( Exception e ) { logger . severe ( "ERROR: " + e . getMessage ( ) ) ; throw e ; } }
|
public class WorkflowManagerImpl { /** * / * ( non - Javadoc )
* @ see nz . co . senanque . workflow . WorkflowManager # getField ( nz . co . senanque . workflow . instances . ProcessInstance , nz . co . senanque . schemaparser . FieldDescriptor ) */
@ Transactional public Object getField ( ProcessInstance processInstance , FieldDescriptor fd ) { } }
|
Object o = getContextDAO ( ) . getContext ( processInstance . getObjectInstance ( ) ) ; String prefix = "get" ; if ( fd . getType ( ) . endsWith ( "Boolean" ) ) { prefix = "is" ; } String name = prefix + StringUtils . capitalize ( fd . getName ( ) ) ; try { Method getter = o . getClass ( ) . getMethod ( name ) ; return getter . invoke ( o ) ; } catch ( Exception e ) { throw new WorkflowException ( "Problem finding field: " + fd . getName ( ) ) ; }
|
public class DataStoreUtil { /** * Make a new record storage , to associate the given ids with an object of
* class dataclass .
* @ param ids DBIDs to store data for
* @ param hints Hints for the storage manager
* @ param dataclasses classes to store
* @ return new record store */
public static WritableRecordStore makeRecordStorage ( DBIDs ids , int hints , Class < ? > ... dataclasses ) { } }
|
return DataStoreFactory . FACTORY . makeRecordStorage ( ids , hints , dataclasses ) ;
|
public class GrailsDomainBinder { /** * Binds the sub classes of a root class using table - per - heirarchy inheritance mapping
* @ param domainClass The root domain class to bind
* @ param parent The parent class instance
* @ param mappings The mappings instance
* @ param sessionFactoryBeanName the session factory bean name */
protected void bindSubClasses ( HibernatePersistentEntity domainClass , PersistentClass parent , InFlightMetadataCollector mappings , String sessionFactoryBeanName ) { } }
|
final java . util . Collection < PersistentEntity > subClasses = domainClass . getMappingContext ( ) . getDirectChildEntities ( domainClass ) ; for ( PersistentEntity sub : subClasses ) { final Class javaClass = sub . getJavaClass ( ) ; if ( javaClass . getSuperclass ( ) . equals ( domainClass . getJavaClass ( ) ) && ConnectionSourcesSupport . usesConnectionSource ( sub , dataSourceName ) ) { bindSubClass ( ( HibernatePersistentEntity ) sub , parent , mappings , sessionFactoryBeanName ) ; } }
|
public class JavaWriter { /** * Prints a parameterized type declaration :
* < pre >
* T & lt ; X >
* < / pre > */
private void printParameterizedType ( ParameterizedType parameterizedType ) throws IOException { } }
|
Type rawType = parameterizedType . getRawType ( ) ; if ( rawType instanceof Class < ? > ) printClass ( ( Class < ? > ) rawType ) ; else printType ( rawType ) ; print ( "<" ) ; Type [ ] typeParameters = parameterizedType . getActualTypeArguments ( ) ; for ( int i = 0 ; i < typeParameters . length ; i ++ ) { if ( i != 0 ) { print ( ", " ) ; } printType ( typeParameters [ i ] ) ; } print ( ">" ) ;
|
public class CheckUtil { /** * Same as checkMmul , but for matrix subtraction */
public static boolean checkSubtract ( INDArray first , INDArray second , double maxRelativeDifference , double minAbsDifference ) { } }
|
RealMatrix rmFirst = convertToApacheMatrix ( first ) ; RealMatrix rmSecond = convertToApacheMatrix ( second ) ; INDArray result = first . sub ( second ) ; RealMatrix rmResult = rmFirst . subtract ( rmSecond ) ; if ( ! checkShape ( rmResult , result ) ) return false ; boolean ok = checkEntries ( rmResult , result , maxRelativeDifference , minAbsDifference ) ; if ( ! ok ) { INDArray onCopies = Shape . toOffsetZeroCopy ( first ) . sub ( Shape . toOffsetZeroCopy ( second ) ) ; printFailureDetails ( first , second , rmResult , result , onCopies , "sub" ) ; } return ok ;
|
public class GrapesServerConfig { /** * Returns the complete Grapes root URL
* @ return String */
public String getUrl ( ) { } }
|
final StringBuilder sb = new StringBuilder ( ) ; sb . append ( "http://" ) ; sb . append ( getHttpConfiguration ( ) . getBindHost ( ) . get ( ) ) ; sb . append ( ":" ) ; sb . append ( getHttpConfiguration ( ) . getPort ( ) ) ; return sb . toString ( ) ;
|
public class AmazonApiGatewayClient { /** * Deletes the < a > ClientCertificate < / a > resource .
* @ param deleteClientCertificateRequest
* A request to delete the < a > ClientCertificate < / a > resource .
* @ return Result of the DeleteClientCertificate operation returned by the service .
* @ throws UnauthorizedException
* The request is denied because the caller has insufficient permissions .
* @ throws TooManyRequestsException
* The request has reached its throttling limit . Retry after the specified time period .
* @ throws BadRequestException
* The submitted request is not valid , for example , the input is incomplete or incorrect . See the
* accompanying error message for details .
* @ throws NotFoundException
* The requested resource is not found . Make sure that the request URI is correct .
* @ sample AmazonApiGateway . DeleteClientCertificate */
@ Override public DeleteClientCertificateResult deleteClientCertificate ( DeleteClientCertificateRequest request ) { } }
|
request = beforeClientExecution ( request ) ; return executeDeleteClientCertificate ( request ) ;
|
public class Cluster { /** * Gets the instance id . */
@ SuppressWarnings ( "WeakerAccess" ) public String getInstanceId ( ) { } }
|
// Constructor ensures that name is not null
ClusterName fullName = Verify . verifyNotNull ( ClusterName . parse ( stateProto . getName ( ) ) , "Name can never be null" ) ; // noinspection ConstantConditions
return fullName . getInstance ( ) ;
|
public class AnnotationUtils { /** * Helper method for comparing two arrays of annotations .
* @ param a1 the first array
* @ param a2 the second array
* @ return a flag whether these arrays are equal */
@ GwtIncompatible ( "incompatible method" ) private static boolean annotationArrayMemberEquals ( final Annotation [ ] a1 , final Annotation [ ] a2 ) { } }
|
if ( a1 . length != a2 . length ) { return false ; } for ( int i = 0 ; i < a1 . length ; i ++ ) { if ( ! equals ( a1 [ i ] , a2 [ i ] ) ) { return false ; } } return true ;
|
public class ExtractionUtil { /** * Extracts the file contained in a gzip archive . The extracted file is
* placed in the exact same path as the file specified .
* @ param file the archive file
* @ throws FileNotFoundException thrown if the file does not exist
* @ throws IOException thrown if there is an error extracting the file . */
public static void extractGzip ( File file ) throws FileNotFoundException , IOException { } }
|
final String originalPath = file . getPath ( ) ; final File gzip = new File ( originalPath + ".gz" ) ; if ( gzip . isFile ( ) && ! gzip . delete ( ) ) { LOGGER . debug ( "Failed to delete initial temporary file when extracting 'gz' {}" , gzip . toString ( ) ) ; gzip . deleteOnExit ( ) ; } if ( ! file . renameTo ( gzip ) ) { throw new IOException ( "Unable to rename '" + file . getPath ( ) + "'" ) ; } final File newFile = new File ( originalPath ) ; try ( FileInputStream fis = new FileInputStream ( gzip ) ; GZIPInputStream cin = new GZIPInputStream ( fis ) ; FileOutputStream out = new FileOutputStream ( newFile ) ) { IOUtils . copy ( cin , out ) ; } finally { if ( gzip . isFile ( ) && ! org . apache . commons . io . FileUtils . deleteQuietly ( gzip ) ) { LOGGER . debug ( "Failed to delete temporary file when extracting 'gz' {}" , gzip . toString ( ) ) ; gzip . deleteOnExit ( ) ; } }
|
public class SDKUtil { /** * Generate parameter hash for the given chain code path , func and args
* @ param path Chain code path
* @ param func Chain code function name
* @ param args List of arguments
* @ return hash of path , func and args */
public static String generateParameterHash ( String path , String func , List < String > args ) { } }
|
logger . debug ( String . format ( "GenerateParameterHash : path=%s, func=%s, args=%s" , path , func , args ) ) ; // Append the arguments
StringBuilder param = new StringBuilder ( path ) ; param . append ( func ) ; args . forEach ( param :: append ) ; // Compute the hash
String strHash = Hex . toHexString ( hash ( param . toString ( ) . getBytes ( ) , new SHA3Digest ( ) ) ) ; return strHash ;
|
public class Filelistener { /** * Start listening to the defined folders .
* @ throws FileNotFoundException
* @ throws ClassNotFoundException
* @ throws IOException
* @ throws ResourceNotExistingException
* @ throws TTException */
public void startListening ( ) throws FileNotFoundException , ClassNotFoundException , IOException , ResourceNotExistingException , TTException { } }
|
mProcessingThread = new Thread ( ) { public void run ( ) { try { processFileNotifications ( ) ; } catch ( InterruptedException | TTException | IOException e ) { } } } ; mProcessingThread . start ( ) ; initSessions ( ) ;
|
public class CheckpointStatsTracker { /** * Callback when a checkpoint fails .
* @ param failed The failed checkpoint stats . */
private void reportFailedCheckpoint ( FailedCheckpointStats failed ) { } }
|
statsReadWriteLock . lock ( ) ; try { counts . incrementFailedCheckpoints ( ) ; history . replacePendingCheckpointById ( failed ) ; dirty = true ; } finally { statsReadWriteLock . unlock ( ) ; }
|
public class SettingsPack { /** * Sets a global limit on the number of connections opened . The number of
* connections is set to a hard minimum of at least two per torrent , so
* if you set a too low connections limit , and open too many torrents ,
* the limit will not be met .
* @ param value */
public SettingsPack connectionsLimit ( int value ) { } }
|
sp . set_int ( settings_pack . int_types . connections_limit . swigValue ( ) , value ) ; return this ;
|
public class ResourceModelStatistics { /** * Adds the mapping with the duration to the statistics .
* @ return this instance . */
public ResourceModelStatistics countMappingDuration ( int durationInMs ) { } }
|
// The right - hand interval boundaries are pre - calculated . We start at the smallest ( 1 ) of the
// interval [ 0 , 1 ) . Thus , when our value is less than the boundary , we know it is in the current interval ( i ) ,
// as the right - hand boundary is exclusive .
for ( int i = 0 ; i < this . indexBoundaries . length ; ++ i ) { if ( durationInMs < this . indexBoundaries [ i ] ) { ++ this . mappingDurationFrequencies [ i ] ; return this ; } } // The mapping duration time exceeds the frequency table boundaries .
// Fallback : count it as the longest possible duration
++ this . mappingDurationFrequencies [ this . mappingDurationFrequencies . length - 1 ] ; return this ;
|
public class TagsApi { /** * Get the raw versions of a given tag ( or all tags ) for the currently logged - in user .
* This method does not require authentication .
* @ param tag tag you want to retrieve all raw versions for . Optional .
* @ return raw versions of a tag for the given tag , or all tags for the currently logged in user .
* @ throws JinxException if there are any errors .
* @ see < a href = " https : / / www . flickr . com / services / api / flickr . tags . getListUserRaw . html " > flickr . tags . getListUserRaw < / a > */
public RawTagsForUser getListUserRaw ( String tag ) throws JinxException { } }
|
Map < String , String > params = new TreeMap < > ( ) ; params . put ( "method" , "flickr.tags.getListUserRaw" ) ; if ( tag != null ) { params . put ( "tag" , tag ) ; } return jinx . flickrGet ( params , RawTagsForUser . class ) ;
|
public class ProducibleConfig { /** * Create the producible data from configurer .
* @ param configurer The configurer reference ( must not be < code > null < / code > ) .
* @ return The producible data .
* @ throws LionEngineException If unable to read node . */
public static ProducibleConfig imports ( Configurer configurer ) { } }
|
Check . notNull ( configurer ) ; return imports ( configurer . getRoot ( ) ) ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.