signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ServerSessionContext { /** * Checks and sets the current request sequence number .
* @ param requestSequence The request sequence number to set .
* @ return Indicates whether the given { @ code requestSequence } number is the next sequence number . */
boolean setRequestSequence ( long requestSequence ) { } } | if ( requestSequence == this . requestSequence + 1 ) { this . requestSequence = requestSequence ; return true ; } else if ( requestSequence <= this . requestSequence ) { return true ; } return false ; |
public class AnalyticFormulas { /** * Return the curvature of the implied normal volatility ( Bachelier volatility ) under a SABR model using the
* approximation of Berestycki . The curvatures is the second derivative of the implied vol w . r . t . the strike ,
* evaluated at the money .
* @ param alpha initial value of the stochastic volatility process of the SABR model .
* @ param beta CEV parameter of the SABR model .
* @ param rho Correlation ( leverages ) of the stochastic volatility .
* @ param nu Volatility of the stochastic volatility ( vol - of - vol ) .
* @ param displacement The displacement parameter d .
* @ param underlying Underlying ( spot ) value .
* @ param maturity Maturity .
* @ return The curvature of the implied normal volatility ( Bachelier volatility ) */
public static double sabrNormalVolatilityCurvatureApproximation ( double alpha , double beta , double rho , double nu , double displacement , double underlying , double maturity ) { } } | double sigma = sabrBerestyckiNormalVolatilityApproximation ( alpha , beta , rho , nu , displacement , underlying , underlying , maturity ) ; // Apply displacement . Displaced model is just a shift on underlying and strike .
underlying += displacement ; /* double d1xdz1 = 1.0;
double d2xdz2 = rho ;
double d3xdz3 = 3.0 * rho * rho - 1.0;
double d1zdK1 = - nu / alpha * Math . pow ( underlying , - beta ) ;
double d2zdK2 = + nu / alpha * beta * Math . pow ( underlying , - beta - 1.0 ) ;
double d3zdK3 = - nu / alpha * beta * ( 1.0 + beta ) * Math . pow ( underlying , - beta - 2.0 ) ;
double d1xdK1 = d1xdz1 * d1zdK1;
double d2xdK2 = d2xdz2 * d1zdK1 * d1zdK1 + d1xdz1 * d2zdK2;
double d3xdK3 = d3xdz3 * d1zdK1 * d1zdK1 * d1zdK1 + 3.0 * d2xdz2 * d2zdK2 * d1zdK1 + d1xdz1 * d3zdK3;
double term1 = alpha * Math . pow ( underlying , beta ) / nu ; */
double d2Part1dK2 = nu * ( ( 1.0 / 3.0 - 1.0 / 2.0 * rho * rho ) * nu / alpha * Math . pow ( underlying , - beta ) + ( 1.0 / 6.0 * beta * beta - 2.0 / 6.0 * beta ) * alpha / nu * Math . pow ( underlying , beta - 2 ) ) ; double d0BdK0 = ( - 1.0 / 24.0 * beta * ( 2 - beta ) * alpha * alpha * Math . pow ( underlying , 2 * beta - 2 ) + 1.0 / 4.0 * beta * alpha * rho * nu * Math . pow ( underlying , beta - 1.0 ) + ( 2.0 - 3.0 * rho * rho ) * nu * nu / 24 ) ; double d1BdK1 = ( - 1.0 / 48.0 * beta * ( 2 - beta ) * ( 2 * beta - 2 ) * alpha * alpha * Math . pow ( underlying , 2 * beta - 3 ) + 1.0 / 8.0 * beta * ( beta - 1.0 ) * alpha * rho * nu * Math . pow ( underlying , beta - 2 ) ) ; double d2BdK2 = ( - 1.0 / 96.0 * beta * ( 2 - beta ) * ( 2 * beta - 2 ) * ( 2 * beta - 3 ) * alpha * alpha * Math . pow ( underlying , 2 * beta - 4 ) + 1.0 / 16.0 * beta * ( beta - 1 ) * ( beta - 2 ) * alpha * rho * nu * Math . pow ( underlying , beta - 3 ) ) ; double curvatureApproximation = nu / alpha * ( ( 1.0 / 3.0 - 1.0 / 2.0 * rho * rho ) * sigma * nu / alpha * Math . pow ( underlying , - 2 * beta ) ) ; double curvaturePart1 = nu / alpha * ( ( 1.0 / 3.0 - 1.0 / 2.0 * rho * rho ) * sigma * nu / alpha * Math . pow ( underlying , - 2 * beta ) + ( 1.0 / 6.0 * beta * beta - 2.0 / 6.0 * beta ) * sigma * alpha / nu * Math . pow ( underlying , - 2 ) ) ; double curvatureMaturityPart = ( rho * nu + alpha * beta * Math . pow ( underlying , beta - 1 ) ) * d1BdK1 + alpha * Math . pow ( underlying , beta ) * d2BdK2 ; return ( curvaturePart1 + maturity * curvatureMaturityPart ) ; |
public class BlockJUnit4ClassRunner { /** * Returns a Statement that , when executed , either returns normally if
* { @ code method } passes , or throws an exception if { @ code method } fails .
* Here is an outline of the default implementation :
* < ul >
* < li > Invoke { @ code method } on the result of { @ link # createTest ( org . junit . runners . model . FrameworkMethod ) } , and
* throw any exceptions thrown by either operation .
* < li > HOWEVER , if { @ code method } ' s { @ code @ Test } annotation has the { @ link Test # expected ( ) }
* attribute , return normally only if the previous step threw an
* exception of the correct type , and throw an exception otherwise .
* < li > HOWEVER , if { @ code method } ' s { @ code @ Test } annotation has the { @ code
* timeout } attribute , throw an exception if the previous step takes more
* than the specified number of milliseconds .
* < li > ALWAYS run all non - overridden { @ code @ Before } methods on this class
* and superclasses before any of the previous steps ; if any throws an
* Exception , stop execution and pass the exception on .
* < li > ALWAYS run all non - overridden { @ code @ After } methods on this class
* and superclasses after any of the previous steps ; all After methods are
* always executed : exceptions thrown by previous steps are combined , if
* necessary , with exceptions from After methods into a
* { @ link MultipleFailureException } .
* < li > ALWAYS allow { @ code @ Rule } fields to modify the execution of the
* above steps . A { @ code Rule } may prevent all execution of the above steps ,
* or add additional behavior before and after , or modify thrown exceptions .
* For more information , see { @ link TestRule }
* < / ul >
* This can be overridden in subclasses , either by overriding this method ,
* or the implementations creating each sub - statement . */
protected Statement methodBlock ( final FrameworkMethod method ) { } } | Object test ; try { test = new ReflectiveCallable ( ) { @ Override protected Object runReflectiveCall ( ) throws Throwable { return createTest ( method ) ; } } . run ( ) ; } catch ( Throwable e ) { return new Fail ( e ) ; } Statement statement = methodInvoker ( method , test ) ; statement = possiblyExpectingExceptions ( method , test , statement ) ; statement = withPotentialTimeout ( method , test , statement ) ; statement = withBefores ( method , test , statement ) ; statement = withAfters ( method , test , statement ) ; statement = withRules ( method , test , statement ) ; statement = withInterruptIsolation ( statement ) ; return statement ; |
public class PatternToken { /** * Checks if the token is a sentence start .
* @ return True if the element starts the sentence and the element hasn ' t been set to have negated POS token . */
public boolean isSentenceStart ( ) { } } | return posToken != null && JLanguageTool . SENTENCE_START_TAGNAME . equals ( posToken . posTag ) && ! posToken . negation ; |
public class Main { /** * Load configuration values specified from either a file or the classloader
* @ return The properties */
private static Properties loadProperties ( ) { } } | Properties properties = new Properties ( ) ; boolean loaded = false ; String sysProperty = SecurityActions . getSystemProperty ( "ironjacamar.options" ) ; if ( sysProperty != null && ! sysProperty . equals ( "" ) ) { File file = new File ( sysProperty ) ; if ( file . exists ( ) ) { FileInputStream fis = null ; try { fis = new FileInputStream ( file ) ; properties . load ( fis ) ; loaded = true ; } catch ( Throwable t ) { // Ignore
} finally { if ( fis != null ) { try { fis . close ( ) ; } catch ( IOException ioe ) { // No op
} } } } } if ( ! loaded ) { File file = new File ( IRONJACAMAR_PROPERTIES ) ; if ( file . exists ( ) ) { FileInputStream fis = null ; try { fis = new FileInputStream ( file ) ; properties . load ( fis ) ; loaded = true ; } catch ( Throwable t ) { // Ignore
} finally { if ( fis != null ) { try { fis . close ( ) ; } catch ( IOException ioe ) { // No op
} } } } } if ( ! loaded ) { InputStream is = null ; try { ClassLoader cl = Main . class . getClassLoader ( ) ; is = cl . getResourceAsStream ( IRONJACAMAR_PROPERTIES ) ; properties . load ( is ) ; loaded = true ; } catch ( Throwable t ) { // Ignore
} finally { if ( is != null ) { try { is . close ( ) ; } catch ( IOException ioe ) { // Nothing to do
} } } } return properties ; |
public class IosHttpURLConnection { /** * Returns the value of the named header field .
* If called on a connection that sets the same header multiple times with
* possibly different values , only the last value is returned . */
@ Override public String getHeaderField ( String key ) { } } | try { getResponse ( ) ; return getHeaderFieldDoNotForceResponse ( key ) ; } catch ( IOException e ) { return null ; } |
public class FlowImpl { /** * If not already created , a new < code > flow < / code > element will be created and returned .
* Otherwise , the first existing < code > flow < / code > element will be returned .
* @ return the instance defined for the element < code > flow < / code > */
public Flow < Flow < T > > getOrCreateFlow ( ) { } } | List < Node > nodeList = childNode . get ( "flow" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new FlowImpl < Flow < T > > ( this , "flow" , childNode , nodeList . get ( 0 ) ) ; } return createFlow ( ) ; |
public class ModelBuilder3D { /** * Layout the molecule , starts with ring systems and than aliphatic chains .
* @ param ringSetMolecule ringSystems of the molecule */
private void layoutMolecule ( List ringSetMolecule , IAtomContainer molecule , AtomPlacer3D ap3d , AtomTetrahedralLigandPlacer3D atlp3d , AtomPlacer atomPlacer ) throws CDKException , IOException , CloneNotSupportedException { } } | // logger . debug ( " * * * * * LAYOUT MOLECULE MAIN * * * * * " ) ;
IAtomContainer ac = null ; int safetyCounter = 0 ; IAtom atom = null ; // Place rest Chains / Atoms
do { safetyCounter ++ ; atom = ap3d . getNextPlacedHeavyAtomWithUnplacedRingNeighbour ( molecule ) ; if ( atom != null ) { // logger . debug ( " layout RingSystem . . . " ) ;
IAtom unplacedAtom = ap3d . getUnplacedRingHeavyAtom ( molecule , atom ) ; IRingSet ringSetA = getRingSetOfAtom ( ringSetMolecule , unplacedAtom ) ; IAtomContainer ringSetAContainer = RingSetManipulator . getAllInOneContainer ( ringSetA ) ; templateHandler . mapTemplates ( ringSetAContainer , ringSetAContainer . getAtomCount ( ) ) ; if ( checkAllRingAtomsHasCoordinates ( ringSetAContainer ) ) { } else { throw new IOException ( "RingAtomLayoutError: Not every ring atom is placed! Molecule cannot be layout.Sorry" ) ; } Point3d firstAtomOriginalCoord = unplacedAtom . getPoint3d ( ) ; Point3d centerPlacedMolecule = ap3d . geometricCenterAllPlacedAtoms ( molecule ) ; setBranchAtom ( molecule , unplacedAtom , atom , ap3d . getPlacedHeavyAtoms ( molecule , atom ) , ap3d , atlp3d ) ; layoutRingSystem ( firstAtomOriginalCoord , unplacedAtom , ringSetA , centerPlacedMolecule , atom , ap3d ) ; searchAndPlaceBranches ( molecule , ringSetAContainer , ap3d , atlp3d , atomPlacer ) ; // logger . debug ( " Ready layout Ring System " ) ;
ringSetA = null ; unplacedAtom = null ; firstAtomOriginalCoord = null ; centerPlacedMolecule = null ; } else { // logger . debug ( " layout chains . . . " ) ;
setAtomsToUnVisited ( molecule ) ; atom = ap3d . getNextPlacedHeavyAtomWithUnplacedAliphaticNeighbour ( molecule ) ; if ( atom != null ) { ac = atom . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; ac . addAtom ( atom ) ; searchAndPlaceBranches ( molecule , ac , ap3d , atlp3d , atomPlacer ) ; ac = null ; } } } while ( ! ap3d . allHeavyAtomsPlaced ( molecule ) || safetyCounter > molecule . getAtomCount ( ) ) ; |
public class Bean { /** * General support for reporting bound property changes . Sends the given PropertyChangeEvent to
* any registered PropertyChangeListener . < p >
* Most bean setters will invoke the fireXXX methods that get a property name and the old and
* new value . However some frameworks and setters may prefer to use this general method . Also ,
* this method allows to fire IndexedPropertyChangeEvents that have been introduced in Java 5.
* @ param event describes the property change
* @ since 1.3 */
protected final void firePropertyChange ( PropertyChangeEvent event ) { } } | PropertyChangeSupport aChangeSupport = this . changeSupport ; if ( aChangeSupport == null ) { return ; } aChangeSupport . firePropertyChange ( event ) ; |
public class CmsLinkProcessor { /** * Ensures that the given tag has the " alt " attribute set . < p >
* if not set , it will be set from the title of the given resource . < p >
* @ param tag the tag to set the alt attribute for
* @ param internalUri the internal URI to get the title from */
protected void setAltAttributeFromTitle ( Tag tag , String internalUri ) { } } | boolean hasAltAttrib = ( tag . getAttribute ( "alt" ) != null ) ; if ( ! hasAltAttrib ) { String value = null ; if ( ( internalUri != null ) && ( m_rootCms != null ) ) { // internal image : try to read the " alt " text from the " Title " property
try { value = m_rootCms . readPropertyObject ( internalUri , CmsPropertyDefinition . PROPERTY_TITLE , false ) . getValue ( ) ; } catch ( CmsException e ) { // property can ' t be read , ignore
} } // some editors add a " / " at the end of the tag , we must make sure to insert before that
@ SuppressWarnings ( "unchecked" ) Vector < Attribute > attrs = tag . getAttributesEx ( ) ; // first element is always the tag name
attrs . add ( 1 , new Attribute ( " " ) ) ; attrs . add ( 2 , new Attribute ( "alt" , value == null ? "" : value , '"' ) ) ; } |
public class CredentialReference { /** * Get an attribute builder for a credential - reference attribute with the specified characteristics . The
* { @ code store } field in the attribute does not register any requirement for a credential store capability .
* @ param name name of attribute
* @ param xmlName name of xml element
* @ param allowNull { @ code false } if the attribute is required
* @ return an { @ link ObjectTypeAttributeDefinition . Builder } which can be used to build an attribute definition */
public static ObjectTypeAttributeDefinition . Builder getAttributeBuilder ( String name , String xmlName , boolean allowNull ) { } } | return getAttributeBuilder ( name , xmlName , allowNull , false ) ; |
public class JsonWriter { /** * Write the double as object key .
* @ param key The double key .
* @ return The JSON Writer . */
public JsonWriter key ( double key ) { } } | startKey ( ) ; writer . write ( '\"' ) ; final long i = ( long ) key ; if ( key == ( double ) i ) { writer . print ( i ) ; } else { writer . print ( key ) ; } writer . write ( '\"' ) ; writer . write ( ':' ) ; return this ; |
public class ManagementEnforcer { /** * removeFilteredNamedGroupingPolicy removes a role inheritance rule from the current named policy , field filters can be specified .
* @ param ptype the policy type , can be " g " , " g2 " , " g3 " , . .
* @ param fieldIndex the policy rule ' s start index to be matched .
* @ param fieldValues the field values to be matched , value " "
* means not to match this field .
* @ return succeeds or not . */
public boolean removeFilteredNamedGroupingPolicy ( String ptype , int fieldIndex , String ... fieldValues ) { } } | boolean ruleRemoved = removeFilteredPolicy ( "g" , ptype , fieldIndex , fieldValues ) ; if ( autoBuildRoleLinks ) { buildRoleLinks ( ) ; } return ruleRemoved ; |
public class DefaultGroovyMethods { /** * Sorts the Collection . Assumes that the collection items are comparable
* and uses their natural ordering to determine the resulting order .
* If the Collection is a List , it is sorted in place and returned .
* Otherwise , the elements are first placed into a new list which is then
* sorted and returned - leaving the original Collection unchanged .
* < pre class = " groovyTestCase " > assert [ 1,2,3 ] = = [ 3,1,2 ] . sort ( ) < / pre >
* @ param self the Iterable to be sorted
* @ return the sorted Iterable as a List
* @ see # sort ( Collection , boolean )
* @ since 2.2.0 */
public static < T > List < T > sort ( Iterable < T > self ) { } } | return sort ( self , true ) ; |
public class Invoice { /** * Stripe will automatically send invoices to customers according to your < a
* href = " https : / / dashboard . stripe . com / account / billing / automatic " > subscriptions settings < / a > .
* However , if you ’ d like to manually send an invoice to your customer out of the normal schedule ,
* you can do so . When sending invoices that have already been paid , there will be no reference to
* the payment in the email .
* < p > Requests made in test - mode result in no emails being sent , despite sending an < code >
* invoice . sent < / code > event . */
public Invoice sendInvoice ( ) throws StripeException { } } | return sendInvoice ( ( Map < String , Object > ) null , ( RequestOptions ) null ) ; |
public class VectorizedRleValuesReader { /** * Reads ` total ` ints into ` c ` filling them in starting at ` c [ rowId ] ` . This reader
* reads the definition levels and then will read from ` data ` for the non - null values .
* If the value is null , c will be populated with ` nullValue ` . Note that ` nullValue ` is only
* necessary for readIntegers because we also use it to decode dictionaryIds and want to make
* sure it always has a value in range .
* This is a batched version of this logic :
* if ( this . readInt ( ) = = level ) {
* c [ rowId ] = data . readInteger ( ) ;
* } else {
* c [ rowId ] = null ; */
public void readIntegers ( int total , WritableColumnVector c , int rowId , int level , VectorizedValuesReader data ) throws IOException { } } | int left = total ; while ( left > 0 ) { if ( this . currentCount == 0 ) this . readNextGroup ( ) ; int n = Math . min ( left , this . currentCount ) ; switch ( mode ) { case RLE : if ( currentValue == level ) { data . readIntegers ( n , c , rowId ) ; } else { c . putNulls ( rowId , n ) ; } break ; case PACKED : for ( int i = 0 ; i < n ; ++ i ) { if ( currentBuffer [ currentBufferIdx ++ ] == level ) { c . putInt ( rowId + i , data . readInteger ( ) ) ; } else { c . putNull ( rowId + i ) ; } } break ; } rowId += n ; left -= n ; currentCount -= n ; } |
public class GridUtils { /** * Create the affine transform that maps from the world ( map ) projection to the pixel on the printed map .
* @ param mapContext the map context */
public static AffineTransform getWorldToScreenTransform ( final MapfishMapContext mapContext ) { } } | return RendererUtilities . worldToScreenTransform ( mapContext . toReferencedEnvelope ( ) , mapContext . getPaintArea ( ) ) ; |
public class BatchRequest { /** * Queues the specified { @ link HttpRequest } for batched execution . Batched requests are executed
* when { @ link # execute ( ) } is called .
* @ param < T > destination class type
* @ param < E > error class type
* @ param httpRequest HTTP Request
* @ param dataClass Data class the response will be parsed into or { @ code Void . class } to ignore
* the content
* @ param errorClass Data class the unsuccessful response will be parsed into or
* { @ code Void . class } to ignore the content
* @ param callback Batch Callback
* @ return this Batch request
* @ throws IOException If building the HTTP Request fails */
public < T , E > BatchRequest queue ( HttpRequest httpRequest , Class < T > dataClass , Class < E > errorClass , BatchCallback < T , E > callback ) throws IOException { } } | Preconditions . checkNotNull ( httpRequest ) ; // TODO ( rmistry ) : Add BatchUnparsedCallback with onResponse ( InputStream content , HttpHeaders ) .
Preconditions . checkNotNull ( callback ) ; Preconditions . checkNotNull ( dataClass ) ; Preconditions . checkNotNull ( errorClass ) ; requestInfos . add ( new RequestInfo < T , E > ( callback , dataClass , errorClass , httpRequest ) ) ; return this ; |
public class Application { /** * This action only gets called if the user is logged in .
* @ return */
@ SecuredAction public Result index ( ) { } } | if ( logger . isDebugEnabled ( ) ) { logger . debug ( "access granted to index" ) ; } DemoUser user = ( DemoUser ) ctx ( ) . args . get ( SecureSocial . USER_KEY ) ; return ok ( index . render ( user , SecureSocial . env ( ) ) ) ; |
public class Worker { /** * TODO : in here it " should " be impossible fro a null return
* @ param workerStatus
* @ param feedPartitions
* @ return a partition available for processing or null if none are available */
@ VisibleForTesting FeedPartition findPartitionToProcess ( List < WorkerStatus > workerStatus , List < FeedPartition > feedPartitions ) { } } | for ( int i = 0 ; i < feedPartitions . size ( ) ; i ++ ) { FeedPartition aPartition = feedPartitions . get ( i ) ; boolean partitionTaken = false ; for ( int j = 0 ; j < workerStatus . size ( ) ; j ++ ) { if ( workerStatus . get ( j ) . getFeedPartitionId ( ) . equals ( aPartition . getPartitionId ( ) ) ) { partitionTaken = true ; } } if ( partitionTaken == false ) { return aPartition ; } } return null ; |
public class Permission { /** * The private CA operations that can be performed by the designated AWS service .
* @ param actions
* The private CA operations that can be performed by the designated AWS service .
* @ see ActionType */
public void setActions ( java . util . Collection < String > actions ) { } } | if ( actions == null ) { this . actions = null ; return ; } this . actions = new java . util . ArrayList < String > ( actions ) ; |
public class DevicesInner { /** * Updates the security settings on a data box edge / gateway device .
* @ param deviceName The device name .
* @ param resourceGroupName The resource group name .
* @ param deviceAdminPassword Device administrator password as an encrypted string ( encrypted using RSA PKCS # 1 ) is used to sign into the local web UI of the device . The Actual password should have at least 8 characters that are a combination of uppercase , lowercase , numeric , and special characters .
* @ 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 > createOrUpdateSecuritySettingsAsync ( String deviceName , String resourceGroupName , AsymmetricEncryptedSecret deviceAdminPassword , final ServiceCallback < Void > serviceCallback ) { } } | return ServiceFuture . fromResponse ( createOrUpdateSecuritySettingsWithServiceResponseAsync ( deviceName , resourceGroupName , deviceAdminPassword ) , serviceCallback ) ; |
public class SQLiteUpdateTaskHelper { /** * Drop all table with specific prefix .
* @ param db
* the db
* @ param prefix
* the prefix */
public static void dropTablesWithPrefix ( SQLiteDatabase db , String prefix ) { } } | Logger . info ( "MASSIVE TABLE DROP OPERATION%s" , StringUtils . ifNotEmptyAppend ( prefix , " WITH PREFIX " ) ) ; drop ( db , QueryType . TABLE , prefix ) ; |
public class Table { /** * Create a new Table with a name and a row / column capacity
* @ param positionUtil an util
* @ param writeUtil an util
* @ param xmlUtil an util
* @ param name the name of the tables
* @ param rowCapacity the row capacity
* @ param columnCapacity the column capacity
* @ param stylesContainer the container for styles
* @ param format the data styles
* @ param libreOfficeMode
* @ return the table */
public static Table create ( final PositionUtil positionUtil , final WriteUtil writeUtil , final XMLUtil xmlUtil , final String name , final int rowCapacity , final int columnCapacity , final StylesContainer stylesContainer , final DataStyles format , final boolean libreOfficeMode ) { } } | positionUtil . checkTableName ( name ) ; final TableBuilder builder = TableBuilder . create ( positionUtil , writeUtil , xmlUtil , stylesContainer , format , libreOfficeMode , name , rowCapacity , columnCapacity ) ; return new Table ( name , builder ) ; |
public class NodeImpl { /** * Returns the sanitized input if it is a URI , or { @ code null } otherwise . */
private String sanitizeUri ( String uri ) { } } | if ( uri == null || uri . length ( ) == 0 ) { return null ; } try { return new URI ( uri ) . toString ( ) ; } catch ( URISyntaxException e ) { return null ; } |
public class UpdatePremiumRates { /** * Runs the example .
* @ param adManagerServices the services factory .
* @ param session the session .
* @ param premiumRateId the ID of the premium rate to update .
* @ throws ApiException if the API request failed with one or more service errors .
* @ throws RemoteException if the API request failed due to other errors . */
public static void runExample ( AdManagerServices adManagerServices , AdManagerSession session , long premiumRateId ) throws RemoteException { } } | // Get the PremiumRateService .
PremiumRateServiceInterface premiumRateService = adManagerServices . get ( session , PremiumRateServiceInterface . class ) ; // Create a statement to get a single premium rate .
StatementBuilder statementBuilder = new StatementBuilder ( ) . where ( "id = :id" ) . orderBy ( "id ASC" ) . limit ( 1 ) . withBindVariableValue ( "id" , premiumRateId ) ; // Get the premium rate .
PremiumRatePage page = premiumRateService . getPremiumRatesByStatement ( statementBuilder . toStatement ( ) ) ; PremiumRate premiumRate = Iterables . getOnlyElement ( Arrays . asList ( page . getResults ( ) ) ) ; // Create a flat fee based premium rate value with a 10 % increase .
PremiumRateValue flatFeePremiumRateValue = new PremiumRateValue ( ) ; flatFeePremiumRateValue . setPremiumFeature ( premiumRate . getPremiumFeature ( ) ) ; flatFeePremiumRateValue . setRateType ( RateType . CPM ) ; flatFeePremiumRateValue . setAdjustmentSize ( 10000L ) ; flatFeePremiumRateValue . setAdjustmentType ( PremiumAdjustmentType . PERCENTAGE ) ; // Update the premium rate ' s premiumRateValues to include a flat fee premium rate .
List < PremiumRateValue > existingPremiumRateValues = ( ( premiumRate . getPremiumRateValues ( ) != null ) ? new ArrayList < > ( Arrays . asList ( premiumRate . getPremiumRateValues ( ) ) ) : new ArrayList < PremiumRateValue > ( ) ) ; existingPremiumRateValues . add ( flatFeePremiumRateValue ) ; premiumRate . setPremiumRateValues ( existingPremiumRateValues . toArray ( new PremiumRateValue [ ] { } ) ) ; // Update the premium rate on the server .
PremiumRate [ ] premiumRates = premiumRateService . updatePremiumRates ( new PremiumRate [ ] { premiumRate } ) ; for ( PremiumRate updatedPremiumRate : premiumRates ) { System . out . printf ( "Premium rate with ID %d associated with rate card id %d was updated.%n" , updatedPremiumRate . getId ( ) , updatedPremiumRate . getRateCardId ( ) ) ; } |
public class ManifestUtils { /** * Retrieves a value for a specific manifest attribute .
* Or null if not found
* @ param attributeName to locate in the manifest
* @ return String value for or null case not found */
public String getManifestAttribute ( String attributeName ) { } } | if ( attributeName != null ) { Map < Object , Object > mf = getManifestAttributes ( ) ; for ( Object att : mf . keySet ( ) ) { if ( attributeName . equals ( att . toString ( ) ) ) { return mf . get ( att ) . toString ( ) ; } } } // In case not found return null ;
return null ; |
public class FnJodaTimeUtils { /** * It converts the given { @ link String } into a { @ link LocalTime } using the given pattern and { @ link Locale } parameters .
* The { @ link DateTime } is configured with the given { @ link DateTimeZone }
* @ param pattern string with the format of the input String
* @ param locale { @ link Locale } to be used
* @ param dateTimeZone the the time zone ( { @ link DateTimeZone } ) to be used
* @ return the { @ link LocalTime } created from the input and arguments */
public static final Function < String , LocalTime > strToLocalTime ( String pattern , String locale , DateTimeZone dateTimeZone ) { } } | return FnLocalTime . strToLocalTime ( pattern , locale , dateTimeZone ) ; |
public class AWSSimpleSystemsManagementClient { /** * Describes the association for the specified target or instance . If you created the association by using the
* < code > Targets < / code > parameter , then you must retrieve the association by using the association ID . If you
* created the association by specifying an instance ID and a Systems Manager document , then you retrieve the
* association by specifying the document name and the instance ID .
* @ param describeAssociationRequest
* @ return Result of the DescribeAssociation operation returned by the service .
* @ throws AssociationDoesNotExistException
* The specified association does not exist .
* @ throws InvalidAssociationVersionException
* The version you specified is not valid . Use ListAssociationVersions to view all versions of an
* association according to the association ID . Or , use the < code > $ LATEST < / code > parameter to view the
* latest version of the association .
* @ throws InternalServerErrorException
* An error occurred on the server side .
* @ throws InvalidDocumentException
* The specified document does not exist .
* @ throws InvalidInstanceIdException
* The following problems can cause this exception : < / p >
* You do not have permission to access the instance .
* SSM Agent is not running . On managed instances and Linux instances , verify that the SSM Agent is running .
* On EC2 Windows instances , verify that the EC2Config service is running .
* SSM Agent or EC2Config service is not registered to the SSM endpoint . Try reinstalling SSM Agent or
* EC2Config service .
* The instance is not in valid state . Valid states are : Running , Pending , Stopped , Stopping . Invalid states
* are : Shutting - down and Terminated .
* @ sample AWSSimpleSystemsManagement . DescribeAssociation
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ssm - 2014-11-06 / DescribeAssociation " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DescribeAssociationResult describeAssociation ( DescribeAssociationRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeAssociation ( request ) ; |
class ComputeCatalan { /** * Generates the nth Catalán number . A Catalán number is a number in a sequence defined
* with a certain recurrence relation . They often show up in combinatory mathematics .
* Args :
* n : index number to generate the Catalán number for
* Returns :
* nth Catalán number
* Examples :
* > > > compute _ catalan ( 10)
* 16796
* > > > compute _ catalan ( 9)
* 4862
* > > > compute _ catalan ( 7)
* 429 */
public static long computeCatalan ( int n ) { } } | if ( n <= 1 ) { return 1 ; } long result = 0 ; for ( int i = 0 ; i < n ; i ++ ) { result += computeCatalan ( i ) * computeCatalan ( n - i - 1 ) ; } return result ; |
public class RandomVariableLazyEvaluation { /** * / * ( non - Javadoc )
* @ see net . finmath . stochastic . RandomVariable # getAverage ( net . finmath . stochastic . RandomVariable ) */
@ Override public double getAverage ( RandomVariable probabilities ) { } } | if ( isDeterministic ( ) ) { return valueIfNonStochastic ; } if ( size ( ) == 0 ) { return Double . NaN ; } return this . cache ( ) . mult ( probabilities ) . getRealizationsStream ( ) . sum ( ) ; |
public class Meta { /** * Reads a JSON object from the given metadata URL and generates a new Meta object containing all types .
* @ param url The API metadata URL .
* @ return Meta */
public static Meta fromUrl ( URL url ) { } } | InputStream stream = null ; try { stream = url . openStream ( ) ; Gson gson = new GsonBuilder ( ) . registerTypeAdapter ( PropertyForm . class , new TypeAdapter < PropertyForm > ( ) { @ Override public void write ( JsonWriter out , PropertyForm value ) throws IOException { out . value ( value . name ( ) . toLowerCase ( ) ) ; } @ Override public PropertyForm read ( JsonReader in ) throws IOException { return PropertyForm . valueOf ( in . nextString ( ) . toUpperCase ( ) ) ; } } ) . create ( ) ; Map < String , Type > types = gson . fromJson ( new InputStreamReader ( stream ) , new TypeToken < Map < String , Type > > ( ) { } . getType ( ) ) ; return new Meta ( types ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } finally { if ( stream != null ) { try { stream . close ( ) ; } catch ( Exception e ) { } } } |
public class ProcessorTemplateElem { /** * Receive notification of the start of an element .
* @ param handler non - null reference to current StylesheetHandler that is constructing the Templates .
* @ param uri The Namespace URI , or an empty string .
* @ param localName The local name ( without prefix ) , or empty string if not namespace processing .
* @ param rawName The qualified name ( with prefix ) .
* @ param attributes The specified or defaulted attributes . */
public void startElement ( StylesheetHandler handler , String uri , String localName , String rawName , Attributes attributes ) throws org . xml . sax . SAXException { } } | super . startElement ( handler , uri , localName , rawName , attributes ) ; try { // ElemTemplateElement parent = handler . getElemTemplateElement ( ) ;
XSLTElementDef def = getElemDef ( ) ; Class classObject = def . getClassObject ( ) ; ElemTemplateElement elem = null ; try { elem = ( ElemTemplateElement ) classObject . newInstance ( ) ; elem . setDOMBackPointer ( handler . getOriginatingNode ( ) ) ; elem . setLocaterInfo ( handler . getLocator ( ) ) ; elem . setPrefixes ( handler . getNamespaceSupport ( ) ) ; } catch ( InstantiationException ie ) { handler . error ( XSLTErrorResources . ER_FAILED_CREATING_ELEMTMPL , null , ie ) ; // " Failed creating ElemTemplateElement instance ! " , ie ) ;
} catch ( IllegalAccessException iae ) { handler . error ( XSLTErrorResources . ER_FAILED_CREATING_ELEMTMPL , null , iae ) ; // " Failed creating ElemTemplateElement instance ! " , iae ) ;
} setPropertiesFromAttributes ( handler , rawName , attributes , elem ) ; appendAndPush ( handler , elem ) ; } catch ( TransformerException te ) { throw new org . xml . sax . SAXException ( te ) ; } |
public class Which { /** * Locates the jar file that contains the given class .
* Note that jar files are not always loaded from { @ link File } ,
* so for diagnostics purposes { @ link # jarURL ( Class ) } is preferrable .
* @ throws IllegalArgumentException
* if failed to determine . */
public static File jarFile ( Class < ? > clazz ) throws IOException { } } | return jarFile ( classFileUrl ( clazz ) , clazz . getName ( ) . replace ( '.' , '/' ) + ".class" ) ; |
public class EvaluatorPool { /** * Die Methode run wird aufgerufen sobald , der CFML Transformer den uebersetzungsprozess
* angeschlossen hat . Die metode run rauft darauf alle Evaluatoren auf die intern gespeicher wurden
* und loescht den internen Speicher .
* @ throws TemplateException */
public void run ( ) throws TemplateException { } } | { // tags
Iterator < TagData > it = tags . iterator ( ) ; while ( it . hasNext ( ) ) { TagData td = it . next ( ) ; SourceCode cfml = td . cfml ; cfml . setPos ( td . pos ) ; try { if ( td . libTag . getEvaluator ( ) != null ) td . libTag . getEvaluator ( ) . evaluate ( td . tag , td . libTag , td . flibs ) ; } catch ( EvaluatorException e ) { clear ( ) ; // print . printST ( e ) ;
throw new TemplateException ( cfml , e ) ; } catch ( Throwable e ) { ExceptionUtil . rethrowIfNecessary ( e ) ; clear ( ) ; throw new TemplateException ( cfml , e ) ; } } tags . clear ( ) ; } // functions
Iterator < FunctionData > it = functions . iterator ( ) ; while ( it . hasNext ( ) ) { FunctionData td = it . next ( ) ; SourceCode cfml = td . cfml ; cfml . setPos ( td . pos ) ; try { if ( td . flf . getEvaluator ( ) != null ) td . flf . getEvaluator ( ) . evaluate ( td . bif , td . flf ) ; } catch ( EvaluatorException e ) { clear ( ) ; // print . printST ( e ) ;
throw new TemplateException ( cfml , e ) ; } catch ( Throwable e ) { ExceptionUtil . rethrowIfNecessary ( e ) ; clear ( ) ; throw new TemplateException ( cfml , e ) ; } } functions . clear ( ) ; |
public class JbcSrcRuntime { /** * Wraps a given template with a collection of escapers to apply .
* @ param delegate The delegate template to render
* @ param directives The set of directives to apply */
public static CompiledTemplate applyEscapers ( CompiledTemplate delegate , ImmutableList < SoyJavaPrintDirective > directives ) { } } | ContentKind kind = delegate . kind ( ) ; if ( canSkipEscaping ( directives , kind ) ) { return delegate ; } return new EscapedCompiledTemplate ( delegate , directives , kind ) ; |
public class CommandHelper { /** * Convert the value according the type of DeviceData .
* @ param deviceDataArgout
* the DeviceData attribute to read
* @ return Short , the result in Short format
* @ throws DevFailed */
public static Short extractToShort ( final DeviceData deviceDataArgout ) throws DevFailed { } } | final Object value = CommandHelper . extract ( deviceDataArgout ) ; Short argout = null ; if ( value instanceof Short ) { argout = ( Short ) value ; } else if ( value instanceof String ) { try { argout = Short . valueOf ( ( String ) value ) ; } catch ( final Exception e ) { Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "output type " + value + " is not a numerical" , "CommandHelper.extractToShort(deviceDataArgin)" ) ; } } else if ( value instanceof Integer ) { argout = Short . valueOf ( ( ( Integer ) value ) . shortValue ( ) ) ; } else if ( value instanceof Long ) { argout = Short . valueOf ( ( ( Long ) value ) . shortValue ( ) ) ; } else if ( value instanceof Float ) { argout = Short . valueOf ( ( ( Float ) value ) . shortValue ( ) ) ; } else if ( value instanceof Boolean ) { if ( ( ( Boolean ) value ) . booleanValue ( ) ) { argout = Short . valueOf ( ( short ) 1 ) ; } else { argout = Short . valueOf ( ( short ) 0 ) ; } } else if ( value instanceof Double ) { argout = Short . valueOf ( ( ( Double ) value ) . shortValue ( ) ) ; } else if ( value instanceof DevState ) { argout = Short . valueOf ( Integer . valueOf ( ( ( DevState ) value ) . value ( ) ) . shortValue ( ) ) ; } else { Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "output type " + value . getClass ( ) + " not supported" , "CommandHelper.extractToShort(Object value,deviceDataArgin)" ) ; } return argout ; |
public class Lines { /** * Returns the distance between the specified point and the specified line segment . */
public static float pointSegDist ( float px , float py , float x1 , float y1 , float x2 , float y2 ) { } } | return FloatMath . sqrt ( pointSegDistSq ( px , py , x1 , y1 , x2 , y2 ) ) ; |
public class NodeUtil { /** * Returns true if the shallow scope contains references to ' this ' keyword */
static boolean referencesThis ( Node n ) { } } | if ( n . isFunction ( ) ) { return referencesThis ( NodeUtil . getFunctionParameters ( n ) ) || referencesThis ( NodeUtil . getFunctionBody ( n ) ) ; } else { return has ( n , Node :: isThis , MATCH_ANYTHING_BUT_NON_ARROW_FUNCTION ) ; } |
public class RuleCallImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EList < Expression > getArguments ( ) { } } | if ( arguments == null ) { arguments = new EObjectContainmentEList < Expression > ( Expression . class , this , SimpleAntlrPackage . RULE_CALL__ARGUMENTS ) ; } return arguments ; |
public class CacheProviderWrapper { /** * ( non - Javadoc )
* @ see com . ibm . ws . cache . intf . DCache # getEntryDisk ( java . lang . Object ) */
@ Override public com . ibm . websphere . cache . CacheEntry getEntryDisk ( Object cacheId ) { } } | final String methodName = "getEntryDisk()" ; CacheEntry ce = null ; if ( this . swapToDisk ) { // TODO write code to support getEntryDisk function
if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet" ) ; } } else { if ( this . featureSupport . isDiskCacheSupported ( ) == false ) { Tr . error ( tc , "DYNA1064E" , new Object [ ] { methodName , cacheName , this . cacheProviderName } ) ; } else { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " cacheName=" + cacheName + " no operation is done because the disk cache offload is not enabled" ) ; } } } return ce ; |
public class CommerceWarehouseItemPersistenceImpl { /** * Returns all the commerce warehouse items .
* @ return the commerce warehouse items */
@ Override public List < CommerceWarehouseItem > findAll ( ) { } } | return findAll ( QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; |
public class MasterSlaveSchema { /** * Renew master - slave rule .
* @ param masterSlaveRuleChangedEvent master - slave rule changed event . */
@ Subscribe public synchronized void renew ( final MasterSlaveRuleChangedEvent masterSlaveRuleChangedEvent ) { } } | if ( getName ( ) . equals ( masterSlaveRuleChangedEvent . getShardingSchemaName ( ) ) ) { masterSlaveRule = new OrchestrationMasterSlaveRule ( masterSlaveRuleChangedEvent . getMasterSlaveRuleConfiguration ( ) ) ; } |
public class Headers { /** * Returns an immutable list of the header values for { @ code name } . */
public List < String > values ( String name ) { } } | List < String > result = null ; for ( int i = 0 , size = size ( ) ; i < size ; i ++ ) { if ( name . equalsIgnoreCase ( name ( i ) ) ) { if ( result == null ) result = new ArrayList < > ( 2 ) ; result . add ( value ( i ) ) ; } } return result != null ? Collections . unmodifiableList ( result ) : Collections . < String > emptyList ( ) ; |
public class Database { /** * Create a new JSON index
* Example usage creating an index that sorts ascending on name , then by year :
* < pre >
* { @ code
* db . createIndex ( " Person _ name " , " Person _ name " , null , new IndexField [ ] {
* new IndexField ( " Person _ name " , SortOrder . asc ) ,
* new IndexField ( " Movie _ year " , SortOrder . asc ) } ) ;
* < / pre >
* Example usage creating an index that sorts ascending by year :
* < pre >
* { @ code
* db . createIndex ( " Movie _ year " , " Movie _ year " , null , new IndexField [ ] {
* new IndexField ( " Movie _ year " , SortOrder . asc ) } ) ;
* < / pre >
* @ param indexName optional name of the index ( if not provided one will be generated )
* @ param designDocName optional name of the design doc in which the index will be created
* @ param indexType optional , type of index ( only " json " for this method )
* @ param fields array of fields in the index
* @ see Database # createIndex ( String ) */
@ Deprecated public void createIndex ( String indexName , String designDocName , String indexType , IndexField [ ] fields ) { } } | if ( indexType == null || "json" . equalsIgnoreCase ( indexType ) ) { JsonIndex . Builder b = JsonIndex . builder ( ) . name ( indexName ) . designDocument ( designDocName ) ; for ( IndexField f : fields ) { switch ( f . getOrder ( ) ) { case desc : b . desc ( f . getName ( ) ) ; break ; case asc : default : b . asc ( f . getName ( ) ) ; break ; } } createIndex ( b . definition ( ) ) ; } else { throw new CouchDbException ( "Unsupported index type " + indexType ) ; } |
public class ReceiveListenerDataReceivedInvocation { /** * Resets the state of this invocation object - used by the pooling code . */
protected synchronized void reset ( Connection connection , ReceiveListener listener , WsByteBuffer data , int size , int segmentType , int requestNumber , int priority , boolean allocatedFromPool , boolean partOfExchange , Conversation conversation ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "reset" , new Object [ ] { connection , listener , data , "" + size , "" + segmentType , "" + requestNumber , "" + priority , "" + allocatedFromPool , "" + partOfExchange , conversation } ) ; this . connection = connection ; this . listener = listener ; this . data = data ; this . size = size ; this . segmentType = segmentType ; this . requestNumber = requestNumber ; this . priority = priority ; this . allocatedFromPool = allocatedFromPool ; this . partOfExchange = partOfExchange ; this . conversation = conversation ; setDispatchable ( null ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "reset" ) ; |
public class XFactory { /** * Create a new , never - before - seen , XMethod object and intern it . */
private static XMethod createXMethod ( @ DottedClassName String className , String methodName , String methodSig , int accessFlags ) { } } | return createXMethod ( className , methodName , methodSig , ( accessFlags & Const . ACC_STATIC ) != 0 ) ; |
public class FNIRGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setFNMCnt ( Integer newFNMCnt ) { } } | Integer oldFNMCnt = fnmCnt ; fnmCnt = newFNMCnt ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . FNIRG__FNM_CNT , oldFNMCnt , fnmCnt ) ) ; |
public class CertificateVersion { /** * Return an enumeration of names of attributes existing within this
* attribute . */
public Enumeration < String > getElements ( ) { } } | AttributeNameEnumeration elements = new AttributeNameEnumeration ( ) ; elements . addElement ( VERSION ) ; return ( elements . elements ( ) ) ; |
public class KinesisInitialPositions { /** * Returns instance of [ [ KinesisInitialPosition ] ] based on the passed
* [ [ InitialPositionInStream ] ] . This method is used in KinesisUtils for translating the
* InitialPositionInStream to InitialPosition . This function would be removed when we deprecate
* the KinesisUtils .
* @ return [ [ InitialPosition ] ] */
public static KinesisInitialPosition fromKinesisInitialPosition ( InitialPositionInStream initialPositionInStream ) throws UnsupportedOperationException { } } | if ( initialPositionInStream == InitialPositionInStream . LATEST ) { return new Latest ( ) ; } else if ( initialPositionInStream == InitialPositionInStream . TRIM_HORIZON ) { return new TrimHorizon ( ) ; } else { // InitialPositionInStream . AT _ TIMESTAMP is not supported .
// Use InitialPosition . atTimestamp ( timestamp ) instead .
throw new UnsupportedOperationException ( "Only InitialPositionInStream.LATEST and InitialPositionInStream." + "TRIM_HORIZON supported in initialPositionInStream(). Please use " + "the initialPosition() from builder API in KinesisInputDStream for " + "using InitialPositionInStream.AT_TIMESTAMP" ) ; } |
public class MergeTopicParser { /** * Get new value for topic id attribute . */
private void handleID ( final AttributesImpl atts ) { } } | String idValue = atts . getValue ( ATTRIBUTE_NAME_ID ) ; if ( idValue != null ) { XMLUtils . addOrSetAttribute ( atts , ATTRIBUTE_NAME_OID , idValue ) ; final URI value = setFragment ( dirPath . toURI ( ) . resolve ( toURI ( filePath ) ) , idValue ) ; if ( util . findId ( value ) ) { idValue = util . getIdValue ( value ) ; } else { idValue = util . addId ( value ) ; } XMLUtils . addOrSetAttribute ( atts , ATTRIBUTE_NAME_ID , idValue ) ; } |
public class Searcher { /** * Searches the given pattern starting from the given elements .
* @ param eles elements to start from
* @ param pattern pattern to search for
* @ return map from starting element to the matching results */
public static Map < BioPAXElement , List < Match > > search ( final Collection < ? extends BioPAXElement > eles , final Pattern pattern ) { } } | final Map < BioPAXElement , List < Match > > map = new ConcurrentHashMap < BioPAXElement , List < Match > > ( ) ; final ExecutorService exec = Executors . newFixedThreadPool ( 10 ) ; for ( final BioPAXElement ele : eles ) { if ( ! pattern . getStartingClass ( ) . isAssignableFrom ( ele . getModelInterface ( ) ) ) continue ; exec . execute ( new Runnable ( ) { @ Override public void run ( ) { List < Match > matches = search ( ele , pattern ) ; if ( ! matches . isEmpty ( ) ) { map . put ( ele , matches ) ; } } } ) ; } exec . shutdown ( ) ; try { exec . awaitTermination ( 10 , TimeUnit . MINUTES ) ; } catch ( InterruptedException e ) { throw new RuntimeException ( "search, failed due to exec timed out." , e ) ; } return Collections . unmodifiableMap ( new HashMap < BioPAXElement , List < Match > > ( map ) ) ; |
public class XMLUtil { /** * Read an enumeration value .
* @ param document is the XML document to explore .
* @ param caseSensitive indicates of the { @ code path } ' s components are case sensitive .
* @ param path is the list of and ended by the attribute ' s name .
* @ return the java class or < code > null < / code > if none . */
@ Pure public static Class < ? > getAttributeClass ( Node document , boolean caseSensitive , String ... path ) { } } | assert document != null : AssertMessages . notNullParameter ( 0 ) ; return getAttributeClassWithDefault ( document , caseSensitive , null , path ) ; |
public class Range { /** * Reverse operation for { @ link # getRelativeRangeOf ( Range ) } .
* A . getAbsoluteRangeFor ( A . getRelativeRangeOf ( B ) ) = = B
* @ param relativeRange range defined relative to this range
* @ return absolute range */
public Range getAbsoluteRangeFor ( Range relativeRange ) { } } | int from = convertBoundaryToAbsolutePosition ( relativeRange . getFrom ( ) ) , to = convertBoundaryToAbsolutePosition ( relativeRange . getTo ( ) ) ; return new Range ( from , to ) ; |
public class GeometryTranslator { /** * Builds a point feature from a dwg attribute . */
public SimpleFeature convertDwgAttribute ( String typeName , String layerName , DwgAttrib attribute , int id ) { } } | Point2D pto = attribute . getInsertionPoint ( ) ; Coordinate coord = new Coordinate ( pto . getX ( ) , pto . getY ( ) , attribute . getElevation ( ) ) ; String textString = attribute . getText ( ) ; return createPointTextFeature ( typeName , layerName , id , coord , textString ) ; |
public class ScanDeterminizer { /** * Only applies when stronger determinism is needed . */
public static void apply ( CompiledPlan plan , DeterminismMode detMode ) { } } | if ( detMode == DeterminismMode . FASTER ) { return ; } if ( plan . hasDeterministicStatement ( ) ) { return ; } AbstractPlanNode planGraph = plan . rootPlanGraph ; if ( planGraph . isOrderDeterministic ( ) ) { return ; } AbstractPlanNode root = plan . rootPlanGraph ; root = recursivelyApply ( root ) ; plan . rootPlanGraph = root ; |
public class CLI { /** * Loads RSA / DSA private key in a PEM format into { @ link KeyPair } . */
public static KeyPair loadKey ( String pemString , String passwd ) throws IOException , GeneralSecurityException { } } | return PrivateKeyProvider . loadKey ( pemString , passwd ) ; |
public class JSONSerializer { /** * Serialize a JSON object , array , or value .
* @ param jsonVal
* the json val
* @ param jsonReferenceToId
* a map from json reference to id
* @ param includeNullValuedFields
* the include null valued fields
* @ param depth
* the depth
* @ param indentWidth
* the indent width
* @ param buf
* the buf */
static void jsonValToJSONString ( final Object jsonVal , final Map < ReferenceEqualityKey < JSONReference > , CharSequence > jsonReferenceToId , final boolean includeNullValuedFields , final int depth , final int indentWidth , final StringBuilder buf ) { } } | if ( jsonVal == null ) { buf . append ( "null" ) ; } else if ( jsonVal instanceof JSONObject ) { // Serialize JSONObject to string
( ( JSONObject ) jsonVal ) . toJSONString ( jsonReferenceToId , includeNullValuedFields , depth , indentWidth , buf ) ; } else if ( jsonVal instanceof JSONArray ) { // Serialize JSONArray to string
( ( JSONArray ) jsonVal ) . toJSONString ( jsonReferenceToId , includeNullValuedFields , depth , indentWidth , buf ) ; } else if ( jsonVal instanceof JSONReference ) { // Serialize JSONReference to string
final Object referencedObjectId = jsonReferenceToId . get ( new ReferenceEqualityKey < > ( ( JSONReference ) jsonVal ) ) ; jsonValToJSONString ( referencedObjectId , jsonReferenceToId , includeNullValuedFields , depth , indentWidth , buf ) ; } else if ( jsonVal instanceof CharSequence || jsonVal instanceof Character || jsonVal . getClass ( ) . isEnum ( ) ) { // Serialize String , Character or enum val to quoted / escaped string
buf . append ( '"' ) ; JSONUtils . escapeJSONString ( jsonVal . toString ( ) , buf ) ; buf . append ( '"' ) ; } else { // Serialize a numeric or Boolean type ( Integer , Long , Short , Float , Double , Boolean , Byte ) to string
// ( doesn ' t need quoting or escaping )
buf . append ( jsonVal . toString ( ) ) ; } |
public class MutableRoaringBitmap { /** * Deserialize the bitmap ( retrieve from the input stream ) . The current bitmap is overwritten .
* See format specification at https : / / github . com / RoaringBitmap / RoaringFormatSpec
* @ param in the DataInput stream
* @ throws IOException Signals that an I / O exception has occurred . */
public void deserialize ( DataInput in ) throws IOException { } } | try { getMappeableRoaringArray ( ) . deserialize ( in ) ; } catch ( InvalidRoaringFormat cookie ) { throw cookie . toIOException ( ) ; // we convert it to an IOException
} |
public class CollectionUtils { /** * Checks whether a Collection contains a specified Object . Object equality
* ( = = ) , rather than . equals ( ) , is used . */
public static < T > boolean containsObject ( Collection < T > c , T o ) { } } | for ( Object o1 : c ) { if ( o == o1 ) { return true ; } } return false ; |
public class CircularByteBuffer { /** * Gets a single byte return or - 1 if no data is available . */
public synchronized int get ( ) { } } | if ( available == 0 ) { return - 1 ; } byte value = buffer [ idxGet ] ; idxGet = ( idxGet + 1 ) % capacity ; available -- ; return value ; |
public class WorkbenchPreferencePageCsk { /** * DirectoryFieldEditor vicePathMac = null ; */
@ Override protected Control createContents ( Composite parent ) { } } | Composite top = new Composite ( parent , SWT . LEFT ) ; // Sets the layout data for the top composite ' s
// place in its parent ' s layout .
top . setLayoutData ( new GridData ( GridData . FILL_HORIZONTAL ) ) ; // Sets the layout for the top composite ' s
// children to populate .
top . setLayout ( new GridLayout ( ) ) ; if ( Platform . getOS ( ) . equalsIgnoreCase ( Platform . OS_MACOSX ) ) { vdmPathMac = new DirectoryFieldEditor ( ICskConstants . VSLGDE_PATH , "Path to VDM Tools for VDM-SL (vdmgde):" , top ) ; vdmPathMac . setPage ( this ) ; vdmPathMac . setPreferenceStore ( getPreferenceStore ( ) ) ; vdmPathMac . load ( ) ; vppPathMac = new DirectoryFieldEditor ( ICskConstants . VPPGDE_PATH , "Path to VDM Tools for VDM-PP (vppgde):" , top ) ; vppPathMac . setPage ( this ) ; vppPathMac . setPreferenceStore ( getPreferenceStore ( ) ) ; vppPathMac . load ( ) ; // vicePathMac = new DirectoryFieldEditor ( ICskConstants . VRTGDE _ PATH , " Path to VDMTools for VICE ( vicegde ) : " , top ) ;
// vicePathMac . setPage ( this ) ;
// vicePathMac . setPreferenceStore ( getPreferenceStore ( ) ) ;
// vicePathMac . load ( ) ;
Label listLabel = new Label ( top , SWT . BOLD ) ; listLabel . setText ( "NOTE: select the \"bin\" folder just above \"vxxgde\"" ) ; } else { vdmPath = new FileFieldEditor ( ICskConstants . VSLGDE_PATH , "Path to VDM Tools for VDM-SL (vdmgde):" , top ) ; vdmPath . setPage ( this ) ; vdmPath . setPreferenceStore ( getPreferenceStore ( ) ) ; vdmPath . load ( ) ; vppPath = new FileFieldEditor ( ICskConstants . VPPGDE_PATH , "Path to VDM Tools for VDM-PP (vppgde):" , top ) ; vppPath . setPage ( this ) ; vppPath . setPreferenceStore ( getPreferenceStore ( ) ) ; vppPath . load ( ) ; // vicePath = new FileFieldEditor ( ICskConstants . VRTGDE _ PATH , " Path to VDMTools for VICE ( vicegde ) : " , top ) ;
// vicePath . setPage ( this ) ;
// vicePath . setPreferenceStore ( getPreferenceStore ( ) ) ;
// vicePath . load ( ) ;
} return top ; |
public class NumericShaper { /** * Returns the index of the high bit in value ( assuming le , actually
* power of 2 > = value ) . value must be positive . */
private static int getHighBit ( int value ) { } } | if ( value <= 0 ) { return - 32 ; } int bit = 0 ; if ( value >= 1 << 16 ) { value >>= 16 ; bit += 16 ; } if ( value >= 1 << 8 ) { value >>= 8 ; bit += 8 ; } if ( value >= 1 << 4 ) { value >>= 4 ; bit += 4 ; } if ( value >= 1 << 2 ) { value >>= 2 ; bit += 2 ; } if ( value >= 1 << 1 ) { bit += 1 ; } return bit ; |
public class DescribeReservedInstancesOfferingsRequest { /** * One or more Reserved Instances offering IDs .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setReservedInstancesOfferingIds ( java . util . Collection ) } or
* { @ link # withReservedInstancesOfferingIds ( java . util . Collection ) } if you want to override the existing values .
* @ param reservedInstancesOfferingIds
* One or more Reserved Instances offering IDs .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DescribeReservedInstancesOfferingsRequest withReservedInstancesOfferingIds ( String ... reservedInstancesOfferingIds ) { } } | if ( this . reservedInstancesOfferingIds == null ) { setReservedInstancesOfferingIds ( new com . amazonaws . internal . SdkInternalList < String > ( reservedInstancesOfferingIds . length ) ) ; } for ( String ele : reservedInstancesOfferingIds ) { this . reservedInstancesOfferingIds . add ( ele ) ; } return this ; |
public class HetatomImpl { /** * { @ inheritDoc } */
@ Override public void setAtoms ( List < Atom > atoms ) { } } | // important we are resetting atoms to a new list , we need to reset the lookup too !
if ( atomNameLookup != null ) atomNameLookup . clear ( ) ; for ( Atom a : atoms ) { a . setGroup ( this ) ; if ( atomNameLookup != null ) atomNameLookup . put ( a . getName ( ) , a ) ; } this . atoms = atoms ; if ( ! atoms . isEmpty ( ) ) { pdb_flag = true ; } |
public class Payload { /** * @ return " the " value of this Payload , stuffed into an Object .
* This is used for evaluating the " validator " portion of a
* PayloadSpecification against these Payloads .
* We don ' t want the JsonSerializer to know about this , so
* renamed to not begin with " get " . */
@ Nullable public Object fetchAValue ( ) { } } | if ( doubleValue != null ) { return doubleValue ; } if ( doubleArray != null ) { return doubleArray ; } if ( longValue != null ) { return longValue ; } if ( longArray != null ) { return longArray ; } if ( stringValue != null ) { return stringValue ; } if ( stringArray != null ) { return stringArray ; } if ( map != null ) { return map ; } return null ; |
public class ComputeNodeOperations { /** * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage .
* This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support . The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service .
* @ param poolId The ID of the pool that contains the compute node .
* @ param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files .
* @ param containerUrl The URL of the container within Azure Blob Storage to which to upload the Batch Service log file ( s ) .
* @ param startTime The start of the time range from which to upload Batch Service log file ( s ) .
* @ param endTime The end of the time range from which to upload Batch Service log file ( s ) .
* @ param additionalBehaviors A collection of { @ link BatchClientBehavior } instances that are applied to the Batch service request .
* @ return The result of uploading Batch service log files from a specific compute node .
* @ throws BatchErrorException Exception thrown when an error response is received from the Batch service .
* @ throws IOException Exception thrown when there is an error in serialization / deserialization of data sent to / received from the Batch service . */
public UploadBatchServiceLogsResult uploadBatchServiceLogs ( String poolId , String nodeId , String containerUrl , DateTime startTime , DateTime endTime , Iterable < BatchClientBehavior > additionalBehaviors ) throws BatchErrorException , IOException { } } | UploadBatchServiceLogsConfiguration configuration = new UploadBatchServiceLogsConfiguration ( ) ; configuration . withContainerUrl ( containerUrl ) ; configuration . withStartTime ( startTime ) ; configuration . withEndTime ( endTime ) ; ComputeNodeUploadBatchServiceLogsOptions options = new ComputeNodeUploadBatchServiceLogsOptions ( ) ; BehaviorManager bhMgr = new BehaviorManager ( this . customBehaviors ( ) , additionalBehaviors ) ; bhMgr . applyRequestBehaviors ( options ) ; return this . parentBatchClient . protocolLayer ( ) . computeNodes ( ) . uploadBatchServiceLogs ( poolId , nodeId , configuration , options ) ; |
public class AbstractExtractor { /** * Gets annotation type .
* @ return the annotation type */
public AnnotationType [ ] getAnnotationTypes ( ) { } } | if ( annotationType . isEmpty ( ) ) { return new AnnotationType [ ] { Types . TOKEN } ; } return annotationType . toArray ( new AnnotationType [ annotationType . size ( ) ] ) ; |
public class Symbol { /** * Is this symbol the same as or enclosed by the given class ? */
public boolean isEnclosedBy ( ClassSymbol clazz ) { } } | for ( Symbol sym = this ; sym . kind != PCK ; sym = sym . owner ) if ( sym == clazz ) return true ; return false ; |
public class MsgDestEncodingUtilsImpl { /** * decodeOtherProperties
* Decode the more interesting JmsDestination properties , which may or may not be included :
* Queue / Topic name
* TopicSpace
* ReadAhead
* Cluster properties
* @ param newDest The Destination to apply the properties to
* @ param msgForm The byte array containing the encoded Destination values
* @ param offset The current offset into msgForm
* @ exception JMSException Thrown if anything goes horribly wrong */
private static void decodeOtherProperties ( JmsDestination newDest , byte [ ] msgForm , int offset ) throws JMSException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "decodeOtherProperties" , new Object [ ] { newDest , msgForm , offset } ) ; PropertyInputStream stream = new PropertyInputStream ( msgForm , offset ) ; while ( stream . hasMore ( ) ) { String shortName = stream . readShortName ( ) ; String longName = reverseMap . get ( shortName ) ; if ( longName != null ) { PropertyEntry propEntry = propertyMap . get ( longName ) ; // This can ' t be null , as we just got the name from the reverseMap !
Object propValue = propEntry . getPropertyCoder ( ) . decodeProperty ( stream ) ; setProperty ( newDest , longName , propEntry . getIntValue ( ) , propValue ) ; } else { // If there is no mapping for the short name , then the property is not known .
// The most likely situation is that we have been sent a property for a newer release .
throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "UNKNOWN_PROPERTY_CWSIA0363" , new Object [ ] { shortName } , null , "MsgDestEncodingUtilsImpl.decodeOtherProperties#1" , null , tc ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "decodeOtherProperties" ) ; |
public class EnumTriangles { public static void main ( String [ ] args ) throws Exception { } } | // Checking input parameters
final ParameterTool params = ParameterTool . fromArgs ( args ) ; // set up execution environment
final ExecutionEnvironment env = ExecutionEnvironment . getExecutionEnvironment ( ) ; // make parameters available in the web interface
env . getConfig ( ) . setGlobalJobParameters ( params ) ; // read input data
DataSet < Edge > edges ; if ( params . has ( "edges" ) ) { edges = env . readCsvFile ( params . get ( "edges" ) ) . fieldDelimiter ( " " ) . includeFields ( true , true ) . types ( Integer . class , Integer . class ) . map ( new TupleEdgeConverter ( ) ) ; } else { System . out . println ( "Executing EnumTriangles example with default edges data set." ) ; System . out . println ( "Use --edges to specify file input." ) ; edges = EnumTrianglesData . getDefaultEdgeDataSet ( env ) ; } // project edges by vertex id
DataSet < Edge > edgesById = edges . map ( new EdgeByIdProjector ( ) ) ; DataSet < Triad > triangles = edgesById // build triads
. groupBy ( Edge . V1 ) . sortGroup ( Edge . V2 , Order . ASCENDING ) . reduceGroup ( new TriadBuilder ( ) ) // filter triads
. join ( edgesById ) . where ( Triad . V2 , Triad . V3 ) . equalTo ( Edge . V1 , Edge . V2 ) . with ( new TriadFilter ( ) ) ; // emit result
if ( params . has ( "output" ) ) { triangles . writeAsCsv ( params . get ( "output" ) , "\n" , "," ) ; // execute program
env . execute ( "Basic Triangle Enumeration Example" ) ; } else { System . out . println ( "Printing result to stdout. Use --output to specify output path." ) ; triangles . print ( ) ; } |
public class PaymentChannelClientState { /** * Returns true if the tx is a valid settlement transaction . */
public synchronized boolean isSettlementTransaction ( Transaction tx ) { } } | try { tx . verify ( ) ; tx . getInput ( 0 ) . verify ( getContractInternal ( ) . getOutput ( 0 ) ) ; return true ; } catch ( VerificationException e ) { return false ; } |
public class MethodSimulator { /** * Simulates the invoke dynamic call . Pushes a method handle on the stack .
* @ param instruction The instruction to simulate */
private void simulateMethodHandle ( final InvokeDynamicInstruction instruction ) { } } | final List < Element > arguments = IntStream . range ( 0 , instruction . getDynamicIdentifier ( ) . getParameters ( ) . size ( ) ) . mapToObj ( t -> runtimeStack . pop ( ) ) . collect ( Collectors . toList ( ) ) ; Collections . reverse ( arguments ) ; if ( ! instruction . getDynamicIdentifier ( ) . isStaticMethod ( ) ) // first parameter is ` this `
arguments . remove ( 0 ) ; // adds the transferred arguments of the bootstrap call
runtimeStack . push ( new MethodHandle ( instruction . getDynamicIdentifier ( ) . getReturnType ( ) , instruction . getIdentifier ( ) , arguments ) ) ; |
public class CollUtil { /** * 新建一个空List
* @ param < T > 集合元素类型
* @ param isLinked 是否新建LinkedList
* @ return List对象
* @ since 4.1.2 */
public static < T > List < T > list ( boolean isLinked ) { } } | return isLinked ? new LinkedList < T > ( ) : new ArrayList < T > ( ) ; |
public class IndianCalendar { /** * { @ inheritDoc } */
protected int handleComputeMonthStart ( int year , int month , boolean useMonth ) { } } | // month is 0 based ; converting it to 1 - based
int imonth ; // If the month is out of range , adjust it into range , and adjust the extended year accordingly
if ( month < 0 || month > 11 ) { year += month / 12 ; month %= 12 ; } imonth = month + 1 ; double jd = IndianToJD ( year , imonth , 1 ) ; return ( int ) jd ; |
public class arp { /** * Use this API to send arp . */
public static base_response send ( nitro_service client , arp resource ) throws Exception { } } | arp sendresource = new arp ( ) ; sendresource . ipaddress = resource . ipaddress ; sendresource . td = resource . td ; sendresource . all = resource . all ; return sendresource . perform_operation ( client , "send" ) ; |
public class KamDialect { /** * { @ inheritDoc } */
@ Override public KamNode replaceNode ( KamNode kamNode , FunctionEnum function , String label ) { } } | return kam . replaceNode ( kamNode , function , label ) ; |
public class Parser { /** * or : = and ( & lt ; OR & gt ; and ) * */
protected AstNode or ( boolean required ) throws ScanException , ParseException { } } | AstNode v = and ( required ) ; if ( v == null ) { return null ; } while ( true ) { switch ( token . getSymbol ( ) ) { case OR : consumeToken ( ) ; v = createAstBinary ( v , and ( true ) , AstBinary . OR ) ; break ; case EXTENSION : if ( getExtensionHandler ( token ) . getExtensionPoint ( ) == ExtensionPoint . OR ) { v = getExtensionHandler ( consumeToken ( ) ) . createAstNode ( v , and ( true ) ) ; break ; } default : return v ; } } |
public class Fields { /** * < p > Filters the { @ link Field } s which are annotated with the given annotation and returns a new
* instance of { @ link Fields } that wrap the filtered collection . < / p >
* @ param annotation
* the { @ link Field } s annotated with this type will be filtered
* < br > < br >
* @ return a < b > new instance < / b > of { @ link Fields } which wraps the filtered { @ link Field } s
* < br > < br >
* @ since 1.3.0 */
public Fields annotatedWith ( final Class < ? extends Annotation > annotation ) { } } | assertNotNull ( annotation , Class . class ) ; return new Fields ( filter ( new Criterion ( ) { @ Override public boolean evaluate ( Field field ) { return field . isAnnotationPresent ( annotation ) ; } } ) ) ; |
public class AWSSimpleSystemsManagementClient { /** * Disassociates the specified Systems Manager document from the specified instance .
* When you disassociate a document from an instance , it does not change the configuration of the instance . To
* change the configuration state of an instance after you disassociate a document , you must create a new document
* with the desired configuration and associate it with the instance .
* @ param deleteAssociationRequest
* @ return Result of the DeleteAssociation operation returned by the service .
* @ throws AssociationDoesNotExistException
* The specified association does not exist .
* @ throws InternalServerErrorException
* An error occurred on the server side .
* @ throws InvalidDocumentException
* The specified document does not exist .
* @ throws InvalidInstanceIdException
* The following problems can cause this exception : < / p >
* You do not have permission to access the instance .
* SSM Agent is not running . On managed instances and Linux instances , verify that the SSM Agent is running .
* On EC2 Windows instances , verify that the EC2Config service is running .
* SSM Agent or EC2Config service is not registered to the SSM endpoint . Try reinstalling SSM Agent or
* EC2Config service .
* The instance is not in valid state . Valid states are : Running , Pending , Stopped , Stopping . Invalid states
* are : Shutting - down and Terminated .
* @ throws TooManyUpdatesException
* There are concurrent updates for a resource that supports one update at a time .
* @ sample AWSSimpleSystemsManagement . DeleteAssociation
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ssm - 2014-11-06 / DeleteAssociation " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DeleteAssociationResult deleteAssociation ( DeleteAssociationRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDeleteAssociation ( request ) ; |
public class PublishingScopeUrl { /** * Get Resource Url for PublishDrafts
* @ return String Resource Url */
public static MozuUrl publishDraftsUrl ( ) { } } | UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/publishing/publishdrafts" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; |
public class Debug { /** * After processing all the PDF documents , this method helps us to get the statistic information of all the PDF documents
* such as the total number of pages , tables , etc .
* @ param outputDirPath
* the directory path where the middle - stage results will go to
* @ param pdfFile
* the PDF file being processed
* @ param pageNum
* the total number of pages in the PDF directory
* @ param tableNum
* the total number of detected tables in the PDF directory
* @ throws IOException */
public static void printStatInfo ( String outputDirPath , File pdfFile , int pageNum , int tableNum ) { } } | try { File classificationData = new File ( outputDirPath , "statInfo" ) ; if ( ! classificationData . exists ( ) ) { classificationData . mkdirs ( ) ; } File fileName = new File ( classificationData , "tableNumStatInfo.txt" ) ; BufferedWriter bw0 = new BufferedWriter ( new FileWriter ( fileName , true ) ) ; bw0 . append ( outputDirPath + pdfFile . getName ( ) + "\t\t" + pageNum + " PAGES\t\t" + tableNum + " TABLES\n" ) ; bw0 . close ( ) ; } catch ( IOException e ) { System . out . printf ( "[Debug Error] IOException\n" ) ; } |
public class ThreadUtils { /** * Null - safe operation to interrupt the specified Thread .
* @ param thread the Thread to interrupt .
* @ see java . lang . Thread # interrupt ( ) */
@ NullSafe public static void interrupt ( Thread thread ) { } } | Optional . ofNullable ( thread ) . ifPresent ( Thread :: interrupt ) ; |
public class JcaServiceUtilities { /** * Restore current context class loader saved when the context class loader was set to the one
* for the resource adapter .
* @ param raClassLoader
* @ param previousClassLoader */
public void endContextClassLoader ( ClassLoader raClassLoader , ClassLoader previousClassLoader ) { } } | if ( raClassLoader != null ) { AccessController . doPrivileged ( new GetAndSetContextClassLoader ( previousClassLoader ) ) ; } |
public class OptionsParamView { /** * Sets whether or not the HTTP CONNECT requests received by the local proxy should be ( persisted and ) shown in the UI .
* @ param showConnectRequests { @ code true } if the HTTP CONNECT requests should be shown , { @ code false } otherwise
* @ since 2.5.0
* @ see # isShowLocalConnectRequests ( ) */
public void setShowLocalConnectRequests ( boolean showConnectRequests ) { } } | if ( showLocalConnectRequests != showConnectRequests ) { showLocalConnectRequests = showConnectRequests ; getConfig ( ) . setProperty ( SHOW_LOCAL_CONNECT_REQUESTS , showConnectRequests ) ; } |
public class SparqlCall { /** * URL - encode a string as UTF - 8 , catching any thrown UnsupportedEncodingException . */
private static final String encode ( String s ) { } } | try { return URLEncoder . encode ( s , UTF_8 ) ; } catch ( UnsupportedEncodingException e ) { throw new Error ( "JVM unable to handle UTF-8" ) ; } |
public class AmazonRedshiftClient { /** * Deletes the specified Amazon Redshift HSM configuration .
* @ param deleteHsmConfigurationRequest
* @ return Result of the DeleteHsmConfiguration operation returned by the service .
* @ throws InvalidHsmConfigurationStateException
* The specified HSM configuration is not in the < code > available < / code > state , or it is still in use by one
* or more Amazon Redshift clusters .
* @ throws HsmConfigurationNotFoundException
* There is no Amazon Redshift HSM configuration with the specified identifier .
* @ sample AmazonRedshift . DeleteHsmConfiguration
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / redshift - 2012-12-01 / DeleteHsmConfiguration "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DeleteHsmConfigurationResult deleteHsmConfiguration ( DeleteHsmConfigurationRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDeleteHsmConfiguration ( request ) ; |
public class RuntimeConfiguration { /** * Adds a ( or a set of ) new host to the black list ; the host can be specified directly or it can be a file ( prefixed by
* < code > file : < / code > ) .
* @ param spec the specification ( a host , or a file prefixed by < code > file < / code > ) .
* @ throws ConfigurationException
* @ throws FileNotFoundException */
public void addBlackListedHost ( final String spec ) throws ConfigurationException , FileNotFoundException { } } | if ( spec . length ( ) == 0 ) return ; // Skip empty specs
if ( spec . startsWith ( "file:" ) ) { final LineIterator lineIterator = new LineIterator ( new FastBufferedReader ( new InputStreamReader ( new FileInputStream ( spec . substring ( 5 ) ) , Charsets . ISO_8859_1 ) ) ) ; while ( lineIterator . hasNext ( ) ) { final MutableString line = lineIterator . next ( ) ; blackListedHostHashes . add ( line . toString ( ) . trim ( ) . hashCode ( ) ) ; } } else blackListedHostHashes . add ( spec . trim ( ) . hashCode ( ) ) ; |
public class Label { /** * Resolves all forward references to this label . This method must be called
* when this label is added to the bytecode of the method , i . e . when its
* position becomes known . This method fills in the blanks that where left
* in the bytecode by each forward reference previously added to this label .
* @ param owner the code writer that calls this method .
* @ param position the position of this label in the bytecode .
* @ param data the bytecode of the method .
* @ return < tt > true < / tt > if a blank that was left for this label was to
* small to store the offset . In such a case the corresponding jump
* instruction is replaced with a pseudo instruction ( using unused
* opcodes ) using an unsigned two bytes offset . These pseudo
* instructions will need to be replaced with true instructions with
* wider offsets ( 4 bytes instead of 2 ) . This is done in
* { @ link MethodWriter # resizeInstructions } .
* @ throws IllegalArgumentException if this label has already been resolved ,
* or if it has not been created by the given code writer . */
boolean resolve ( final MethodWriter owner , final int position , final byte [ ] data ) { } } | boolean needUpdate = false ; this . status |= RESOLVED ; this . position = position ; int i = 0 ; while ( i < referenceCount ) { int source = srcAndRefPositions [ i ++ ] ; int reference = srcAndRefPositions [ i ++ ] ; int offset ; if ( source >= 0 ) { offset = position - source ; if ( offset < Short . MIN_VALUE || offset > Short . MAX_VALUE ) { /* * changes the opcode of the jump instruction , in order to
* be able to find it later ( see resizeInstructions in
* MethodWriter ) . These temporary opcodes are similar to
* jump instruction opcodes , except that the 2 bytes offset
* is unsigned ( and can therefore represent values from 0 to
* 65535 , which is sufficient since the size of a method is
* limited to 65535 bytes ) . */
int opcode = data [ reference - 1 ] & 0xFF ; if ( opcode <= Opcodes . JSR ) { // changes IFEQ . . . JSR to opcodes 202 to 217
data [ reference - 1 ] = ( byte ) ( opcode + 49 ) ; } else { // changes IFNULL and IFNONNULL to opcodes 218 and 219
data [ reference - 1 ] = ( byte ) ( opcode + 20 ) ; } needUpdate = true ; } data [ reference ++ ] = ( byte ) ( offset >>> 8 ) ; data [ reference ] = ( byte ) offset ; } else { offset = position + source + 1 ; data [ reference ++ ] = ( byte ) ( offset >>> 24 ) ; data [ reference ++ ] = ( byte ) ( offset >>> 16 ) ; data [ reference ++ ] = ( byte ) ( offset >>> 8 ) ; data [ reference ] = ( byte ) offset ; } } return needUpdate ; |
public class Jaguar { /** * Installs the specified component into Jaguar .
* The component must be installed after Jaguar started .
* @ param component The component class to be installed . */
public static synchronized void install ( Class < ? > component ) { } } | Preconditions . checkState ( container != null , "Cannot install component until Jaguar starts" ) ; if ( ! installed ( component ) ) { container . install ( component ) ; } |
public class AccountsInner { /** * Gets the SAS token associated with the specified Data Lake Analytics and Azure Storage account and container combination .
* @ param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account .
* @ param accountName The name of the Data Lake Analytics account from which an Azure Storage account ' s SAS token is being requested .
* @ param storageAccountName The name of the Azure storage account for which the SAS token is being requested .
* @ param containerName The name of the Azure storage container for which the SAS token is being requested .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; SasTokenInfoInner & gt ; object */
public Observable < Page < SasTokenInfoInner > > listSasTokensAsync ( final String resourceGroupName , final String accountName , final String storageAccountName , final String containerName ) { } } | return listSasTokensWithServiceResponseAsync ( resourceGroupName , accountName , storageAccountName , containerName ) . map ( new Func1 < ServiceResponse < Page < SasTokenInfoInner > > , Page < SasTokenInfoInner > > ( ) { @ Override public Page < SasTokenInfoInner > call ( ServiceResponse < Page < SasTokenInfoInner > > response ) { return response . body ( ) ; } } ) ; |
public class N { /** * Mostly it ' s designed for one - step operation to complete the operation in one step .
* < code > java . util . stream . Stream < / code > is preferred for multiple phases operation .
* @ param a
* @ param fromIndex
* @ param toIndex
* @ param func
* @ param max
* @ param supplier
* @ return */
public static < T , R , C extends Collection < R > , E extends Exception > C map ( final T [ ] a , final int fromIndex , final int toIndex , final Try . Function < ? super T , ? extends R , E > func , final IntFunction < ? extends C > supplier ) throws E { } } | checkFromToIndex ( fromIndex , toIndex , len ( a ) ) ; N . checkArgNotNull ( func ) ; if ( N . isNullOrEmpty ( a ) ) { return supplier . apply ( 0 ) ; } final C result = supplier . apply ( toIndex - fromIndex ) ; for ( int i = fromIndex ; i < toIndex ; i ++ ) { result . add ( func . apply ( a [ i ] ) ) ; } return result ; |
public class BoxesRunTime { /** * arg . toChar */
public static java . lang . Character toCharacter ( Object arg ) throws NoSuchMethodException { } } | if ( arg instanceof java . lang . Integer ) return boxToCharacter ( ( char ) unboxToInt ( arg ) ) ; if ( arg instanceof java . lang . Short ) return boxToCharacter ( ( char ) unboxToShort ( arg ) ) ; if ( arg instanceof java . lang . Character ) return ( java . lang . Character ) arg ; if ( arg instanceof java . lang . Long ) return boxToCharacter ( ( char ) unboxToLong ( arg ) ) ; if ( arg instanceof java . lang . Byte ) return boxToCharacter ( ( char ) unboxToByte ( arg ) ) ; if ( arg instanceof java . lang . Float ) return boxToCharacter ( ( char ) unboxToFloat ( arg ) ) ; if ( arg instanceof java . lang . Double ) return boxToCharacter ( ( char ) unboxToDouble ( arg ) ) ; throw new NoSuchMethodException ( ) ; |
public class BehaviorTreeLibrary { /** * Creates the { @ link BehaviorTree } for the specified reference and blackboard object .
* @ param treeReference the tree identifier , typically a path
* @ param blackboard the blackboard object ( it can be { @ code null } ) .
* @ return the tree cloned from the archetype .
* @ throws SerializationException if the reference cannot be successfully parsed .
* @ throws TaskCloneException if the archetype cannot be successfully parsed . */
@ SuppressWarnings ( "unchecked" ) public < T > BehaviorTree < T > createBehaviorTree ( String treeReference , T blackboard ) { } } | BehaviorTree < T > bt = ( BehaviorTree < T > ) retrieveArchetypeTree ( treeReference ) . cloneTask ( ) ; bt . setObject ( blackboard ) ; return bt ; |
public class TranslationServiceClient { /** * Gets a glossary . Returns NOT _ FOUND , if the glossary doesn ' t exist .
* < p > Sample code :
* < pre > < code >
* try ( TranslationServiceClient translationServiceClient = TranslationServiceClient . create ( ) ) {
* String formattedName = TranslationServiceClient . formatGlossaryName ( " [ PROJECT ] " , " [ LOCATION ] " , " [ GLOSSARY ] " ) ;
* Glossary response = translationServiceClient . getGlossary ( formattedName ) ;
* < / code > < / pre >
* @ param name Required . The name of the glossary to retrieve .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final Glossary getGlossary ( String name ) { } } | GLOSSARY_PATH_TEMPLATE . validate ( name , "getGlossary" ) ; GetGlossaryRequest request = GetGlossaryRequest . newBuilder ( ) . setName ( name ) . build ( ) ; return getGlossary ( request ) ; |
public class HttpIgnoreBodyCallback { /** * @ see
* com . ibm . wsspi . channelfw . InterChannelCallback # error ( com . ibm . wsspi . channelfw
* . VirtualConnection , java . lang . Throwable ) */
public void error ( VirtualConnection vc , Throwable t ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "error() called: " + vc ) ; } // can ' t do anything with a null VC
if ( null == vc ) { return ; } Object o = vc . getStateMap ( ) . get ( CallbackIDs . CALLBACK_HTTPICL ) ; if ( null == o ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "ERROR: null ICL in error()" ) ; } return ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Error occurring while purging body: " + t ) ; } // close the connection
( ( HttpInboundLink ) o ) . close ( vc , ( Exception ) t ) ; |
public class Style { /** * Default material pink transparent style for SuperToasts .
* @ return A new Style */
public static Style pink ( ) { } } | final Style style = new Style ( ) ; style . color = PaletteUtils . getSolidColor ( PaletteUtils . MATERIAL_PINK ) ; return style ; |
public class NodeStepDataResultImpl { /** * Add a data context to a source result
* @ param result
* @ param dataContext
* @ return */
public static NodeStepResult with ( final NodeStepResult result , final WFSharedContext dataContext ) { } } | return new NodeStepDataResultImpl ( result , result . getException ( ) , result . getFailureReason ( ) , result . getFailureMessage ( ) , result . getFailureData ( ) , result . getNode ( ) , dataContext ) ; |
public class TransactionGeomIndexUtil { public static TransactionGeomIndex getIndex ( String identifier ) { } } | if ( identifier == null ) { return new TransactionGeomIndex ( ) ; } TransactionGeomIndex index = new TransactionGeomIndex ( ) ; int position = identifier . indexOf ( "featureTransaction.feature" ) ; if ( position >= 0 ) { String temp = identifier . substring ( position + ( "featureTransaction.feature" . length ( ) ) ) ; index . setFeatureIndex ( readInteger ( temp ) ) ; // Geometry index ( polygon , lineString or point ) :
index . setGeometryIndex ( getIndex ( identifier , "polygon" ) ) ; if ( index . getGeometryIndex ( ) < 0 ) { index . setGeometryIndex ( getIndex ( identifier , "linestring" ) ) ; } if ( index . getGeometryIndex ( ) < 0 ) { index . setGeometryIndex ( getIndex ( identifier , "point" ) ) ; } index . setExteriorRing ( hasIdentifier ( identifier , "shell" ) ) ; index . setInteriorRingIndex ( getIndex ( identifier , "hole" ) ) ; // Coordinate index ( coordinate or edge ) :
index . setCoordinateIndex ( getIndex ( identifier , "coordinate" ) ) ; if ( index . getCoordinateIndex ( ) < 0 ) { index . setEdgeIndex ( getIndex ( identifier , "edge" ) ) ; } return index ; } return index ; |
public class WhiteSpaceFilterPrintWriter { /** * Writes the given byte to the underlying output stream if it passes filtering .
* @ param c the byte to write . */
@ Override public void write ( final int c ) { } } | WhiteSpaceFilterStateMachine . StateChange change = stateMachine . nextState ( ( char ) c ) ; if ( change . getOutputBytes ( ) != null ) { for ( int i = 0 ; i < change . getOutputBytes ( ) . length ; i ++ ) { super . write ( change . getOutputBytes ( ) [ i ] ) ; } } if ( ! change . isSuppressCurrentChar ( ) ) { super . write ( c ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.