signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class CommercePriceEntryLocalServiceImpl { /** * This method is used to insert a new CommercePriceEntry or update an
* existing one
* @ param commercePriceEntryId - < b > Only < / b > used when updating an entity
* the matching one will be updated
* @ param cpInstanceId - < b > Only < / b > used when add... | // Update
if ( commercePriceEntryId > 0 ) { try { return updateCommercePriceEntry ( commercePriceEntryId , price , promoPrice , serviceContext ) ; } catch ( NoSuchPriceEntryException nspee ) { if ( _log . isDebugEnabled ( ) ) { _log . debug ( "Unable to find price entry with ID: " + commercePriceEntryId ) ; } } } if ( ... |
public class HttpServerExchange { /** * Actually resumes reads or writes , if the relevant method has been called .
* @ return < code > true < / code > if reads or writes were resumed */
boolean runResumeReadWrite ( ) { } } | boolean ret = false ; if ( anyAreSet ( state , FLAG_SHOULD_RESUME_WRITES ) ) { responseChannel . runResume ( ) ; ret = true ; } if ( anyAreSet ( state , FLAG_SHOULD_RESUME_READS ) ) { requestChannel . runResume ( ) ; ret = true ; } return ret ; |
public class LibLoader { /** * Loads a native library with the given { @ link LoadPolicy load policy } .
* @ param clazz
* The class whose classloader should be used to resolve shipped libraries
* @ param name
* The name of the class .
* @ param policy
* The load policy . */
public void loadLibrary ( Class ... | if ( loaded . contains ( name ) ) { return ; } switch ( policy ) { case PREFER_SHIPPED : try { loadShippedLibrary ( clazz , name ) ; } catch ( LoadLibraryException ex ) { try { loadSystemLibrary ( name ) ; } catch ( LoadLibraryException ex2 ) { throw ex ; } } break ; case PREFER_SYSTEM : try { loadSystemLibrary ( name ... |
public class WSJobRepositoryImpl { /** * { @ inheritDoc } */
@ Override public WSJobExecution createJobExecution ( long jobInstanceId , Properties jobParameters ) { } } | return persistenceManagerService . createJobExecution ( jobInstanceId , jobParameters , new Date ( ) ) ; |
public class ShufflingIterable { /** * Returns a new { @ link ShufflingIterable } for the specified iterable and random number generator .
* @ param iterable the source iterable
* @ param rng the random number generator to use in shuffling the iterable
* @ return a new shuffling iterable for contents of the origi... | return new ShufflingIterable < > ( iterable , rng ) ; |
public class TypesWalker { /** * Walk will stop if visitor tells it ' s enough or when hierarchy incompatibility will be found .
* @ param one first type
* @ param two second type
* @ param visitor visitor */
public static void walk ( final Type one , final Type two , final TypesVisitor visitor ) { } } | // Use possibly more specific generics ( otherwise root class generics would be used as Object and this
// way it could be used as upper bound )
// Also , types could contain outer class generics declarations , which must be preserved
// e . g . ( Outer < String > . Inner field ) . getGenericType ( ) = = ParameterizedT... |
public class ListUsageForLicenseConfigurationResult { /** * An array of < code > LicenseConfigurationUsage < / code > objects .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setLicenseConfigurationUsageList ( java . util . Collection ) } or
* { @ link # w... | if ( this . licenseConfigurationUsageList == null ) { setLicenseConfigurationUsageList ( new java . util . ArrayList < LicenseConfigurationUsage > ( licenseConfigurationUsageList . length ) ) ; } for ( LicenseConfigurationUsage ele : licenseConfigurationUsageList ) { this . licenseConfigurationUsageList . add ( ele ) ;... |
public class IfcProcessImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcRelSequence > getIsSuccessorFrom ( ) { } } | return ( EList < IfcRelSequence > ) eGet ( Ifc4Package . Literals . IFC_PROCESS__IS_SUCCESSOR_FROM , true ) ; |
public class FunctionGenerator { /** * Adds the caller of parentExpr to the current body of the last
* function that was created .
* @ param parentExpr */
private void updateCurrentFunction ( AbstractFunctionExpression parentExpr ) { } } | GroovyExpression expr = parentExpr . getCaller ( ) ; if ( expr instanceof AbstractFunctionExpression ) { AbstractFunctionExpression exprAsFunction = ( AbstractFunctionExpression ) expr ; GroovyExpression exprCaller = exprAsFunction . getCaller ( ) ; parentExpr . setCaller ( exprCaller ) ; updateCurrentFunctionDefintion... |
public class UserLoginProvider { /** * Makes sure there is a UserLogin on a session ; designed to be called by code unrelated to the regular login logic ( the
* TemplateExceptionRenderer ) to make sure there ' s at least an anonymous login session set up for that templater
* @ param session
* @ return */
public U... | if ( session . getAttribute ( LOGIN_SESSION_ATTRIBUTE ) == null ) // Fall back on the anonymous user
// Save in the " login " session attribute
session . setAttribute ( LOGIN_SESSION_ATTRIBUTE , new UserLoginImpl ( null ) ) ; return ( UserLogin ) session . getAttribute ( LOGIN_SESSION_ATTRIBUTE ) ; |
public class UserRepository { /** * Validates that the supplied session key is still valid and if so , refreshes it for the
* specified number of days .
* @ return true if the session was located and refreshed , false if it no longer exists . */
public boolean refreshSession ( String sessionKey , int expireDays ) t... | Calendar cal = Calendar . getInstance ( ) ; cal . add ( Calendar . DATE , expireDays ) ; Date expires = new Date ( cal . getTime ( ) . getTime ( ) ) ; // attempt to update an existing session row , returning true if we found and updated it
return ( update ( "update sessions set expires = '" + expires + "' " + "where au... |
public class StringGroovyMethods { /** * Appends the String representation of the given operand to this CharSequence .
* @ param left a CharSequence
* @ param value any Object
* @ return the original toString ( ) of the CharSequence with the object appended
* @ since 1.8.2 */
public static String plus ( CharSeq... | return left + DefaultGroovyMethods . toString ( value ) ; |
public class Condition { /** * With Valid Json Path .
* Check to see if incoming path has a valid string value selected via a < a href = " https : / / github . com / jayway / JsonPath / " >
* JSONPath < / a > expression . */
public static Condition withPostBodyContainingJsonPath ( final String pattern , final Objec... | return new Condition ( input -> value . equals ( JsonPath . parse ( input . getPostBody ( ) ) . read ( pattern ) ) ) ; |
public class ManagedResourceSummaryMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ManagedResourceSummary managedResourceSummary , ProtocolMarshaller protocolMarshaller ) { } } | if ( managedResourceSummary == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( managedResourceSummary . getResourceType ( ) , RESOURCETYPE_BINDING ) ; protocolMarshaller . marshall ( managedResourceSummary . getAssociationCount ( ) , ASSOCIA... |
public class KeyedMultiObjectPool { /** * { @ inheritDoc } */
@ Override protected void onShutDown ( ) { } } | for ( PoolKey < K > k : pool . keySet ( ) ) { PoolableObjects < V > pobjs = objectPool ( k , Boolean . FALSE ) ; pobjs . shutdown ( ) ; } |
public class RandomVariableDifferentiableAADStochasticNonOptimized { /** * / * ( non - Javadoc )
* @ see net . finmath . stochastic . RandomVariable # sub ( net . finmath . stochastic . RandomVariable ) */
@ Override public RandomVariable sub ( RandomVariable randomVariable ) { } } | return new RandomVariableDifferentiableAADStochasticNonOptimized ( getValues ( ) . sub ( randomVariable ) , Arrays . asList ( this , randomVariable ) , OperatorType . SUB ) ; |
public class AbstractEditor { /** * Method to obtain a message from the message source
* defined via the services locator , at the default locale . */
protected String getMessage ( String key , Object [ ] params ) { } } | MessageSource messageSource = ValkyrieRepository . getInstance ( ) . getApplicationConfig ( ) . messageSource ( ) ; return messageSource . getMessage ( key , params , Locale . getDefault ( ) ) ; |
public class RosterEntry { /** * Convert a roster entry with the given name to a roster item . As per RFC 6121 § 2.1.2.2 . , clients MUST NOT include
* the ' ask ' attribute , thus set { @ code includeAskAttribute } to { @ code false } .
* @ param entry the roster entry .
* @ param name the name of the roster ite... | RosterPacket . Item item = new RosterPacket . Item ( entry . getJid ( ) , name ) ; item . setItemType ( entry . getType ( ) ) ; if ( includeAskAttribute ) { item . setSubscriptionPending ( entry . isSubscriptionPending ( ) ) ; } item . setApproved ( entry . isApproved ( ) ) ; // Set the correct group names for the item... |
public class GrahamScanConvexHull2D { /** * Find the starting point , and sort it to the beginning of the list . The
* starting point must be on the outer hull . Any " most extreme " point will do ,
* e . g . the one with the lowest Y coordinate and for ties with the lowest X . */
private void findStartingPoint ( )... | // Well , we already know the best Y value . . .
final double bestY = minmaxY . getMin ( ) ; double bestX = Double . POSITIVE_INFINITY ; int bestI = - 1 ; Iterator < double [ ] > iter = this . points . iterator ( ) ; for ( int i = 0 ; iter . hasNext ( ) ; i ++ ) { double [ ] vec = iter . next ( ) ; if ( vec [ 1 ] == be... |
public class HierarchyDiscovery { /** * Processing part . Every type variable is mapped to the actual type in the resolvedTypeVariablesMap . This map is used later
* on for resolving types . */
private void processTypeVariables ( TypeVariable < ? > [ ] variables , Type [ ] values ) { } } | for ( int i = 0 ; i < variables . length ; i ++ ) { processTypeVariable ( variables [ i ] , values [ i ] ) ; } |
public class RelatedGregorianYearRule { /** * ~ Methoden - - - - - */
@ Override public Integer getValue ( T context ) { } } | CalendarSystem < T > calsys = this . getCalendarSystem ( context ) ; T start = context . with ( this . dayOfYear , 1 ) ; return toGregorianYear ( calsys . transform ( start ) ) ; |
public class OpDeprecation { /** * < pre >
* Explanation of why it was deprecated and what to use instead .
* < / pre >
* < code > optional string explanation = 2 ; < / code > */
public com . google . protobuf . ByteString getExplanationBytes ( ) { } } | java . lang . Object ref = explanation_ ; if ( ref instanceof java . lang . String ) { com . google . protobuf . ByteString b = com . google . protobuf . ByteString . copyFromUtf8 ( ( java . lang . String ) ref ) ; explanation_ = b ; return b ; } else { return ( com . google . protobuf . ByteString ) ref ; } |
public class CollectionData { /** * Puts data into this data tree at the specified key string .
* @ param keyStr One or more map keys and / or list indices ( separated by ' . ' if multiple parts ) .
* Indicates the path to the location within this data tree .
* @ param value The data to put at the specified locat... | List < String > keys = split ( keyStr , '.' ) ; int numKeys = keys . size ( ) ; CollectionData collectionData = this ; for ( int i = 0 ; i <= numKeys - 2 ; ++ i ) { SoyData nextSoyData = collectionData . getSingle ( keys . get ( i ) ) ; if ( nextSoyData != null && ! ( nextSoyData instanceof CollectionData ) ) { throw n... |
public class GroovyScript2RestLoader { /** * This method is useful for clients that can send script in request body
* without form - data . At required to set specific Content - type header
* ' script / groovy ' .
* @ param stream the stream that contains groovy source code
* @ param uriInfo see javax . ws . rs... | "script/groovy" } ) @ Path ( "add/{repository}/{workspace}/{path:.*}" ) public Response addScript ( InputStream stream , @ Context UriInfo uriInfo , @ PathParam ( "repository" ) String repository , @ PathParam ( "workspace" ) String workspace , @ PathParam ( "path" ) String path ) { Session ses = null ; try { ses = ses... |
public class Guestbook { /** * Add a greeting to the specified guestbook . */
private void addGreeting ( String guestbookName , String user , String message ) throws DatastoreException { } } | Entity . Builder greeting = Entity . newBuilder ( ) ; greeting . setKey ( makeKey ( GUESTBOOK_KIND , guestbookName , GREETING_KIND ) ) ; greeting . getMutableProperties ( ) . put ( USER_PROPERTY , makeValue ( user ) . build ( ) ) ; greeting . getMutableProperties ( ) . put ( MESSAGE_PROPERTY , makeValue ( message ) . b... |
public class SqlDateTimeUtils { /** * Parse date time string to timestamp based on the given time zone string and format .
* Returns null if parsing failed .
* @ param dateStr the date time string
* @ param format the date time string format
* @ param tzStr the time zone id string */
public static Long toTimest... | TimeZone tz = TIMEZONE_CACHE . get ( tzStr ) ; return toTimestamp ( dateStr , format , tz ) ; |
public class ZKPaths { /** * Return the children of the given path sorted by sequence number
* @ param zookeeper the client
* @ param path the path
* @ return sorted list of children
* @ throws InterruptedException thread interruption
* @ throws org . apache . zookeeper . KeeperException zookeeper errors */
p... | List < String > children = zookeeper . getChildren ( path , false ) ; List < String > sortedList = Lists . newArrayList ( children ) ; Collections . sort ( sortedList ) ; return sortedList ; |
public class ConnectOperation { /** * Emits BluetoothGatt and completes after connection is established .
* @ return BluetoothGatt after connection reaches { @ link com . polidea . rxandroidble2 . RxBleConnection . RxBleConnectionState # CONNECTED }
* state .
* @ throws com . polidea . rxandroidble2 . exceptions ... | // start connecting the BluetoothGatt
// note : Due to different Android BLE stack implementations it is not certain whether ` connectGatt ( ) ` or ` BluetoothGattCallback `
// will emit BluetoothGatt first
return Single . create ( new SingleOnSubscribe < BluetoothGatt > ( ) { @ Override public void subscribe ( final S... |
public class CSVExporter { /** * Export all XYChart series as columns in separate CSV files .
* @ param chart
* @ param path2Dir */
public static void writeCSVColumns ( XYChart chart , String path2Dir ) { } } | for ( XYSeries xySeries : chart . getSeriesMap ( ) . values ( ) ) { writeCSVColumns ( xySeries , path2Dir ) ; } |
public class AwsS3ServiceClientImpl { /** * Puts an object .
* @ param bucket the bucket to put the object in .
* @ param key the key ( or name ) of the object .
* @ param acl the ACL to apply to the object ( e . g . private ) .
* @ param contentType the content type of the object ( e . g . application / json )... | return proxy . putObject ( bucket , key , acl , contentType , body ) ; |
public class TextUtils { /** * Split the input on the given separator char , and unescape each portion using the escape char and special chars
* @ param input input string
* @ param separator char separating each component
* @ param echar escape char
* @ param special chars that are escaped
* @ return results... | return splitUnescape ( input , new char [ ] { separator } , echar , special ) ; |
public class IMatrix { /** * Creates a vector with the content of a row from this matrix */
public IVector getVectorFromRow ( int index ) { } } | IVector result = new IVector ( columns ) ; for ( int i = 0 ; i < columns ; i ++ ) { result . realvector [ i ] = realmatrix [ index ] [ i ] ; result . imagvector [ i ] = imagmatrix [ index ] [ i ] ; } return result ; |
public class BusNetwork { /** * Remove a bus stop from this network .
* If this bus stop removal implies empty hubs , these hubs
* will be also removed .
* @ param busStop is the bus stop to remove .
* @ return < code > true < / code > if the bus stop was successfully removed , otherwise < code > false < / code... | if ( this . validBusStops . remove ( busStop ) ) { busStop . setContainer ( null ) ; busStop . setEventFirable ( true ) ; fireShapeChanged ( new BusChangeEvent ( this , BusChangeEventType . STOP_REMOVED , busStop , - 1 , "shape" , // $ NON - NLS - 1 $
null , null ) ) ; checkPrimitiveValidity ( ) ; return true ; } final... |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link GeneratorType }
* { @ code > } */
@ XmlElementDecl ( namespace = "http://www.w3.org/2005/Atom" , name = "generator" , scope = SourceType . class ) public JAXBElement < GeneratorType > createSourceTypeGenerator ( Gene... | return new JAXBElement < GeneratorType > ( FEED_TYPE_GENERATOR_QNAME , GeneratorType . class , SourceType . class , value ) ; |
public class UserList { /** * Sets the listType value for this UserList .
* @ param listType * Type of this list : remarketing / logical / external remarketing .
* < span class = " constraint Selectable " > This field can be selected using
* the value " ListType " . < / span > < span class = " constraint Filterab... | this . listType = listType ; |
public class Unchecked { /** * Wrap a { @ link CheckedIntUnaryOperator } in a { @ link IntUnaryOperator } with a custom handler for checked exceptions .
* Example :
* < code > < pre >
* IntStream . of ( 1 , 2 , 3 ) . map ( Unchecked . intUnaryOperator (
* if ( i & lt ; 0)
* throw new Exception ( " Only positi... | return t -> { try { return operator . applyAsInt ( t ) ; } catch ( Throwable e ) { handler . accept ( e ) ; throw new IllegalStateException ( "Exception handler must throw a RuntimeException" , e ) ; } } ; |
public class WeightedDirectedMultigraph { /** * { @ inheritDoc } */
public int degree ( int vertex ) { } } | SparseWeightedDirectedTypedEdgeSet < T > edges = vertexToEdges . get ( vertex ) ; return ( edges == null ) ? 0 : edges . size ( ) ; |
public class ContentSpec { /** * Sets the Content Specifications title .
* @ param title The title for the content specification */
public void setTitle ( final String title ) { } } | if ( title == null && this . title == null ) { return ; } else if ( title == null ) { removeChild ( this . title ) ; this . title = null ; } else if ( this . title == null ) { this . title = new KeyValueNode < String > ( CommonConstants . CS_TITLE_TITLE , title ) ; appendChild ( this . title , false ) ; } else { this .... |
public class GeneralPurposeFFT_F32_1D { /** * radb5 : Real FFT ' s backward processing of factor 5 */
void radb5 ( final int ido , final int l1 , final float in [ ] , final int in_off , final float out [ ] , final int out_off , final int offset ) { } } | final float tr11 = 0.309016994374947451262869435595348477f ; final float ti11 = 0.951056516295153531181938433292089030f ; final float tr12 = - 0.809016994374947340240566973079694435f ; final float ti12 = 0.587785252292473248125759255344746634f ; int i , ic ; float ci2 , ci3 , ci4 , ci5 , di3 , di4 , di5 , di2 , cr2 , c... |
public class Router { /** * SUBSCRIPTION */
protected void subscribe ( Routee < P > routee ) { } } | if ( ! routees . contains ( routee ) ) routees . add ( routee ) ; |
public class BoxesRunTime { /** * arg . toInt */
public static java . lang . Integer toInteger ( Object arg ) throws NoSuchMethodException { } } | if ( arg instanceof java . lang . Integer ) return ( java . lang . Integer ) arg ; if ( arg instanceof java . lang . Long ) return boxToInteger ( ( int ) unboxToLong ( arg ) ) ; if ( arg instanceof java . lang . Double ) return boxToInteger ( ( int ) unboxToDouble ( arg ) ) ; if ( arg instanceof java . lang . Float ) r... |
public class DescribeStreamRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeStreamRequest describeStreamRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeStreamRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeStreamRequest . getStreamName ( ) , STREAMNAME_BINDING ) ; protocolMarshaller . marshall ( describeStreamRequest . getStreamARN ( ) , STREAMARN_BINDING ) ;... |
public class AbstractUdfOperator { /** * Binds the result produced by a plan rooted at { @ code root } to a variable
* used by the UDF wrapped in this operator .
* @ param root The root of the plan producing this input . */
public void setBroadcastVariable ( String name , Operator < ? > root ) { } } | if ( name == null ) { throw new IllegalArgumentException ( "The broadcast input name may not be null." ) ; } if ( root == null ) { throw new IllegalArgumentException ( "The broadcast input root operator may not be null." ) ; } this . broadcastInputs . put ( name , root ) ; |
public class CudaZeroHandler { /** * This method returns total number of allocated objects in host memory
* @ return */
@ Override public long getAllocatedHostObjects ( ) { } } | AtomicLong counter = new AtomicLong ( 0 ) ; for ( Long threadId : zeroAllocations . keySet ( ) ) { counter . addAndGet ( zeroAllocations . get ( threadId ) . size ( ) ) ; } return counter . get ( ) ; |
public class AbstractDepthFirstSearch { /** * Classify CROSS and FORWARD edges */
private void classifyUnknownEdges ( ) { } } | Iterator < EdgeType > edgeIter = graph . edgeIterator ( ) ; while ( edgeIter . hasNext ( ) ) { EdgeType edge = edgeIter . next ( ) ; int dfsEdgeType = getDFSEdgeType ( edge ) ; if ( dfsEdgeType == UNKNOWN_EDGE ) { int srcDiscoveryTime = getDiscoveryTime ( getSource ( edge ) ) ; int destDiscoveryTime = getDiscoveryTime ... |
public class PathUtils { /** * List files ONLY , not include directories . */
public static List < File > listFiles ( File dir , FileFilter filter , boolean recursive ) { } } | List < File > list = new ArrayList < File > ( ) ; listFilesInternal ( list , dir , filter , recursive ) ; return list ; |
public class EventMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Event event , ProtocolMarshaller protocolMarshaller ) { } } | if ( event == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( event . getEventId ( ) , EVENTID_BINDING ) ; protocolMarshaller . marshall ( event . getEventName ( ) , EVENTNAME_BINDING ) ; protocolMarshaller . marshall ( event . getReadOnly (... |
public class AsyncAppender { /** * Initialize the batcher that stores the messages and calls the underlying
* appenders .
* @ param appenderName
* - The name of the appender for which the batcher is created */
private void initBatcher ( String appenderName ) { } } | MessageProcessor < LoggingEvent > messageProcessor = new MessageProcessor < LoggingEvent > ( ) { @ Override public void process ( List < LoggingEvent > objects ) { processLoggingEvents ( objects ) ; } } ; String batcherName = this . getClass ( ) . getName ( ) + BATCHER_NAME_LIMITER + appenderName ; batcher = BatcherFac... |
public class CmsDirectEditEntryPoint { /** * Toggles the visibility of the toolbar . < p >
* @ param show < code > true < / code > to show the toolbar */
protected void toggleToolbar ( boolean show ) { } } | if ( show ) { CmsDebugLog . consoleLog ( "Showing toolbar" ) ; CmsToolbar . showToolbar ( m_toolbar , true , m_toolbarVisibility , I_CmsLayoutBundle . INSTANCE . toolbarCss ( ) . simpleToolbarShow ( ) ) ; saveToolbarVisibility ( true ) ; } else { CmsDebugLog . consoleLog ( "Hiding toolbar" ) ; CmsToolbar . showToolbar ... |
public class CommonTree { /** * For every node in this subtree , make sure it ' s start / stop token ' s
* are set . Walk depth first , visit bottom up . Only updates nodes
* with at least one token index & lt ; 0. */
public void setUnknownTokenBoundaries ( ) { } } | if ( children == null ) { if ( startIndex < 0 || stopIndex < 0 ) { startIndex = stopIndex = token . getTokenIndex ( ) ; } return ; } for ( int i = 0 ; i < children . size ( ) ; i ++ ) { ( ( CommonTree ) children . get ( i ) ) . setUnknownTokenBoundaries ( ) ; } if ( startIndex >= 0 && stopIndex >= 0 ) return ; // alrea... |
public class UserCredentials { /** * Sets the value of the given field . Any existing value for that field is
* replaced .
* @ param field
* The field whose value should be assigned .
* @ param value
* The value to assign to the given field .
* @ return
* The previous value of the field , or null if the v... | return setValue ( field . getName ( ) , value ) ; |
public class AdminReqheaderAction { public static OptionalEntity < RequestHeader > getEntity ( final CreateForm form , final String username , final long currentTime ) { } } | switch ( form . crudMode ) { case CrudMode . CREATE : return OptionalEntity . of ( new RequestHeader ( ) ) . map ( entity -> { entity . setCreatedBy ( username ) ; entity . setCreatedTime ( currentTime ) ; return entity ; } ) ; case CrudMode . EDIT : if ( form instanceof EditForm ) { return ComponentUtil . getComponent... |
public class OsmMapShapeConverter { /** * Convert a { @ link Geometry } to a Map shape
* @ param geometry
* @ return */
@ SuppressWarnings ( "unchecked" ) public OsmDroidMapShape toShape ( Geometry geometry ) { } } | OsmDroidMapShape shape = null ; GeometryType geometryType = geometry . getGeometryType ( ) ; switch ( geometryType ) { case POINT : shape = new OsmDroidMapShape ( geometryType , OsmMapShapeType . LAT_LNG , toLatLng ( ( Point ) geometry ) ) ; break ; case LINESTRING : shape = new OsmDroidMapShape ( geometryType , OsmMap... |
public class DataSet { /** * Applies a Map transformation on a { @ link DataSet } . < br / >
* The transformation calls a { @ link MapFunction } for each element of the DataSet .
* Each MapFunction call returns exactly one element .
* @ param mapper The MapFunction that is called for each element of the DataSet .... | if ( mapper == null ) { throw new NullPointerException ( "Map function must not be null." ) ; } return new MapOperator < T , R > ( this , mapper ) ; |
public class LastActivityManager { /** * wait until the last activity is stopped
* @ param timeOutInMillis timeout for wait */
public void waitForAllActivitiesDestroy ( int timeOutInMillis ) { } } | synchronized ( activityStack ) { long start = System . currentTimeMillis ( ) ; long now = start ; while ( ! activityStack . isEmpty ( ) && start + timeOutInMillis > now ) { try { activityStack . wait ( start - now + timeOutInMillis ) ; } catch ( InterruptedException ignored ) { } now = System . currentTimeMillis ( ) ; ... |
public class BatchDetectEntitiesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( BatchDetectEntitiesRequest batchDetectEntitiesRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( batchDetectEntitiesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( batchDetectEntitiesRequest . getTextList ( ) , TEXTLIST_BINDING ) ; protocolMarshaller . marshall ( batchDetectEntitiesRequest . getLanguageCode ( ) , LANGUAG... |
public class ScriptRunner { /** * Invokes the script found at the specified location ( file system or URL ) .
* @ param location A file on the file system or a URL .
* @ param req A < code > TaskRequest < / code > prepared externally .
* @ return The < code > TaskResponse < / code > that results from invoking the... | // Assertions .
if ( location == null ) { String msg = "Argument 'location' cannot be null." ; throw new IllegalArgumentException ( msg ) ; } return run ( compileTask ( location ) , req ) ; |
public class GinFactoryModuleBuilder { /** * See the factory configuration examples at { @ link GinFactoryModuleBuilder } . */
public < F > GinModule build ( Class < F > factoryInterface ) { } } | return build ( TypeLiteral . get ( factoryInterface ) ) ; |
public class BigDecimalTextField { /** * Format the number and show it .
* @ param number Number to set . */
public void setValue ( Number number ) { } } | String txt = null ; if ( number != null ) { txt = this . format . format ( number ) ; } setText ( txt ) ; |
public class XbaseFactoryImpl { /** * Creates the default factory implementation .
* < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public static XbaseFactory init ( ) { } } | try { XbaseFactory theXbaseFactory = ( XbaseFactory ) EPackage . Registry . INSTANCE . getEFactory ( XbasePackage . eNS_URI ) ; if ( theXbaseFactory != null ) { return theXbaseFactory ; } } catch ( Exception exception ) { EcorePlugin . INSTANCE . log ( exception ) ; } return new XbaseFactoryImpl ( ) ; |
public class StreamEx { /** * Returns a new { @ code StreamEx } which elements are { @ link List } objects
* containing all possible tuples of the elements of supplied collection of
* collections . The whole stream forms an n - fold Cartesian product ( or
* cross - product ) of the input collections .
* Every s... | if ( source . isEmpty ( ) ) return StreamEx . of ( new ConstSpliterator . OfRef < > ( Collections . emptyList ( ) , 1 , true ) ) ; return of ( new CrossSpliterator . ToList < > ( source ) ) ; |
public class SBT013Analysis { /** * { @ inheritDoc } */
@ Override public void writeToFile ( File analysisCacheFile ) // use Zinc method ( if there is any ) ?
{ } } | if ( stamps != null ) // stamps were modified , merge now
{ analysis = analysis . copy ( stamps , analysis . apis ( ) , analysis . relations ( ) , analysis . infos ( ) , analysis . compilations ( ) ) ; stamps = null ; } AnalysisStore analysisStore = Compiler . analysisStore ( analysisCacheFile ) ; analysisStore . set (... |
public class AbstractCacheableLockManager { /** * Returns lock data by node identifier . */
protected LockData getLockDataById ( String nodeId ) { } } | try { return getLockDataById . run ( nodeId ) ; } catch ( LockException e ) { if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "An exception occurred: " + e . getMessage ( ) ) ; } } return null ; |
public class SimpleTriggerContext { /** * Update this holder ' s state with the latest time values .
* @ param lastScheduledExecutionTime
* last < i > scheduled < / i > execution time
* @ param lastActualExecutionTime
* last < i > actual < / i > execution time
* @ param lastCompletionTime
* last completion ... | this . lastScheduledExecutionTime = lastScheduledExecutionTime ; this . lastActualExecutionTime = lastActualExecutionTime ; this . lastCompletionTime = lastCompletionTime ; |
public class TSL2561Consumer { /** * Device lux range 0.1 - 40,000 + see
* https : / / learn . adafruit . com / tsl2561 / overview */
public double readLux ( ) throws IOException { } } | int ambient = readU16LittleEndian ( TSL2561_COMMAND_BIT | TSL2561_REGISTER_CHAN0_LOW ) ; int ir = readU16LittleEndian ( TSL2561_COMMAND_BIT | TSL2561_REGISTER_CHAN1_LOW ) ; if ( ambient >= 0xffff || ir >= 0xffff ) // value ( s ) exeed ( s ) datarange
throw new RuntimeException ( "Gain too high. Values exceed range." ) ... |
public class Choice8 { /** * { @ inheritDoc } */
@ Override public Choice7 < A , B , C , D , E , F , G > converge ( Function < ? super H , ? extends CoProduct7 < A , B , C , D , E , F , G , ? > > convergenceFn ) { } } | return match ( Choice7 :: a , Choice7 :: b , Choice7 :: c , Choice7 :: d , Choice7 :: e , Choice7 :: f , Choice7 :: g , convergenceFn . andThen ( cp7 -> cp7 . match ( Choice7 :: a , Choice7 :: b , Choice7 :: c , Choice7 :: d , Choice7 :: e , Choice7 :: f , Choice7 :: g ) ) ) ; |
public class JQMSlider { /** * Sets the value of the slider to the given value
* @ param value the new value of the slider , must be in the range of the slider */
@ Override public void setValue ( Double value , boolean fireEvents ) { } } | Double old = getValue ( ) ; if ( old == value || old != null && old . equals ( value ) ) return ; internVal = value ; setInputValueAttr ( value ) ; ignoreChange = true ; try { refresh ( input . getElement ( ) . getId ( ) , doubleToNiceStr ( value ) ) ; } finally { ignoreChange = false ; } if ( fireEvents ) ValueChangeE... |
public class _MethodBindingToMethodExpression { /** * Note : MethodInfo . getParamTypes ( ) may incorrectly return an empty class array if invoke ( ) has not been called .
* @ throws IllegalStateException
* if expected params types have not been determined . */
@ Override public MethodInfo getMethodInfo ( ELContext... | checkNullArgument ( context , "elcontext" ) ; checkNullState ( methodBinding , "methodBinding" ) ; if ( methodInfo == null ) { final FacesContext facesContext = ( FacesContext ) context . getContext ( FacesContext . class ) ; if ( facesContext != null ) { methodInfo = invoke ( new Invoker < MethodInfo > ( ) { public Me... |
public class RetryPolicy { /** * Registers the { @ code listener } to be called when an execution is aborted . */
public RetryPolicy < R > onAbort ( CheckedConsumer < ? extends ExecutionCompletedEvent < R > > listener ) { } } | abortListener = EventListener . of ( Assert . notNull ( listener , "listener" ) ) ; return this ; |
public class SAX2DTM2 { /** * Receive notification of the beginning of the document .
* @ throws SAXException Any SAX exception , possibly
* wrapping another exception .
* @ see org . xml . sax . ContentHandler # startDocument */
public void startDocument ( ) throws SAXException { } } | int doc = addNode ( DTM . DOCUMENT_NODE , DTM . DOCUMENT_NODE , DTM . NULL , DTM . NULL , 0 , true ) ; m_parents . push ( doc ) ; m_previous = DTM . NULL ; m_contextIndexes . push ( m_prefixMappings . size ( ) ) ; // for the next element . |
public class TextMessageBuilder { /** * { @ inheritDoc } Returns a response containing a plain text message . */
public FbBotMillResponse build ( MessageEnvelope envelope ) { } } | User recipient = getRecipient ( envelope ) ; Message message = new TextMessage ( messageText ) ; message . setQuickReplies ( quickReplies ) ; return new FbBotMillMessageResponse ( recipient , message ) ; |
public class JsMsgObject { /** * Encode the message part into a byte array buffer .
* The buffer will be used for transmitting over the wire , hardening
* into a database and any other need for ' serialization '
* Locking : The caller MUST have already synchronized on getPartLockArtefact ( jsPart )
* before cal... | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "encodePartToBuffer" , new Object [ ] { jsPart , header , buffer , offset } ) ; JMFMessage msg = ( JMFMessage ) jsPart . jmfPart ; int length = 0 ; int newOffset = offset ; try { length = msg . getEncodedLength ( ) ; ... |
public class KerasModelBuilder { /** * Set model architecture from file name pointing to model YAML string .
* @ param modelYamlFilename Name of file containing model YAML string
* @ return Model Builder
* @ throws IOException I / O Exception */
public KerasModelBuilder modelYamlFilename ( String modelYamlFilenam... | checkForExistence ( modelYamlFilename ) ; this . modelJson = new String ( Files . readAllBytes ( Paths . get ( modelYamlFilename ) ) ) ; return this ; |
public class PersonDirectoryConfiguration { /** * Overrides DAO acts as the root , it handles incorporating attributes from the attribute
* swapper utility , wraps the caching DAO */
@ Bean ( name = "personAttributeDao" ) @ Qualifier ( "personAttributeDao" ) public IPersonAttributeDao getPersonAttributeDao ( ) { } } | final PortalRootPersonAttributeDao rslt = new PortalRootPersonAttributeDao ( ) ; rslt . setDelegatePersonAttributeDao ( getRequestAttributeMergingDao ( ) ) ; rslt . setAttributeOverridesMap ( getSessionAttributesOverridesMap ( ) ) ; return rslt ; |
public class FilterContext { /** * Unregisters CounterRequestMXBean beans . */
private void unregisterJmxExpose ( ) { } } | if ( jmxNames . isEmpty ( ) ) { return ; } try { final MBeanServer platformMBeanServer = MBeans . getPlatformMBeanServer ( ) ; for ( final ObjectName name : jmxNames ) { platformMBeanServer . unregisterMBean ( name ) ; } } catch ( final JMException e ) { LOG . warn ( "failed to unregister JMX beans" , e ) ; } |
public class ColumnSchema { /** * VoltDB added method to get a non - catalog - dependent
* representation of this HSQLDB object .
* @ param session The current Session object may be needed to resolve
* some names .
* @ return XML , correctly indented , representing this object .
* @ throws HSQLParseException ... | VoltXMLElement column = new VoltXMLElement ( "column" ) ; // output column metadata
column . attributes . put ( "name" , columnName . name ) ; String typestring = Types . getTypeName ( dataType . typeCode ) ; column . attributes . put ( "valuetype" , typestring ) ; column . attributes . put ( "nullable" , String . valu... |
public class FastDeserializer { /** * Read a varbinary , serialized the same way VoltDB serializes
* strings , but returned as byte [ ] .
* @ return The byte [ ] value read from the stream .
* @ throws IOException Rethrows any IOExceptions . */
public byte [ ] readVarbinary ( ) throws IOException { } } | final int len = readInt ( ) ; // check for null string
if ( len == VoltType . NULL_STRING_LENGTH ) { return null ; } assert len >= 0 ; if ( len < VoltType . NULL_STRING_LENGTH ) { throw new IOException ( "Varbinary length is negative " + len ) ; } if ( len > buffer . remaining ( ) ) { throw new IOException ( "Varbinary... |
public class Matrix4d { /** * / * ( non - Javadoc )
* @ see org . joml . Matrix4dc # mul ( org . joml . Matrix4x3dc , org . joml . Matrix4d ) */
public Matrix4d mul ( Matrix4x3dc right , Matrix4d dest ) { } } | if ( ( properties & PROPERTY_IDENTITY ) != 0 ) return dest . set ( right ) ; else if ( ( right . properties ( ) & PROPERTY_IDENTITY ) != 0 ) return dest . set ( this ) ; return mulGeneric ( right , dest ) ; |
public class ns_ssl_certkey { /** * < pre >
* Use this operation to install certificates on NetScaler Instance ( s ) .
* < / pre > */
public static ns_ssl_certkey add ( nitro_service client , ns_ssl_certkey resource ) throws Exception { } } | resource . validate ( "add" ) ; return ( ( ns_ssl_certkey [ ] ) resource . perform_operation ( client , "add" ) ) [ 0 ] ; |
public class PortalSessionScope { /** * / * ( non - Javadoc )
* @ see org . springframework . beans . factory . config . Scope # get ( java . lang . String , org . springframework . beans . factory . ObjectFactory ) */
@ Override public Object get ( String name , ObjectFactory < ? > objectFactory ) { } } | final HttpSession session = this . getPortalSesion ( true ) ; final Object sessionMutex = WebUtils . getSessionMutex ( session ) ; synchronized ( sessionMutex ) { Object scopedObject = session . getAttribute ( name ) ; if ( scopedObject == null ) { scopedObject = objectFactory . getObject ( ) ; session . setAttribute (... |
public class RegionAutoscalerClient { /** * Retrieves a list of autoscalers contained within the specified region .
* < p > Sample code :
* < pre > < code >
* try ( RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient . create ( ) ) {
* ProjectRegionName region = ProjectRegionName . of ( " [ P... | ListRegionAutoscalersHttpRequest request = ListRegionAutoscalersHttpRequest . newBuilder ( ) . setRegion ( region ) . build ( ) ; return listRegionAutoscalers ( request ) ; |
public class MeteredBalancingPolicy { /** * Once a minute , pass off information about the amount of load generated per
* work unit off to Zookeeper for use in the claiming and rebalancing process . */
private void scheduleLoadTicks ( ) { } } | Runnable sendLoadToZookeeper = new Runnable ( ) { @ Override public void run ( ) { final List < String > loads = new ArrayList < String > ( ) ; synchronized ( meters ) { for ( Map . Entry < String , Meter > entry : meters . entrySet ( ) ) { final String workUnit = entry . getKey ( ) ; loads . add ( String . format ( "/... |
public class Parser { /** * A { @ link Parser } that runs { @ code this } for 0 ore more times separated and optionally terminated by { @ code
* delim } . For example : { @ code " foo ; foo ; foo " } and { @ code " foo ; foo ; " } both matches { @ code foo . sepEndBy ( semicolon ) } .
* < p > The return values are ... | return Parsers . or ( sepEndBy1 ( delim ) , EmptyListParser . < T > instance ( ) ) ; |
public class WikibaseDataFetcher { /** * Fetches the documents for the entities of the given string IDs . The
* result is a map from entity IDs to { @ link EntityDocument } objects . It is
* possible that a requested ID could not be found : then this key is not set
* in the map .
* @ param entityIds
* string ... | return getEntityDocuments ( Arrays . asList ( entityIds ) ) ; |
public class ResponseToRoomImpl { /** * / * ( non - Javadoc )
* @ see com . tvd12 . ezyfox . core . command . ResponseToRoom # only ( java . lang . String [ ] ) */
@ Override public ResponseToRoom only ( String ... params ) { } } | includedVars . addAll ( Arrays . asList ( params ) ) ; return this ; |
public class UnnecessaryStoreBeforeReturn { /** * looks for instructions that are binary operators , and if it is saves the left hand side register ( if it exists ) in the userValue .
* @ param seen
* the opcode of the currently parsed instruction
* @ return the lhs register number if it exists or - 1 */
private ... | if ( binaryOps . get ( seen ) && ( stack . getStackDepth ( ) >= 2 ) ) { OpcodeStack . Item item = stack . getStackItem ( 1 ) ; return item . getRegisterNumber ( ) ; } return - 1 ; |
public class PdfDocument { /** * If the current line is not empty or null , it is added to the arraylist
* of lines and a new empty line is added . */
protected void carriageReturn ( ) { } } | // the arraylist with lines may not be null
if ( lines == null ) { lines = new ArrayList ( ) ; } // If the current line is not null
if ( line != null ) { // we check if the end of the page is reached ( bugfix by Francois Gravel )
if ( currentHeight + line . height ( ) + leading < indentTop ( ) - indentBottom ( ) ) { //... |
public class Utils { /** * Get a FileInputStream object using AccessController . doPrivileged ( . . . )
* @ param file the file to get the input stream for
* @ return the file input stream
* @ throws FileNotFoundException */
public static FileInputStream getFileInputStreamPrivileged ( final File file ) throws Fil... | final AtomicReference < FileNotFoundException > exceptionRef = new AtomicReference < FileNotFoundException > ( ) ; FileInputStream fis = AccessController . doPrivileged ( new PrivilegedAction < FileInputStream > ( ) { @ Override public FileInputStream run ( ) { try { return new FileInputStream ( file ) ; } catch ( File... |
public class LogManager { /** * Returns a formatter Logger with the specified name .
* This logger let you use a { @ link java . util . Formatter } string in the message to format parameters .
* Short - hand for { @ code getLogger ( name , StringFormatterMessageFactory . INSTANCE ) }
* @ param name The logger nam... | return name == null ? getFormatterLogger ( StackLocatorUtil . getCallerClass ( 2 ) ) : getLogger ( name , StringFormatterMessageFactory . INSTANCE ) ; |
public class WARCWritable { /** * Appends the current record to a { @ link DataOutput } stream . */
@ Override public void write ( DataOutput out ) throws IOException { } } | if ( record != null ) record . write ( out ) ; |
public class CmsDriverManager { /** * Deletes an organizational unit . < p >
* Only organizational units that contain no suborganizational unit can be deleted . < p >
* The organizational unit can not be delete if it is used in the request context ,
* or if the current user belongs to it . < p >
* All users and... | // check organizational unit in context
if ( dbc . getRequestContext ( ) . getOuFqn ( ) . equals ( organizationalUnit . getName ( ) ) ) { throw new CmsDbConsistencyException ( Messages . get ( ) . container ( Messages . ERR_ORGUNIT_DELETE_IN_CONTEXT_1 , organizationalUnit . getName ( ) ) ) ; } // check organizational u... |
public class DirectoryUtil { /** * Provides a listing of files in a directory , sorted in order
* of most to least recent . */
public static File [ ] listFilesSortedByModDate ( File dir ) { } } | File [ ] backupDirFiles = dir . listFiles ( ) ; Arrays . sort ( backupDirFiles , new FileComparator ( ) ) ; return backupDirFiles ; |
public class ParamConverterEngine { /** * Creates an instance of T from the given input . Unlike { @ link # convertValue ( String , Class ,
* java . lang . reflect . Type , String ) } , this method support multi - value parameters .
* @ param input the input Strings , may be { @ literal null } or empty
* @ param ... | if ( rawType . isArray ( ) ) { if ( input == null ) { input = getMultipleValues ( defaultValue , null ) ; } return createArray ( input , rawType . getComponentType ( ) ) ; } else if ( Collection . class . isAssignableFrom ( rawType ) ) { if ( input == null ) { input = getMultipleValues ( defaultValue , null ) ; } retur... |
public class ClientIDRegistry { /** * Register a new client ID */
public synchronized void register ( String clientID ) throws InvalidClientIDException { } } | if ( ! clientIDs . add ( clientID ) ) { log . error ( "Client ID already exists : " + clientID ) ; throw new InvalidClientIDException ( "Client ID already exists : " + clientID ) ; } log . debug ( "Registered clientID : " + clientID ) ; |
public class TypeConversion { /** * A utility method to convert the long from the byte array to a long .
* @ param bytes
* The byte array containing the long .
* @ param offset
* The index at which the long is located .
* @ return The long value . */
public static long bytesToLong ( byte [ ] bytes , int offse... | long result = 0x0 ; for ( int i = offset ; i < offset + 8 ; ++ i ) { result = result << 8 ; result |= ( bytes [ i ] & 0x00000000000000FFl ) ; } return result ; |
public class DeviceMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Device device , ProtocolMarshaller protocolMarshaller ) { } } | if ( device == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( device . getCertificateArn ( ) , CERTIFICATEARN_BINDING ) ; protocolMarshaller . marshall ( device . getId ( ) , ID_BINDING ) ; protocolMarshaller . marshall ( device . getSyncSh... |
public class RequestBuilder { /** * Sends an HTTP request based on the current builder configuration . If no
* request headers have been set , the header " Content - Type " will be used with
* a value of " text / plain ; charset = utf - 8 " .
* @ return a { @ link Request } object that can be used to track the re... | XMLHttpRequest xmlHttpRequest = XMLHttpRequest . create ( ) ; evaluateSync ( requestData ) ; try { if ( ( user != null ) && ( password != null ) ) { if ( m_sync ) { xmlHttpRequest . openSync ( httpMethod , url , user , password ) ; } else { xmlHttpRequest . open ( httpMethod , url , user , password ) ; } } else if ( us... |
public class VdmLaunchShortcut { /** * Resolves a type that can be launched from the given scope and launches in the specified mode .
* @ param scope
* the java elements to consider for a type that can be launched
* @ param mode
* launch mode
* @ param selectTitle
* prompting title for choosing a type to la... | INode [ ] types = null ; try { project = findProject ( scope , PlatformUI . getWorkbench ( ) . getProgressService ( ) ) ; ILaunchConfiguration config = findLaunchConfiguration ( project . getName ( ) , getConfigurationType ( ) ) ; if ( config != null ) { // config already exists for the project .
launch ( config , mode... |
public class AuditCollectorUtil { /** * Get api authentication headers */
protected static HttpEntity getHeaders ( AuditSettings auditSettings ) { } } | HttpHeaders headers = new HttpHeaders ( ) ; if ( ! CollectionUtils . isEmpty ( auditSettings . getUsernames ( ) ) && ! CollectionUtils . isEmpty ( auditSettings . getApiKeys ( ) ) ) { headers . set ( STR_APIUSER , auditSettings . getUsernames ( ) . iterator ( ) . next ( ) ) ; headers . set ( STR_AUTHORIZATION , STR_API... |
public class KernelApi { /** * / * public static ExplicitIndexHits nodeQueryIndex ( String indexName , Object query , GraphDatabaseService db ) throws Exception {
* return getReadOperation ( db ) . nodeExplicitIndexQuery ( indexName , query ) ;
* public static ExplicitIndexHits relationshipQueryIndex ( String index... | Relationship rel = db . getRelationshipById ( id ) ; return rel . getEndNode ( ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.