signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class CreateCommitRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateCommitRequest createCommitRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createCommitRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createCommitRequest . getRepositoryName ( ) , REPOSITORYNAME_BINDING ) ; protocolMarshaller . marshall ( createCommitRequest . getBranchName ( ) , BRANCHNAME_BINDING ) ; protocolMarshaller . marshall ( createCommitRequest . getParentCommitId ( ) , PARENTCOMMITID_BINDING ) ; protocolMarshaller . marshall ( createCommitRequest . getAuthorName ( ) , AUTHORNAME_BINDING ) ; protocolMarshaller . marshall ( createCommitRequest . getEmail ( ) , EMAIL_BINDING ) ; protocolMarshaller . marshall ( createCommitRequest . getCommitMessage ( ) , COMMITMESSAGE_BINDING ) ; protocolMarshaller . marshall ( createCommitRequest . getKeepEmptyFolders ( ) , KEEPEMPTYFOLDERS_BINDING ) ; protocolMarshaller . marshall ( createCommitRequest . getPutFiles ( ) , PUTFILES_BINDING ) ; protocolMarshaller . marshall ( createCommitRequest . getDeleteFiles ( ) , DELETEFILES_BINDING ) ; protocolMarshaller . marshall ( createCommitRequest . getSetFileModes ( ) , SETFILEMODES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class GoogleMapShapeConverter { /** * Convert a { @ link MultiLatLng } to a { @ link MultiPoint }
* @ param latLngs lat lngs
* @ param hasZ has z flag
* @ param hasM has m flag
* @ return multi point */
public MultiPoint toMultiPoint ( List < LatLng > latLngs , boolean hasZ , boolean hasM ) { } } | MultiPoint multiPoint = new MultiPoint ( hasZ , hasM ) ; for ( LatLng latLng : latLngs ) { Point point = toPoint ( latLng ) ; multiPoint . addPoint ( point ) ; } return multiPoint ; |
public class EnvLoader { /** * Adds a dependency to the current environment .
* @ param depend the dependency to add */
public static void addDependency ( Dependency depend ) { } } | ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; addDependency ( depend , loader ) ; |
public class RandomVariableLowMemory { /** * / * ( non - Javadoc )
* @ see net . finmath . stochastic . RandomVariableInterface # abs ( ) */
public RandomVariableInterface abs ( ) { } } | if ( isDeterministic ( ) ) { double newValueIfNonStochastic = Math . abs ( valueIfNonStochastic ) ; return new RandomVariableLowMemory ( time , newValueIfNonStochastic ) ; } else { double [ ] newRealizations = new double [ realizations . length ] ; for ( int i = 0 ; i < newRealizations . length ; i ++ ) { newRealizations [ i ] = Math . abs ( realizations [ i ] ) ; } return new RandomVariableLowMemory ( time , newRealizations ) ; } |
public class TiffWriter { /** * Write strip data .
* @ param ifd the ifd
* @ return the array list
* @ throws IOException Signals that an I / O exception has occurred . */
private ArrayList < Integer > writeStripData ( IFD ifd ) throws IOException { } } | ArrayList < Integer > newStripOffsets = new ArrayList < Integer > ( ) ; IfdTags metadata = ifd . getMetadata ( ) ; TagValue stripOffsets = metadata . get ( 273 ) ; TagValue stripSizes = metadata . get ( 279 ) ; for ( int i = 0 ; i < stripOffsets . getCardinality ( ) ; i ++ ) { try { int pos = ( int ) data . position ( ) ; newStripOffsets . add ( pos ) ; int start = stripOffsets . getValue ( ) . get ( i ) . toInt ( ) ; int size = stripSizes . getValue ( ) . get ( i ) . toInt ( ) ; this . input . seekOffset ( start ) ; for ( int off = start ; off < start + size ; off ++ ) { byte v = this . input . readDirectByte ( ) ; data . put ( v ) ; } if ( data . position ( ) % 2 != 0 ) { // Correct word alignment
data . put ( ( byte ) 0 ) ; } } catch ( Exception ex ) { } } return newStripOffsets ; |
public class Spies { /** * Proxies a binary function spying for first parameter .
* @ param < T1 > the function first parameter type
* @ param < T2 > the function second parameter type
* @ param < R > the function result type
* @ param function the function that will be spied
* @ param param1 a box that will be containing the first spied parameter
* @ return the proxied function */
public static < T1 , T2 , R > BiFunction < T1 , T2 , R > spy1st ( BiFunction < T1 , T2 , R > function , Box < T1 > param1 ) { } } | return spy ( function , Box . < R > empty ( ) , param1 , Box . < T2 > empty ( ) ) ; |
public class ModelsImpl { /** * Creates a single child in an existing composite entity model .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param cEntityId The composite entity extractor ID .
* @ param addCompositeEntityChildOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the UUID object if successful . */
public UUID addCompositeEntityChild ( UUID appId , String versionId , UUID cEntityId , AddCompositeEntityChildOptionalParameter addCompositeEntityChildOptionalParameter ) { } } | return addCompositeEntityChildWithServiceResponseAsync ( appId , versionId , cEntityId , addCompositeEntityChildOptionalParameter ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class LiveEventsInner { /** * Create Live Event .
* Creates a Live Event .
* @ param resourceGroupName The name of the resource group within the Azure subscription .
* @ param accountName The Media Services account name .
* @ param liveEventName The name of the Live Event .
* @ param parameters Live Event properties needed for creation .
* @ param autoStart The flag indicates if auto start the Live Event .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < LiveEventInner > createAsync ( String resourceGroupName , String accountName , String liveEventName , LiveEventInner parameters , Boolean autoStart ) { } } | return createWithServiceResponseAsync ( resourceGroupName , accountName , liveEventName , parameters , autoStart ) . map ( new Func1 < ServiceResponse < LiveEventInner > , LiveEventInner > ( ) { @ Override public LiveEventInner call ( ServiceResponse < LiveEventInner > response ) { return response . body ( ) ; } } ) ; |
public class AbstractClassLoader { /** * Get the synchronized object for loading the given class . */
public static ISynchronizationPoint < NoException > getClassLoadingSP ( String name ) { } } | synchronized ( classLoadingSP ) { Pair < Thread , JoinPoint < NoException > > p = classLoadingSP . get ( name ) ; if ( p == null ) { JoinPoint < NoException > jp = new JoinPoint < NoException > ( ) ; jp . addToJoin ( 1 ) ; jp . start ( ) ; classLoadingSP . put ( name , new Pair < Thread , JoinPoint < NoException > > ( Thread . currentThread ( ) , jp ) ) ; return null ; } if ( p . getValue1 ( ) == Thread . currentThread ( ) ) { p . getValue2 ( ) . addToJoin ( 1 ) ; return null ; } return p . getValue2 ( ) ; } |
public class ResultPartitionMetrics { public static void registerQueueLengthMetrics ( MetricGroup group , ResultPartition partition ) { } } | ResultPartitionMetrics metrics = new ResultPartitionMetrics ( partition ) ; group . gauge ( "totalQueueLen" , metrics . getTotalQueueLenGauge ( ) ) ; group . gauge ( "minQueueLen" , metrics . getMinQueueLenGauge ( ) ) ; group . gauge ( "maxQueueLen" , metrics . getMaxQueueLenGauge ( ) ) ; group . gauge ( "avgQueueLen" , metrics . getAvgQueueLenGauge ( ) ) ; |
public class LockingTree { /** * Return a { @ link HasInputStream } where all read access to the underlying data is synchronized around the path
* @ param path path
* @ param stream stream
* @ return synchronized stream access */
protected HasInputStream synchStream ( final Path path , final HasInputStream stream ) { } } | return new HasInputStream ( ) { @ Override public InputStream getInputStream ( ) throws IOException { ByteArrayOutputStream bytes = new ByteArrayOutputStream ( ) ; writeContent ( bytes ) ; return new ByteArrayInputStream ( bytes . toByteArray ( ) ) ; } @ Override public long writeContent ( OutputStream outputStream ) throws IOException { synchronized ( pathSynch ( path ) ) { return stream . writeContent ( outputStream ) ; } } } ; |
public class OptionsImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case SimpleAntlrPackage . OPTIONS__OPTION_VALUES : return optionValues != null && ! optionValues . isEmpty ( ) ; } return super . eIsSet ( featureID ) ; |
public class GeneralTopologyContextImpl { /** * Gets information about who is consuming the outputs of the specified component ,
* and how .
* @ return Map from stream id to component id to the Grouping used . */
public Map < String , Map < String , TopologyAPI . Grouping > > getTargets ( String componentId ) { } } | Map < String , Map < String , TopologyAPI . Grouping > > retVal = new HashMap < > ( ) ; if ( ! outputs . containsKey ( componentId ) ) { return retVal ; } for ( TopologyAPI . OutputStream ostream : outputs . get ( componentId ) ) { Map < String , TopologyAPI . Grouping > targetMap = new HashMap < > ( ) ; for ( Map . Entry < String , List < TopologyAPI . InputStream > > e : inputs . entrySet ( ) ) { String targetComponentId = e . getKey ( ) ; for ( TopologyAPI . InputStream is : e . getValue ( ) ) { if ( areStreamsEqual ( ostream . getStream ( ) , is . getStream ( ) ) ) { targetMap . put ( targetComponentId , is . getGtype ( ) ) ; } } } retVal . put ( ostream . getStream ( ) . getId ( ) , targetMap ) ; } return retVal ; |
public class N { /** * Returns a new array with removes all the occurrences of specified elements from < code > a < / code >
* @ param a
* @ param elements
* @ return
* @ see Collection # removeAll ( Collection ) */
@ SafeVarargs public static float [ ] removeAll ( final float [ ] a , final float ... elements ) { } } | if ( N . isNullOrEmpty ( a ) ) { return N . EMPTY_FLOAT_ARRAY ; } else if ( N . isNullOrEmpty ( elements ) ) { return a . clone ( ) ; } else if ( elements . length == 1 ) { return removeAllOccurrences ( a , elements [ 0 ] ) ; } final FloatList list = FloatList . of ( a . clone ( ) ) ; list . removeAll ( FloatList . of ( elements ) ) ; return list . trimToSize ( ) . array ( ) ; |
public class ForTokens { /** * { @ inheritDoc } */
public ParameterDescription . InDefinedShape get ( int index ) { } } | int offset = declaringMethod . isStatic ( ) ? 0 : 1 ; for ( ParameterDescription . Token token : tokens . subList ( 0 , index ) ) { offset += token . getType ( ) . getStackSize ( ) . getSize ( ) ; } return new ParameterDescription . Latent ( declaringMethod , tokens . get ( index ) , index , offset ) ; |
public class StrBuilder { /** * Searches the string builder using the matcher to find the first
* match searching from the given index .
* Matchers can be used to perform advanced searching behaviour .
* For example you could write a matcher to find the character ' a '
* followed by a number .
* @ param matcher the matcher to use , null returns - 1
* @ param startIndex the index to start at , invalid index rounded to edge
* @ return the first index matched , or - 1 if not found */
public int indexOf ( final StrMatcher matcher , int startIndex ) { } } | startIndex = ( startIndex < 0 ? 0 : startIndex ) ; if ( matcher == null || startIndex >= size ) { return - 1 ; } final int len = size ; final char [ ] buf = buffer ; for ( int i = startIndex ; i < len ; i ++ ) { if ( matcher . isMatch ( buf , i , startIndex , len ) > 0 ) { return i ; } } return - 1 ; |
public class HadoopUtils { /** * Moves a src { @ link Path } from a srcFs { @ link FileSystem } to a dst { @ link Path } on a dstFs { @ link FileSystem } . If
* the srcFs and the dstFs have the same scheme , and neither of them or S3 schemes , then the { @ link Path } is simply
* renamed . Otherwise , the data is from the src { @ link Path } to the dst { @ link Path } . So this method can handle copying
* data between different { @ link FileSystem } implementations .
* @ param srcFs the source { @ link FileSystem } where the src { @ link Path } exists
* @ param src the source { @ link Path } which will me moved
* @ param dstFs the destination { @ link FileSystem } where the dst { @ link Path } should be created
* @ param dst the { @ link Path } to move data to
* @ param overwrite true if the destination should be overwritten ; otherwise , false */
public static void movePath ( FileSystem srcFs , Path src , FileSystem dstFs , Path dst , boolean overwrite , Configuration conf ) throws IOException { } } | if ( srcFs . getUri ( ) . getScheme ( ) . equals ( dstFs . getUri ( ) . getScheme ( ) ) && ! FS_SCHEMES_NON_ATOMIC . contains ( srcFs . getUri ( ) . getScheme ( ) ) && ! FS_SCHEMES_NON_ATOMIC . contains ( dstFs . getUri ( ) . getScheme ( ) ) ) { renamePath ( srcFs , src , dst ) ; } else { copyPath ( srcFs , src , dstFs , dst , true , overwrite , conf ) ; } |
public class QLearningDiscrete { /** * Single step of training
* @ param obs last obs
* @ return relevant info for next step */
protected QLStepReturn < O > trainStep ( O obs ) { } } | Integer action ; INDArray input = getInput ( obs ) ; boolean isHistoryProcessor = getHistoryProcessor ( ) != null ; if ( isHistoryProcessor ) getHistoryProcessor ( ) . record ( input ) ; int skipFrame = isHistoryProcessor ? getHistoryProcessor ( ) . getConf ( ) . getSkipFrame ( ) : 1 ; int historyLength = isHistoryProcessor ? getHistoryProcessor ( ) . getConf ( ) . getHistoryLength ( ) : 1 ; int updateStart = getConfiguration ( ) . getUpdateStart ( ) + ( ( getConfiguration ( ) . getBatchSize ( ) + historyLength ) * skipFrame ) ; Double maxQ = Double . NaN ; // ignore if Nan for stats
// if step of training , just repeat lastAction
if ( getStepCounter ( ) % skipFrame != 0 ) { action = lastAction ; } else { if ( history == null ) { if ( isHistoryProcessor ) { getHistoryProcessor ( ) . add ( input ) ; history = getHistoryProcessor ( ) . getHistory ( ) ; } else history = new INDArray [ ] { input } ; } // concat the history into a single INDArray input
INDArray hstack = Transition . concat ( Transition . dup ( history ) ) ; if ( isHistoryProcessor ) { hstack . muli ( 1.0 / getHistoryProcessor ( ) . getScale ( ) ) ; } // if input is not 2d , you have to append that the batch is 1 length high
if ( hstack . shape ( ) . length > 2 ) hstack = hstack . reshape ( Learning . makeShape ( 1 , ArrayUtil . toInts ( hstack . shape ( ) ) ) ) ; INDArray qs = getCurrentDQN ( ) . output ( hstack ) ; int maxAction = Learning . getMaxAction ( qs ) ; maxQ = qs . getDouble ( maxAction ) ; action = getEgPolicy ( ) . nextAction ( hstack ) ; } lastAction = action ; StepReply < O > stepReply = getMdp ( ) . step ( action ) ; accuReward += stepReply . getReward ( ) * configuration . getRewardFactor ( ) ; // if it ' s not a skipped frame , you can do a step of training
if ( getStepCounter ( ) % skipFrame == 0 || stepReply . isDone ( ) ) { INDArray ninput = getInput ( stepReply . getObservation ( ) ) ; if ( isHistoryProcessor ) getHistoryProcessor ( ) . add ( ninput ) ; INDArray [ ] nhistory = isHistoryProcessor ? getHistoryProcessor ( ) . getHistory ( ) : new INDArray [ ] { ninput } ; Transition < Integer > trans = new Transition ( history , action , accuReward , stepReply . isDone ( ) , nhistory [ 0 ] ) ; getExpReplay ( ) . store ( trans ) ; if ( getStepCounter ( ) > updateStart ) { Pair < INDArray , INDArray > targets = setTarget ( getExpReplay ( ) . getBatch ( ) ) ; getCurrentDQN ( ) . fit ( targets . getFirst ( ) , targets . getSecond ( ) ) ; } history = nhistory ; accuReward = 0 ; } return new QLStepReturn < O > ( maxQ , getCurrentDQN ( ) . getLatestScore ( ) , stepReply ) ; |
public class HttpQuery { /** * Sends a 500 error page to the client .
* Handles responses from deprecated API calls as well as newer , versioned
* API calls
* @ param cause The unexpected exception that caused this error . */
@ Override public void internalError ( final Exception cause ) { } } | logError ( "Internal Server Error on " + request ( ) . getUri ( ) , cause ) ; if ( this . api_version > 0 ) { // always default to the latest version of the error formatter since we
// need to return something
switch ( this . api_version ) { case 1 : default : sendReply ( HttpResponseStatus . INTERNAL_SERVER_ERROR , serializer . formatErrorV1 ( cause ) ) ; } return ; } ThrowableProxy tp = new ThrowableProxy ( cause ) ; tp . calculatePackagingData ( ) ; final String pretty_exc = ThrowableProxyUtil . asString ( tp ) ; tp = null ; if ( hasQueryStringParam ( "json" ) ) { // 32 = 10 + some extra space as exceptions always have \ t ' s to escape .
final StringBuilder buf = new StringBuilder ( 32 + pretty_exc . length ( ) ) ; buf . append ( "{\"err\":\"" ) ; HttpQuery . escapeJson ( pretty_exc , buf ) ; buf . append ( "\"}" ) ; sendReply ( HttpResponseStatus . INTERNAL_SERVER_ERROR , buf ) ; } else { sendReply ( HttpResponseStatus . INTERNAL_SERVER_ERROR , makePage ( "Internal Server Error" , "Houston, we have a problem" , "<blockquote>" + "<h1>Internal Server Error</h1>" + "Oops, sorry but your request failed due to a" + " server error.<br/><br/>" + "Please try again in 30 seconds.<pre>" + pretty_exc + "</pre></blockquote>" ) ) ; } |
public class PdfStamper { /** * Applies a digital signature to a document . The returned PdfStamper
* can be used normally as the signature is only applied when closing .
* Note that the pdf is created in memory .
* A possible use is :
* < pre >
* KeyStore ks = KeyStore . getInstance ( " pkcs12 " ) ;
* ks . load ( new FileInputStream ( " my _ private _ key . pfx " ) , " my _ password " . toCharArray ( ) ) ;
* String alias = ( String ) ks . aliases ( ) . nextElement ( ) ;
* PrivateKey key = ( PrivateKey ) ks . getKey ( alias , " my _ password " . toCharArray ( ) ) ;
* Certificate [ ] chain = ks . getCertificateChain ( alias ) ;
* PdfReader reader = new PdfReader ( " original . pdf " ) ;
* FileOutputStream fout = new FileOutputStream ( " signed . pdf " ) ;
* PdfStamper stp = PdfStamper . createSignature ( reader , fout , ' \ 0 ' ) ;
* PdfSignatureAppearance sap = stp . getSignatureAppearance ( ) ;
* sap . setCrypto ( key , chain , null , PdfSignatureAppearance . WINCER _ SIGNED ) ;
* sap . setReason ( " I ' m the author " ) ;
* sap . setLocation ( " Lisbon " ) ;
* / / comment next line to have an invisible signature
* sap . setVisibleSignature ( new Rectangle ( 100 , 100 , 200 , 200 ) , 1 , null ) ;
* stp . close ( ) ;
* < / pre >
* @ param reader the original document
* @ param os the output stream
* @ param pdfVersion the new pdf version or ' \ 0 ' to keep the same version as the original
* document
* @ throws DocumentException on error
* @ throws IOException on error
* @ return a < CODE > PdfStamper < / CODE > */
public static PdfStamper createSignature ( PdfReader reader , OutputStream os , char pdfVersion ) throws DocumentException , IOException { } } | return createSignature ( reader , os , pdfVersion , null , false ) ; |
public class PluginDefaultGroovyMethods { /** * Returns a sequential { @ link Stream } with the specified array as its
* source .
* @ param self The array , assumed to be unmodified during use
* @ return a { @ code Stream } for the array */
public static Stream < Integer > stream ( int [ ] self ) { } } | return IntStream . range ( 0 , self . length ) . mapToObj ( i -> self [ i ] ) ; |
public class ManagementLocksInner { /** * Deletes the management lock of a resource or any level below the resource .
* To delete management locks , you must have access to Microsoft . Authorization / * or Microsoft . Authorization / locks / * actions . Of the built - in roles , only Owner and User Access Administrator are granted those actions .
* @ param resourceGroupName The name of the resource group containing the resource with the lock to delete .
* @ param resourceProviderNamespace The resource provider namespace of the resource with the lock to delete .
* @ param parentResourcePath The parent resource identity .
* @ param resourceType The resource type of the resource with the lock to delete .
* @ param resourceName The name of the resource with the lock to delete .
* @ param lockName The name of the lock to delete .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < Void > deleteAtResourceLevelAsync ( String resourceGroupName , String resourceProviderNamespace , String parentResourcePath , String resourceType , String resourceName , String lockName , final ServiceCallback < Void > serviceCallback ) { } } | return ServiceFuture . fromResponse ( deleteAtResourceLevelWithServiceResponseAsync ( resourceGroupName , resourceProviderNamespace , parentResourcePath , resourceType , resourceName , lockName ) , serviceCallback ) ; |
public class BeatFinder { /** * Stop listening for beats . */
public synchronized void stop ( ) { } } | if ( isRunning ( ) ) { socket . get ( ) . close ( ) ; socket . set ( null ) ; deliverLifecycleAnnouncement ( logger , false ) ; } |
public class ClasspathSqlResource { /** * { @ inheritDoc } */
@ Override public InputStream getInputStream ( ) throws IOException { } } | ClassLoader cl = Thread . currentThread ( ) . getContextClassLoader ( ) ; return cl . getResourceAsStream ( sqlPath ) ; |
public class ColumnDefEx { /** * Combines both defaultContentType and defaultContent and generates proper content . */
public String calcDefaultContent ( ) { } } | if ( defaultContentType == null ) return defaultContent ; String s ; switch ( defaultContentType ) { case BUTTON : s = "<button data-role='none'>" ; if ( ! Empty . is ( defaultContent ) ) s += defaultContent ; return s + "</button>" ; case CHECKBOX : case CHECKBOX_ROWSELECT : s = "<input type='checkbox' data-role='none'" ; if ( DefaultContentType . CHECKBOX_ROWSELECT . equals ( defaultContentType ) ) { s += " class='" + JsDataTable . CHECKBOX_ROWSEL + "'" ; } if ( ! Empty . is ( defaultContent ) ) { s += ">" + defaultContent + "</input>" ; } else { s += "></input>" ; } return s ; case ROW_DETAILS : return "" ; default : return defaultContent ; } |
public class NumberFormat { /** * Formats a number and appends the resulting text to the given string
* buffer .
* The number can be of any subclass of { @ link java . lang . Number } .
* This implementation extracts the number ' s value using
* { @ link java . lang . Number # longValue ( ) } for all integral type values that
* can be converted to < code > long < / code > without loss of information ,
* including < code > BigInteger < / code > values with a
* { @ link java . math . BigInteger # bitLength ( ) bit length } of less than 64,
* and { @ link java . lang . Number # doubleValue ( ) } for all other types . It
* then calls
* { @ link # format ( long , java . lang . StringBuffer , java . text . FieldPosition ) }
* or { @ link # format ( double , java . lang . StringBuffer , java . text . FieldPosition ) } .
* This may result in loss of magnitude information and precision for
* < code > BigInteger < / code > and < code > BigDecimal < / code > values .
* @ param number the number to format
* @ param toAppendTo the < code > StringBuffer < / code > to which the formatted
* text is to be appended
* @ param pos On input : an alignment field , if desired .
* On output : the offsets of the alignment field .
* @ return the value passed in as < code > toAppendTo < / code >
* @ exception IllegalArgumentException if < code > number < / code > is
* null or not an instance of < code > Number < / code > .
* @ exception NullPointerException if < code > toAppendTo < / code > or
* < code > pos < / code > is null
* @ exception ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode . UNNECESSARY
* @ see java . text . FieldPosition */
public StringBuffer format ( Object number , StringBuffer toAppendTo , FieldPosition pos ) { } } | if ( number instanceof Long || number instanceof Integer || number instanceof Short || number instanceof Byte || number instanceof AtomicInteger || number instanceof AtomicLong || ( number instanceof BigInteger && ( ( BigInteger ) number ) . bitLength ( ) < 64 ) ) { return format ( ( ( Number ) number ) . longValue ( ) , toAppendTo , pos ) ; } else if ( number instanceof Number ) { return format ( ( ( Number ) number ) . doubleValue ( ) , toAppendTo , pos ) ; } else { throw new IllegalArgumentException ( "Cannot format given Object as a Number" ) ; } |
public class RepositoryURIResolver { /** * Resolves the " repository " URI .
* @ param path
* the href to the resource
* @ return the resolved Source or null if the resource was not found
* @ throws TransformerException
* if no URL can be constructed from the path */
protected StreamSource resolveRepositoryURI ( String path ) throws TransformerException { } } | StreamSource resolvedSource = null ; try { if ( path != null ) { URL url = new URL ( path ) ; InputStream in = url . openStream ( ) ; if ( in != null ) { resolvedSource = new StreamSource ( in ) ; } } else { throw new TransformerException ( "Resource does not exist. \"" + path + "\" is not accessible." ) ; } } catch ( MalformedURLException mfue ) { throw new TransformerException ( "Error accessing resource using servlet context: " + path , mfue ) ; } catch ( IOException ioe ) { throw new TransformerException ( "Unable to access resource at: " + path , ioe ) ; } return resolvedSource ; |
public class AbstractClassLoader { /** * Add a class loader from a resource contained by this class loader , for example an inner jar file . */
public final void addSubLoader ( AbstractClassLoader loader ) { } } | if ( subLoaders == null ) subLoaders = new ArrayList < > ( ) ; subLoaders . add ( loader ) ; |
public class StackdriverExportUtils { /** * Convert a OpenCensus Point to a StackDriver Point */
@ VisibleForTesting static Point createPoint ( io . opencensus . metrics . export . Point point , @ javax . annotation . Nullable io . opencensus . common . Timestamp startTimestamp ) { } } | TimeInterval . Builder timeIntervalBuilder = TimeInterval . newBuilder ( ) ; timeIntervalBuilder . setEndTime ( convertTimestamp ( point . getTimestamp ( ) ) ) ; if ( startTimestamp != null ) { timeIntervalBuilder . setStartTime ( convertTimestamp ( startTimestamp ) ) ; } Point . Builder builder = Point . newBuilder ( ) ; builder . setInterval ( timeIntervalBuilder . build ( ) ) ; builder . setValue ( createTypedValue ( point . getValue ( ) ) ) ; return builder . build ( ) ; |
public class Utils { /** * Closes a closeable ( usually stream ) , suppressing any IOExceptions .
* @ param closeable the resource to close quietly , may be { @ code null } */
public static void close ( Closeable closeable ) { } } | if ( closeable != null ) { try { closeable . close ( ) ; } catch ( IOException ioe ) { // Suppress the exception
logger . log ( Level . FINEST , "Unable to close resource." , ioe ) ; } } |
public class PrimitiveArrays { /** * Returns the value of the element with the maximum value */
public static int max ( byte [ ] array , int offset , int length ) { } } | int max = - Integer . MAX_VALUE ; for ( int i = 0 ; i < length ; i ++ ) { int tmp = array [ offset + i ] ; if ( tmp > max ) { max = tmp ; } } return max ; |
public class BloomFilter { /** * Initializes and increases the capacity of this < tt > BloomFilter < / tt > instance , if necessary ,
* to ensure that it can accurately estimate the membership of elements given the expected
* number of insertions . This operation forgets all previous memberships when resizing .
* @ param expectedInsertions the number of expected insertions
* @ param fpp the false positive probability , where 0.0 > fpp < 1.0 */
void ensureCapacity ( @ NonNegative long expectedInsertions , @ NonNegative double fpp ) { } } | checkArgument ( expectedInsertions >= 0 ) ; checkArgument ( fpp > 0 && fpp < 1 ) ; double optimalBitsFactor = - Math . log ( fpp ) / ( Math . log ( 2 ) * Math . log ( 2 ) ) ; int optimalNumberOfBits = ( int ) ( expectedInsertions * optimalBitsFactor ) ; int optimalSize = optimalNumberOfBits >>> BITS_PER_LONG_SHIFT ; if ( ( table != null ) && ( table . length >= optimalSize ) ) { return ; } else if ( optimalSize == 0 ) { tableShift = Integer . SIZE - 1 ; table = new long [ 1 ] ; } else { int powerOfTwoShift = Integer . SIZE - Integer . numberOfLeadingZeros ( optimalSize - 1 ) ; tableShift = Integer . SIZE - powerOfTwoShift ; table = new long [ 1 << powerOfTwoShift ] ; } |
public class Composite { /** * / * Flush is a package method used by Page . flush ( ) to locate the
* most nested composite , write out and empty its contents . */
void flush ( OutputStream out , String encoding ) throws IOException { } } | flush ( new OutputStreamWriter ( out , encoding ) ) ; |
public class AbstractJPAComponent { /** * Process application " started " event . */
public void startedApplication ( JPAApplInfo applInfo ) throws RuntimeWarning // d406994.2
{ } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "startedApplication : " + applInfo . getApplName ( ) ) ; // To save footprint , if an application does not have any JPA access , remove
// the unnecessary appInfo object from list .
if ( applInfo . getScopeSize ( ) == 0 ) { if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "App has no JPA access - removing from applList" ) ; applList . remove ( applInfo . getApplName ( ) ) ; } if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Current application list : " + getSortedAppNames ( ) ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "startedApplication : " + applInfo . getApplName ( ) ) ; |
public class MulticastSocket { /** * Set the default time - to - live for multicast packets sent out
* on this { @ code MulticastSocket } in order to control the
* scope of the multicasts .
* < P > The ttl < B > must < / B > be in the range { @ code 0 < = ttl < =
* 255 } or an { @ code IllegalArgumentException } will be thrown .
* Multicast packets sent with a TTL of { @ code 0 } are not transmitted
* on the network but may be delivered locally .
* @ param ttl
* the time - to - live
* @ throws IOException
* if an I / O exception occurs while setting the
* default time - to - live value
* @ see # getTimeToLive ( ) */
public void setTimeToLive ( int ttl ) throws IOException { } } | if ( ttl < 0 || ttl > 255 ) { throw new IllegalArgumentException ( "ttl out of range" ) ; } if ( isClosed ( ) ) throw new SocketException ( "Socket is closed" ) ; getImpl ( ) . setTimeToLive ( ttl ) ; |
public class ViewPropertyAnimatorPreHC { /** * Starts the underlying Animator for a set of properties . We use a single animator that
* simply runs from 0 to 1 , and then use that fractional value to set each property
* value accordingly . */
private void startAnimation ( ) { } } | ValueAnimator animator = ValueAnimator . ofFloat ( 1.0f ) ; ArrayList < NameValuesHolder > nameValueList = ( ArrayList < NameValuesHolder > ) mPendingAnimations . clone ( ) ; mPendingAnimations . clear ( ) ; int propertyMask = 0 ; int propertyCount = nameValueList . size ( ) ; for ( int i = 0 ; i < propertyCount ; ++ i ) { NameValuesHolder nameValuesHolder = nameValueList . get ( i ) ; propertyMask |= nameValuesHolder . mNameConstant ; } mAnimatorMap . put ( animator , new PropertyBundle ( propertyMask , nameValueList ) ) ; animator . addUpdateListener ( mAnimatorEventListener ) ; animator . addListener ( mAnimatorEventListener ) ; if ( mStartDelaySet ) { animator . setStartDelay ( mStartDelay ) ; } if ( mDurationSet ) { animator . setDuration ( mDuration ) ; } if ( mInterpolatorSet ) { animator . setInterpolator ( mInterpolator ) ; } animator . start ( ) ; |
public class SqlDateTimeUtils { /** * Format a timestamp as specific .
* @ param ts the timestamp to format .
* @ param format the string formatter .
* @ param tz the time zone */
public static String dateFormat ( long ts , String format , TimeZone tz ) { } } | SimpleDateFormat formatter = FORMATTER_CACHE . get ( format ) ; formatter . setTimeZone ( tz ) ; Date dateTime = new Date ( ts ) ; return formatter . format ( dateTime ) ; |
public class RythmEngine { /** * ( 3rd party API , not for user application )
* Get an new template class by { @ link org . rythmengine . resource . ITemplateResource template resource }
* @ param resource the template resource
* @ return template class */
public TemplateClass getTemplateClass ( ITemplateResource resource ) { } } | String key = S . str ( resource . getKey ( ) ) ; TemplateClass tc = classes ( ) . getByTemplate ( key ) ; if ( null == tc ) { tc = new TemplateClass ( resource , this ) ; } return tc ; |
public class JWT { /** * Verify whether the JWT is valid . If valid return the decoded instance .
* @ param jwt jwt
* @ param secret signature key
* @ return the decoded jwt instance
* @ throws DecodeException if jwt is illegal */
public static JWT verify ( String jwt , String secret ) { } } | return verify ( jwt , secret == null ? null : secret . getBytes ( StandardCharsets . UTF_8 ) ) ; |
public class DefaultJiraClient { /** * Get a list of Boards . It ' s saved as Team in Hygieia
* @ return List of Team */
@ Override public List < Team > getBoards ( ) { } } | int count = 0 ; int startAt = 0 ; boolean isLast = false ; List < Team > result = new ArrayList < > ( ) ; while ( ! isLast ) { String url = featureSettings . getJiraBaseUrl ( ) + ( featureSettings . getJiraBaseUrl ( ) . endsWith ( "/" ) ? "" : "/" ) + BOARD_TEAMS_REST_SUFFIX + "?startAt=" + startAt ; try { ResponseEntity < String > responseEntity = makeRestCall ( url ) ; String responseBody = responseEntity . getBody ( ) ; JSONObject teamsJson = ( JSONObject ) parser . parse ( responseBody ) ; if ( teamsJson != null ) { JSONArray valuesArray = ( JSONArray ) teamsJson . get ( "values" ) ; if ( ! CollectionUtils . isEmpty ( valuesArray ) ) { for ( Object obj : valuesArray ) { JSONObject jo = ( JSONObject ) obj ; String teamId = getString ( jo , "id" ) ; String teamName = getString ( jo , "name" ) ; String teamType = getString ( jo , "type" ) ; Team team = new Team ( teamId , teamName ) ; team . setTeamType ( teamType ) ; team . setChangeDate ( "" ) ; team . setAssetState ( "Active" ) ; team . setIsDeleted ( "False" ) ; result . add ( team ) ; count = count + 1 ; } isLast = ( boolean ) teamsJson . get ( "isLast" ) ; LOGGER . info ( "JIRA Collector collected " + count + " boards" ) ; if ( ! isLast ) { startAt += JIRA_BOARDS_PAGING ; } } else { isLast = true ; } } else { isLast = true ; } } catch ( ParseException pe ) { isLast = true ; LOGGER . error ( "Parser exception when parsing teams" , pe ) ; } catch ( HygieiaException | HttpClientErrorException | HttpServerErrorException e ) { isLast = true ; LOGGER . error ( "Error in calling JIRA API: " + url , e . getMessage ( ) ) ; } } return result ; |
public class Transliterator { /** * Register a Transliterator object .
* < p > Because ICU may choose to cache Transliterator objects internally , this must
* be called at application startup , prior to any calls to
* Transliterator . getInstance to avoid undefined behavior .
* @ param trans the Transliterator object */
static void registerInstance ( Transliterator trans , boolean visible ) { } } | registry . put ( trans . getID ( ) , trans , visible ) ; |
public class AbstractOutputWriter { /** * Convert value of this setting to a Java < b > long < / b > .
* If the property is not found , the < code > defaultValue < / code > is returned . If the property is not a long , an exception is thrown .
* @ param name name of the property
* @ param defaultValue default value if the property is not defined .
* @ return int value of the property or < code > defaultValue < / code > if the property is not defined .
* @ throws IllegalArgumentException if setting is not is not a long . */
protected long getLongSetting ( String name , long defaultValue ) throws IllegalArgumentException { } } | if ( settings . containsKey ( name ) ) { String value = settings . get ( name ) . toString ( ) ; try { return Long . parseLong ( value ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Setting '" + name + "=" + value + "' is not a long on " + this . toString ( ) ) ; } } else { return defaultValue ; } |
public class ResizeTransformer { /** * Changes X view position using layout ( ) method .
* @ param verticalDragOffset used to calculate the new X position . */
@ Override public void updatePosition ( float verticalDragOffset ) { } } | int right = getViewRightPosition ( verticalDragOffset ) ; int left = right - layoutParams . width ; int top = getView ( ) . getTop ( ) ; int bottom = top + layoutParams . height ; getView ( ) . layout ( left , top , right , bottom ) ; |
public class ModuleItem { /** * add stats for new modules that are added : called when a module item is added */
private void addToStatsTree ( ModuleItem mi ) { } } | ArrayList colMembers = myStatsWithChildren . subCollections ( ) ; if ( colMembers == null ) { colMembers = new ArrayList ( 1 ) ; myStatsWithChildren . setSubcollections ( colMembers ) ; } colMembers . add ( mi . getStats ( true ) ) ; |
public class ThriftClient { /** * ( non - Javadoc )
* @ see com . impetus . kundera . client . Client # deleteByColumn ( java . lang . String ,
* java . lang . String , java . lang . String , java . lang . Object ) */
@ Override public void deleteByColumn ( String schemaName , String tableName , String columnName , Object columnValue ) { } } | if ( ! isOpen ( ) ) { throw new PersistenceException ( "ThriftClient is closed." ) ; } Connection conn = null ; try { conn = getConnection ( ) ; ColumnPath path = new ColumnPath ( tableName ) ; conn . getClient ( ) . remove ( CassandraUtilities . toBytes ( columnValue , columnValue . getClass ( ) ) , path , generator . getTimestamp ( ) , getConsistencyLevel ( ) ) ; } catch ( InvalidRequestException e ) { log . error ( "Error while deleting of column family {} for row key {}, Caused by: ." , tableName , columnValue , e ) ; throw new KunderaException ( e ) ; } catch ( TException e ) { log . error ( "Error while deleting of column family {} for row key {}, Caused by: ." , tableName , columnValue , e ) ; throw new KunderaException ( e ) ; } finally { releaseConnection ( conn ) ; } |
public class ListRuleNamesByTargetRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListRuleNamesByTargetRequest listRuleNamesByTargetRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listRuleNamesByTargetRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listRuleNamesByTargetRequest . getTargetArn ( ) , TARGETARN_BINDING ) ; protocolMarshaller . marshall ( listRuleNamesByTargetRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listRuleNamesByTargetRequest . getLimit ( ) , LIMIT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class PAXWicketFilterFactory { /** * / * ( non - Javadoc )
* @ see org . ops4j . pax . wicket . api . FilterFactory # createFilter ( org . ops4j . pax . wicket . api . ConfigurableFilterConfig ) */
public Filter createFilter ( ConfigurableFilterConfig filterConfig ) throws ServletException { } } | return new Filter ( ) { public void init ( FilterConfig filterConfig ) throws ServletException { // Do init tasks here
} public void doFilter ( ServletRequest request , ServletResponse response , FilterChain chain ) throws IOException , ServletException { // do filter here
chain . doFilter ( request , response ) ; } public void destroy ( ) { // do destroy tasks here
} } ; |
public class PageSourceImpl { /** * return source path as String
* @ return source path as String */
@ Override public String getDisplayPath ( ) { } } | if ( ! mapping . hasArchive ( ) ) { return StringUtil . toString ( getPhyscalFile ( ) , null ) ; } else if ( isLoad ( LOAD_PHYSICAL ) ) { return StringUtil . toString ( getPhyscalFile ( ) , null ) ; } else if ( isLoad ( LOAD_ARCHIVE ) ) { return StringUtil . toString ( getArchiveSourcePath ( ) , null ) ; } else { boolean pse = physcalExists ( ) ; boolean ase = archiveExists ( ) ; if ( mapping . isPhysicalFirst ( ) ) { if ( pse ) return getPhyscalFile ( ) . toString ( ) ; else if ( ase ) return getArchiveSourcePath ( ) ; return getPhyscalFile ( ) . toString ( ) ; } if ( ase ) return getArchiveSourcePath ( ) ; else if ( pse ) return getPhyscalFile ( ) . toString ( ) ; return getArchiveSourcePath ( ) ; } |
public class ReportDistributor { /** * Returns true if the application is debuggable .
* @ return true if the application is debuggable . */
private boolean isDebuggable ( ) { } } | final PackageManager pm = context . getPackageManager ( ) ; try { return ( pm . getApplicationInfo ( context . getPackageName ( ) , 0 ) . flags & ApplicationInfo . FLAG_DEBUGGABLE ) > 0 ; } catch ( PackageManager . NameNotFoundException e ) { return false ; } |
public class CmsVfsDriver { /** * Returns the parent id of the given resource . < p >
* @ param dbc the current database context
* @ param projectId the current project id
* @ param resourcename the resource name to read the parent id for
* @ return the parent id of the given resource
* @ throws CmsDataAccessException if something goes wrong */
protected String internalReadParentId ( CmsDbContext dbc , CmsUUID projectId , String resourcename ) throws CmsDataAccessException { } } | if ( "/" . equalsIgnoreCase ( resourcename ) ) { return CmsUUID . getNullUUID ( ) . toString ( ) ; } String parent = CmsResource . getParentFolder ( resourcename ) ; parent = CmsFileUtil . removeTrailingSeparator ( parent ) ; ResultSet res = null ; PreparedStatement stmt = null ; Connection conn = null ; String parentId = null ; try { conn = m_sqlManager . getConnection ( dbc ) ; stmt = m_sqlManager . getPreparedStatement ( conn , projectId , "C_RESOURCES_READ_PARENT_STRUCTURE_ID" ) ; stmt . setString ( 1 , parent ) ; res = stmt . executeQuery ( ) ; if ( res . next ( ) ) { parentId = res . getString ( 1 ) ; while ( res . next ( ) ) { // do nothing only move through all rows because of mssql odbc driver
} } else { throw new CmsVfsResourceNotFoundException ( Messages . get ( ) . container ( Messages . ERR_READ_PARENT_ID_1 , dbc . removeSiteRoot ( resourcename ) ) ) ; } } catch ( SQLException e ) { throw new CmsDbSqlException ( Messages . get ( ) . container ( Messages . ERR_GENERIC_SQL_1 , CmsDbSqlException . getErrorQuery ( stmt ) ) , e ) ; } finally { m_sqlManager . closeAll ( dbc , conn , stmt , res ) ; } return parentId ; |
public class AdminDictProtwordsAction { private static OptionalEntity < ProtwordsItem > getEntity ( final CreateForm form ) { } } | switch ( form . crudMode ) { case CrudMode . CREATE : final ProtwordsItem entity = new ProtwordsItem ( 0 , StringUtil . EMPTY ) ; return OptionalEntity . of ( entity ) ; case CrudMode . EDIT : if ( form instanceof EditForm ) { return ComponentUtil . getComponent ( ProtwordsService . class ) . getProtwordsItem ( form . dictId , ( ( EditForm ) form ) . id ) ; } break ; default : break ; } return OptionalEntity . empty ( ) ; |
public class FSA { /** * A factory for reading automata in any of the supported versions .
* @ param stream
* The input stream to read automaton data from . The stream is not
* closed .
* @ return Returns an instantiated automaton . Never null .
* @ throws IOException
* If the input stream does not represent an automaton or is
* otherwise invalid . */
public static FSA read ( InputStream stream ) throws IOException { } } | final FSAHeader header = FSAHeader . read ( stream ) ; switch ( header . version ) { case FSA5 . VERSION : return new FSA5 ( stream ) ; case CFSA . VERSION : return new CFSA ( stream ) ; case CFSA2 . VERSION : return new CFSA2 ( stream ) ; default : throw new IOException ( String . format ( Locale . ROOT , "Unsupported automaton version: 0x%02x" , header . version & 0xFF ) ) ; } |
public class CmsGitToolOptionsPanel { /** * Sets the flags for the current action . < p > */
public void setActionFlags ( ) { } } | m_checkinBean . setFetchAndResetBeforeImport ( m_fetchAndReset . getValue ( ) . booleanValue ( ) ) ; switch ( m_mode ) { case checkOut : m_checkinBean . setCheckout ( true ) ; m_checkinBean . setResetHead ( false ) ; m_checkinBean . setResetRemoteHead ( false ) ; break ; case checkIn : m_checkinBean . setCheckout ( false ) ; m_checkinBean . setResetHead ( false ) ; m_checkinBean . setResetRemoteHead ( false ) ; break ; case resetHead : m_checkinBean . setCheckout ( false ) ; m_checkinBean . setResetHead ( true ) ; m_checkinBean . setResetRemoteHead ( false ) ; break ; case resetRemoteHead : m_checkinBean . setCheckout ( false ) ; m_checkinBean . setResetHead ( false ) ; m_checkinBean . setResetRemoteHead ( true ) ; break ; default : break ; } |
public class WebAppFilterManager { /** * PI08268 */
private boolean setDefaultMethod ( HttpServletRequest httpServletReq , String attributeTargetClass , String httpMethod ) { } } | if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) logger . logp ( Level . FINE , CLASS_NAME , "setDefaultMethod" , "set attribute checkdefaultmethod [" + httpMethod + "] , and [" + attributeTargetClass + "]" ) ; httpServletReq . setAttribute ( "com.ibm.ws.webcontainer.security.checkdefaultmethod" , httpMethod ) ; httpServletReq . setAttribute ( attributeTargetClass , "TRUE" ) ; return true ; |
public class AbstractAlpineQueryManager { /** * Refreshes and detaches an objects .
* @ param pcs the instances to detach
* @ param < T > the type to return
* @ return the detached instances
* @ since 1.3.0 */
public < T > List < T > detach ( List < T > pcs ) { } } | pm . getFetchPlan ( ) . setDetachmentOptions ( FetchPlan . DETACH_LOAD_FIELDS ) ; return new ArrayList < > ( pm . detachCopyAll ( pcs ) ) ; |
public class JacksonJsonHandler { /** * { @ inheritDoc } */
@ Override public void writeJson ( Writer writer , Map < String , ? > value ) throws IOException { } } | mapper . writeValue ( writer , value ) ; |
public class DITableInfo { /** * Retrieves , if definitely known , the transfer size for values of the
* specified column , in bytes . < p >
* @ param i zero - based column index
* @ return the transfer size for values of the
* specified column , in bytes */
Integer getColBufLen ( int i ) { } } | int size ; int type ; ColumnSchema column ; column = table . getColumn ( i ) ; type = column . getDataType ( ) . getJDBCTypeCode ( ) ; switch ( type ) { case Types . SQL_CHAR : case Types . SQL_CLOB : case Types . VARCHAR_IGNORECASE : case Types . SQL_VARCHAR : { size = column . getDataType ( ) . precision > Integer . MAX_VALUE ? Integer . MAX_VALUE : ( int ) column . getDataType ( ) . precision ; if ( size == 0 ) { } else if ( size > HALF_MAX_INT ) { size = 0 ; } else { size = 2 * size ; } break ; } case Types . SQL_BINARY : case Types . SQL_BLOB : case Types . SQL_VARBINARY : { size = column . getDataType ( ) . precision > Integer . MAX_VALUE ? Integer . MAX_VALUE : ( int ) column . getDataType ( ) . precision ; break ; } case Types . SQL_BIGINT : case Types . SQL_DOUBLE : case Types . SQL_FLOAT : case Types . SQL_DATE : case Types . SQL_REAL : case Types . SQL_TIME_WITH_TIME_ZONE : case Types . SQL_TIME : { size = 8 ; break ; } case Types . SQL_TIMESTAMP_WITH_TIME_ZONE : case Types . SQL_TIMESTAMP : { size = 12 ; break ; } case Types . SQL_INTEGER : case Types . SQL_SMALLINT : case Types . TINYINT : { size = 4 ; break ; } case Types . SQL_BOOLEAN : { size = 1 ; break ; } default : { size = 0 ; break ; } } return ( size > 0 ) ? ValuePool . getInt ( size ) : null ; |
public class MyProxyServerAuthorization { /** * Performs MyProxy server authorization checks . The hostname of
* the server is compared with the hostname specified in the
* server ' s ( topmost ) certificate in the certificate chain . The
* hostnames must match exactly ( in case - insensitive way ) . The
* service in the certificate may be " host " or " myproxy " .
* < code > AuthorizationException < / code > if the authorization fails .
* Otherwise , the function completes normally .
* @ param context the security context .
* @ param host host address of the peer .
* @ exception AuthorizationException if the peer is
* not authorized to access / use the resource . */
public void authorize ( GSSContext context , String host ) throws AuthorizationException { } } | try { this . authzMyProxyService . authorize ( context , host ) ; } catch ( AuthorizationException e ) { this . authzHostService . authorize ( context , host ) ; } |
public class AWSCodePipelineClient { /** * Removes the connection between the webhook that was created by CodePipeline and the external tool with events to
* be detected . Currently only supported for webhooks that target an action type of GitHub .
* @ param deregisterWebhookWithThirdPartyRequest
* @ return Result of the DeregisterWebhookWithThirdParty operation returned by the service .
* @ throws ValidationException
* The validation was specified in an invalid format .
* @ throws WebhookNotFoundException
* The specified webhook was entered in an invalid format or cannot be found .
* @ sample AWSCodePipeline . DeregisterWebhookWithThirdParty
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / codepipeline - 2015-07-09 / DeregisterWebhookWithThirdParty "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DeregisterWebhookWithThirdPartyResult deregisterWebhookWithThirdParty ( DeregisterWebhookWithThirdPartyRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDeregisterWebhookWithThirdParty ( request ) ; |
public class OPFHandler { /** * Returns an immutable list of the items in the spine . May contain duplicates
* if several < code > itemref < / code > elements point to the same item .
* Returns the empty list if the items have not been parsed yet .
* @ return the list of items in the spine , guaranteed non - null . */
public List < OPFItem > getSpineItems ( ) { } } | return ( items != null ) ? items . getSpineItems ( ) : ImmutableList . < OPFItem > of ( ) ; |
public class GeneratedDUserDaoImpl { /** * query - by method for field createdBy
* @ param createdBy the specified attribute
* @ return an Iterable of DUsers for the specified createdBy */
public Iterable < DUser > queryByCreatedBy ( java . lang . String createdBy ) { } } | return queryByField ( null , DUserMapper . Field . CREATEDBY . getFieldName ( ) , createdBy ) ; |
public class ReqQueue { /** * 增加并发安全机制 , 日后如遇到长连接处理速度极限可以考虑去掉synchronized关键字 , 但需要仔细验证并发安全问题 */
public void writeAndFlush ( ResponseWrapper ... responses ) { } } | synchronized ( this ) { for ( ResponseWrapper response : responses ) { msgId_response . put ( response . getRequest ( ) . getMsgId ( ) , response ) ; } toContinue ( ) ; if ( isTooMany ( ) ) { processTooMany ( ) ; } } |
public class DescribeImagePermissionsRequest { /** * The 12 - digit identifier of one or more AWS accounts with which the image is shared .
* @ param sharedAwsAccountIds
* The 12 - digit identifier of one or more AWS accounts with which the image is shared . */
public void setSharedAwsAccountIds ( java . util . Collection < String > sharedAwsAccountIds ) { } } | if ( sharedAwsAccountIds == null ) { this . sharedAwsAccountIds = null ; return ; } this . sharedAwsAccountIds = new java . util . ArrayList < String > ( sharedAwsAccountIds ) ; |
public class IPv6AddressSection { /** * Whether this section is consistent with an EUI64 section ,
* which means it came from an extended 8 byte address ,
* and the corresponding segments in the middle match 0xff and 0xfe
* @ param partial whether missing segments are considered a match
* @ return */
public boolean isEUI64 ( boolean partial ) { } } | int segmentCount = getSegmentCount ( ) ; int endIndex = addressSegmentIndex + segmentCount ; if ( addressSegmentIndex <= 5 ) { if ( endIndex > 6 ) { int index3 = 5 - addressSegmentIndex ; IPv6AddressSegment seg3 = getSegment ( index3 ) ; IPv6AddressSegment seg4 = getSegment ( index3 + 1 ) ; return seg4 . matchesWithMask ( 0xfe00 , 0xff00 ) && seg3 . matchesWithMask ( 0xff , 0xff ) ; } else if ( partial && endIndex == 6 ) { IPv6AddressSegment seg3 = getSegment ( 5 - addressSegmentIndex ) ; return seg3 . matchesWithMask ( 0xff , 0xff ) ; } } else if ( partial && addressSegmentIndex == 6 && endIndex > 6 ) { IPv6AddressSegment seg4 = getSegment ( 6 - addressSegmentIndex ) ; return seg4 . matchesWithMask ( 0xfe00 , 0xff00 ) ; } return partial ; |
public class FileExecutor { /** * 解析JSON
* @ param url { @ link URL }
* @ return { @ link JSONObject }
* @ throws IOException 异常
* @ since 1.1.0 */
public static JSONObject parseJsonObject ( URL url ) throws IOException { } } | String path = url . toString ( ) ; if ( path . startsWith ( ValueConsts . LOCAL_FILE_URL ) ) { return parseJsonObject ( NetUtils . urlToString ( url ) ) ; } else { return JSONObject . parseObject ( read ( url ) ) ; } |
public class CovarianceMatrix { /** * Add a single value with weight 1.0.
* @ param val Value */
public void put ( double [ ] val ) { } } | assert ( val . length == mean . length ) ; final double nwsum = wsum + 1. ; // Compute new means
for ( int i = 0 ; i < mean . length ; i ++ ) { final double delta = val [ i ] - mean [ i ] ; nmea [ i ] = mean [ i ] + delta / nwsum ; } // Update covariance matrix
for ( int i = 0 ; i < mean . length ; i ++ ) { for ( int j = i ; j < mean . length ; j ++ ) { // We DO want to use the new mean once and the old mean once !
// It does not matter which one is which .
double delta = ( val [ i ] - nmea [ i ] ) * ( val [ j ] - mean [ j ] ) ; elements [ i ] [ j ] = elements [ i ] [ j ] + delta ; // Optimize via symmetry
if ( i != j ) { elements [ j ] [ i ] = elements [ j ] [ i ] + delta ; } } } // Use new values .
wsum = nwsum ; System . arraycopy ( nmea , 0 , mean , 0 , nmea . length ) ; |
public class Messages { /** * Get a message bundle of the given type .
* @ param type the bundle type class
* @ return the bundle */
public static < T > T getBundle ( final Class < T > type ) { } } | return doPrivileged ( new PrivilegedAction < T > ( ) { public T run ( ) { final Locale locale = Locale . getDefault ( ) ; final String lang = locale . getLanguage ( ) ; final String country = locale . getCountry ( ) ; final String variant = locale . getVariant ( ) ; Class < ? extends T > bundleClass = null ; if ( variant != null && ! variant . isEmpty ( ) ) try { bundleClass = Class . forName ( join ( type . getName ( ) , "$bundle" , lang , country , variant ) , true , type . getClassLoader ( ) ) . asSubclass ( type ) ; } catch ( ClassNotFoundException e ) { // ignore
} if ( bundleClass == null && country != null && ! country . isEmpty ( ) ) try { bundleClass = Class . forName ( join ( type . getName ( ) , "$bundle" , lang , country , null ) , true , type . getClassLoader ( ) ) . asSubclass ( type ) ; } catch ( ClassNotFoundException e ) { // ignore
} if ( bundleClass == null && lang != null && ! lang . isEmpty ( ) ) try { bundleClass = Class . forName ( join ( type . getName ( ) , "$bundle" , lang , null , null ) , true , type . getClassLoader ( ) ) . asSubclass ( type ) ; } catch ( ClassNotFoundException e ) { // ignore
} if ( bundleClass == null ) try { bundleClass = Class . forName ( join ( type . getName ( ) , "$bundle" , null , null , null ) , true , type . getClassLoader ( ) ) . asSubclass ( type ) ; } catch ( ClassNotFoundException e ) { throw new IllegalArgumentException ( "Invalid bundle " + type + " (implementation not found)" ) ; } final Field field ; try { field = bundleClass . getField ( "INSTANCE" ) ; } catch ( NoSuchFieldException e ) { throw new IllegalArgumentException ( "Bundle implementation " + bundleClass + " has no instance field" ) ; } try { return type . cast ( field . get ( null ) ) ; } catch ( IllegalAccessException e ) { throw new IllegalArgumentException ( "Bundle implementation " + bundleClass + " could not be instantiated" , e ) ; } } } ) ; |
public class Strings { /** * Splits the input string using the given separator to identify its tokens ;
* it will also trim the tokens , depending on the trim parameter .
* @ param strings
* the string to split .
* @ param separator
* the character sequence to use as a token separator .
* @ param trim
* whether the tokens should be trimmed .
* @ return
* an array of tokens . */
public static String [ ] split ( String strings , String separator , boolean trim ) { } } | StringTokeniser tokeniser = new StringTokeniser ( separator ) ; String [ ] tokens = tokeniser . tokenise ( strings ) ; if ( trim ) { for ( int i = 0 ; i < tokens . length ; ++ i ) { tokens [ i ] = tokens [ i ] != null ? tokens [ i ] . trim ( ) : tokens [ i ] ; } } return tokens ; |
public class PhysicalEntityWrapper { /** * Binds to downstream interactions . */
public void initDownstream ( ) { } } | for ( Interaction inter : getDownstreamInteractions ( pe . getParticipantOf ( ) ) ) { AbstractNode node = ( AbstractNode ) graph . getGraphObject ( inter ) ; if ( node == null ) continue ; if ( inter instanceof Conversion ) { Conversion conv = ( Conversion ) inter ; ConversionWrapper conW = ( ConversionWrapper ) node ; if ( conv . getConversionDirection ( ) == ConversionDirectionType . REVERSIBLE && conv . getRight ( ) . contains ( pe ) ) { node = conW . getReverse ( ) ; } } Edge edge = new EdgeL3 ( this , node , graph ) ; this . getDownstreamNoInit ( ) . add ( edge ) ; node . getUpstreamNoInit ( ) . add ( edge ) ; } |
public class ResourceKey { /** * Constructs new resource key from plain string according to following rules : < ul >
* < li > Last dot in the string separates key bundle from key id . < / li >
* < li > Strings starting from the dot represent a key with < code > null < / code > bundle ( default bundle ) . < / li >
* < li > Strings ending with a dot represent keys with < code > null < / code > id ( bundles ) . < / li >
* < / ul >
* This operation is inversion of { @ link # toString ( ) } method for identifiers
* not containing { @ link # ID _ COMPONENT _ DELIMITER } character : < ul >
* < li > string . equals ( plain ( string ) . toString ( ) ) < / li >
* < li > key . equals ( plain ( key . toString ( ) ) ) < / li >
* < / ul >
* @ param key string representation of a key
* @ return the key corresponding to given string */
public static final ResourceKey plain ( String key ) { } } | int idx = key . lastIndexOf ( BUNDLE_ID_SEPARATOR ) ; if ( idx < 0 ) { return new ResourceKey ( null , key ) ; } String bundle = idx > 0 ? key . substring ( 0 , idx ) : null ; String id = idx < key . length ( ) - 1 ? key . substring ( idx + 1 ) : null ; return key ( bundle , id ) ; |
public class Vector4 { /** * Sets all of the elements of the vector .
* @ return a reference to this vector , for chaining . */
public Vector4 set ( FloatBuffer buf ) { } } | return set ( buf . get ( ) , buf . get ( ) , buf . get ( ) , buf . get ( ) ) ; |
public class SchemaGenerator { /** * This is the main recursive spot that builds out the various forms of Output types
* @ param buildCtx the context we need to work out what we are doing
* @ param rawType the type to be built
* @ return an output type */
@ SuppressWarnings ( { } } | "unchecked" , "TypeParameterUnusedInFormals" } ) private < T extends GraphQLOutputType > T buildOutputType ( BuildContext buildCtx , Type rawType ) { TypeDefinition typeDefinition = buildCtx . getTypeDefinition ( rawType ) ; TypeInfo typeInfo = TypeInfo . typeInfo ( rawType ) ; GraphQLOutputType outputType = buildCtx . hasOutputType ( typeDefinition ) ; if ( outputType != null ) { return typeInfo . decorate ( outputType ) ; } if ( buildCtx . stackContains ( typeInfo ) ) { // we have circled around so put in a type reference and fix it up later
// otherwise we will go into an infinite loop
return typeInfo . decorate ( typeRef ( typeInfo . getName ( ) ) ) ; } buildCtx . push ( typeInfo ) ; if ( typeDefinition instanceof ObjectTypeDefinition ) { outputType = buildObjectType ( buildCtx , ( ObjectTypeDefinition ) typeDefinition ) ; } else if ( typeDefinition instanceof InterfaceTypeDefinition ) { outputType = buildInterfaceType ( buildCtx , ( InterfaceTypeDefinition ) typeDefinition ) ; } else if ( typeDefinition instanceof UnionTypeDefinition ) { outputType = buildUnionType ( buildCtx , ( UnionTypeDefinition ) typeDefinition ) ; } else if ( typeDefinition instanceof EnumTypeDefinition ) { outputType = buildEnumType ( buildCtx , ( EnumTypeDefinition ) typeDefinition ) ; } else if ( typeDefinition instanceof ScalarTypeDefinition ) { outputType = buildScalar ( buildCtx , ( ScalarTypeDefinition ) typeDefinition ) ; } else { // typeDefinition is not a valid output type
throw new NotAnOutputTypeError ( rawType , typeDefinition ) ; } buildCtx . putOutputType ( outputType ) ; buildCtx . pop ( ) ; return ( T ) typeInfo . decorate ( outputType ) ; |
public class VerificationCreator { /** * Add the requested post parameters to the Request .
* @ param request Request to add post params to */
private void addPostParams ( final Request request ) { } } | if ( to != null ) { request . addPostParam ( "To" , to ) ; } if ( channel != null ) { request . addPostParam ( "Channel" , channel ) ; } if ( customMessage != null ) { request . addPostParam ( "CustomMessage" , customMessage ) ; } if ( sendDigits != null ) { request . addPostParam ( "SendDigits" , sendDigits ) ; } if ( locale != null ) { request . addPostParam ( "Locale" , locale ) ; } if ( customCode != null ) { request . addPostParam ( "CustomCode" , customCode ) ; } if ( amount != null ) { request . addPostParam ( "Amount" , amount ) ; } if ( payee != null ) { request . addPostParam ( "Payee" , payee ) ; } |
public class VersionControlGit { /** * Different from cloneRepo in that will clone only a single branch .
* For quicker clone of specific branch / tag . */
public void cloneBranch ( String branch ) throws Exception { } } | CloneCommand cloneCommand = Git . cloneRepository ( ) . setURI ( repositoryUrl ) . setDirectory ( localRepo . getDirectory ( ) . getParentFile ( ) ) . setBranchesToClone ( Arrays . asList ( branch ) ) . setCloneAllBranches ( false ) . setBranch ( branch ) ; if ( credentialsProvider != null ) cloneCommand . setCredentialsProvider ( credentialsProvider ) ; Git git = cloneCommand . call ( ) ; git . getRepository ( ) . close ( ) ; git . close ( ) ; |
public class CmsContentTypeVisitor { /** * Returns if an element with the given path will be displayed at root level of a content editor tab . < p >
* @ param path the element path
* @ return < code > true < / code > if an element with the given path will be displayed at root level of a content editor tab */
private boolean isTabRootLevel ( String path ) { } } | path = path . substring ( 1 ) ; if ( ! path . contains ( "/" ) ) { return true ; } if ( m_tabInfos != null ) { for ( CmsTabInfo info : m_tabInfos ) { if ( info . isCollapsed ( ) && path . startsWith ( info . getStartName ( ) ) && ! path . substring ( info . getStartName ( ) . length ( ) + 1 ) . contains ( "/" ) ) { return true ; } } } return false ; |
public class JavaClasspathParser { /** * Backward compatibility : only accessible and non - accessible files are suported . */
private static IAccessRule [ ] getAccessRules ( IPath [ ] accessibleFiles , IPath [ ] nonAccessibleFiles ) { } } | final int accessibleFilesLength = accessibleFiles == null ? 0 : accessibleFiles . length ; final int nonAccessibleFilesLength = nonAccessibleFiles == null ? 0 : nonAccessibleFiles . length ; final int length = accessibleFilesLength + nonAccessibleFilesLength ; if ( length == 0 ) { return null ; } final IAccessRule [ ] accessRules = new IAccessRule [ length ] ; if ( accessibleFiles != null ) { for ( int i = 0 ; i < accessibleFilesLength ; i ++ ) { accessRules [ i ] = JavaCore . newAccessRule ( accessibleFiles [ i ] , IAccessRule . K_ACCESSIBLE ) ; } } if ( nonAccessibleFiles != null ) { for ( int i = 0 ; i < nonAccessibleFilesLength ; i ++ ) { accessRules [ accessibleFilesLength + i ] = JavaCore . newAccessRule ( nonAccessibleFiles [ i ] , IAccessRule . K_NON_ACCESSIBLE ) ; } } return accessRules ; |
public class SecureEmbeddedServer { /** * Returns the application configuration .
* @ return */
protected org . apache . commons . configuration . Configuration getConfiguration ( ) { } } | try { return ApplicationProperties . get ( ) ; } catch ( AtlasException e ) { throw new RuntimeException ( "Unable to load configuration: " + ApplicationProperties . APPLICATION_PROPERTIES ) ; } |
public class ZProxy { /** * Creates a new proxy in a ZeroMQ way .
* This proxy will be less efficient than the
* { @ link # newZProxy ( ZContext , String , org . zeromq . ZProxy . Proxy , String , Object . . . ) low - level one } .
* @ param ctx the context used for the proxy .
* Possibly null , in this case a new context will be created and automatically destroyed afterwards .
* @ param name the name of the proxy . Possibly null .
* @ param selector the creator of the selector used for the internal polling . Not null .
* @ param sockets the sockets creator of the proxy . Not null .
* @ param motdelafin the final word used to mark the end of the proxy . Null to disable this mechanism .
* @ param args an optional array of arguments that will be passed at the creation .
* @ return the created proxy .
* @ deprecated use { @ link # newZProxy ( ZContext , String , Proxy , String , Object . . . ) } instead . */
@ Deprecated public static ZProxy newZProxy ( ZContext ctx , String name , SelectorCreator selector , Proxy sockets , String motdelafin , Object ... args ) { } } | return newZProxy ( ctx , name , sockets , motdelafin , args ) ; |
public class CommerceNotificationTemplateUserSegmentRelLocalServiceBaseImpl { /** * Sets the user local service .
* @ param userLocalService the user local service */
public void setUserLocalService ( com . liferay . portal . kernel . service . UserLocalService userLocalService ) { } } | this . userLocalService = userLocalService ; |
public class XMLUtils { /** * Transform file with XML filters . Only file URIs are supported .
* @ param input absolute URI to transform and replace
* @ param filters XML filters to transform file with , may be an empty list */
public void transform ( final URI input , final List < XMLFilter > filters ) throws DITAOTException { } } | assert input . isAbsolute ( ) ; if ( ! input . getScheme ( ) . equals ( "file" ) ) { throw new IllegalArgumentException ( "Only file URI scheme supported: " + input ) ; } transform ( new File ( input ) , filters ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcPreDefinedPropertySet ( ) { } } | if ( ifcPreDefinedPropertySetEClass == null ) { ifcPreDefinedPropertySetEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 444 ) ; } return ifcPreDefinedPropertySetEClass ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link MultiSolidType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link MultiSolidType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "MultiSolid" , substitutionHeadNamespace = "http://www.opengis.net/gml" , substitutionHeadName = "_GeometricAggregate" ) public JAXBElement < MultiSolidType > createMultiSolid ( MultiSolidType value ) { } } | return new JAXBElement < MultiSolidType > ( _MultiSolid_QNAME , MultiSolidType . class , null , value ) ; |
public class BigQuerySnippets { /** * [ VARIABLE " my _ table _ name " ] */
public TableResult listTableDataFromId ( String datasetName , String tableName ) { } } | // [ START bigquery _ browse _ table ]
TableId tableIdObject = TableId . of ( datasetName , tableName ) ; // This example reads the result 100 rows per RPC call . If there ' s no need to limit the number ,
// simply omit the option .
TableResult tableData = bigquery . listTableData ( tableIdObject , TableDataListOption . pageSize ( 100 ) ) ; for ( FieldValueList row : tableData . iterateAll ( ) ) { // do something with the row
} // [ END bigquery _ browse _ table ]
return tableData ; |
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIfcFootingTypeEnumToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class EntityUtils { /** * Convert a string value to a typed value based on a non - entity - referencing attribute data type .
* @ param valueStr string value
* @ param attr non - entity - referencing attribute
* @ return typed value
* @ throws MolgenisDataException if attribute references another entity */
public static Object getTypedValue ( String valueStr , Attribute attr ) { } } | // Reference types cannot be processed because we lack an entityManager in this route .
if ( EntityTypeUtils . isReferenceType ( attr ) ) { throw new MolgenisDataException ( "getTypedValue(String, AttributeMetadata) can't be used for attributes referencing entities" ) ; } return getTypedValue ( valueStr , attr , null ) ; |
public class GSEAConverter { /** * Creates GSEA entries from the pathways contained in the model .
* @ param model Model
* @ return a set of GSEA entries */
public Collection < GMTEntry > convert ( final Model model ) { } } | final Collection < GMTEntry > toReturn = new TreeSet < GMTEntry > ( new Comparator < GMTEntry > ( ) { @ Override public int compare ( GMTEntry o1 , GMTEntry o2 ) { return o1 . toString ( ) . compareTo ( o2 . toString ( ) ) ; } } ) ; Model l3Model ; // convert to level 3 in necessary
if ( model . getLevel ( ) == BioPAXLevel . L2 ) l3Model = ( new LevelUpgrader ( ) ) . filter ( model ) ; else l3Model = model ; // a modifiable copy of the set of all PRs in the model -
// after all , it has all the PRs that do not belong to any pathway
final Set < SequenceEntityReference > sequenceEntityReferences = new HashSet < SequenceEntityReference > ( l3Model . getObjects ( SequenceEntityReference . class ) ) ; final Set < Pathway > pathways = l3Model . getObjects ( Pathway . class ) ; for ( Pathway pathway : pathways ) { String name = ( pathway . getDisplayName ( ) == null ) ? pathway . getStandardName ( ) : pathway . getDisplayName ( ) ; if ( name == null || name . isEmpty ( ) ) name = pathway . getUri ( ) ; final Pathway currentPathway = pathway ; final String currentPathwayName = name ; final boolean ignoreSubPathways = ( ! skipSubPathwaysOf . isEmpty ( ) && shareSomeObjects ( currentPathway . getDataSource ( ) , skipSubPathwaysOf ) ) || skipSubPathways ; LOG . debug ( "Begin converting " + currentPathwayName + " pathway, uri=" + currentPathway . getUri ( ) ) ; // collect sequence entity references from current pathway
// TODO : add Fetcher . evidenceFilter ?
Fetcher fetcher = new Fetcher ( SimpleEditorMap . L3 , Fetcher . nextStepFilter ) ; fetcher . setSkipSubPathways ( ignoreSubPathways ) ; Set < SequenceEntityReference > pathwaySers = fetcher . fetch ( currentPathway , SequenceEntityReference . class ) ; if ( ! pathwaySers . isEmpty ( ) ) { LOG . debug ( "For pathway: " + currentPathwayName + " (" + currentPathway . getUri ( ) + "), got " + pathwaySers . size ( ) + " sERs; now - grouping by organism..." ) ; Map < String , Set < SequenceEntityReference > > orgToPrsMap = organismToProteinRefsMap ( pathwaySers ) ; // create GSEA / GMT entries - one entry per organism ( null organism also makes one )
String dataSource = getDataSource ( currentPathway . getDataSource ( ) ) ; Collection < GMTEntry > entries = createGseaEntries ( currentPathway . getUri ( ) , currentPathwayName , dataSource , orgToPrsMap ) ; if ( ! entries . isEmpty ( ) ) toReturn . addAll ( entries ) ; sequenceEntityReferences . removeAll ( pathwaySers ) ; // keep not processed PRs ( a PR can be processed multiple times )
LOG . debug ( "- collected " + entries . size ( ) + "entries." ) ; } } // when there ' re no pathways , only empty pathays , pathways w / o PRs , then use all / rest of PRs -
// organize PRs by species ( GSEA s / w can handle only same species identifiers in a data row )
if ( ! sequenceEntityReferences . isEmpty ( ) && ! skipOutsidePathways ) { LOG . info ( "Creating entries for the rest of PRs (outside any pathway)..." ) ; Map < String , Set < SequenceEntityReference > > orgToPrsMap = organismToProteinRefsMap ( sequenceEntityReferences ) ; if ( ! orgToPrsMap . isEmpty ( ) ) { // create GSEA / GMT entries - one entry per organism ( null organism also makes one )
if ( model . getUri ( ) == null ) { toReturn . addAll ( createGseaEntries ( "other" , "other" , getDataSource ( l3Model . getObjects ( Provenance . class ) ) , orgToPrsMap ) ) ; } else { toReturn . addAll ( createGseaEntries ( model . getUri ( ) , model . getName ( ) , getDataSource ( l3Model . getObjects ( Provenance . class ) ) , orgToPrsMap ) ) ; } } } return toReturn ; |
public class QueryParameters { /** * Updates value of specified key
* @ param key Key
* @ param value Value
* @ return this instance of QueryParameters */
public QueryParameters updateValue ( String key , Object value ) { } } | this . values . put ( processKey ( key ) , value ) ; return this ; |
public class AbstractLinear { /** * ComponentListener methods */
@ Override public void componentResized ( final ComponentEvent EVENT ) { } } | final Container PARENT = getParent ( ) ; if ( ( PARENT != null ) && ( PARENT . getLayout ( ) == null ) ) { setSize ( getWidth ( ) , getHeight ( ) ) ; } else { // setSize ( new Dimension ( getWidth ( ) , getHeight ( ) ) ) ;
setPreferredSize ( new Dimension ( getWidth ( ) , getHeight ( ) ) ) ; } calcInnerBounds ( ) ; if ( getWidth ( ) >= getHeight ( ) ) { // Horizontal
setOrientation ( Orientation . HORIZONTAL ) ; recreateLedImages ( getInnerBounds ( ) . height ) ; recreateUserLedImages ( getInnerBounds ( ) . height ) ; if ( isLedOn ( ) ) { setCurrentLedImage ( getLedImageOn ( ) ) ; } else { setCurrentLedImage ( getLedImageOff ( ) ) ; } setLedPosition ( ( getInnerBounds ( ) . width - 20.0 - 16.0 ) / getInnerBounds ( ) . width , 0.453271028 ) ; if ( isUserLedOn ( ) ) { setCurrentUserLedImage ( getUserLedImageOn ( ) ) ; } else { setCurrentUserLedImage ( getUserLedImageOff ( ) ) ; } setUserLedPosition ( 18.0 / getInnerBounds ( ) . width , 0.453271028 ) ; } else { // Vertical
setOrientation ( Orientation . VERTICAL ) ; recreateLedImages ( getInnerBounds ( ) . width ) ; recreateUserLedImages ( getInnerBounds ( ) . width ) ; if ( isLedOn ( ) ) { setCurrentLedImage ( getLedImageOn ( ) ) ; } else { setCurrentLedImage ( getLedImageOff ( ) ) ; } setLedPosition ( 0.453271028 , ( 20.0 / getInnerBounds ( ) . height ) ) ; if ( isUserLedOn ( ) ) { setCurrentUserLedImage ( getUserLedImageOn ( ) ) ; } else { setCurrentUserLedImage ( getUserLedImageOff ( ) ) ; } setUserLedPosition ( ( getInnerBounds ( ) . width - 18.0 - 16.0 ) / getInnerBounds ( ) . width , 0.453271028 ) ; } getModel ( ) . setSize ( getLocation ( ) . x , getLocation ( ) . y , getWidth ( ) , getHeight ( ) ) ; init ( getInnerBounds ( ) . width , getInnerBounds ( ) . height ) ; revalidate ( ) ; // repaint ( ) ; |
public class ElasticMeterRegistry { /** * VisibleForTesting */
String indexName ( ) { } } | ZonedDateTime dt = ZonedDateTime . ofInstant ( new Date ( config ( ) . clock ( ) . wallTime ( ) ) . toInstant ( ) , ZoneOffset . UTC ) ; return config . index ( ) + config . indexDateSeparator ( ) + indexDateFormatter . format ( dt ) ; |
public class BasicCloner { /** * Sets CloneImplementors to be used .
* @ param implementors The implementors */
public void setImplementors ( Map < Class < ? > , CloneImplementor > implementors ) { } } | // this . implementors = implementors ;
this . allImplementors = new HashMap < Class < ? > , CloneImplementor > ( ) ; allImplementors . putAll ( builtInImplementors ) ; allImplementors . putAll ( implementors ) ; |
public class PrimeFacesListAdapter { /** * Converts a string based Row Key to the Key Type as specified by the
* DataController ( adaptee ) .
* @ param rowKey
* string based Row Key
* @ return the converted key */
@ SuppressWarnings ( "unchecked" ) K convertToGetValueOfParameter ( final String rowKey ) { } } | final Object parameterValue = ConvertUtils . convert ( rowKey , getkeyofParameterType ) ; if ( parameterValue . getClass ( ) . equals ( getkeyofParameterType ) ) { return ( K ) parameterValue ; } else { throw new RuntimeException ( "Unable to convert String " + "based rowKey to " + getkeyofParameterType . getName ( ) ) ; } |
public class RemoteTransaction { /** * - - - - - interface Callback - - - - - */
@ Override public void callback ( final AbstractMessage msg ) { } } | synchronized ( lock ) { hasTimeout = false ; message = msg ; lock . notify ( ) ; } |
public class DefaultVfs { /** * Recursively list the full resource path of all the resources that are children of the
* resource identified by a URL .
* @ param url The URL that identifies the resource to list .
* @ param path The path to the resource that is identified by the URL . Generally , this is the
* value passed to get the resource URL .
* @ return A list containing the names of the child resources .
* @ throws IOException If I / O errors occur */
public List < String > list ( URL url , String path ) throws IOException { } } | InputStream is = null ; try { List < String > resources = new ArrayList < String > ( ) ; // First , try to find the URL of a JAR file containing the requested resource . If a JAR
// file is found , then we ' ll list child resources by reading the JAR .
URL jarUrl = findJarForResource ( url ) ; if ( jarUrl != null ) { is = jarUrl . openStream ( ) ; return listResources ( new JarInputStream ( is ) , path ) ; } List < String > children = new ArrayList < String > ( ) ; children = this . getResourceUrls ( url , path , is , children ) ; // The URL prefix to use when recursively listing child resources
String prefix = url . toExternalForm ( ) ; if ( ! prefix . endsWith ( PATH_SP ) ) { prefix = prefix + PATH_SP ; } // Iterate over immediate children , adding files and recursing into directories
for ( String child : children ) { String resourcePath = path + PATH_SP + child ; resources . add ( resourcePath ) ; URL childUrl = new URL ( prefix + child ) ; resources . addAll ( list ( childUrl , resourcePath ) ) ; } return resources ; } finally { IoHelper . closeQuietly ( is ) ; } |
public class ApiOvhTelephony { /** * List the phones with Sip slot available
* REST : GET / telephony / { billingAccount } / line / { serviceName } / phoneCanBeAssociable
* @ param billingAccount [ required ] The name of your billingAccount
* @ param serviceName [ required ]
* @ deprecated */
public ArrayList < OvhLinePhone > billingAccount_line_serviceName_phoneCanBeAssociable_GET ( String billingAccount , String serviceName ) throws IOException { } } | String qPath = "/telephony/{billingAccount}/line/{serviceName}/phoneCanBeAssociable" ; StringBuilder sb = path ( qPath , billingAccount , serviceName ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t8 ) ; |
public class InMemoryPartition { /** * releases all of the partition ' s segments ( pages and overflow buckets )
* @ param target memory pool to release segments to */
public void clearAllMemory ( List < MemorySegment > target ) { } } | // return the overflow segments
if ( this . overflowSegments != null ) { for ( int k = 0 ; k < this . numOverflowSegments ; k ++ ) { target . add ( this . overflowSegments [ k ] ) ; } } // return the partition buffers
target . addAll ( this . partitionPages ) ; this . partitionPages . clear ( ) ; |
public class CompressionUtilities { /** * Compress a folder and its contents .
* @ param srcFolder path to the folder to be compressed .
* @ param destZipFile path to the final output zip file .
* @ param addBaseFolder flag to decide whether to add also the provided base ( srcFolder ) folder or not .
* @ throws IOException */
static public void zipFolder ( String srcFolder , String destZipFile , boolean addBaseFolder ) throws IOException { } } | if ( new File ( srcFolder ) . isDirectory ( ) ) { try ( FileOutputStream fileWriter = new FileOutputStream ( destZipFile ) ; ZipOutputStream zip = new ZipOutputStream ( fileWriter ) ) { addFolderToZip ( "" , srcFolder , zip , addBaseFolder ) ; // $ NON - NLS - 1 $
} } else { throw new IOException ( srcFolder + " is not a folder." ) ; } |
public class SignatureFileVerifier { /** * returns true if signer contains exactly the same code signers as
* oldSigner and newSigner , false otherwise . oldSigner
* is allowed to be null . */
static boolean matches ( CodeSigner [ ] signers , CodeSigner [ ] oldSigners , CodeSigner [ ] newSigners ) { } } | // special case
if ( ( oldSigners == null ) && ( signers == newSigners ) ) return true ; boolean match ; // make sure all oldSigners are in signers
if ( ( oldSigners != null ) && ! isSubSet ( oldSigners , signers ) ) return false ; // make sure all newSigners are in signers
if ( ! isSubSet ( newSigners , signers ) ) { return false ; } // now make sure all the code signers in signers are
// also in oldSigners or newSigners
for ( int i = 0 ; i < signers . length ; i ++ ) { boolean found = ( ( oldSigners != null ) && contains ( oldSigners , signers [ i ] ) ) || contains ( newSigners , signers [ i ] ) ; if ( ! found ) return false ; } return true ; |
public class ActiveSyncManager { /** * Apply AddSyncPoint entry and journal the entry .
* @ param context journal context
* @ param entry addSyncPoint entry */
public void applyAndJournal ( Supplier < JournalContext > context , AddSyncPointEntry entry ) { } } | try { apply ( entry ) ; context . get ( ) . append ( Journal . JournalEntry . newBuilder ( ) . setAddSyncPoint ( entry ) . build ( ) ) ; } catch ( Throwable t ) { ProcessUtils . fatalError ( LOG , t , "Failed to apply %s" , entry ) ; throw t ; // fatalError will usually system . exit
} |
public class AliPayApi { /** * 电脑网站支付 ( PC支付 )
* @ param httpResponse
* { HttpServletResponse }
* @ param model
* { AlipayTradePagePayModel }
* @ param notifyUrl
* 异步通知URL
* @ param returnUrl
* 同步通知URL
* @ throws { AlipayApiException }
* @ throws { IOException } */
public static void tradePage ( HttpServletResponse httpResponse , AlipayTradePagePayModel model , String notifyUrl , String returnUrl ) throws AlipayApiException , IOException { } } | AlipayTradePagePayRequest request = new AlipayTradePagePayRequest ( ) ; request . setBizModel ( model ) ; request . setNotifyUrl ( notifyUrl ) ; request . setReturnUrl ( returnUrl ) ; String form = AliPayApiConfigKit . getAliPayApiConfig ( ) . getAlipayClient ( ) . pageExecute ( request ) . getBody ( ) ; // 调用SDK生成表单
httpResponse . setContentType ( "text/html;charset=" + AliPayApiConfigKit . getAliPayApiConfig ( ) . getCharset ( ) ) ; httpResponse . getWriter ( ) . write ( form ) ; // 直接将完整的表单html输出到页面
httpResponse . getWriter ( ) . flush ( ) ; httpResponse . getWriter ( ) . close ( ) ; |
public class ProposalLineItem { /** * Gets the lastReservationDateTime value for this ProposalLineItem .
* @ return lastReservationDateTime * The last { @ link DateTime } when the { @ link ProposalLineItem }
* reserved inventory .
* This attribute is read - only . */
public com . google . api . ads . admanager . axis . v201811 . DateTime getLastReservationDateTime ( ) { } } | return lastReservationDateTime ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.