signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class CPMeasurementUnitServiceBaseImpl { /** * Sets the cp tax category remote service .
* @ param cpTaxCategoryService the cp tax category remote service */
public void setCPTaxCategoryService ( com . liferay . commerce . product . service . CPTaxCategoryService cpTaxCategoryService ) { } } | this . cpTaxCategoryService = cpTaxCategoryService ; |
public class CatalogUtil { /** * Build Importer configuration optionally log deprecation or any other messages .
* @ param importConfiguration deployment configuration .
* @ param validation if we are validating configuration log any deprecation messages . This avoids double logging of deprecated
* or any other m... | String importBundleUrl = importConfiguration . getModule ( ) ; if ( ! importConfiguration . isEnabled ( ) ) { return null ; } switch ( importConfiguration . getType ( ) ) { case CUSTOM : break ; case KAFKA : String version = importConfiguration . getVersion ( ) . trim ( ) ; if ( "8" . equals ( version ) ) { if ( valida... |
import java . lang . Math ; class ComputePolygonArea { /** * This function calculates the area of a regular polygon with a given number of sides and side length .
* Examples :
* computePolygonArea ( 4 , 20 ) - > 400.000006
* computePolygonArea ( 10 , 15 ) - > 1731.1969896610804
* computePolygonArea ( 9 , 7 ) - ... | return ( sideNumber * Math . pow ( sideLength , 2 ) ) / ( 4 * Math . tan ( Math . PI / sideNumber ) ) ; |
public class CommerceAccountOrganizationRelUtil { /** * Returns the last commerce account organization rel in the ordered set where organizationId = & # 63 ; .
* @ param organizationId the organization ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ re... | return getPersistence ( ) . fetchByOrganizationId_Last ( organizationId , orderByComparator ) ; |
public class CycleAnalyzer { /** * This method searches a given { @ link Graph } for cycles . This method looks
* into all vertices . If a disconnected subgraph exists , this graph is
* analyzed , too .
* @ param < V >
* is the actual vertex implementation .
* @ param < E >
* is the actual edge implementati... | requireNonNull ( graph , "The given start vertex is null" ) ; Set < V > notVisited = new HashSet < > ( graph . getVertices ( ) ) ; while ( ! notVisited . isEmpty ( ) ) { if ( hasCycle ( notVisited . iterator ( ) . next ( ) , new Stack < > ( ) , new Stack < > ( ) , notVisited , directed ) ) { return true ; } } return fa... |
public class SimpleDataArray { /** * Sets data at a given index .
* @ param index the array index
* @ param data the data ( byte array ) .
* If < code > null < / code > , the data at the given index will be removed .
* @ param scn the global scn indicating the sequence of this change
* @ throws ArrayIndexOutO... | if ( data == null ) { set ( index , data , 0 , 0 , scn ) ; } else { set ( index , data , 0 , data . length , scn ) ; } |
public class RestartServerCmd { public Any execute ( DeviceImpl device , Any in_any ) throws DevFailed { } } | Util . out4 . println ( "RestartServer.execute(): arrived " ) ; ( ( DServer ) ( device ) ) . restart_server ( ) ; return Util . return_empty_any ( "RestartServer" ) ; |
public class PartitionKeyGenerators { /** * Produces a partition key from the device ID contained in an incoming request .
* @ return partition key derived from device ID
* @ throws PersistenceException if device ID cannot be retrieved */
public static Function < RequestEnvelope , String > deviceId ( ) { } } | return r -> Optional . ofNullable ( r ) . map ( RequestEnvelope :: getContext ) . map ( Context :: getSystem ) . map ( SystemState :: getDevice ) . map ( Device :: getDeviceId ) . orElseThrow ( ( ) -> new PersistenceException ( "Could not retrieve device ID from request envelope to generate persistence ID" ) ) ; |
public class Gauge { /** * Defines the text that could be used in a tooltip as an
* alert message .
* @ param MESSAGE */
public void setAlertMessage ( final String MESSAGE ) { } } | if ( null == alertMessage ) { _alertMessage = MESSAGE ; fireUpdateEvent ( ALERT_EVENT ) ; } else { alertMessage . set ( MESSAGE ) ; } |
public class SecurityFatHttpUtils { /** * This method creates a connection to a webpage and then returns the connection , it doesn ' t care what the response code is .
* @ param server
* The liberty server that is hosting the URL
* @ param path
* The path to the URL with the output to test ( excluding port and ... | int timeout = DEFAULT_TIMEOUT ; URL url = createURL ( server , path ) ; HttpURLConnection con = getHttpConnection ( url , timeout , HTTPRequestMethod . GET ) ; Log . info ( SecurityFatHttpUtils . class , "getHttpConnection" , "Connecting to " + url . toExternalForm ( ) + " expecting http response in " + timeout + " sec... |
public class VirtualNetworkGatewaysInner { /** * Updates a virtual network gateway tags .
* @ param resourceGroupName The name of the resource group .
* @ param virtualNetworkGatewayName The name of the virtual network gateway .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ th... | return beginUpdateTagsWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class InterProcessSemaphoreV2 { /** * Set the data to put for the node created by this semaphore . This must be called prior to calling one
* of the acquire ( ) methods .
* @ param nodeData node data */
public void setNodeData ( byte [ ] nodeData ) { } } | this . nodeData = ( nodeData != null ) ? Arrays . copyOf ( nodeData , nodeData . length ) : null ; |
public class GedLinkDocumentMongoToGedObjectConverterVisitor { /** * { @ inheritDoc } */
@ Override public final void visit ( final SourceLinkDocumentMongo document ) { } } | setGedObject ( new SourceLink ( getParent ( ) , "Source" , new ObjectId ( document . getString ( ) ) ) ) ; |
public class PreparedModel { /** * Returns the element name for the class descriptor which is the adjusted short ( unqualified ) class
* name . Also takes care that the element name does not clash with another class of the same short
* name that maps to a different table though .
* @ param classDesc The class des... | String elementName = classDesc . getClassNameOfObject ( ) . replace ( '$' , '_' ) ; elementName = elementName . substring ( elementName . lastIndexOf ( '.' ) + 1 ) ; Table table = getTableFor ( elementName ) ; int suffix = 0 ; while ( ( table != null ) && ! table . getName ( ) . equals ( classDesc . getFullTableName ( ... |
public class DateUtils { /** * Get the minutes difference */
public static int minutesDiff ( Date earlierDate , Date laterDate ) { } } | if ( earlierDate == null || laterDate == null ) { return 0 ; } return ( int ) ( ( laterDate . getTime ( ) / MINUTE_MILLIS ) - ( earlierDate . getTime ( ) / MINUTE_MILLIS ) ) ; |
public class VimGenerator2 { /** * Append a Vim pattern .
* @ param it the receiver of the generated elements .
* @ param addNewLine indicates if a new line must be appended .
* @ param name the name of the pattern .
* @ param pattern the regular expression .
* @ param contained indicates if the pattern is ma... | it . append ( "syn match " ) ; // $ NON - NLS - 1 $
it . append ( name ) ; if ( contained ) { it . append ( " contained" ) ; // $ NON - NLS - 1 $
} it . append ( " " ) ; // $ NON - NLS - 1 $
it . append ( regexString ( pattern ) ) ; if ( contains . length > 0 ) { it . append ( " contains=" ) . append ( contains [ 0 ] )... |
public class PolicyStatesInner { /** * Queries policy states for the resources under the management group .
* @ param policyStatesResource The virtual resource under PolicyStates resource type . In a given time range , ' latest ' represents the latest policy state ( s ) , whereas ' default ' represents all policy sta... | return ServiceFuture . fromResponse ( listQueryResultsForManagementGroupWithServiceResponseAsync ( policyStatesResource , managementGroupName ) , serviceCallback ) ; |
public class SpatialUtil { /** * Check that two spatial objects have the same dimensionality .
* @ param box1 First object
* @ param box2 Second object
* @ return Dimensionality
* @ throws IllegalArgumentException when the dimensionalities do not agree */
public static int assertSameDimensionality ( SpatialComp... | final int dim = box1 . getDimensionality ( ) ; if ( dim != box2 . getDimensionality ( ) ) { throw new IllegalArgumentException ( "The spatial objects do not have the same dimensionality!" ) ; } return dim ; |
public class Projection { /** * This will revert the current map ' s scaling and rotation for a point . This can be useful when
* drawing to a fixed location on the screen . */
public Point unrotateAndScalePoint ( int x , int y , Point reuse ) { } } | return applyMatrixToPoint ( x , y , reuse , mUnrotateAndScaleMatrix , mOrientation != 0 ) ; |
public class MemcachedNodesManager { /** * Return the nodeId for the given socket address . Returns < code > null < / code >
* if the socket address is not known .
* @ throws IllegalArgumentException thrown when the socketAddress is < code > null < / code > or not registered with this { @ link MemcachedNodesManager... | if ( socketAddress == null ) { throw new IllegalArgumentException ( "SocketAddress must not be null." ) ; } final String result = _address2Ids . get ( socketAddress ) ; if ( result == null ) { throw new IllegalArgumentException ( "SocketAddress " + socketAddress + " not known (registered addresses: " + _address2Ids . k... |
public class DscCompilationJobsInner { /** * Retrieve the job stream identified by job stream id .
* @ param resourceGroupName Name of an Azure Resource group .
* @ param automationAccountName The name of the automation account .
* @ param jobId The job id .
* @ param jobStreamId The job stream id .
* @ throw... | return getStreamWithServiceResponseAsync ( resourceGroupName , automationAccountName , jobId , jobStreamId ) . map ( new Func1 < ServiceResponse < JobStreamInner > , JobStreamInner > ( ) { @ Override public JobStreamInner call ( ServiceResponse < JobStreamInner > response ) { return response . body ( ) ; } } ) ; |
public class PlainLauncher { /** * Creates the UI which the launcher displays . If there is misconfiguration or error , a UI containing an error
* message is returned .
* @ return the UI which the launcher displays . */
protected WComponent createUI ( ) { } } | // Check if the parameter COMPONENT _ TO _ LAUNCH _ PARAM _ KEY has been
// configured with the name of a component to launch .
WComponent sharedApp ; uiClassName = getComponentToLaunchClassName ( ) ; if ( uiClassName == null ) { sharedApp = new WText ( "You need to set the class name of the WComponent you want to run.... |
public class CmsImageScaler { /** * Adds a filter name to the list of filters that should be applied to the image . < p >
* @ param filter the filter name to add */
public void addFilter ( String filter ) { } } | if ( CmsStringUtil . isNotEmpty ( filter ) ) { filter = filter . trim ( ) . toLowerCase ( ) ; if ( FILTERS . contains ( filter ) ) { m_filters . add ( filter ) ; } } |
public class SourceTreeManager { /** * Get the source tree from the input source .
* @ param source The Source object that should identify the desired node .
* @ param locator The location of the caller , for diagnostic purposes .
* @ return non - null reference to a node .
* @ throws TransformerException if th... | int n = getNode ( source ) ; if ( DTM . NULL != n ) return n ; n = parseToNode ( source , locator , xctxt ) ; if ( DTM . NULL != n ) putDocumentInCache ( n , source ) ; return n ; |
public class ProcessExecutor { /** * Override this to customize how the waiting task is started in the background .
* @ param < T > the type of the task
* @ param executor the executor service to submit the task on
* @ param task the task to be submitted
* @ return the future of the task */
protected < T > Futu... | return executor . submit ( wrapTask ( task ) ) ; |
public class EFapsClassLoader { /** * Get the current EFapsClassLoader .
* This static method is used to provide a way to use the same classloader
* in different threads , due to the reason that using different classloader
* instances might bring the problem of " instanceof " return unexpected results .
* @ par... | if ( EFapsClassLoader . CLASSLOADER == null ) { EFapsClassLoader . CLASSLOADER = new EFapsClassLoader ( _parent , true ) ; } return EFapsClassLoader . CLASSLOADER ; |
public class WSFServlet { /** * Creates a ServletDelegate instance according to the STACK _ SERVLET _ DELEGATE _ CLASS init parameter .
* The class is loaded through a ServletDelegateFactory that ' s retrieved as follows :
* - if a default ClassLoaderProvider is available , the webservice subsystem classloader from... | ClassLoaderProvider clProvider = ClassLoaderProvider . getDefaultProvider ( ) ; ClassLoader cl = clProvider . getWebServiceSubsystemClassLoader ( ) ; ServiceLoader < ServletDelegateFactory > sl = ServiceLoader . load ( ServletDelegateFactory . class , cl ) ; ServletDelegateFactory factory = sl . iterator ( ) . next ( )... |
public class GeneralizedCounter { /** * adds to count for the { @ link # depth ( ) } - dimensional key < code > l < / code > . */
public void incrementCount ( List < K > l , double count ) { } } | if ( l . size ( ) != depth ) { wrongDepth ( ) ; // throws exception
} GeneralizedCounter < K > next = this ; Iterator < K > i = l . iterator ( ) ; K o = i . next ( ) ; while ( i . hasNext ( ) ) { next . addToTotal ( count ) ; next = next . conditionalizeHelper ( o ) ; o = i . next ( ) ; } next . incrementCount1D ( o , ... |
public class ManipulateResponse { /** * tag : : json [ ] */
@ Route ( method = HttpMethod . GET , uri = "/manipulate/json" ) public Result jsonResult ( ) { } } | ObjectNode node = new ObjectMapper ( ) . createObjectNode ( ) ; node . put ( "hello" , "world" ) ; return ok ( node ) ; |
public class PluginWSCommons { /** * Write properties of the specified UpdateCenter to the specified JsonWriter .
* < pre >
* " updateCenterRefresh " : " 2015-04-24T16:08:36 + 0200"
* < / pre > */
public static void writeUpdateCenterProperties ( JsonWriter json , Optional < UpdateCenter > updateCenter ) { } } | if ( updateCenter . isPresent ( ) ) { json . propDateTime ( PROPERTY_UPDATE_CENTER_REFRESH , updateCenter . get ( ) . getDate ( ) ) ; } |
public class ReadFileExtensions { /** * The Method readHeadLine ( ) opens the File and reads the first line from the file .
* @ param inputFile
* The Path to the File and name from the file from where we read .
* @ return The first line from the file .
* @ throws FileNotFoundException
* the file not found exc... | String headLine = null ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( inputFile ) ) ) { headLine = reader . readLine ( ) ; } return headLine ; |
public class TaskExecutor { /** * Waits until the first task completes , then calls the ( optional ) observers
* to notify the completion and returns the result .
* @ param futures
* the list of futures to wait for .
* @ param observers
* an optional set of observers .
* @ return
* the result of the first... | int count = futures . size ( ) ; while ( count -- > 0 ) { int id = queue . take ( ) ; logger . debug ( "task '{}' complete (count: {}, queue: {})" , id , count , queue . size ( ) ) ; T result = futures . get ( id ) . get ( ) ; for ( TaskObserver < T > observer : observers ) { observer . onTaskComplete ( tasks . get ( i... |
public class RandomRotation { /** * Randomly rotates a vector using the random rotation matrix that was created in the constructor .
* @ param vector
* The initial vector
* @ return The randomly rotated vector */
public double [ ] rotate ( double [ ] vector ) { } } | DenseMatrix64F transformed = new DenseMatrix64F ( 1 , vector . length ) ; DenseMatrix64F original = DenseMatrix64F . wrap ( 1 , vector . length , vector ) ; CommonOps . mult ( original , randomMatrix , transformed ) ; return transformed . getData ( ) ; |
public class Serial { /** * < p > Sends an array of bytes to the serial port / device identified by the given file descriptor . < / p >
* @ param fd
* The file descriptor of the serial port / device .
* @ param data
* A ByteBuffer of data to be transmitted .
* @ param offset
* The starting index ( inclusive... | // we make a copy of the data argument because we don ' t want to modify the original source data
byte [ ] buffer = new byte [ length ] ; System . arraycopy ( data , offset , buffer , 0 , length ) ; // write the buffer contents to the serial port via JNI native method
write ( fd , buffer , length ) ; |
public class GriddedTileDao { /** * Delete by table name
* @ param tableName
* table name
* @ return deleted count */
public int delete ( String tableName ) { } } | DeleteBuilder < GriddedTile , Long > db = deleteBuilder ( ) ; int deleted = 0 ; try { db . where ( ) . eq ( GriddedTile . COLUMN_TABLE_NAME , tableName ) ; PreparedDelete < GriddedTile > deleteQuery = db . prepare ( ) ; deleted = delete ( deleteQuery ) ; } catch ( SQLException e ) { throw new GeoPackageException ( "Fai... |
public class UsageIndex { /** * Build usage index for given collection of proto files . */
public static UsageIndex build ( Collection < Proto > protos ) { } } | UsageIndex usageIndex = new UsageIndex ( ) ; for ( Proto proto : protos ) { ProtoWalker . newInstance ( proto . getContext ( ) ) . onMessage ( message -> { for ( Field field : message . getFields ( ) ) { usageIndex . register ( field . getType ( ) , message ) ; } } ) . onService ( service -> { for ( ServiceMethod servi... |
public class NodeImpl { /** * Return child Properties list .
* @ return List of child Properties
* @ throws RepositoryException
* if error occurs
* @ throws AccessDeniedException
* if Nodes cannot be listed due to permissions on this Node */
private List < PropertyData > childPropertiesData ( ) throws Reposit... | List < PropertyData > storedProps = new ArrayList < PropertyData > ( dataManager . getChildPropertiesData ( nodeData ( ) ) ) ; Collections . sort ( storedProps , new PropertiesDataOrderComparator < PropertyData > ( ) ) ; return storedProps ; |
public class VirtualCdj { /** * Send a master changed announcement to all registered master listeners .
* @ param update the message announcing the new tempo master */
private void deliverMasterChangedAnnouncement ( final DeviceUpdate update ) { } } | for ( final MasterListener listener : getMasterListeners ( ) ) { try { listener . masterChanged ( update ) ; } catch ( Throwable t ) { logger . warn ( "Problem delivering master changed announcement to listener" , t ) ; } } |
public class OracleDatabase { /** * { @ inheritDoc } */
@ Override public long nextSequence ( final ConnectionResource _con , final String _name ) throws SQLException { } } | final long ret ; final String cmd = new StringBuilder ( ) . append ( "SELECT " + _name + ".nextval from dual" ) . toString ( ) ; final Statement stmt = _con . createStatement ( ) ; try { final ResultSet resultset = stmt . executeQuery ( cmd ) ; if ( resultset . next ( ) ) { ret = resultset . getLong ( 1 ) ; } else { th... |
public class CommerceTaxFixedRateAddressRelPersistenceImpl { /** * Caches the commerce tax fixed rate address rel in the entity cache if it is enabled .
* @ param commerceTaxFixedRateAddressRel the commerce tax fixed rate address rel */
@ Override public void cacheResult ( CommerceTaxFixedRateAddressRel commerceTaxFi... | entityCache . putResult ( CommerceTaxFixedRateAddressRelModelImpl . ENTITY_CACHE_ENABLED , CommerceTaxFixedRateAddressRelImpl . class , commerceTaxFixedRateAddressRel . getPrimaryKey ( ) , commerceTaxFixedRateAddressRel ) ; commerceTaxFixedRateAddressRel . resetOriginalValues ( ) ; |
public class MessagesApi { /** * Get normalized message presence
* Get normalized message presence .
* @ param startDate startDate ( required )
* @ param endDate endDate ( required )
* @ param interval String representing grouping interval . One of : & # 39 ; minute & # 39 ; ( 1 hour limit ) , & # 39 ; hour & #... | ApiResponse < FieldPresenceEnvelope > resp = getFieldPresenceWithHttpInfo ( startDate , endDate , interval , sdid , fieldPresence ) ; return resp . getData ( ) ; |
public class DefaultDependencyDescriptor { /** * { @ inheritDoc } */
@ Override public ArtifactSpec toArtifactSpec ( ) { } } | if ( spec == null ) { spec = new ArtifactSpec ( getScope ( ) , getGroup ( ) , getName ( ) , getVersion ( ) , getType ( ) , getClassifier ( ) , getFile ( ) ) ; } return spec ; |
public class AbstractExcerpt { /** * { @ inheritDoc } */
public String getExcerpt ( String id , int maxFragments , int maxFragmentSize ) throws IOException { } } | IndexReader reader = index . getIndexReader ( ) ; try { checkRewritten ( reader ) ; Term idTerm = new Term ( FieldNames . UUID , id ) ; TermDocs tDocs = reader . termDocs ( idTerm ) ; int docNumber ; Document doc ; try { if ( tDocs . next ( ) ) { docNumber = tDocs . doc ( ) ; doc = reader . document ( docNumber ) ; } e... |
public class ZooKeeperMasterModel { /** * Remove a deployment group .
* < p > If successful , all ZK nodes associated with the DG will be deleted . Specifically these
* nodes are guaranteed to be non - existent after a successful remove ( not all of them might exist
* before , though ) :
* < ul >
* < li > / c... | log . info ( "removing deployment-group: name={}" , name ) ; final ZooKeeperClient client = provider . get ( "removeDeploymentGroup" ) ; try { client . ensurePath ( Paths . configDeploymentGroups ( ) ) ; client . ensurePath ( Paths . statusDeploymentGroups ( ) ) ; client . ensurePath ( Paths . statusDeploymentGroupTask... |
public class JsonbDeSerializer { /** * Initializes the instance with necessary registries .
* @ param typeRegistry
* Mapping from type name to type class .
* @ param deserRegistry
* Mapping from type name to deserializers .
* @ param serRegistry
* Mapping from type name to serializers . */
public void init ... | if ( initialized ) { throw new IllegalStateException ( "Instance already initialized - Don't call the init methods more than once" ) ; } this . typeRegistry = typeRegistry ; for ( final JsonbDeserializer < ? > deserializer : deserializers ) { if ( deserializer instanceof DeserializerRegistryRequired ) { if ( deserRegis... |
public class BoUtils { /** * De - serialize byte array to " document " .
* @ param data
* @ return
* @ since 0.10.0 */
@ SuppressWarnings ( "unchecked" ) public static Map < String , Object > bytesToDocument ( byte [ ] data ) { } } | return data != null && data . length > 0 ? SerializationUtils . fromByteArrayFst ( data , Map . class ) : null ; |
public class ReceiveMessageBuilder { /** * Extract message header entry as variable .
* @ param headerName
* @ param variable
* @ return */
public T extractFromHeader ( String headerName , String variable ) { } } | if ( headerExtractor == null ) { headerExtractor = new MessageHeaderVariableExtractor ( ) ; getAction ( ) . getVariableExtractors ( ) . add ( headerExtractor ) ; } headerExtractor . getHeaderMappings ( ) . put ( headerName , variable ) ; return self ; |
public class HibernateMappingContextConfiguration { /** * Check whether any of the configured entity type filters matches
* the current class descriptor contained in the metadata reader . */
protected boolean matchesFilter ( MetadataReader reader , MetadataReaderFactory readerFactory ) throws IOException { } } | for ( TypeFilter filter : ENTITY_TYPE_FILTERS ) { if ( filter . match ( reader , readerFactory ) ) { return true ; } } return false ; |
public class Table { /** * Returns array for a new row with SQL DEFAULT value for each column n
* where exists [ n ] is false . This provides default values only where
* required and avoids evaluating these values where they will be
* overwritten . */
Object [ ] getNewRowData ( Session session ) { } } | Object [ ] data = new Object [ getColumnCount ( ) ] ; int i ; if ( hasDefaultValues ) { for ( i = 0 ; i < getColumnCount ( ) ; i ++ ) { Expression def = colDefaults [ i ] ; if ( def != null ) { data [ i ] = def . getValue ( session , colTypes [ i ] ) ; } } } return data ; |
public class CharacterRangeImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case XtextPackage . CHARACTER_RANGE__LEFT : return left != null ; case XtextPackage . CHARACTER_RANGE__RIGHT : return right != null ; } return super . eIsSet ( featureID ) ; |
public class HyperionClient { /** * Execute the request
* @ param request The data service request
* @ return The HTTP response */
protected Response executeRequest ( Request request ) { } } | try { com . squareup . okhttp . Request httpRequest = buildHttpRequest ( request ) ; if ( logger . isInfoEnabled ( ) ) logger . info ( "Sending request: {} {}" , httpRequest . method ( ) , httpRequest . urlString ( ) ) ; if ( logger . isDebugEnabled ( ) && request . getRequestMethod ( ) . isBodyRequest ( ) ) { Buffer b... |
public class Forwarder { /** * Clear history to the first matched locationId . For example , current history is
* A - > B - > A - > C - > B , clearToLocationId ( " A " ) will pop B and C and leave the back stack as A - > B - > A .
* < p > Note that , if { @ link # clearAll ( ) } is called , this method has no effec... | clearHistory = true ; clearToLocationId = clearTo . getName ( ) ; return this ; |
public class HiveProxyQueryExecutor { /** * Execute query .
* @ param query the query
* @ param proxy the proxy
* @ throws SQLException the sql exception */
public void executeQuery ( String query , Optional < String > proxy ) throws SQLException { } } | executeQueries ( Collections . singletonList ( query ) , proxy ) ; |
public class VpcSecurityGroupMembershipMarshaller { /** * Marshall the given parameter object . */
public void marshall ( VpcSecurityGroupMembership vpcSecurityGroupMembership , ProtocolMarshaller protocolMarshaller ) { } } | if ( vpcSecurityGroupMembership == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( vpcSecurityGroupMembership . getVpcSecurityGroupId ( ) , VPCSECURITYGROUPID_BINDING ) ; protocolMarshaller . marshall ( vpcSecurityGroupMembership . getStatus... |
public class WritableFactory { /** * Create a new writable instance ( using reflection ) given the specified key
* @ param writableTypeKey Key to create a new writable instance for
* @ return A new ( empty / default ) Writable instance */
public Writable newWritable ( short writableTypeKey ) { } } | Constructor < ? extends Writable > c = constructorMap . get ( writableTypeKey ) ; if ( c == null ) { throw new IllegalStateException ( "Unknown writable key: " + writableTypeKey ) ; } try { return c . newInstance ( ) ; } catch ( Exception e ) { throw new RuntimeException ( "Could not create new Writable instance" ) ; } |
public class BucketPath { /** * A wrapper around
* { @ link BucketPath # escapeString ( String , Map , TimeZone , boolean , int , int ,
* boolean ) }
* with the timezone set to the default . */
public static String escapeString ( String in , Map < String , String > headers , boolean needRounding , int unit , int ... | return escapeString ( in , headers , null , needRounding , unit , roundDown , false ) ; |
public class Debug { public void doPost ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { } } | String target = null ; Log l = LogFactory . getLog ( Debug . class ) ; if ( ! ( l instanceof LogImpl ) ) return ; LogImpl log = ( LogImpl ) l ; String action = request . getParameter ( "Action" ) ; if ( "Set Options" . equals ( action ) ) { log . setDebug ( "on" . equals ( request . getParameter ( "D" ) ) ) ; log . set... |
public class IdentityHttpHeaderProcessor { /** * / * ( non - Javadoc )
* @ see org . archive . wayback . replay . HttpHeaderProcessor # filter ( java . util . Map , java . lang . String , java . lang . String , org . archive . wayback . ResultURIConverter , org . archive . wayback . core . CaptureSearchResult ) */
pu... | if ( key . equalsIgnoreCase ( HTTP_TRANSFER_ENCODING_HEADER_UP ) ) preserve ( output , key , value ) ; else output . put ( key , value ) ; |
public class DescribeUsersRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeUsersRequest describeUsersRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeUsersRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeUsersRequest . getAuthenticationType ( ) , AUTHENTICATIONTYPE_BINDING ) ; protocolMarshaller . marshall ( describeUsersRequest . getMaxResults ( ) , MAXRESU... |
public class BasicExecutionHandler { /** * < p > Throws a { @ link InvocationException } with the { @ link InvocationContext } . < / p >
* < p > See { @ link ExecutionHandler # onError ( InvocationContext , Exception ) } < / p >
* @ param context
* the { @ link InvocationContext } with information on the proxy in... | throw InvocationException . newInstance ( context , error ) ; |
public class ModelElementTypeImpl { /** * Resolve all types recursively which are extending this type
* @ param allExtendingTypes set of calculated extending types */
public void resolveExtendingTypes ( Set < ModelElementType > allExtendingTypes ) { } } | for ( ModelElementType modelElementType : extendingTypes ) { ModelElementTypeImpl modelElementTypeImpl = ( ModelElementTypeImpl ) modelElementType ; if ( ! allExtendingTypes . contains ( modelElementTypeImpl ) ) { allExtendingTypes . add ( modelElementType ) ; modelElementTypeImpl . resolveExtendingTypes ( allExtending... |
public class AbcGrammar { /** * nth - repeat : : = " [ " ( nth - repeat - num / nth - repeat - text )
* for compatibility , accepts ( " : | " / " | " ) nth - repeat - num */
Rule NthRepeat ( ) { } } | return FirstOf ( SequenceS ( String ( "[" ) . label ( Barline ) . suppressSubnodes ( ) , FirstOfS ( NthRepeatNum ( ) , NthRepeatText ( ) ) ) , SequenceS ( Sequence ( ZeroOrMore ( ':' ) , "|" ) . label ( Barline ) . suppressSubnodes ( ) , NthRepeatNum ( ) ) ) . label ( NthRepeat ) ; |
public class Bzip2BitReader { /** * Reads up to 32 bits from the { @ link ByteBuf } .
* @ param count The number of bits to read ( maximum { @ code 32 } as a size of { @ code int } )
* @ return The bits requested , right - aligned within the integer */
int readBits ( final int count ) { } } | if ( count < 0 || count > 32 ) { throw new IllegalArgumentException ( "count: " + count + " (expected: 0-32 )" ) ; } int bitCount = this . bitCount ; long bitBuffer = this . bitBuffer ; if ( bitCount < count ) { long readData ; int offset ; switch ( in . readableBytes ( ) ) { case 1 : { readData = in . readUnsignedByte... |
public class DefaultJiraClient { /** * Construct Feature object
* @ param issue
* @ return Feature */
@ SuppressWarnings ( "PMD.NPathComplexity" ) protected Feature getFeature ( JSONObject issue , Team board ) { } } | Feature feature = new Feature ( ) ; feature . setsId ( getString ( issue , "id" ) ) ; feature . setsNumber ( getString ( issue , "key" ) ) ; JSONObject fields = ( JSONObject ) issue . get ( "fields" ) ; JSONObject epic = ( JSONObject ) fields . get ( "epic" ) ; String epicId = getString ( fields , featureSettings . get... |
public class AbstractValidate { /** * Method without varargs to increase performance */
public < T > T [ ] noNullElements ( final T [ ] array , final String message ) { } } | notNull ( array ) ; final int index = indexOfNullElement ( array ) ; if ( index != - 1 ) { fail ( String . format ( message , index ) ) ; } return array ; |
public class AbstractRedisStorage { /** * Check if the trigger identified by the given key exists
* @ param triggerKey the key of the desired trigger
* @ param jedis a thread - safe Redis connection
* @ return true if the trigger exists ; false otherwise */
public boolean checkExists ( TriggerKey triggerKey , T j... | return jedis . exists ( redisSchema . triggerHashKey ( triggerKey ) ) ; |
public class Hashes { /** * Preprocesses a bit vector so that SpookyHash 4 - word - state can be computed
* in constant time on all prefixes .
* @ param bv
* a bit vector .
* @ param seed
* a seed for the hash .
* @ return an array containing the four internal words of state during the
* hash computation ... | final long length = bv . length ( ) ; if ( length < Long . SIZE * 2 ) return null ; final long [ ] state = new long [ 4 * ( int ) ( length + Long . SIZE * 2 ) / ( 4 * Long . SIZE ) ] ; long h0 , h1 , h2 , h3 ; h0 = seed ; h1 = seed ; h2 = ARBITRARY_BITS ; h3 = ARBITRARY_BITS ; long remaining = length ; long pos = 0 ; i... |
public class RemoteEnvironment { @ Override public JobExecutionResult execute ( String jobName ) throws Exception { } } | PlanExecutor executor = getExecutor ( ) ; Plan p = createProgramPlan ( jobName ) ; // Session management is disabled , revert this commit to enable
// p . setJobId ( jobID ) ;
// p . setSessionTimeout ( sessionTimeout ) ;
JobExecutionResult result = executor . executePlan ( p ) ; this . lastJobExecutionResult = result ... |
public class FirefoxFilter { /** * Note : we don ' t take a dependency on the FirefoxDriver jar as it might not be on the classpath */
@ Override public Map < String , Object > apply ( Map < String , Object > unmodifiedCaps ) { } } | Map < String , Object > caps = unmodifiedCaps . entrySet ( ) . parallelStream ( ) . filter ( entry -> ( "browserName" . equals ( entry . getKey ( ) ) && "firefox" . equals ( entry . getValue ( ) ) ) || entry . getKey ( ) . startsWith ( "firefox_" ) || entry . getKey ( ) . startsWith ( "moz:" ) ) . filter ( entry -> Obj... |
public class CmsSitemapView { /** * Adds the gallery tree items to the parent . < p >
* @ param parent the parent item
* @ param galleries the gallery folder entries */
private void addGalleryEntries ( CmsGalleryTreeItem parent , List < CmsGalleryFolderEntry > galleries ) { } } | for ( CmsGalleryFolderEntry galleryFolder : galleries ) { CmsGalleryTreeItem folderItem = createGalleryFolderItem ( galleryFolder ) ; parent . addChild ( folderItem ) ; m_galleryTreeItems . put ( galleryFolder . getStructureId ( ) , folderItem ) ; addGalleryEntries ( folderItem , galleryFolder . getSubGalleries ( ) ) ;... |
public class EnhancedDebuggerWindow { /** * Notification that the root window is closing . Stop listening for received and
* transmitted packets in all the debugged connections .
* @ param evt the event that indicates that the root window is closing */
private synchronized void rootWindowClosing ( WindowEvent evt )... | // Notify to all the debuggers to stop debugging
for ( EnhancedDebugger debugger : debuggers ) { debugger . cancel ( ) ; } // Release any reference to the debuggers
debuggers . clear ( ) ; // Release the default instance
instance = null ; frame = null ; notifyAll ( ) ; |
public class AggregatorExtension { /** * / * ( non - Javadoc )
* @ see com . ibm . jaggr . service . IAggregator . ILoadedExtension # getInstance ( ) */
@ Override public Object getInstance ( ) { } } | final String sourceMethod = "getInstance" ; // $ NON - NLS - 1 $
boolean isTraceLogging = log . isLoggable ( Level . FINER ) ; if ( isTraceLogging ) { log . entering ( AggregatorExtension . class . getName ( ) , sourceMethod ) ; log . exiting ( AggregatorExtension . class . getName ( ) , sourceMethod , instance ) ; } r... |
public class ShareResultMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ShareResult shareResult , ProtocolMarshaller protocolMarshaller ) { } } | if ( shareResult == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( shareResult . getPrincipalId ( ) , PRINCIPALID_BINDING ) ; protocolMarshaller . marshall ( shareResult . getInviteePrincipalId ( ) , INVITEEPRINCIPALID_BINDING ) ; protocolM... |
public class OADProfile { /** * Set the state to INACTIVE and clear state variables */
private void reset ( ) { } } | setState ( OADState . INACTIVE ) ; currentImage = null ; firmwareBundle = null ; nextBlock = 0 ; oadListener = null ; watchdog . stop ( ) ; oadApproval . reset ( ) ; |
public class DataSet { /** * Writes a DataSet to the standard output streams ( stdout ) of the TaskManagers that execute
* the program ( or more specifically , the data sink operators ) . On a typical cluster setup , the
* data will appear in the TaskManagers ' < i > . out < / i > files .
* < p > To print the dat... | return output ( new PrintingOutputFormat < T > ( prefix , false ) ) ; |
public class VdmEditor { /** * Synchronizes the outliner selection with the given element position in
* the editor .
* @ param element
* the java element to select */
protected void synchronizeOutlinePage ( INode element ) { } } | // TODO : don ' t search for mutexes
if ( element instanceof AMutexSyncDefinition ) return ; if ( element instanceof ABlockSimpleBlockStm ) return ; try { synchronizeOutlinePage ( element , false ) ; // true
} catch ( Exception e ) { } |
public class VirtualJarFileInputStream { /** * Close the current entry , and calculate the crc value .
* @ throws IOException if any problems occur */
private void closeCurrent ( ) throws IOException { } } | virtualJarInputStream . closeEntry ( ) ; currentEntry . crc = crc . getValue ( ) ; crc . reset ( ) ; |
public class Locale { /** * This method must be called only for creating the Locale . *
* constants due to making shortcuts . */
private static Locale createConstant ( String lang , String country ) { } } | BaseLocale base = BaseLocale . createInstance ( lang , country ) ; return getInstance ( base , null ) ; |
public class Query { /** * / * ( non - Javadoc )
* @ see org . eclipse . datatools . connectivity . oda . IQuery # setObject ( java . lang . String , java . lang . Object ) */
public void setObject ( String parameterName , Object value ) throws OdaException { } } | // only applies to named input parameter
parameters . put ( parameterName , value ) ; |
public class ExportSupport { /** * Check if exporting data is supported in the current environment . Exporting is possible in two cases :
* - The master is set to local . In this case any file system , including local FS , will work for exporting .
* - The file system is not local . Local file systems do not work i... | // Anything is supported with a local master . Regex matches ' local ' , ' local [ DIGITS ] ' or ' local [ * ] '
if ( sparkMaster . matches ( "^local(\\[(\\d+|\\*)])?$" ) ) { return true ; } // Clustered mode is supported as long as the file system is not a local one
return ! fs . getUri ( ) . getScheme ( ) . equals ( ... |
public class AponSyntaxException { /** * Create a detail message .
* @ param lineNumber the line number
* @ param line the character line
* @ param tline the trimmed character line
* @ param msg the message
* @ return the detail message */
private static String makeMessage ( int lineNumber , String line , Str... | int columnNumber = ( tline != null ? line . indexOf ( tline ) : 0 ) ; StringBuilder sb = new StringBuilder ( ) ; if ( msg != null ) { sb . append ( msg ) ; } sb . append ( " [lineNumber: " ) . append ( lineNumber ) ; if ( columnNumber != - 1 ) { String lspace = line . substring ( 0 , columnNumber ) ; int tabCnt = Strin... |
public class AccountFiltersInner { /** * Update an Account Filter .
* Updates an existing Account Filter in the Media Services account .
* @ param resourceGroupName The name of the resource group within the Azure subscription .
* @ param accountName The Media Services account name .
* @ param filterName The Acc... | return ServiceFuture . fromResponse ( updateWithServiceResponseAsync ( resourceGroupName , accountName , filterName , parameters ) , serviceCallback ) ; |
public class JobInstanceSqlMapDao { /** * TODO : ( ketan ) do we really need to reload the current state from DB ? */
private void logIfJobIsCompleted ( JobInstance jobInstance ) { } } | JobState currentState = getCurrentState ( jobInstance . getId ( ) ) ; if ( currentState . isCompleted ( ) && ! jobInstance . isCopy ( ) ) { String message = String . format ( "State change for a completed Job is not allowed. Job %s is currently State=%s, Result=%s" , jobInstance . getIdentifier ( ) , jobInstance . getS... |
public class SimpleAttachable { /** * { @ inheritDoc } */
public synchronized < T > T getAttachment ( final AttachmentKey < T > key ) { } } | if ( key == null ) { return null ; } return key . cast ( attachments . get ( key ) ) ; |
public class DummyBaseTransactionManager { /** * Rolls back the transaction associated with the calling thread .
* @ throws IllegalStateException If the transaction is in a state where it cannot be rolled back . This could be
* because the calling thread is not associated with a transaction , or because it is in
... | Transaction tx = getTransaction ( ) ; if ( tx == null ) throw new IllegalStateException ( "no transaction associated with thread" ) ; tx . rollback ( ) ; // Disassociate tx from thread .
setTransaction ( null ) ; |
public class StructureTools { /** * Returns an array of the requested Atoms from the Structure object .
* Iterates over all groups and checks if the requested atoms are in this
* group , no matter if this is a { @ link AminoAcid } or { @ link HetatomImpl }
* group . If the group does not contain all requested ato... | List < Chain > chains = s . getModel ( 0 ) ; List < Atom > atoms = new ArrayList < Atom > ( ) ; extractAtoms ( atomNames , chains , atoms ) ; return atoms . toArray ( new Atom [ atoms . size ( ) ] ) ; |
public class Moment { /** * / * [ deutsch ]
* < p > Konstruiert einen neuen UTC - Zeitstempel mit Hilfe von
* Zeitkoordinaten auf der angegebenen Zeitskala . < / p >
* < p > Die angegebene verstrichene Zeit { @ code elapsedTime } wird intern
* in die UTC - Epochenzeit umgerechnet , sollte eine andere Zeitskala ... | if ( ( elapsedTime == 0 ) && ( nanosecond == 0 ) && ( scale == POSIX ) ) { return Moment . UNIX_EPOCH ; } return new Moment ( elapsedTime , nanosecond , scale ) ; |
public class JSONs { /** * Read an optional integer .
* @ param o the object to parse
* @ param id the key in the map that points to an integer
* @ param def the default integer value if the key is absent
* @ return the resulting integer
* @ throws JSONConverterException if the key does not point to a int */
... | if ( o . containsKey ( id ) ) { try { return ( Integer ) o . get ( id ) ; } catch ( ClassCastException e ) { throw new JSONConverterException ( "Unable to read a int from string '" + id + "'" , e ) ; } } return def ; |
public class ImageStatistics { /** * Returns the sum of all the pixels in the image .
* @ param img Input image . Not modified . */
public static long sum ( InterleavedS64 img ) { } } | if ( BoofConcurrency . USE_CONCURRENT ) { return ImplImageStatistics_MT . sum ( img ) ; } else { return ImplImageStatistics . sum ( img ) ; } |
public class MethodCallImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case SimpleExpressionsPackage . METHOD_CALL__VALUE : return VALUE_EDEFAULT == null ? value != null : ! VALUE_EDEFAULT . equals ( value ) ; } return super . eIsSet ( featureID ) ; |
public class FormatDate { /** * Create the internal Formatter instance and perform the formatting .
* @ throws JspException if a JSP exception has occurred */
public void doTag ( ) throws JspException { } } | JspTag parentTag = SimpleTagSupport . findAncestorWithClass ( this , IFormattable . class ) ; // if there are errors we need to either add these to the parent AbstractBastTag or report an error .
if ( hasErrors ( ) ) { if ( parentTag instanceof IFormattable ) { IFormattable parent = ( IFormattable ) parentTag ; parent ... |
public class QuartzScheduler { /** * Add ( register ) the given < code > Calendar < / code > to the Scheduler .
* @ throws SchedulerException
* if there is an internal Scheduler error , or a Calendar with the
* same name already exists , and < code > replace < / code > is
* < code > false < / code > . */
public... | validateState ( ) ; m_aResources . getJobStore ( ) . storeCalendar ( calName , calendar , replace , updateTriggers ) ; |
public class GVRBoundsPicker { /** * Tests the bounding volumes of a set of scene objects against
* all the colliders the scene and returns a list of collisions .
* This function is not meant for general collision detection
* but can be used to implement simple bounds - based collisions .
* Inside GearVRF it is... | sFindObjectsLock . lock ( ) ; try { final GVRPickedObject [ ] result = NativePicker . pickBounds ( scene . getNative ( ) , collidables ) ; if ( result == null ) { return sEmptyList ; } return result ; } finally { sFindObjectsLock . unlock ( ) ; } |
public class MenuUtil { /** * Adds a new menu item to the menu with the specified name and
* attributes .
* @ param l the action listener .
* @ param menu the menu to add the item to .
* @ param name the item name .
* @ param mnem the mnemonic key for the item .
* @ return the new menu item . */
public stat... | return addMenuItem ( l , menu , name , Integer . valueOf ( mnem ) , null ) ; |
public class ImageLocalNormalization { /** * < p > Normalizes the input image such that local statics are a zero mean and with standard deviation
* of 1 . The image border is handled by truncating the kernel and renormalizing it so that it ' s sum is
* still one . < / p >
* < p > output [ x , y ] = ( input [ x , ... | // check preconditions and initialize data structures
initialize ( input , output ) ; // avoid overflow issues by ensuring that the max pixel value is 1
T adjusted = ensureMaxValueOfOne ( input , maxPixelValue ) ; // take advantage of 2D gaussian kernels being separable
if ( border == null ) { WorkArrays work = General... |
public class ThreadLocalBuilderBasedDeserializer { /** * Copied from { @ code com . fasterxml . jackson . databind . deser . BuilderBasedDeserializer }
* and modified to use { @ link ThreadLocalBuilder } instantiation and build . */
private Object vanillaDeserializeAndFinishBuild ( final JsonParser p , final Deserial... | try { return ThreadLocalBuilder . buildGeneric ( _threadLocalBuilderClass , b -> { Object bean = b ; try { while ( p . getCurrentToken ( ) != JsonToken . END_OBJECT ) { final String propName = p . getCurrentName ( ) ; // Skip field name :
p . nextToken ( ) ; final SettableBeanProperty prop = _beanProperties . find ( pr... |
public class LibertyFeaturesToMavenRepo { /** * Add Maven coordinates into the modified JSON file .
* @ param modifiedJsonFile
* The location to write the modified JSON file .
* @ param jsonArray
* The original JSON array of all features .
* @ param features
* The map of symbolic names to LibertyFeature obj... | JsonArrayBuilder jsonArrayBuilder = Json . createArrayBuilder ( ) ; for ( int i = 0 ; i < jsonArray . size ( ) ; i ++ ) { JsonObject jsonObject = jsonArray . getJsonObject ( i ) ; JsonObjectBuilder jsonObjectBuilder = Json . createObjectBuilder ( jsonObject ) ; JsonObject wlpInfo = jsonObject . getJsonObject ( Constant... |
public class BlockAutomaton { /** * Retrieves a list of outgoing edges of a block ( state ) .
* @ param block
* the block ( state ) .
* @ return the outgoing edges of the given block ( state ) . */
public List < BlockEdge < S , L > > getOutgoingEdges ( Block < S , L > block ) { } } | return Arrays . asList ( edges [ block . getId ( ) ] ) ; |
public class OptionGroupOption { /** * The versions that are available for the option .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setOptionGroupOptionVersions ( java . util . Collection ) } or
* { @ link # withOptionGroupOptionVersions ( java . util .... | if ( this . optionGroupOptionVersions == null ) { setOptionGroupOptionVersions ( new com . amazonaws . internal . SdkInternalList < OptionVersion > ( optionGroupOptionVersions . length ) ) ; } for ( OptionVersion ele : optionGroupOptionVersions ) { this . optionGroupOptionVersions . add ( ele ) ; } return this ; |
public class ModelMigration { /** * { @ inheritDoc } */
@ Override public String generateMigration ( ) throws IOException { } } | if ( scriptInfo != null ) { return null ; } if ( diff == null ) { diff ( ) ; } setOffline ( ) ; String version = null ; try { if ( diff . isEmpty ( ) ) { logger . info ( "no changes detected - no migration written" ) ; return null ; } // there were actually changes to write
Migration dbMigration = diff . getMigration (... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.