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 atom . * @ param atom the atom to apply the model to * @ param explicitValence the explicit valence ( bond order sum ) */ private void applyMDLValenceModel ( IAtom atom , int explicitValence , int unpaired ) { } }
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 ; Integer charge = atom . getFormalCharge ( ) ; if ( charge == null ) charge = 0 ; int implicitValence = MDLValence . implicitValence ( element , charge , explicitValence ) ; if ( implicitValence < explicitValence ) { atom . setValency ( explicitValence ) ; atom . setImplicitHydrogenCount ( 0 ) ; } else { atom . setValency ( implicitValence ) ; atom . setImplicitHydrogenCount ( implicitValence - explicitValence ) ; } }
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 UpdateProvisioningArtifact operation returned by the service . * @ throws ResourceNotFoundException * The specified resource was not found . * @ throws InvalidParametersException * One or more parameters provided to the operation are not valid . * @ sample AWSServiceCatalog . UpdateProvisioningArtifact * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / servicecatalog - 2015-12-10 / UpdateProvisioningArtifact " * target = " _ top " > AWS API Documentation < / a > */ @ Override public UpdateProvisioningArtifactResult updateProvisioningArtifact ( UpdateProvisioningArtifactRequest request ) { } }
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 ( ) ) { this . providers . put ( entry . getKey ( ) , provider ) ; Class < ? extends ChannelFactory > newFactory = entry . getValue ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Class < ? extends ChannelFactory > prevFactory = this . factories . get ( entry . getKey ( ) ) ; if ( null != prevFactory && newFactory != prevFactory ) { Tr . event ( tc , "WARNING: overlaying existing factory: " + prevFactory ) ; } } this . factories . put ( entry . getKey ( ) , newFactory ) ; } } // end - sync // now that we have a new factory type , tell ChannelUtils to process // any delayed config that might be waiting for it ChannelUtils . loadConfig ( null ) ;
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 validation you * instead add your self signed certificate to the Java keystore . < / p > */ public static void disableSSLValidation ( ) { } }
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 documentation content * @ return a documentation { @ link Section } * @ throws IOException if there is an error reading the files */ public Section addAppendicesSection ( SoftwareSystem softwareSystem , File ... files ) throws IOException { } }
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 ( BootstrapConstants . messages . getString ( "info.runtimePackageComplete" ) , archive . getAbsolutePath ( ) ) ) ; } else { System . out . println ( BootstrapConstants . messages . getString ( "info.runtimePackageException" ) ) ; } return packageRc ;
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 ; } return padded ;
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 sql , Map < String , ParameterBindingDTO > parameterBindings ) throws SQLException { } }
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 false ; } SFBaseResultSet sfResultSet ; try { sfResultSet = sfStatement . execute ( sql , parameterBindings , SFStatement . CallingMethod . EXECUTE ) ; sfResultSet . setSession ( this . connection . getSfSession ( ) ) ; if ( resultSet != null ) { openResultSets . add ( resultSet ) ; } resultSet = new SnowflakeResultSetV1 ( sfResultSet , this ) ; queryID = sfResultSet . getQueryId ( ) ; // Legacy behavior treats update counts as result sets for single - // statement execute , so we only treat update counts as update counts // if JDBC _ EXECUTE _ RETURN _ COUNT _ FOR _ DML is set , or if a statement // is multi - statement if ( ! sfResultSet . getStatementType ( ) . isGenerateResultSet ( ) && ( connection . getSfSession ( ) . isExecuteReturnCountForDML ( ) || sfStatement . hasChildren ( ) ) ) { updateCount = ResultUtil . calculateUpdateCount ( sfResultSet ) ; if ( resultSet != null ) { openResultSets . add ( resultSet ) ; } resultSet = null ; return false ; } updateCount = NO_UPDATES ; return true ; } catch ( SFException ex ) { throw new SnowflakeSQLException ( ex . getCause ( ) , ex . getSqlState ( ) , ex . getVendorCode ( ) , ex . getParams ( ) ) ; }
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 quaternion . * This method pre - multiplies the rotation given by < code > dt < / code > and < code > ( vx , vy , vz ) < / code > by < code > this < / code > , so * the angular velocities are always relative to the local coordinate system of the rotation represented by < code > this < / code > quaternion . * This method is equivalent to calling : < code > rotateLocal ( dt * vx , dt * vy , dt * vz ) < / code > * Reference : < a href = " http : / / physicsforgames . blogspot . de / 2010/02 / quaternions . html " > http : / / physicsforgames . blogspot . de / < / a > * @ param dt * the delta time * @ param vx * the angular velocity around the x axis * @ param vy * the angular velocity around the y axis * @ param vz * the angular velocity around the z axis * @ return this */ public Quaterniond integrate ( double dt , double vx , double vy , double vz ) { } }
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 alive . * @ param timeout timeout in milliseconds , must be greater than zero and less * than 60000. */ public void setSessionTimeout ( int timeout ) { } }
( ( 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 flags the flags for the new organizational unit * @ param resourceName the first associated resource * @ return a < code > { @ link CmsOrganizationalUnit } < / code > object representing * the newly created organizational unit * @ throws CmsException if operation was not successful */ public CmsOrganizationalUnit createOrganizationalUnit ( CmsObject cms , String ouFqn , String description , int flags , String resourceName ) throws CmsException { } }
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 , description , flags , resource ) ;
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 . * @ throws InvalidParameterException * This exception is thrown when the Amazon Cognito service encounters an invalid parameter . * @ throws ResourceNotFoundException * This exception is thrown when the Amazon Cognito service cannot find the requested resource . * @ throws InternalErrorException * This exception is thrown when Amazon Cognito encounters an internal error . * @ sample AWSCognitoIdentityProvider . DescribeUserPoolDomain * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / cognito - idp - 2016-04-18 / DescribeUserPoolDomain " * target = " _ top " > AWS API Documentation < / a > */ @ Override public DescribeUserPoolDomainResult describeUserPoolDomain ( DescribeUserPoolDomainRequest request ) { } }
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 the first period . * @ param frequency The frequency . * @ param maturity The end date of the last period . * @ param daycountConvention The daycount convention . * @ param shortPeriodConvention If short period exists , have it first or last . * @ param dateRollConvention Adjustment to be applied to the all dates . * @ param businessdayCalendar Businessday calendar ( holiday calendar ) to be used for date roll adjustment . * @ param fixingOffsetDays Number of business days to be added to period start to get the fixing date . * @ param paymentOffsetDays Number of business days to be added to period end to get the payment date . * @ return The corresponding schedule * @ deprecated Will be removed in version 2.3 */ @ Deprecated public static Schedule createScheduleFromConventions ( LocalDate referenceDate , LocalDate startDate , String frequency , double maturity , String daycountConvention , String shortPeriodConvention , String dateRollConvention , BusinessdayCalendar businessdayCalendar , int fixingOffsetDays , int paymentOffsetDays ) { } }
LocalDate maturityDate = createDateFromDateAndOffset ( startDate , maturity ) ; return createScheduleFromConventions ( referenceDate , startDate , maturityDate , Frequency . valueOf ( frequency . toUpperCase ( ) ) , DaycountConvention . getEnum ( daycountConvention ) , ShortPeriodConvention . valueOf ( shortPeriodConvention . toUpperCase ( ) ) , DateRollConvention . getEnum ( dateRollConvention ) , businessdayCalendar , fixingOffsetDays , paymentOffsetDays ) ;
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 * as well . This way , overloaded JMX operation can be used . If an overloaded JMX operation * is called without specifying the argument types , then an exception is raised . * @ param server server to try * @ param request request to process from where the operation and its arguments are extracted . * @ return the return value of the operation call */ @ Override public Object doHandleRequest ( MBeanServerConnection server , JmxExecRequest request ) throws InstanceNotFoundException , AttributeNotFoundException , ReflectionException , MBeanException , IOException { } }
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 ( types . paramOpenTypes != null && types . paramOpenTypes [ i ] != null ) { params [ i ] = converters . getToOpenTypeConverter ( ) . convertToObject ( types . paramOpenTypes [ i ] , args . get ( i ) ) ; } else { params [ i ] = converters . getToObjectConverter ( ) . prepareValue ( types . paramClasses [ i ] , args . get ( i ) ) ; } } // TODO : Maybe allow for a path as well which could be applied on the return value . . . return server . invoke ( request . getObjectName ( ) , types . operationName , params , types . paramClasses ) ;
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 of the request * @ return a { @ link com . baasbox . android . RequestToken } to handle the asynchronous request */ public static RequestToken count ( String collection , int flags , BaasHandler < Long > handler ) { } }
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 Optional < List < FormItem > > parseRequestMultiPartItems ( String encoding ) { } }
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.tmpdir" ) ) ) ; // Configuration . getTmpDir ( ) ) ; // README the file for tmpdir * MIGHT * need to go into Properties ServletFileUpload upload = new ServletFileUpload ( factory ) ; if ( encoding != null ) upload . setHeaderEncoding ( encoding ) ; upload . setFileSizeMax ( properties . getInt ( Constants . PROPERTY_UPLOADS_MAX_SIZE ) ) ; try { List < FormItem > items = upload . parseRequest ( request ) . stream ( ) . map ( item -> new ApacheFileItemFormItem ( item ) ) . collect ( Collectors . toList ( ) ) ; return Optional . of ( items ) ; } catch ( FileUploadException e ) { // " Error while trying to process mulitpart file upload " // README : perhaps some logging } return Optional . empty ( ) ;
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 which will definitely be reached if * non - implicit - exception control paths are followed */ public Set < Location > getUnconditionalDerefLocationSet ( ValueNumber vn ) { } }
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 menuHelp ;
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 > C10NFilterProvider < T > staticFilterProvider ( C10NFilter < T > filter ) { } }
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 > and ( Predicate < ? super T > first , Predicate < ? super T > second ) { } }
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 . clearInitialState ( ) ; }
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 . addEdge ( "e1" , v1 , v2 , "(7, 1)" ) ; e1 . setProperty ( "c1" , 7 ) ; e1 . setProperty ( "c2" , 1 ) ; Edge e2 = g . addEdge ( "e2" , v1 , v3 , "(1, 4)" ) ; e2 . setProperty ( "c1" , 1 ) ; e2 . setProperty ( "c2" , 4 ) ; Edge e3 = g . addEdge ( "e3" , v1 , v4 , "(2, 1)" ) ; e3 . setProperty ( "c1" , 2 ) ; e3 . setProperty ( "c2" , 1 ) ; Edge e4 = g . addEdge ( "e4" , v2 , v4 , "(1, 1)" ) ; e4 . setProperty ( "c1" , 1 ) ; e4 . setProperty ( "c2" , 1 ) ; Edge e5 = g . addEdge ( "e5" , v2 , v6 , "(2, 1)" ) ; e5 . setProperty ( "c1" , 2 ) ; e5 . setProperty ( "c2" , 1 ) ; Edge e6 = g . addEdge ( "e6" , v3 , v4 , "(1, 1)" ) ; e6 . setProperty ( "c1" , 1 ) ; e6 . setProperty ( "c2" , 1 ) ; Edge e7 = g . addEdge ( "e7" , v4 , v5 , "(3, 2)" ) ; e7 . setProperty ( "c1" , 3 ) ; e7 . setProperty ( "c2" , 2 ) ; Edge e8 = g . addEdge ( "e8" , v4 , v6 , "(4, 8)" ) ; e8 . setProperty ( "c1" , 4 ) ; e8 . setProperty ( "c2" , 8 ) ; Edge e9 = g . addEdge ( "e9" , v5 , v6 , "(1, 1)" ) ; e9 . setProperty ( "c1" , 1 ) ; e9 . setProperty ( "c2" , 1 ) ; return g ;
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 transferText * Text to display for file number " N of M " . */ public final void setTransferText ( final String transferText ) { } }
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 in the slice * @ param upper * the index of the last token to be included in the slice * @ return an array containing the desired tokens */ private static Token [ ] tokensSubArray ( Sentence sentence , int lower , int upper , boolean considerChunk ) { } }
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 rootTokens . toArray ( new Token [ rootTokens . size ( ) ] ) ; } return rootTokens . toArray ( new Token [ rootTokens . size ( ) ] ) ;
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 ++ ) { MkMaxEntry p = node . getEntry ( i ) ; double dist_pq = distance ( p . getRoutingObjectID ( ) , q . getRoutingObjectID ( ) ) ; // p is nearer to q than the farthest kNN - candidate of q // = = > p becomes a knn - candidate if ( dist_pq <= knnDist_q ) { knns_q . insert ( dist_pq , p . getRoutingObjectID ( ) ) ; if ( knns_q . size ( ) >= getKmax ( ) ) { knnDist_q = knns_q . getKNNDistance ( ) ; q . setKnnDistance ( knnDist_q ) ; } } // p is nearer to q than to its farthest knn - candidate // q becomes knn of p if ( dist_pq <= p . getKnnDistance ( ) ) { KNNList knns_p = knnq . getKNNForDBID ( p . getRoutingObjectID ( ) , getKmax ( ) - 1 ) ; if ( knns_p . size ( ) + 1 < getKmax ( ) ) { p . setKnnDistance ( Double . NaN ) ; } else { double knnDist_p = Math . max ( dist_pq , knns_p . getKNNDistance ( ) ) ; p . setKnnDistance ( knnDist_p ) ; } } knnDist_node = Math . max ( knnDist_node , p . getKnnDistance ( ) ) ; } } // directory node else { List < DoubleIntPair > entries = getSortedEntries ( node , q . getRoutingObjectID ( ) ) ; for ( DoubleIntPair distEntry : entries ) { MkMaxEntry dirEntry = node . getEntry ( distEntry . second ) ; double entry_knnDist = dirEntry . getKnnDistance ( ) ; if ( distEntry . second < entry_knnDist || distEntry . second < knnDist_q ) { preInsert ( q , dirEntry , knns_q ) ; knnDist_q = knns_q . getKNNDistance ( ) ; } knnDist_node = Math . max ( knnDist_node , dirEntry . getKnnDistance ( ) ) ; } } if ( LOG . isDebugging ( ) ) { LOG . debugFine ( nodeEntry + "set knn dist " + knnDist_node ) ; } nodeEntry . setKnnDistance ( knnDist_node ) ;
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 webhook . * @ param webhookCreateParameters The parameters for creating a webhook . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the WebhookInner object if successful . */ public WebhookInner beginCreate ( String resourceGroupName , String registryName , String webhookName , WebhookCreateParameters webhookCreateParameters ) { } }
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 response ) { } }
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 ( ) ) { return OUTCOME_CLIENT_ERROR ; } if ( status . is5xxServerError ( ) ) { return OUTCOME_SERVER_ERROR ; } } return OUTCOME_UNKNOWN ; } catch ( IllegalArgumentException exc ) { return OUTCOME_UNKNOWN ; }
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 obtaining a Connection . * @ param cri optional information for the connection request * @ return a Connection . * @ throws ResourceException */ private final Connection getConnectionUsingDS ( String userN , String password , final WSConnectionRequestInfoImpl cri ) throws ResourceException { } }
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 ? null : password . trim ( ) ; Connection conn = null ; boolean isConnectionSetupComplete = false ; try { conn = AccessController . doPrivileged ( new PrivilegedExceptionAction < Connection > ( ) { public Connection run ( ) throws Exception { boolean buildConnection = cri . ivShardingKey != null || cri . ivSuperShardingKey != null ; if ( ! buildConnection && dataSourceOrDriver instanceof XADataSource ) { // TODO this code path is very suspect , and so we are not continuing it for connection builder path . // Why convert what was requested to be a DataSource to XADataSource ? // And then it also leaks the XAConnection . It is not tracked , so it never gets closed ! return user == null ? ( ( XADataSource ) dataSourceOrDriver ) . getXAConnection ( ) . getConnection ( ) : ( ( XADataSource ) dataSourceOrDriver ) . getXAConnection ( user , pwd ) . getConnection ( ) ; } else { return buildConnection ? jdbcRuntime . buildConnection ( ( DataSource ) dataSourceOrDriver , user , pwd , cri ) : user == null ? ( ( DataSource ) dataSourceOrDriver ) . getConnection ( ) : ( ( DataSource ) dataSourceOrDriver ) . getConnection ( user , pwd ) ; } } } ) ; try { postGetConnectionHandling ( conn ) ; } catch ( SQLException se ) { FFDCFilter . processException ( se , getClass ( ) . getName ( ) , "260" , this ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getConnectionUsingDS" , se ) ; throw AdapterUtil . translateSQLException ( se , this , false , getClass ( ) ) ; } isConnectionSetupComplete = true ; } catch ( PrivilegedActionException pae ) { FFDCFilter . processException ( pae . getException ( ) , getClass ( ) . getName ( ) , "1372" ) ; ResourceException resX = new DataStoreAdapterException ( "JAVAX_CONN_ERR" , pae . getException ( ) , getClass ( ) , "Connection" ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getConnectionUsingDS" , pae . getException ( ) ) ; throw resX ; } catch ( ClassCastException castX ) { // There ' s a possibility this occurred because of an error in the JDBC driver // itself . The trace should allow us to determine this . FFDCFilter . processException ( castX , getClass ( ) . getName ( ) , "1312" ) ; ResourceException resX = new DataStoreAdapterException ( "NOT_A_1_PHASE_DS" , null , getClass ( ) , castX . getMessage ( ) ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getConnectionUsingDS" , castX ) ; throw resX ; } finally { // Destroy the connection if we weren ' t able to successfully complete the setup . if ( conn != null && ! isConnectionSetupComplete ) try { conn . close ( ) ; } catch ( Throwable x ) { } } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getConnectionUsingDS" , AdapterUtil . toString ( conn ) ) ; return conn ;
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 doHandleRequest ( MBeanServerConnection pServer , JmxReadRequest pRequest ) throws InstanceNotFoundException , AttributeNotFoundException , ReflectionException , MBeanException , IOException { } }
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 . SECONDS ) ) { log . info ( "Executor service did not terminate before timeout; forcing shutdown." ) ; List < Runnable > queuedTasks = pool . shutdownNow ( ) ; // Cancel currently executing tasks log . info ( "Discarded {} tasks that were still queued; still waiting for executor service to terminate." , queuedTasks . size ( ) ) ; // Wait a while for tasks to respond to being cancelled if ( ! pool . awaitTermination ( 60 , TimeUnit . SECONDS ) ) { log . error ( "Pool did not terminate." ) ; } else { log . info ( "Executor service terminated after forced shutdown." ) ; } } else { log . info ( "Executor service finished all queued tasks and terminated." ) ; } } catch ( InterruptedException ie ) { log . error ( "Interrupted while waiting for pool to terminate; forcing shutdown." , ie ) ; // ( Re - ) Cancel if current thread also interrupted List < Runnable > queuedTasks = pool . shutdownNow ( ) ; log . info ( "Discarded {} tasks that were still queued; no longer waiting for executor service to terminate." , queuedTasks . size ( ) ) ; // Preserve interrupt status Thread . currentThread ( ) . interrupt ( ) ; }
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 filterUnwantedReferences ( List < JpaRef > result , Collection < BeanId > query ) { } }
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 & gt ; object */ public Observable < Page < EventInner > > listEventsNextAsync ( final String nextPageLink ) { } }
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 createAccountTotals ( String rawJSON ) throws TwitterException { } }
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 ( emptyFlagAttribute . getString ( ) ) ; } } catch ( LdapInvalidAttributeValueException e ) { throw new ObjectClassViolationException ( e ) ; } return empty ? new String ( ) : null ;
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 : / / localhost : 10101' * CompletableFuture future = http . patchAsync ( ) { * request . uri . path = ' / something ' * def result = future . get ( ) * The configuration ` closure ` allows additional configuration for this request based on the { @ link HttpConfig } interface . * @ param closure the additional configuration closure ( delegated to { @ link HttpConfig } ) * @ return the resulting content */ public CompletableFuture < Object > patchAsync ( @ DelegatesTo ( HttpConfig . class ) final Closure closure ) { } }
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 can be found . * @ param tree the compilation unit tree * @ return the location for the enclosing module * @ throws IOException if there is a problem while searching for the module . */ private Location getModuleLocation ( JCCompilationUnit tree ) throws IOException { } }
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 ; loc = fileManager . getLocationForModule ( sourceOutput , fo ) ; } return loc ;
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 " + selfLinkUri + " as expected in HAL-FORMS" ) ; }
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 ` mTextureView ` * @ param viewHeight The height of ` mTextureView ` */ private void configureTransform ( int viewWidth , int viewHeight ) { } }
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 ( ) . getDefaultDisplay ( ) . getRotation ( ) ; Matrix matrix = new Matrix ( ) ; RectF viewRect = new RectF ( 0 , 0 , viewWidth , viewHeight ) ; RectF bufferRect = new RectF ( 0 , 0 , cameraHeight , cameraWidth ) ; // TODO why w / h swapped ? float centerX = viewRect . centerX ( ) ; float centerY = viewRect . centerY ( ) ; if ( Surface . ROTATION_90 == rotation || Surface . ROTATION_270 == rotation ) { bufferRect . offset ( centerX - bufferRect . centerX ( ) , centerY - bufferRect . centerY ( ) ) ; matrix . setRectToRect ( viewRect , bufferRect , Matrix . ScaleToFit . FILL ) ; float scale = Math . max ( ( float ) viewHeight / cameraHeight , ( float ) viewWidth / cameraWidth ) ; matrix . postScale ( scale , scale , centerX , centerY ) ; matrix . postRotate ( 90 * ( rotation - 2 ) , centerX , centerY ) ; } mTextureView . setTransform ( matrix ) ;
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 . If the exponent of the result is between { @ link * Float # MIN _ EXPONENT } and { @ link Float # MAX _ EXPONENT } , the * answer is calculated exactly . If the exponent of the result * would be larger than { @ code Float . MAX _ EXPONENT } , an * infinity is returned . Note that if the result is subnormal , * precision may be lost ; that is , when { @ code scalb ( x , n ) } * is subnormal , { @ code scalb ( scalb ( x , n ) , - n ) } may not equal * < i > x < / i > . When the result is non - NaN , the result has the same * sign as { @ code f } . * < p > Special cases : * < ul > * < li > If the first argument is NaN , NaN is returned . * < li > If the first argument is infinite , then an infinity of the * same sign is returned . * < li > If the first argument is zero , then a zero of the same * sign is returned . * < / ul > * @ param f number to be scaled by a power of two . * @ param scaleFactor power of 2 used to scale { @ code f } * @ return { @ code f } & times ; 2 < sup > { @ code scaleFactor } < / sup > * @ since 1.6 */ public static float scalb ( float f , int scaleFactor ) { } }
// 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 + FloatConsts . SIGNIFICAND_WIDTH + 1 ; // Make sure scaling factor is in a reasonable range scaleFactor = Math . max ( Math . min ( scaleFactor , MAX_SCALE ) , - MAX_SCALE ) ; /* * Since + MAX _ SCALE for float fits well within the double * exponent range and + float - > double conversion is exact * the multiplication below will be exact . Therefore , the * rounding that occurs when the double product is cast to * float will be the correctly rounded float result . Since * all operations other than the final multiply will be exact , * it is not necessary to declare this method strictfp . */ return ( float ) ( ( double ) f * powerOfTwoD ( scaleFactor ) ) ;
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 * after the newline character after the - - - - - END SOMETHING - - - - - line . * @ param is the InputStream * @ returns byte block or null if end of stream * @ throws IOException If any parsing error */ private static byte [ ] readOneBlock ( InputStream is ) throws IOException { } }
// 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 data , might skip info at the beginning char [ ] data = new char [ 2048 ] ; int pos = 0 ; // Step 1 : Read until header is found int hyphen = ( c == '-' ) ? 1 : 0 ; // count of consequent hyphens int last = ( c == '-' ) ? - 1 : c ; // the char before hyphen while ( true ) { int next = is . read ( ) ; if ( next == - 1 ) { // We accept useless data after the last block , // say , empty lines . return null ; } if ( next == '-' ) { hyphen ++ ; } else { hyphen = 0 ; last = next ; } if ( hyphen == 5 && ( last == - 1 || last == '\r' || last == '\n' ) ) { break ; } } // Step 2 : Read the rest of header , determine the line end int end ; StringBuffer header = new StringBuffer ( "-----" ) ; while ( true ) { int next = is . read ( ) ; if ( next == - 1 ) { throw new IOException ( "Incomplete data" ) ; } if ( next == '\n' ) { end = '\n' ; break ; } if ( next == '\r' ) { next = is . read ( ) ; if ( next == - 1 ) { throw new IOException ( "Incomplete data" ) ; } if ( next == '\n' ) { end = '\n' ; } else { end = '\r' ; data [ pos ++ ] = ( char ) next ; } break ; } header . append ( ( char ) next ) ; } // Step 3 : Read the data while ( true ) { int next = is . read ( ) ; if ( next == - 1 ) { throw new IOException ( "Incomplete data" ) ; } if ( next != '-' ) { data [ pos ++ ] = ( char ) next ; if ( pos >= data . length ) { data = Arrays . copyOf ( data , data . length + 1024 ) ; } } else { break ; } } // Step 4 : Consume the footer StringBuffer footer = new StringBuffer ( "-" ) ; while ( true ) { int next = is . read ( ) ; // Add next = = ' \ n ' for maximum safety , in case endline // is not consistent . if ( next == - 1 || next == end || next == '\n' ) { break ; } if ( next != '\r' ) footer . append ( ( char ) next ) ; } checkHeaderFooter ( header . toString ( ) , footer . toString ( ) ) ; BASE64Decoder decoder = new BASE64Decoder ( ) ; return decoder . decodeBuffer ( new String ( data , 0 , pos ) ) ; }
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 ( property . getEnclosingType ( ) ) ) ; b . loadConstant ( methodName ) ; if ( isAccessor ) { // Accessor method has no parameters . b . loadNull ( ) ; } else { // Mutator method has one parameter . b . loadConstant ( 1 ) ; b . newObject ( TypeDesc . forClass ( Class [ ] . class ) ) ; b . dup ( ) ; b . loadConstant ( 0 ) ; b . loadConstant ( TypeDesc . forClass ( property . getType ( ) ) ) ; b . storeToArray ( TypeDesc . forClass ( Class [ ] . class ) ) ; } b . invokeVirtual ( Class . class . getName ( ) , "getMethod" , TypeDesc . forClass ( Method . class ) , new TypeDesc [ ] { TypeDesc . STRING , TypeDesc . forClass ( Class [ ] . class ) } ) ; b . loadConstant ( TypeDesc . forClass ( annotation . getAnnotationType ( ) ) ) ; b . invokeVirtual ( Method . class . getName ( ) , "getAnnotation" , TypeDesc . forClass ( Annotation . class ) , new TypeDesc [ ] { TypeDesc . forClass ( Class . class ) } ) ; b . checkCast ( TypeDesc . forClass ( annotation . getAnnotationType ( ) ) ) ;
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 */ public < ResultT > ResultT findOne ( final Bson filter , final Class < ResultT > resultClass ) { } }
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 . width - 1 , 0 , corners [ 1 ] ) ; transform . compute ( frame . width - 1 , frame . height - 1 , corners [ 2 ] ) ; transform . compute ( 0 , frame . height - 1 , corners [ 3 ] ) ; // find the bounding box int x0 = Integer . MAX_VALUE ; int y0 = Integer . MAX_VALUE ; int x1 = - Integer . MAX_VALUE ; int y1 = - Integer . MAX_VALUE ; for ( int i = 0 ; i < 4 ; i ++ ) { Point2D_F32 p = corners [ i ] ; int x = ( int ) p . x ; int y = ( int ) p . y ; if ( x0 > x ) x0 = x ; if ( y0 > y ) y0 = y ; if ( x1 < x ) x1 = x ; if ( y1 < y ) y1 = y ; } x1 ++ ; y1 ++ ; if ( x0 < 0 ) x0 = 0 ; if ( x1 > backgroundWidth ) x1 = backgroundWidth ; if ( y0 < 0 ) y0 = 0 ; if ( y1 > backgroundHeight ) y1 = backgroundHeight ; updateBackground ( x0 , y0 , x1 , y1 , frame ) ;
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 , ClassVisitor visitor ) { } }
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 ) ) && ( ti . getTypeID ( ) . getTypeVal ( ) == RIOType . STRUCT ) ) { return ( StructTypeID ) ti . getTypeID ( ) ; } } return null ;
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 { @ code getId ( ) } may be different . * The normalization checks if the rules of this { @ code ZoneId } have a fixed offset . * If they do , then the { @ code ZoneOffset } equal to that offset is returned . * Otherwise { @ code this } is returned . * @ return the time - zone unique ID , not null */ public ZoneId normalized ( ) { } }
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 listeners requested since last time for ( int i = 0 ; i < keyListenersToAdd . size ( ) ; i ++ ) { addKeyListenerImpl ( ( KeyListener ) keyListenersToAdd . get ( i ) ) ; } keyListenersToAdd . clear ( ) ; for ( int i = 0 ; i < mouseListenersToAdd . size ( ) ; i ++ ) { addMouseListenerImpl ( ( MouseListener ) mouseListenersToAdd . get ( i ) ) ; } mouseListenersToAdd . clear ( ) ; if ( doubleClickTimeout != 0 ) { if ( System . currentTimeMillis ( ) > doubleClickTimeout ) { doubleClickTimeout = 0 ; } } this . height = height ; Iterator allStarts = allListeners . iterator ( ) ; while ( allStarts . hasNext ( ) ) { ControlledInputReciever listener = ( ControlledInputReciever ) allStarts . next ( ) ; listener . inputStarted ( ) ; } while ( Keyboard . next ( ) ) { if ( Keyboard . getEventKeyState ( ) ) { int eventKey = resolveEventKey ( Keyboard . getEventKey ( ) , Keyboard . getEventCharacter ( ) ) ; keys [ eventKey ] = Keyboard . getEventCharacter ( ) ; pressed [ eventKey ] = true ; nextRepeat [ eventKey ] = System . currentTimeMillis ( ) + keyRepeatInitial ; consumed = false ; for ( int i = 0 ; i < keyListeners . size ( ) ; i ++ ) { KeyListener listener = ( KeyListener ) keyListeners . get ( i ) ; if ( listener . isAcceptingInput ( ) ) { listener . keyPressed ( eventKey , Keyboard . getEventCharacter ( ) ) ; if ( consumed ) { break ; } } } } else { int eventKey = resolveEventKey ( Keyboard . getEventKey ( ) , Keyboard . getEventCharacter ( ) ) ; nextRepeat [ eventKey ] = 0 ; consumed = false ; for ( int i = 0 ; i < keyListeners . size ( ) ; i ++ ) { KeyListener listener = ( KeyListener ) keyListeners . get ( i ) ; if ( listener . isAcceptingInput ( ) ) { listener . keyReleased ( eventKey , keys [ eventKey ] ) ; if ( consumed ) { break ; } } } } } while ( Mouse . next ( ) ) { if ( Mouse . getEventButton ( ) >= 0 ) { if ( Mouse . getEventButtonState ( ) ) { consumed = false ; mousePressed [ Mouse . getEventButton ( ) ] = true ; pressedX = ( int ) ( xoffset + ( Mouse . getEventX ( ) * scaleX ) ) ; pressedY = ( int ) ( yoffset + ( ( height - Mouse . getEventY ( ) - 1 ) * scaleY ) ) ; for ( int i = 0 ; i < mouseListeners . size ( ) ; i ++ ) { MouseListener listener = ( MouseListener ) mouseListeners . get ( i ) ; if ( listener . isAcceptingInput ( ) ) { listener . mousePressed ( Mouse . getEventButton ( ) , pressedX , pressedY ) ; if ( consumed ) { break ; } } } } else { consumed = false ; mousePressed [ Mouse . getEventButton ( ) ] = false ; int releasedX = ( int ) ( xoffset + ( Mouse . getEventX ( ) * scaleX ) ) ; int releasedY = ( int ) ( yoffset + ( ( height - Mouse . getEventY ( ) - 1 ) * scaleY ) ) ; if ( ( pressedX != - 1 ) && ( pressedY != - 1 ) && ( Math . abs ( pressedX - releasedX ) < mouseClickTolerance ) && ( Math . abs ( pressedY - releasedY ) < mouseClickTolerance ) ) { considerDoubleClick ( Mouse . getEventButton ( ) , releasedX , releasedY ) ; pressedX = pressedY = - 1 ; } for ( int i = 0 ; i < mouseListeners . size ( ) ; i ++ ) { MouseListener listener = ( MouseListener ) mouseListeners . get ( i ) ; if ( listener . isAcceptingInput ( ) ) { listener . mouseReleased ( Mouse . getEventButton ( ) , releasedX , releasedY ) ; if ( consumed ) { break ; } } } } } else { if ( Mouse . isGrabbed ( ) && displayActive ) { if ( ( Mouse . getEventDX ( ) != 0 ) || ( Mouse . getEventDY ( ) != 0 ) ) { consumed = false ; for ( int i = 0 ; i < mouseListeners . size ( ) ; i ++ ) { MouseListener listener = ( MouseListener ) mouseListeners . get ( i ) ; if ( listener . isAcceptingInput ( ) ) { if ( anyMouseDown ( ) ) { listener . mouseDragged ( 0 , 0 , Mouse . getEventDX ( ) , - Mouse . getEventDY ( ) ) ; } else { listener . mouseMoved ( 0 , 0 , Mouse . getEventDX ( ) , - Mouse . getEventDY ( ) ) ; } if ( consumed ) { break ; } } } } } int dwheel = Mouse . getEventDWheel ( ) ; wheel += dwheel ; if ( dwheel != 0 ) { consumed = false ; for ( int i = 0 ; i < mouseListeners . size ( ) ; i ++ ) { MouseListener listener = ( MouseListener ) mouseListeners . get ( i ) ; if ( listener . isAcceptingInput ( ) ) { listener . mouseWheelMoved ( dwheel ) ; if ( consumed ) { break ; } } } } } } if ( ! displayActive || Mouse . isGrabbed ( ) ) { lastMouseX = getMouseX ( ) ; lastMouseY = getMouseY ( ) ; } else { if ( ( lastMouseX != getMouseX ( ) ) || ( lastMouseY != getMouseY ( ) ) ) { consumed = false ; for ( int i = 0 ; i < mouseListeners . size ( ) ; i ++ ) { MouseListener listener = ( MouseListener ) mouseListeners . get ( i ) ; if ( listener . isAcceptingInput ( ) ) { if ( anyMouseDown ( ) ) { listener . mouseDragged ( lastMouseX , lastMouseY , getMouseX ( ) , getMouseY ( ) ) ; } else { listener . mouseMoved ( lastMouseX , lastMouseY , getMouseX ( ) , getMouseY ( ) ) ; } if ( consumed ) { break ; } } } lastMouseX = getMouseX ( ) ; lastMouseY = getMouseY ( ) ; } } if ( controllersInited ) { for ( int i = 0 ; i < getControllerCount ( ) ; i ++ ) { int count = ( ( Controller ) controllers . get ( i ) ) . getButtonCount ( ) + 3 ; count = Math . min ( count , 24 ) ; for ( int c = 0 ; c <= count ; c ++ ) { if ( controls [ i ] [ c ] && ! isControlDwn ( c , i ) ) { controls [ i ] [ c ] = false ; fireControlRelease ( c , i ) ; } else if ( ! controls [ i ] [ c ] && isControlDwn ( c , i ) ) { controllerPressed [ i ] [ c ] = true ; controls [ i ] [ c ] = true ; fireControlPress ( c , i ) ; } } } } if ( keyRepeat ) { for ( int i = 0 ; i < 1024 ; i ++ ) { if ( pressed [ i ] && ( nextRepeat [ i ] != 0 ) ) { if ( System . currentTimeMillis ( ) > nextRepeat [ i ] ) { nextRepeat [ i ] = System . currentTimeMillis ( ) + keyRepeatInterval ; consumed = false ; for ( int j = 0 ; j < keyListeners . size ( ) ; j ++ ) { KeyListener listener = ( KeyListener ) keyListeners . get ( j ) ; if ( listener . isAcceptingInput ( ) ) { listener . keyPressed ( i , keys [ i ] ) ; if ( consumed ) { break ; } } } } } } } Iterator all = allListeners . iterator ( ) ; while ( all . hasNext ( ) ) { ControlledInputReciever listener = ( ControlledInputReciever ) all . next ( ) ; listener . inputEnded ( ) ; } if ( Display . isCreated ( ) ) { displayActive = Display . isActive ( ) ; }
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 getQ ( DMatrixRMaj Q , boolean compact ) { } }
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 = CommonOps_DDRM . identity ( numRows ) ; } else { if ( Q . numRows != numRows || Q . numCols != numRows ) { throw new IllegalArgumentException ( "Unexpected matrix dimension." ) ; } else { CommonOps_DDRM . setIdentity ( Q ) ; } } } for ( int j = minLength - 1 ; j >= 0 ; j -- ) { u [ j ] = 1 ; for ( int i = j + 1 ; i < numRows ; i ++ ) { u [ i ] = QR . get ( i , j ) ; } QrHelperFunctions_DDRM . rank1UpdateMultR ( Q , u , gammas [ j ] , j , j , numRows , v ) ; } return Q ;
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 one of " filename " , * " namespace " , or " generic " . * @ return A map from generated file name ( of the form " < * > SoyInfo . java " ) to generated file * content . * @ throws SoyCompilationException If compilation fails . */ ImmutableMap < String , String > generateParseInfo ( String javaPackage , String javaClassNameSource ) { } }
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 time , since we are not running code generation the optimization work // doesn ' t help anything // 2 . it potentially removes metadata from the tree by precalculating expressions . For example , // trivial print nodes are evaluated , which can remove globals from the tree , but the ParseResult result = parse ( passManagerBuilder ( ) . allowUnknownGlobals ( ) . optimize ( false ) ) ; throwIfErrorsPresent ( ) ; SoyFileSetNode soyTree = result . fileSet ( ) ; TemplateRegistry registry = result . registry ( ) ; // Do renaming of package - relative class names . ImmutableMap < String , String > parseInfo = new GenerateParseInfoVisitor ( javaPackage , javaClassNameSource , registry , typeRegistry ) . exec ( soyTree ) ; throwIfErrorsPresent ( ) ; reportWarnings ( ) ; return parseInfo ;
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 - property < / code > */ public ConfigPropertyType < AdminobjectType < T > > getOrCreateConfigProperty ( ) { } }
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 ( ModifierContributor . ForField ... modifierContributor ) { } }
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 = new CSVWriter ( sw , delimiter ) ; } else { // TSV writer = CSVWriter . getStrictTSVWriter ( sw ) ; } toCSVWriter ( writer , vt , columns ) ; String csvString = sw . toString ( ) ; return Pair . of ( csvString . length ( ) , csvString . getBytes ( com . google_voltpatches . common . base . Charsets . UTF_8 ) ) ;
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 list * @ param positions * @ param limits * @ return byte [ ] */ public static final byte [ ] asByteArray ( WsByteBuffer [ ] list , int [ ] positions , int [ ] limits ) { } }
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 [ i ] ; i ++ ) { position = list [ i ] . position ( ) ; list [ i ] . position ( positions [ i ] ) ; list [ i ] . get ( output , offset , ( limits [ i ] - positions [ i ] ) ) ; offset += ( limits [ i ] - positions [ i ] ) ; list [ i ] . position ( position ) ; } return output ;
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 . getFragment ( ) ) ; } else { return new URI ( initialUri . getScheme ( ) , initialUri . getUserInfo ( ) , initialUri . getHost ( ) , initialUri . getPort ( ) , finalPath , initialUri . getQuery ( ) , initialUri . getFragment ( ) ) ; } } catch ( URISyntaxException e ) { throw ExceptionUtils . getRuntimeException ( e ) ; }
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 serializers for serializing Objects value contains , if any . * @ throws java . io . IOException If serialization failed . */ @ Override public void writeShapeSpecificSerialization ( LineString value , JsonGenerator jgen , SerializerProvider provider ) throws IOException { } }
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 . getNumPoints ( ) ; j ++ ) { Point coordinate = value . getPointN ( j ) ; jgen . writeStartArray ( ) ; ser . serialize ( coordinate . getX ( ) , jgen , provider ) ; ser . serialize ( coordinate . getY ( ) , jgen , provider ) ; jgen . writeEndArray ( ) ; } jgen . writeEndArray ( ) ;
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 buffer in chars * @ throws IOException if an I / O error occurs in the reader * @ throws ParseException if the input is not valid JSON */ public JsonValue parse ( Reader reader , int buffersize ) throws IOException { } }
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 = 0 ; captureStart = - 1 ; read ( ) ; return readValue ( ) ;
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 < T , WebPage > mapper ) { } }
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 > wantsNotificationPredicate ) { } }
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 event * as just the event . Once we have two or more events we create a linked list * and walk the list to dedupe events by identity */ Object pendingNotifications = m_clientsPendingNotification . get ( c ) ; try { if ( pendingNotifications == null ) { m_clientsPendingNotification . put ( c , notification ) ; } else if ( pendingNotifications instanceof Supplier ) { // Identity duplicate check if ( pendingNotifications == notification ) return ; // Convert to a two node linked list @ SuppressWarnings ( "unchecked" ) Node n1 = new Node ( ( Supplier < DeferredSerialization > ) pendingNotifications , null ) ; n1 = m_cachedNodes . get ( n1 , n1 ) ; Node n2 = new Node ( notification , n1 ) ; n2 = m_cachedNodes . get ( n2 , n2 ) ; m_clientsPendingNotification . put ( c , n2 ) ; } else { // Walk the list and check if the notification is a duplicate Node head = ( Node ) pendingNotifications ; boolean dup = false ; while ( head != null ) { if ( head . notification == notification ) { dup = true ; break ; } head = head . next ; } // If it ' s a dupe , no new work if ( dup ) continue ; // Otherwise replace the head of the list which is the value in the map Node replacement = new Node ( notification , ( Node ) pendingNotifications ) ; replacement = m_cachedNodes . get ( replacement , replacement ) ; m_clientsPendingNotification . put ( c , replacement ) ; } } catch ( ExecutionException e ) { VoltDB . crashLocalVoltDB ( "Unexpected exception pushing client notifications" , true , Throwables . getRootCause ( e ) ) ; } } } } ) ;
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 > * @ param s Stream to cycle * @ return New cycling stream */ public static < U > Stream < U > cycle ( final Stream < U > s ) { } }
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 ( ) : "msgsAdj[i] = " + msgsAdj [ edge ] + "\n" + "edge: " + fg . edgeToString ( edge ) ;
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 , String DisplayName , InputStream FileData ) throws PopbillException { } }
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 . */ public static String generateValidXLinkUrl ( XLinkUrlBlueprint template , ModelDescription modelInformation , String contextId , String objectAsJsonString ) { } }
String completeUrl = template . getBaseUrl ( ) ; completeUrl += "&" + template . getKeyNames ( ) . getModelClassKeyName ( ) + "=" + urlEncodeParameter ( modelInformation . getModelClassName ( ) ) ; completeUrl += "&" + template . getKeyNames ( ) . getModelVersionKeyName ( ) + "=" + urlEncodeParameter ( modelInformation . getVersionString ( ) ) ; completeUrl += "&" + template . getKeyNames ( ) . getContextIdKeyName ( ) + "=" + urlEncodeParameter ( contextId ) ; completeUrl += "&" + template . getKeyNames ( ) . getIdentifierKeyName ( ) + "=" + urlEncodeParameter ( objectAsJsonString ) ; return completeUrl ;
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 ( keyArea == null ) keyArea = super . setupKey ( iKeyArea ) ; return keyArea ;
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 ++ ) { if ( id . equals ( children [ i ] . getAttribute ( "id" ) ) ) { security . removeChild ( children [ 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 */ protected void validateArgumentList ( String [ ] args , boolean supportsTarget , boolean supportsDefaultTarget ) { } }
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 = args [ 1 ] ; if ( ! primArg . startsWith ( "-" ) ) firstArg = 2 ; } } } // Arguments and values come in pairs ( expect - password ) . // Anything outside of that pattern is invalid . // Loop through , jumping in pairs except when we encounter // - password - - that may be an interactive prompt which won ' t // define a value . for ( int i = firstArg ; i < args . length ; i ++ ) { String argName = getArgName ( args [ i ] ) ; if ( ! isKnownArgument ( argName ) ) { throw new IllegalArgumentException ( getMessage ( "invalidArg" , argName ) ) ; } // Everything we accept as an arg expects an name = value pair . // If we see anything without the = value pair , error if ( ! args [ i ] . contains ( "=" ) ) { throw new IllegalArgumentException ( getMessage ( "missingValue" , argName ) ) ; } }
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 first matching commerce account , or < code > null < / code > if a matching commerce account could not be found */ public static CommerceAccount fetchByU_T_First ( long userId , int type , OrderByComparator < CommerceAccount > orderByComparator ) { } }
return getPersistence ( ) . fetchByU_T_First ( userId , type , orderByComparator ) ;