signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class MaxSAT { /** * The main MaxSAT solving method . * @ param handler a MaxSAT handler * @ return the result of the solving process * @ throws IllegalArgumentException if the configuration was not valid */ public final MaxSATResult search ( final MaxSATHandler handler ) { } }
this . handler = handler ; if ( handler != null ) handler . startedSolving ( ) ; final MaxSATResult result = search ( ) ; if ( handler != null ) handler . finishedSolving ( ) ; this . handler = null ; return result ;
public class MDLV3000Reader { /** * Applies the MDL valence model to atoms using the explicit valence ( bond * order sum ) and charge to determine the correct number of implicit * hydrogens . The model is not applied if the explicit valence is less than * 0 - this is the case when a query bond was read for an ato...
if ( atom . getValency ( ) != null ) { if ( atom . getValency ( ) >= explicitValence ) atom . setImplicitHydrogenCount ( atom . getValency ( ) - ( explicitValence - unpaired ) ) ; else atom . setImplicitHydrogenCount ( 0 ) ; } else { Integer element = atom . getAtomicNumber ( ) ; if ( element == null ) element = 0 ; In...
public class AWSServiceCatalogClient { /** * Updates the specified provisioning artifact ( also known as a version ) for the specified product . * You cannot update a provisioning artifact for a product that was shared with you . * @ param updateProvisioningArtifactRequest * @ return Result of the UpdateProvision...
request = beforeClientExecution ( request ) ; return executeUpdateProvisioningArtifact ( request ) ;
public class Storage { /** * Enumerates all known buckets . * @ return a list of all known buckets */ public List < Bucket > getBuckets ( ) { } }
List < Bucket > result = Lists . newArrayList ( ) ; for ( File file : getBaseDir ( ) . listFiles ( ) ) { if ( file . isDirectory ( ) ) { result . add ( new Bucket ( file ) ) ; } } return result ;
public class Ray2 { /** * Sets the ray parameters to the values contained in the supplied vectors . * @ return a reference to this ray , for chaining . */ public Ray2 set ( IVector origin , IVector direction ) { } }
this . origin . set ( origin ) ; this . direction . set ( direction ) ; return this ;
public class ChannelFrameworkImpl { /** * Set a factory provider . * @ param provider */ @ Override public void registerFactories ( ChannelFactoryProvider provider ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Register factory provider; " + provider . getClass ( ) . getName ( ) ) ; } synchronized ( this . factories ) { for ( Entry < String , Class < ? extends ChannelFactory > > entry : provider . getTypes ( ) . entrySet ( ) ) { th...
public class SSLTools { /** * Disabling SSL validation is strongly discouraged . This is generally only intended for use during testing or perhaps * when used in a private network with a self signed certificate . * < p > Even when using with a self signed certificate it is recommended that instead of disabling SSL ...
try { SSLContext context = SSLContext . getInstance ( "SSL" ) ; context . init ( null , new TrustManager [ ] { new UnsafeTrustManager ( ) } , null ) ; HttpsURLConnection . setDefaultSSLSocketFactory ( context . getSocketFactory ( ) ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; }
public class ViewpointsAndPerspectivesDocumentationTemplate { /** * Adds an " Appendices " section relating to a { @ link SoftwareSystem } from one or more files . * @ param softwareSystem the { @ link SoftwareSystem } the documentation content relates to * @ param files one or more File objects that point to the d...
return addSection ( softwareSystem , "Appendices" , files ) ;
public class PackageCommand { /** * Package the server * @ return */ public ReturnCode doPackageRuntimeOnly ( ) { } }
System . out . println ( BootstrapConstants . messages . getString ( "info.runtimePackaging" ) ) ; File archive = getArchive ( "wlp" , wlpOutputRoot ) ; ReturnCode packageRc = packageServerRuntime ( archive , true ) ; if ( packageRc == ReturnCode . OK ) { System . out . println ( MessageFormat . format ( BootstrapConst...
public class EncodedElement { /** * Force the usable data stored in this list ends on a a byte boundary , by * padding to the end with zeros . * @ return true if the data was padded , false if it already ended on a byte * boundary . */ public boolean padToByte ( ) { } }
boolean padded = false ; EncodedElement end = EncodedElement . getEnd_S ( this ) ; int tempVal = end . usableBits ; if ( tempVal % 8 != 0 ) { int toWrite = 8 - ( tempVal % 8 ) ; end . addInt ( 0 , toWrite ) ; /* Assert FOR DEVEL ONLY : */ assert ( ( this . getTotalBits ( ) + offset ) % 8 == 0 ) ; padded = true ; } retu...
public class PropertiesManagerCore { /** * Remove the GeoPackage with the name but does not close it * @ param name * GeoPackage name * @ return removed GeoPackage */ public T removeGeoPackage ( String name ) { } }
T removed = null ; PropertiesCoreExtension < T , ? , ? , ? > properties = propertiesMap . remove ( name ) ; if ( properties != null ) { removed = properties . getGeoPackage ( ) ; } return removed ;
public class SnowflakeStatementV1 { /** * Execute sql * @ param sql sql statement * @ param parameterBindings a map of binds to use for this query * @ return whether there is result set or not * @ throws SQLException if @ link { # executeQuery ( String ) } throws exception */ boolean executeInternal ( String sq...
raiseSQLExceptionIfStatementIsClosed ( ) ; connection . injectedDelay ( ) ; logger . debug ( "execute: {}" , sql ) ; String trimmedSql = sql . trim ( ) ; if ( trimmedSql . length ( ) >= 20 && trimmedSql . toLowerCase ( ) . startsWith ( "set-sf-property" ) ) { // deprecated : sfsql executeSetProperty ( sql ) ; return fa...
public class Quaterniond { /** * Integrate the rotation given by the angular velocity < code > ( vx , vy , vz ) < / code > around the x , y and z axis , respectively , * with respect to the given elapsed time delta < code > dt < / code > and add the differentiate rotation to the rotation represented by this quaternio...
return integrate ( dt , vx , vy , vz , this ) ;
public class Users { /** * Send token via sms to a user with some options defined . * @ param userId * @ param options * @ return Hash instance with API ' s response . */ public Hash requestSms ( int userId , Map < String , String > options ) { } }
String url = "" ; try { url = URLEncoder . encode ( Integer . toString ( userId ) , ENCODE ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } MapToResponse opt = new MapToResponse ( options ) ; String content = this . get ( SMS_PATH + url , opt ) ; return instanceFromXml ( this . getStatus ( ) , content ) ;
public class DragableArea { /** * Enable capturing of ' mousedown ' events . */ public void enableStart ( ) { } }
EventTarget targ = ( EventTarget ) element ; targ . addEventListener ( SVGConstants . SVG_EVENT_MOUSEDOWN , this , false ) ;
public class GenericMonitor { /** * Cancel updater task and unregister producers . * However , call of { @ link # setup ( ) } method will recreate everything and * turn this GenericMonitor back to running state . */ private void stop ( ) { } }
// unregister and free all resources ; if ( updateTask != null ) updateTask . cancel ( ) ; for ( GenericStatsProducer producer : producers ) { producer . genericStats . destroy ( ) ; ProducerRegistryFactory . getProducerRegistryInstance ( ) . unregisterProducer ( producer ) ; } producers . clear ( ) ;
public class ServiceLocatorImpl { /** * Specify the time out of the session established at the server . The * session is kept alive by requests sent by this client object . If the * session is idle for a period of time that would timeout the session , the * client will send a PING request to keep the session aliv...
( ( ZKBackend ) getBackend ( ) ) . setSessionTimeout ( timeout ) ; if ( LOG . isLoggable ( Level . FINE ) ) { LOG . fine ( "Locator session timeout set to: " + timeout ) ; }
public class CmsOrgUnitManager { /** * Creates a new organizational unit . < p > * The parent structure must exist . < p > * @ param cms the opencms context * @ param ouFqn the fully qualified name of the new organizational unit * @ param description the description of the new organizational unit * @ param fl...
CmsResource resource = null ; if ( ( ( flags & CmsOrganizationalUnit . FLAG_WEBUSERS ) == 0 ) || ( resourceName != null ) ) { // only normal OUs have to have at least one resource resource = cms . readResource ( resourceName ) ; } return m_securityManager . createOrganizationalUnit ( cms . getRequestContext ( ) , ouFqn...
public class AWSCognitoIdentityProviderClient { /** * Gets information about a domain . * @ param describeUserPoolDomainRequest * @ return Result of the DescribeUserPoolDomain operation returned by the service . * @ throws NotAuthorizedException * This exception is thrown when a user is not authorized . * @ t...
request = beforeClientExecution ( request ) ; return executeDescribeUserPoolDomain ( request ) ;
public class ScheduleGenerator { /** * Generates a schedule based on some meta data . The schedule generation * considers short periods . * @ param referenceDate The date which is used in the schedule to internally convert dates to doubles , i . e . , the date where t = 0. * @ param startDate The start date of th...
LocalDate maturityDate = createDateFromDateAndOffset ( startDate , maturity ) ; return createScheduleFromConventions ( referenceDate , startDate , maturityDate , Frequency . valueOf ( frequency . toUpperCase ( ) ) , DaycountConvention . getEnum ( daycountConvention ) , ShortPeriodConvention . valueOf ( shortPeriodConve...
public class ExecHandler { /** * Execute an JMX operation . The operation name is taken from the request , as well as the * arguments to use . If the operation is given in the format " op ( type1 , type2 , . . . ) " * ( e . g " getText ( java . lang . String , int ) " then the argument types are taken into account ...
OperationAndParamType types = extractOperationTypes ( server , request ) ; int nrParams = types . paramClasses . length ; Object [ ] params = new Object [ nrParams ] ; List < Object > args = request . getArguments ( ) ; verifyArguments ( request , types , nrParams , args ) ; for ( int i = 0 ; i < nrParams ; i ++ ) { if...
public class Logger { /** * Issue a log message with a level of TRACE using { @ link java . text . MessageFormat } - style formatting . * @ param format the message format string * @ param params the parameters */ public void tracev ( String format , Object ... params ) { } }
doLog ( Level . TRACE , FQCN , format , params , null ) ;
public class BaasDocument { /** * Asynchronously retrieves the number of documents readable to the user in < code > collection < / code > * @ param collection the collection to doCount not < code > null < / code > * @ param flags { @ link RequestOptions } * @ param handler a callback to be invoked with the result...
return doCount ( collection , null , flags , handler ) ;
public class JobMasterClientRestServiceHandler { /** * Lists all the jobs in the history . * @ return the response of the names of all the jobs */ @ GET @ Path ( ServiceConstants . LIST ) public Response list ( ) { } }
return RestUtils . call ( new RestUtils . RestCallable < List < Long > > ( ) { @ Override public List < Long > call ( ) throws Exception { return mJobMaster . list ( ) ; } } , ServerConfiguration . global ( ) ) ;
public class DirectedMultigraph { /** * { @ inheritDoc } */ public boolean contains ( Edge e ) { } }
SparseDirectedTypedEdgeSet < T > edges = vertexToEdges . get ( e . to ( ) ) ; return edges != null && edges . contains ( e ) ;
public class JawnServletContext { /** * Gets the FileItemIterator of the input . * Can be used to process uploads in a streaming fashion . Check out : * http : / / commons . apache . org / fileupload / streaming . html * @ return the FileItemIterator of the request or null if there was an * error . */ public Op...
DiskFileItemFactory factory = new DiskFileItemFactory ( ) ; factory . setSizeThreshold ( properties . getInt ( Constants . PROPERTY_UPLOADS_MAX_SIZE /* Constants . Params . maxUploadSize . name ( ) */ ) ) ; // Configuration . getMaxUploadSize ( ) ) ; factory . setRepository ( new File ( System . getProperty ( "java.io....
public class Enter { /** * Visitor method : enter classes of a list of trees , returning a list of types . */ < T extends JCTree > List < Type > classEnter ( List < T > trees , Env < AttrContext > env ) { } }
ListBuffer < Type > ts = new ListBuffer < > ( ) ; for ( List < T > l = trees ; l . nonEmpty ( ) ; l = l . tail ) { Type t = classEnter ( l . head , env ) ; if ( t != null ) ts . append ( t ) ; } return ts . toList ( ) ;
public class UnconditionalValueDerefSet { /** * Get the set of Locations where given value is guaranteed to be * dereferenced . ( I . e . , if non - implicit - exception control paths are * followed , one of these locations will be reached ) . * @ param vn * the value * @ return set of Locations , one of whic...
Set < Location > derefLocationSet = derefLocationSetMap . get ( vn ) ; if ( derefLocationSet == null ) { derefLocationSet = Collections . < Location > emptySet ( ) ; } return derefLocationSet ;
public class MainMenuBar { /** * This method initializes menuHelp * @ return javax . swing . JMenu */ public JMenu getMenuHelp ( ) { } }
if ( menuHelp == null ) { menuHelp = new JMenu ( ) ; menuHelp . setText ( Constant . messages . getString ( "menu.help" ) ) ; // ZAP : i18n menuHelp . setMnemonic ( Constant . messages . getChar ( "menu.help.mnemonic" ) ) ; menuHelp . add ( getMenuHelpAbout ( ) ) ; menuHelp . add ( getMenuHelpSupport ( ) ) ; } return m...
public class MolgenisValidationException { /** * renumber the violation row indices with the actual row numbers */ public void renumberViolationRowIndices ( List < Integer > actualIndices ) { } }
violations . forEach ( v -> v . renumberRowIndex ( actualIndices ) ) ;
public class C10NFilters { /** * < p > Filter provider that always returns the specified instance * @ param filter filter instance to return from the generated provider ( not - null ) * @ param < T > Filter argument type * @ return instance of filter provider ( never - null ) */ public static < T > C10NFilterProv...
Preconditions . assertNotNull ( filter , "filter" ) ; return new StaticC10NFilterProvider < T > ( filter ) ;
public class Predicates { /** * Returns a predicate that evaluates to { @ code true } if both of its * components evaluate to { @ code true } . The components are evaluated in * order , and evaluation will be " short - circuited " as soon as a false * predicate is found . */ public static < T > Predicate < T > an...
return new AndPredicate < > ( Predicates . < T > asList ( Objects . requireNonNull ( first ) , Objects . requireNonNull ( second ) ) ) ;
public class BehaviorBase { /** * < p class = " changed _ added _ 2_0 " > Implementation of * { @ link javax . faces . component . StateHolder # restoreState } . */ @ SuppressWarnings ( "unchecked" ) public void restoreState ( FacesContext context , Object state ) { } }
if ( context == null ) { throw new NullPointerException ( ) ; } if ( state != null ) { // Unchecked cast from Object to List < BehaviorListener > listeners = ( List < BehaviorListener > ) UIComponentBase . restoreAttachedState ( context , state ) ; // If we saved state last time , save state again next time . clearInit...
public class Password { /** * Retrieves the salt from the given value . * @ param value The overall password hash value . * @ return The salt , which is the first { @ value Generate # SALT _ BYTES } bytes of the */ private static String getSalt ( byte [ ] value ) { } }
byte [ ] salt = new byte [ Generate . SALT_BYTES ] ; System . arraycopy ( value , 0 , salt , 0 , salt . length ) ; return ByteArray . toBase64 ( salt ) ;
public class BlueprintsGraphMultiobjectiveSearch { /** * Build an example graph to execute in this example . * @ return example graph */ private static Graph buildGraph ( ) { } }
Graph g = new TinkerGraph ( ) ; // add vertices Vertex v1 = g . addVertex ( "v1" ) ; Vertex v2 = g . addVertex ( "v2" ) ; Vertex v3 = g . addVertex ( "v3" ) ; Vertex v4 = g . addVertex ( "v4" ) ; Vertex v5 = g . addVertex ( "v5" ) ; Vertex v6 = g . addVertex ( "v6" ) ; // add edges labeled with costs Edge e1 = g . addE...
public class DocTreeScanner { /** * { @ inheritDoc } This implementation scans the children in left to right order . * @ param node { @ inheritDoc } * @ param p { @ inheritDoc } * @ return the result of scanning */ @ Override public R visitDeprecated ( DeprecatedTree node , P p ) { } }
return scan ( node . getBody ( ) , p ) ;
public class VisualizerContext { /** * Add ( register ) a visualization . * @ param parent Parent object * @ param vis Visualization */ public void addVis ( Object parent , VisualizationItem vis ) { } }
vistree . add ( parent , vis ) ; notifyFactories ( vis ) ; visChanged ( vis ) ;
public class RoomInfoImpl { /** * / * ( non - Javadoc ) * @ see com . tvd12 . ezyfox . core . command . UpdateRoomInfo # setName ( java . lang . String ) */ @ Override public void setName ( String name ) { } }
room . setName ( name ) ; apiRoom . setName ( name ) ;
public class FileCopyProgressPanel { /** * Set the transfer text . Can contain two possible variables : $ N = Current * file number , $ M = Max file count . If called outside the EDT this method * will switch to the UI thread using * < code > SwingUtilities . invokeLater ( Runnable ) < / code > . * @ param tran...
if ( SwingUtilities . isEventDispatchThread ( ) ) { setTransferTextIntern ( transferText ) ; } else { try { SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { setTransferTextIntern ( transferText ) ; } } ) ; } catch ( final Exception ex ) { ignore ( ) ; } }
public class PollScheduler { /** * Stop the poller , shutting down the current executor service . */ public void stop ( ) { } }
ScheduledExecutorService service = executor . get ( ) ; if ( service != null && executor . compareAndSet ( service , null ) ) { service . shutdown ( ) ; } else { throw new IllegalStateException ( "scheduler must be started before you stop it" ) ; }
public class SuggestionBuilder { /** * Gets the tokens from the < code > tokens < / code > array which are between * < code > lower < / code > and < code > upper < / code > positions . * @ param sentence * the sentence containing the desired tokens * @ param lower * the index of the first token to be included...
List < Token > rootTokens = sentence . getTokens ( ) . subList ( lower , upper + 1 ) ; if ( considerChunk ) { List < Token > resp = new ArrayList < Token > ( rootTokens . size ( ) ) ; for ( int i = 0 ; i < rootTokens . size ( ) ; i ++ ) { resp . addAll ( getTokensRecursively ( rootTokens . get ( i ) ) ) ; } return root...
public class EpiLur { /** * Return the first Lur ( if any ) which also implements UserPass * @ return */ public CredVal getUserPassImpl ( ) { } }
for ( Lur lur : lurs ) { if ( lur instanceof CredVal ) { return ( CredVal ) lur ; } } return null ;
public class MkMaxTree { /** * Adapts the knn distances before insertion of entry q . * @ param q the entry to be inserted * @ param nodeEntry the entry representing the root of the current subtree * @ param knns _ q the knns of q */ private void preInsert ( MkMaxEntry q , MkMaxEntry nodeEntry , KNNHeap knns_q ) ...
if ( LOG . isDebugging ( ) ) { LOG . debugFine ( "preInsert " + q + " - " + nodeEntry + "\n" ) ; } double knnDist_q = knns_q . getKNNDistance ( ) ; MkMaxTreeNode < O > node = getNode ( nodeEntry ) ; double knnDist_node = 0. ; // leaf node if ( node . isLeaf ( ) ) { for ( int i = 0 ; i < node . getNumEntries ( ) ; i ++ ...
public class WebhooksInner { /** * Creates a webhook for a container registry with the specified parameters . * @ param resourceGroupName The name of the resource group to which the container registry belongs . * @ param registryName The name of the container registry . * @ param webhookName The name of the webho...
return beginCreateWithServiceResponseAsync ( resourceGroupName , registryName , webhookName , webhookCreateParameters ) . toBlocking ( ) . single ( ) . body ( ) ;
public class WebClientExchangeTags { /** * Creates an { @ code outcome } { @ code Tag } derived from the * { @ link ClientResponse # statusCode ( ) status } of the given { @ code response } . * @ param response the response * @ return the outcome tag * @ since 2.2.0 */ public static Tag outcome ( ClientResponse...
try { if ( response != null ) { HttpStatus status = response . statusCode ( ) ; if ( status . is1xxInformational ( ) ) { return OUTCOME_INFORMATIONAL ; } if ( status . is2xxSuccessful ( ) ) { return OUTCOME_SUCCESS ; } if ( status . is3xxRedirection ( ) ) { return OUTCOME_REDIRECTION ; } if ( status . is4xxClientError ...
public class WSManagedConnectionFactoryImpl { /** * Get a Connection from a DataSource based on what is in the cri . A null userName * indicates that no user name or password should be provided . * @ param userN the user name for obtaining a Connection , or null if none . * @ param password the password for obtai...
final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "getConnectionUsingDS" , AdapterUtil . toString ( dataSourceOrDriver ) , userN ) ; final String user = userN == null ? null : userN . trim ( ) ; final String pwd = password == null ?...
public class ReadHandler { /** * Used for a request to a single attribute from a single MBean . Merging of MBeanServers is done * one layer above . * @ param pServer server on which to request the attribute * @ param pRequest the request itself . * @ return the attribute ' s value */ @ Override public Object do...
checkRestriction ( pRequest . getObjectName ( ) , pRequest . getAttributeName ( ) ) ; return pServer . getAttribute ( pRequest . getObjectName ( ) , pRequest . getAttributeName ( ) ) ;
public class ReceiveQueue { /** * Adapted from example in javadoc of ExecutorService . */ private void shutdownAndAwaitTermination ( ExecutorService pool , int queueSize ) { } }
log . info ( "Shutting down executor service; queue size={}." , queueSize ) ; pool . shutdown ( ) ; // Disable new tasks from being submitted log . info ( "Waiting for executor service to finish all queued tasks." ) ; try { // Wait a while for existing tasks to terminate if ( ! pool . awaitTermination ( 60 , TimeUnit ....
public class JpaRef { /** * Beans with different schemaName may have same instance id . * The IN search query is greedy , finding instances that * match any combination of instance id and schemaName . Hence , * the query may find references belonging to wrong schema * so filter those out . */ static void filter...
ListIterator < JpaRef > it = result . listIterator ( ) ; while ( it . hasNext ( ) ) { // remove reference from result that was not part of the query BeanId found = it . next ( ) . getSource ( ) ; if ( ! query . contains ( found ) ) { it . remove ( ) ; } }
public class WebhooksInner { /** * Lists recent events for the specified webhook . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; EventInner & g...
return listEventsNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < EventInner > > , Page < EventInner > > ( ) { @ Override public Page < EventInner > call ( ServiceResponse < Page < EventInner > > response ) { return response . body ( ) ; } } ) ;
public class TwitterObjectFactory { /** * Constructs an AccountTotals object from rawJSON string . * @ param rawJSON raw JSON form as String * @ return AccountTotals * @ throws TwitterException when provided string is not a valid JSON string . * @ since Twitter4J 2.1.9 */ public static AccountTotals createAccou...
try { return new AccountTotalsJSONImpl ( new JSONObject ( rawJSON ) ) ; } catch ( JSONException e ) { throw new TwitterException ( e ) ; }
public class LdapUtils { /** * Returns the value of the first occurence of attributeType from entry . */ public static String extractAttributeEmptyCheck ( Entry entry , String attributeType ) { } }
Attribute attribute = entry . get ( attributeType ) ; Attribute emptyFlagAttribute = entry . get ( SchemaConstants . EMPTY_FLAG_ATTRIBUTE ) ; boolean empty = false ; try { if ( attribute != null ) { return attribute . getString ( ) ; } else if ( emptyFlagAttribute != null ) { empty = Boolean . valueOf ( emptyFlagAttrib...
public class BiLevelCacheMap { /** * If key is already in cacheL1 , the new value will show with a delay , * since merge L2 - > L1 may not happen immediately . To force the merge sooner , * call < code > size ( ) < code > . */ public Object put ( Object key , Object value ) { } }
synchronized ( _cacheL2 ) { _cacheL2 . put ( key , value ) ; // not really a miss , but merge to avoid big increase in L2 size // ( it cannot be reallocated , it is final ) mergeIfNeeded ( ) ; } return value ;
public class HttpBuilder { /** * Executes an asynchronous PATCH request on the configured URI ( asynchronous alias to the ` patch ( Closure ) ` method ) , with additional configuration * provided by the configuration closure . * [ source , groovy ] * def http = HttpBuilder . configure { * request . uri = ' http...
return CompletableFuture . supplyAsync ( ( ) -> patch ( closure ) , getExecutor ( ) ) ;
public class PropsUtils { /** * Load job schedules from the given directories * @ param dirs The directories to check for properties * @ param suffixes The suffixes to load * @ return The properties */ public static Props loadPropsInDirs ( final List < File > dirs , final String ... suffixes ) { } }
final Props props = new Props ( ) ; for ( final File dir : dirs ) { props . putLocal ( loadPropsInDir ( dir , suffixes ) ) ; } return props ;
public class LongEditor { /** * Map the argument text into and Integer using Integer . valueOf . */ @ Override public void setAsText ( final String text ) { } }
if ( BeanUtils . isNull ( text ) ) { setValue ( null ) ; return ; } try { Object newValue = Long . valueOf ( text ) ; setValue ( newValue ) ; } catch ( NumberFormatException e ) { throw new IllegalArgumentException ( "Failed to parse long." , e ) ; }
public class Source { /** * Provides the source and type of the event that causes AWS Config to evaluate your AWS resources . * @ return Provides the source and type of the event that causes AWS Config to evaluate your AWS resources . */ public java . util . List < SourceDetail > getSourceDetails ( ) { } }
if ( sourceDetails == null ) { sourceDetails = new com . amazonaws . internal . SdkInternalList < SourceDetail > ( ) ; } return sourceDetails ;
public class Modules { /** * Determine the location for the module on the module source path * or source output directory which contains a given CompilationUnit . * If the source output directory is unset , the class output directory * will be checked instead . * { @ code null } is returned if no such module ca...
JavaFileObject fo = tree . sourcefile ; Location loc = fileManager . getLocationForModule ( StandardLocation . MODULE_SOURCE_PATH , fo ) ; if ( loc == null ) { Location sourceOutput = fileManager . hasLocation ( StandardLocation . SOURCE_OUTPUT ) ? StandardLocation . SOURCE_OUTPUT : StandardLocation . CLASS_OUTPUT ; lo...
public class HalFormsSerializers { /** * Verify that the resource ' s self link and the affordance ' s URI have the same relative path . * @ param resource * @ param model */ private static void validate ( RepresentationModel < ? > resource , HalFormsAffordanceModel model ) { } }
String affordanceUri = model . getURI ( ) ; String selfLinkUri = resource . getRequiredLink ( IanaLinkRelations . SELF . value ( ) ) . expand ( ) . getHref ( ) ; if ( ! affordanceUri . equals ( selfLinkUri ) ) { throw new IllegalStateException ( "Affordance's URI " + affordanceUri + " doesn't match self link " + selfLi...
public class SimpleCamera2Activity { /** * Configures the necessary { @ link Matrix } transformation to ` mTextureView ` . * This method should not to be called until the camera preview size is determined in * openCamera , or until the size of ` mTextureView ` is fixed . * @ param viewWidth The width of ` mTextur...
int cameraWidth , cameraHeight ; try { open . mLock . lock ( ) ; if ( null == mTextureView || null == open . mCameraSize ) { return ; } cameraWidth = open . mCameraSize . getWidth ( ) ; cameraHeight = open . mCameraSize . getHeight ( ) ; } finally { open . mLock . unlock ( ) ; } int rotation = getWindowManager ( ) . ge...
public class Formatter { /** * 将List转换成JSON , 需要类重写toString方法 , 并返回一个JSON字符串 * @ param list { @ link List } * @ return { @ link String } */ public static String listToJson ( List < ? > list ) { } }
JSONArray array = new JSONArray ( ) ; if ( Checker . isNotEmpty ( list ) ) { array . addAll ( list ) ; } return formatJson ( array . toString ( ) ) ;
public class Jassimp { /** * Helper method for wrapping a vector . < p > * Used by JNI , do not modify ! * @ param x x component * @ param y y component * @ param z z component * @ return the wrapped vector */ static Object wrapVec3 ( float x , float y , float z ) { } }
ByteBuffer temp = ByteBuffer . allocate ( 3 * 4 ) ; temp . putFloat ( x ) ; temp . putFloat ( y ) ; temp . putFloat ( z ) ; temp . flip ( ) ; return s_wrapperProvider . wrapVector3f ( temp , 0 , 3 ) ;
public class Math { /** * Returns { @ code f } & times ; * 2 < sup > { @ code scaleFactor } < / sup > rounded as if performed * by a single correctly rounded floating - point multiply to a * member of the float value set . See the Java * Language Specification for a discussion of floating - point * value sets...
// magnitude of a power of two so large that scaling a finite // nonzero value by it would be guaranteed to over or // underflow ; due to rounding , scaling down takes takes an // additional power of two which is reflected here final int MAX_SCALE = FloatConsts . MAX_EXPONENT + - FloatConsts . MIN_EXPONENT + FloatConst...
public class X509Factory { /** * Returns an ASN . 1 SEQUENCE from a stream , which might be a BER - encoded * binary block or a PEM - style BASE64 - encoded ASCII data . In the latter * case , it ' s de - BASE64 ' ed before return . * After the reading , the input stream pointer is after the BER block , or * af...
// The first character of a BLOCK . int c = is . read ( ) ; if ( c == - 1 ) { return null ; } if ( c == DerValue . tag_Sequence ) { ByteArrayOutputStream bout = new ByteArrayOutputStream ( 2048 ) ; bout . write ( c ) ; readBERInternal ( is , bout , c ) ; return bout . toByteArray ( ) ; } else { // Read BASE64 encoded d...
public class StorableGenerator { /** * Generates code that loads a property annotation to the stack . */ private void loadPropertyAnnotation ( CodeBuilder b , StorableProperty property , StorablePropertyAnnotation annotation ) { } }
/* Example UserInfo . class . getMethod ( " setFirstName " , new Class [ ] { String . class } ) . getAnnotation ( LengthConstraint . class ) */ String methodName = annotation . getAnnotatedMethod ( ) . getName ( ) ; boolean isAccessor = ! methodName . startsWith ( "set" ) ; b . loadConstant ( TypeDesc . forClass ( ...
public class RemoteMongoCollectionImpl { /** * Finds a document in the collection . * @ param filter the query filter * @ param resultClass the class to decode each document into * @ param < ResultT > the target document type of the iterable . * @ return a task containing the result of the find one operation */...
return proxy . findOne ( filter , resultClass ) ;
public class DefaultNumberValue { /** * ( non - Javadoc ) * @ see javax . money . NumberValue # round ( java . math . MathContext ) */ @ Override public NumberValue round ( MathContext mathContext ) { } }
if ( this . number instanceof BigDecimal ) { return new DefaultNumberValue ( ( ( BigDecimal ) this . number ) . round ( mathContext ) ) ; } return new DefaultNumberValue ( new BigDecimal ( this . number . toString ( ) ) . round ( mathContext ) ) ;
public class IfcIrregularTimeSeriesImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) public EList < IfcIrregularTimeSeriesValue > getValues ( ) { } }
return ( EList < IfcIrregularTimeSeriesValue > ) eGet ( Ifc2x3tc1Package . Literals . IFC_IRREGULAR_TIME_SERIES__VALUES , true ) ;
public class BackgroundModelMoving { /** * Updates the background with new image information . * @ param homeToCurrent Transform from home image to the current image * @ param frame The current image in the sequence */ public void updateBackground ( MotionModel homeToCurrent , T frame ) { } }
worldToHome . concat ( homeToCurrent , worldToCurrent ) ; worldToCurrent . invert ( currentToWorld ) ; // find the distorted polygon of the current image in the " home " background reference frame transform . setModel ( currentToWorld ) ; transform . compute ( 0 , 0 , corners [ 0 ] ) ; transform . compute ( frame . wid...
public class Statement { /** * Writes this statement to the { @ link ClassVisitor } as a method . * @ param access The access modifiers of the method * @ param method The method signature * @ param visitor The class visitor to write it to */ public final void writeMethod ( int access , Method method , ClassVisito...
writeMethodTo ( new CodeBuilder ( access , method , null , visitor ) ) ;
public class Table { /** * < code > repeated . google . privacy . dlp . v2 . Table . Row rows = 2 ; < / code > */ public java . util . List < ? extends com . google . privacy . dlp . v2 . Table . RowOrBuilder > getRowsOrBuilderList ( ) { } }
return rows_ ;
public class StructTypeID { /** * return the StructTypeiD , if any , of the given field */ StructTypeID findStruct ( String name ) { } }
// walk through the list , searching . Not the most efficient way , but this // in intended to be used rarely , so we keep it simple . // As an optimization , we can keep a hashmap of record name to its RTI , for later . for ( FieldTypeInfo ti : typeInfos ) { if ( ( 0 == ti . getFieldID ( ) . compareTo ( name ) ) && ( ...
public class ZoneId { /** * Normalizes the time - zone ID , returning a { @ code ZoneOffset } where possible . * The returns a normalized { @ code ZoneId } that can be used in place of this ID . * The result will have { @ code ZoneRules } equivalent to those returned by this object , * however the ID returned by ...
try { ZoneRules rules = getRules ( ) ; if ( rules . isFixedOffset ( ) ) { return rules . getOffset ( Instant . EPOCH ) ; } } catch ( ZoneRulesException ex ) { // ignore invalid objects } return this ;
public class JWKSet { /** * TODO : Add cleanup */ public void add ( String setId , JWK jwk ) { } }
if ( jwksBySetId . containsKey ( setId ) == false ) { jwksBySetId . put ( setId , Collections . synchronizedSet ( new HashSet < JWK > ( ) ) ) ; } jwksBySetId . get ( setId ) . add ( jwk ) ;
public class Input { /** * Poll the state of the input * @ param width The width of the game view * @ param height The height of the game view */ public void poll ( int width , int height ) { } }
if ( paused ) { clearControlPressedRecord ( ) ; clearKeyPressedRecord ( ) ; clearMousePressedRecord ( ) ; while ( Keyboard . next ( ) ) { } while ( Mouse . next ( ) ) { } return ; } if ( ! Display . isActive ( ) ) { clearControlPressedRecord ( ) ; clearKeyPressedRecord ( ) ; clearMousePressedRecord ( ) ; } // add any l...
public class QRDecompositionHouseholder_DDRM { /** * Computes the Q matrix from the imformation stored in the QR matrix . This * operation requires about 4 ( m < sup > 2 < / sup > n - mn < sup > 2 < / sup > + n < sup > 3 < / sup > / 3 ) flops . * @ param Q The orthogonal Q matrix . */ @ Override public DMatrixRMaj ...
if ( compact ) { if ( Q == null ) { Q = CommonOps_DDRM . identity ( numRows , minLength ) ; } else { if ( Q . numRows != numRows || Q . numCols != minLength ) { throw new IllegalArgumentException ( "Unexpected matrix dimension." ) ; } else { CommonOps_DDRM . setIdentity ( Q ) ; } } } else { if ( Q == null ) { Q = Commo...
public class SoyFileSet { /** * Generates Java classes containing parse info ( param names , template names , meta info ) . There * will be one Java class per Soy file . * @ param javaPackage The Java package for the generated classes . * @ param javaClassNameSource Source of the generated class names . Must be o...
resetErrorReporter ( ) ; // TODO ( lukes ) : see if we can enforce that globals are provided at compile time here . given that // types have to be , this should be possible . Currently it is disabled for backwards // compatibility // N . B . we do not run the optimizer here for 2 reasons : // 1 . it would just waste ti...
public class AdminobjectTypeImpl { /** * If not already created , a new < code > config - property < / code > element will be created and returned . * Otherwise , the first existing < code > config - property < / code > element will be returned . * @ return the instance defined for the element < code > config - pro...
List < Node > nodeList = childNode . get ( "config-property" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new ConfigPropertyTypeImpl < AdminobjectType < T > > ( this , "config-property" , childNode , nodeList . get ( 0 ) ) ; } return createConfigProperty ( ) ;
public class ForField { /** * Creates a field transformer that patches the transformed field by the given modifier contributors . * @ param modifierContributor The modifier contributors to apply . * @ return A suitable field transformer . */ public static Transformer < FieldDescription > withModifiers ( ModifierCon...
return withModifiers ( Arrays . asList ( modifierContributor ) ) ;
public class VoltTableUtil { /** * Returns the number of characters generated and the csv data * in UTF - 8 encoding . */ public static Pair < Integer , byte [ ] > toCSV ( VoltTable vt , ArrayList < VoltType > columns , char delimiter , char fullDelimiters [ ] , int lastNumCharacters ) throws IOException { } }
StringWriter sw = new StringWriter ( ( int ) ( lastNumCharacters * 1.2 ) ) ; CSVWriter writer ; if ( fullDelimiters != null ) { writer = new CSVWriter ( sw , fullDelimiters [ 0 ] , fullDelimiters [ 1 ] , fullDelimiters [ 2 ] , String . valueOf ( fullDelimiters [ 3 ] ) ) ; } else if ( delimiter == ',' ) { // CSV writer ...
public class PdfContentByte { /** * Adds a rectangle to the current path . * @ param x x - coordinate of the starting point * @ param y y - coordinate of the starting point * @ param w width * @ param h height */ public void rectangle ( float x , float y , float w , float h ) { } }
content . append ( x ) . append ( ' ' ) . append ( y ) . append ( ' ' ) . append ( w ) . append ( ' ' ) . append ( h ) . append ( " re" ) . append_i ( separator ) ;
public class WsByteBufferUtils { /** * Converts a list of buffers to a byte [ ] using the input starting positions * and * ending limits . Buffers will remaining unchanged after this process . A null * or * empty list will return a null byte [ ] . This will also stop on the first null * buffer . * @ param l...
if ( null == list ) return null ; int size = 0 ; for ( int i = 0 ; i < list . length && null != list [ i ] ; i ++ ) { size += limits [ i ] - positions [ i ] ; } if ( 0 == size ) return null ; byte [ ] output = new byte [ size ] ; int offset = 0 ; int position = 0 ; for ( int i = 0 ; i < list . length && null != list [ ...
public class URIUtils { /** * Set the replace of the uri and return the new URI . * @ param initialUri the starting URI , the URI to update * @ param path the path to set on the baeURI */ public static URI setPath ( final URI initialUri , final String path ) { } }
String finalPath = path ; if ( ! finalPath . startsWith ( "/" ) ) { finalPath = '/' + path ; } try { if ( initialUri . getHost ( ) == null && initialUri . getAuthority ( ) != null ) { return new URI ( initialUri . getScheme ( ) , initialUri . getAuthority ( ) , finalPath , initialUri . getQuery ( ) , initialUri . getFr...
public class TaskDao { /** * TaskManager use only */ public void setActiveLogId ( String id , String activeLogId ) { } }
Integer value = null ; if ( activeLogId != null ) { value = Integer . parseInt ( activeLogId ) ; } db . update ( "UPDATE Tasks SET activeLogId = ? WHERE id = ?" , value , Integer . parseInt ( id ) ) ;
public class CoronaConf { /** * Get and cache the cpu to resource partitioning for this object . * @ return Mapping of cpu to resources ( cached ) */ public Map < Integer , Map < ResourceType , Integer > > getCpuToResourcePartitioning ( ) { } }
if ( cachedCpuToResourcePartitioning == null ) { cachedCpuToResourcePartitioning = getUncachedCpuToResourcePartitioning ( this ) ; } return cachedCpuToResourcePartitioning ;
public class LineStringSerializer { /** * Method that can be called to ask implementation to serialize values of type this serializer handles . * @ param value Value to serialize ; can not be null . * @ param jgen Generator used to output resulting Json content * @ param provider Provider that can be used to get ...
jgen . writeFieldName ( "type" ) ; jgen . writeString ( "LineString" ) ; jgen . writeArrayFieldStart ( "coordinates" ) ; // set beanproperty to null since we are not serializing a real property JsonSerializer < Object > ser = provider . findValueSerializer ( Double . class , null ) ; for ( int j = 0 ; j < value . getNu...
public class RecurlyClient { /** * Update an invoice * Updates an existing invoice . * @ param invoiceId String Recurly Invoice ID * @ return the updated invoice object on success , null otherwise */ public Invoice updateInvoice ( final String invoiceId , final Invoice invoice ) { } }
return doPUT ( Invoices . INVOICES_RESOURCE + "/" + invoiceId , invoice , Invoice . class ) ;
public class JsonReducedValueParser { /** * Reads a single value from the given reader and parses it as JsonValue . * The input must be pointing to the beginning of a JsonLiteral , * not JsonArray or JsonObject . * @ param reader the reader to read the input from * @ param buffersize the size of the input buffe...
if ( reader == null ) { throw new NullPointerException ( "reader is null" ) ; } if ( buffersize <= 0 ) { throw new IllegalArgumentException ( "buffersize is zero or negative" ) ; } this . reader = reader ; buffer = new char [ buffersize ] ; bufferOffset = 0 ; index = 0 ; fill = 0 ; line = 1 ; lineOffset = 0 ; current =...
public class AbstractGenerator { /** * Add collection of pages to sitemap * @ param < T > This is the type parameter * @ param webPages Collection of pages * @ param mapper Mapper function which transforms some object to WebPage * @ return this */ public < T > I addPages ( Collection < T > webPages , Function <...
for ( T element : webPages ) { addPage ( mapper . apply ( element ) ) ; } return getThis ( ) ;
public class RateLimitedClientNotifier { /** * The collection will be filtered to exclude non VoltPort connections */ public void queueNotification ( final Collection < ClientInterfaceHandleManager > connections , final Supplier < DeferredSerialization > notification , final Predicate < ClientInterfaceHandleManager > w...
m_submissionQueue . offer ( new Runnable ( ) { @ Override public void run ( ) { for ( ClientInterfaceHandleManager cihm : connections ) { if ( ! wantsNotificationPredicate . apply ( cihm ) ) continue ; final Connection c = cihm . connection ; /* * To avoid extra allocations and promotion we initially store a single eve...
public class Streams { /** * Create a new Stream that infiniteable cycles the provided Stream * < pre > * { @ code * assertThat ( Streams . cycle ( Stream . of ( 1,2,3 ) ) * . limit ( 6) * . collect ( CyclopsCollectors . toList ( ) ) , * equalTo ( Arrays . asList ( 1,2,3,1,2,3 ) ) ) ; * < / pre > * @ pa...
return cycle ( Streamable . fromStream ( s ) ) ;
public class GrahamScanConvexHull2D { /** * Compute the convex hull , and return the resulting polygon . * @ return Polygon of the hull */ public Polygon getHull ( ) { } }
if ( ! ok ) { computeConvexHull ( ) ; } return new Polygon ( points , minmaxX . getMin ( ) , minmaxX . getMax ( ) , minmaxY . getMin ( ) , minmaxY . getMax ( ) ) ;
public class BeliefPropagation { /** * Creates the adjoint of the unnormalized message for the edge at time t * and stores it in msgsAdj [ i ] . */ private void backwardCreateMessage ( int edge ) { } }
if ( ! bg . isT1T2 ( edge ) && ( bg . t2E ( edge ) instanceof GlobalFactor ) ) { log . warn ( "ONLY FOR TESTING: Creating a single message from a global factor: " + edge ) ; } if ( bg . isT1T2 ( edge ) ) { backwardVarToFactor ( edge ) ; } else { backwardFactorToVar ( edge ) ; } assert ! msgsAdj [ edge ] . containsNaN (...
public class StatementServiceImp { /** * ( non - Javadoc ) * @ see com . popbill . api . StatementService # attachFile ( java . lang . String , int , java . lang . String , java . lang . String , java . io . InputStream ) */ @ Override public Response attachFile ( String CorpNum , int ItemCode , String MgtKey , Strin...
return attachFile ( CorpNum , ItemCode , MgtKey , DisplayName , FileData , null ) ;
public class XLinkDemonstrationUtils { /** * For demonstration ONLY method . * < br / > < br / > * Demonstrates how a valid XLink - Url is generated out of an XLinkTemplate , * a ModelDescription and an Identifying Object , serialized with JSON . * This Method does not prepare the url for local switching . */ p...
String completeUrl = template . getBaseUrl ( ) ; completeUrl += "&" + template . getKeyNames ( ) . getModelClassKeyName ( ) + "=" + urlEncodeParameter ( modelInformation . getModelClassName ( ) ) ; completeUrl += "&" + template . getKeyNames ( ) . getModelVersionKeyName ( ) + "=" + urlEncodeParameter ( modelInformation...
public class HttpDispatcher { /** * DS method for setting the Work Classification service reference . * @ param service */ @ Reference ( name = "workClassifier" , policy = ReferencePolicy . DYNAMIC , cardinality = ReferenceCardinality . OPTIONAL ) protected void setWorkClassifier ( WorkClassifier service ) { } }
workClassifier = service ;
public class PropertiesInput { /** * Add this key area description to the Record . */ public KeyArea setupKey ( int iKeyArea ) { } }
KeyArea keyArea = null ; if ( iKeyArea == 0 ) { keyArea = this . makeIndex ( DBConstants . UNIQUE , ID_KEY ) ; keyArea . addKeyField ( ID , DBConstants . ASCENDING ) ; } if ( iKeyArea == 1 ) { keyArea = this . makeIndex ( DBConstants . UNIQUE , KEY_KEY ) ; keyArea . addKeyField ( KEY , DBConstants . ASCENDING ) ; } if ...
public class XMLConfigAdmin { /** * remove security manager matching given id * @ param id * @ throws PageException */ public void removeSecurityManager ( Password password , String id ) throws PageException { } }
checkWriteAccess ( ) ; ( ( ConfigServerImpl ) ConfigImpl . getConfigServer ( config , password ) ) . removeSecurityManager ( id ) ; Element security = _getRootElement ( "security" ) ; Element [ ] children = XMLConfigWebFactory . getChildren ( security , "accessor" ) ; for ( int i = 0 ; i < children . length ; i ++ ) { ...
public class BasePluginConfigCommandTask { /** * Validates that there are no unknown arguments or values specified * to the task . * @ param args the arguments to the task * @ param supportsTarget * @ param supportsDefaultTarget * @ throws IllegalArgumentException if an argument is defined is unknown */ prote...
checkRequiredArguments ( args , ! supportsTarget || supportsDefaultTarget ) ; // If the command supports a target name // skip the first argument if it is the target name . int firstArg = 1 ; if ( supportsTarget ) { if ( ! supportsDefaultTarget ) { firstArg = 2 ; } else { if ( args . length > 1 ) { String primArg = arg...
public class CommerceAccountUtil { /** * Returns the first commerce account in the ordered set where userId = & # 63 ; and type = & # 63 ; . * @ param userId the user ID * @ param type the type * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the ...
return getPersistence ( ) . fetchByU_T_First ( userId , type , orderByComparator ) ;