signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class KamImpl { /** * { @ inheritDoc } */
@ Override public Set < KamNode > getAdjacentNodes ( KamNode kamNode , EdgeDirectionType edgeDirection , EdgeFilter edgeFilter , NodeFilter nodeFilter ) { } } | Set < KamNode > adjacentNodes = new LinkedHashSet < KamNode > ( ) ; KamNode node = null ; if ( EdgeDirectionType . FORWARD == edgeDirection || EdgeDirectionType . BOTH == edgeDirection ) { final Set < KamEdge > sources = nodeSourceMap . get ( kamNode ) ; if ( hasItems ( sources ) ) { for ( KamEdge kamEdge : sources ) {... |
public class JMElasticsearchIndex { /** * Upsert data with object mapper update response .
* @ param sourceObject the source object
* @ param index the index
* @ param type the type
* @ param id the id
* @ return the update response */
public UpdateResponse upsertDataWithObjectMapper ( Object sourceObject , S... | return upsertData ( JMElasticsearchUtil . buildSourceByJsonMapper ( sourceObject ) , index , type , id ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < }
* { @ link EnumIncludeRelationships } { @ code > } */
@ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "includeRelationships" , scope = GetDescendants . class ) public JAXBElement... | return new JAXBElement < EnumIncludeRelationships > ( _GetObjectOfLatestVersionIncludeRelationships_QNAME , EnumIncludeRelationships . class , GetDescendants . class , value ) ; |
public class LOCI { /** * Run the algorithm
* @ param database Database to process
* @ param relation Relation to process
* @ return Outlier result */
public OutlierResult run ( Database database , Relation < O > relation ) { } } | DistanceQuery < O > distFunc = database . getDistanceQuery ( relation , getDistanceFunction ( ) ) ; RangeQuery < O > rangeQuery = database . getRangeQuery ( distFunc ) ; DBIDs ids = relation . getDBIDs ( ) ; // LOCI preprocessing step
WritableDataStore < DoubleIntArrayList > interestingDistances = DataStoreUtil . makeS... |
public class SimulatorTaskTracker { /** * Creates a signal for itself marking the completion of a task attempt .
* It assumes that the task attempt hasn ' t made any progress in the user
* space code so far , i . e . it is called right at launch for map tasks and
* immediately after all maps completed for reduce ... | // We need to clone ( ) status as we modify and it goes into an Event
TaskStatus status = ( TaskStatus ) tip . getTaskStatus ( ) . clone ( ) ; long delta = tip . getUserSpaceRunTime ( ) ; assert delta >= 0 : "TaskAttempt " + tip . getTaskStatus ( ) . getTaskID ( ) + " has negative UserSpaceRunTime = " + delta ; long fi... |
public class ThingAttributeMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ThingAttribute thingAttribute , ProtocolMarshaller protocolMarshaller ) { } } | if ( thingAttribute == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( thingAttribute . getThingName ( ) , THINGNAME_BINDING ) ; protocolMarshaller . marshall ( thingAttribute . getThingTypeName ( ) , THINGTYPENAME_BINDING ) ; protocolMarsha... |
public class AbstractRectangularShape1dfx { /** * Replies the property that is the height of the box .
* @ return the height property . */
@ Pure public DoubleProperty heightProperty ( ) { } } | if ( this . height == null ) { this . height = new SimpleDoubleProperty ( this , MathFXAttributeNames . HEIGHT ) ; this . height . bind ( Bindings . subtract ( maxYProperty ( ) , minYProperty ( ) ) ) ; } return this . height ; |
public class CreateVoiceConnectorRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateVoiceConnectorRequest createVoiceConnectorRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createVoiceConnectorRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createVoiceConnectorRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( createVoiceConnectorRequest . getRequireEncryption ( ) , REQUIRE... |
public class ComponentExposedTypeGenerator { /** * Process Vue Props from the { @ link IsVueComponent } Class . */
private void processProps ( ) { } } | ElementFilter . fieldsIn ( component . getEnclosedElements ( ) ) . stream ( ) . filter ( field -> hasAnnotation ( field , Prop . class ) ) . forEach ( field -> { String propName = field . getSimpleName ( ) . toString ( ) ; Prop prop = field . getAnnotation ( Prop . class ) ; collectionFieldsValidator . validateComponen... |
public class DataJoinReducerBase { /** * join the list of the value lists , and collect the results .
* @ param tags
* a list of input tags
* @ param values
* a list of value lists , each corresponding to one input source
* @ param key
* @ param output
* @ throws IOException */
private void joinAndCollect... | if ( values . length < 1 ) { return ; } Object [ ] partialList = new Object [ values . length ] ; joinAndCollect ( tags , values , 0 , partialList , key , output , reporter ) ; |
public class CPadawan { /** * Return an instance of the padawan
* @ return may the force be with you ! */
public static final CPadawan getInstance ( ) { } } | try { mutex . acquire ( ) ; CPadawan toReturn = ( handle == null ) ? ( handle = new CPadawan ( ) ) : handle ; toReturn . init ( ) ; return toReturn ; } finally { try { mutex . release ( ) ; } catch ( Exception ignore ) { } } |
public class CommonUtils { /** * String Long turn number .
* @ param num The number of strings .
* @ param defaultLong The default value
* @ return long */
public static long parseLong ( String num , long defaultLong ) { } } | if ( num == null ) { return defaultLong ; } else { try { return Long . parseLong ( num ) ; } catch ( Exception e ) { return defaultLong ; } } |
public class ParameterBuilder { /** * Builds the parameter definition .
* @ return Parameter definition */
public Parameter < T > build ( ) { } } | if ( this . name == null ) { throw new IllegalArgumentException ( "Name is missing." ) ; } if ( this . type == null ) { throw new IllegalArgumentException ( "Type is missing." ) ; } return new Parameter < T > ( this . name , this . type , this . applicationId , this . defaultOsgiConfigProperty , this . defaultValue , n... |
public class DeploymentUtils { /** * Get all resource roots for a { @ link DeploymentUnit }
* @ param deploymentUnit The deployment unit
* @ return The deployment root and any additional resource roots */
public static List < ResourceRoot > allResourceRoots ( DeploymentUnit deploymentUnit ) { } } | List < ResourceRoot > roots = new ArrayList < ResourceRoot > ( ) ; // not all deployment units have a deployment root
final ResourceRoot deploymentRoot = deploymentUnit . getAttachment ( Attachments . DEPLOYMENT_ROOT ) ; if ( deploymentRoot != null ) roots . add ( deploymentRoot ) ; roots . addAll ( deploymentUnit . ge... |
public class WVideoRenderer { /** * Paints the given WVideo .
* @ param component the WVideo to paint .
* @ param renderContext the RenderContext to paint to . */
@ Override public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { } } | WVideo videoComponent = ( WVideo ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; Video [ ] video = videoComponent . getVideo ( ) ; if ( video == null || video . length == 0 ) { return ; } Track [ ] tracks = videoComponent . getTracks ( ) ; WVideo . Controls controls = videoComponent . getControls (... |
public class StackTraceSampleCoordinator { /** * Shuts down the coordinator .
* < p > After shut down , no further operations are executed . */
public void shutDown ( ) { } } | synchronized ( lock ) { if ( ! isShutDown ) { LOG . info ( "Shutting down stack trace sample coordinator." ) ; for ( PendingStackTraceSample pending : pendingSamples . values ( ) ) { pending . discard ( new RuntimeException ( "Shut down" ) ) ; } pendingSamples . clear ( ) ; isShutDown = true ; } } |
public class BirthDateFromAncestorsEstimator { /** * Try recursing through the ancestors to find a marriage date .
* @ param localDate if not null we already have a better estimate
* @ return an estimate based on some ancestor ' s marriage date */
public LocalDate estimateFromMarriage ( final LocalDate localDate ) ... | if ( localDate != null ) { return localDate ; } final PersonNavigator navigator = new PersonNavigator ( person ) ; final List < Family > families = navigator . getFamiliesC ( ) ; LocalDate date = null ; for ( final Family family : families ) { date = processMarriageDate ( date , family ) ; date = childAdjustment ( date... |
public class FileFormatDataSchemaParser { /** * Append source files that were resolved through { @ link DataSchemaResolver } to the provided list .
* @ param result to append the files that were resolved through { @ link DataSchemaResolver } . */
private void appendSourceFilesFromSchemaResolver ( ParseResult result )... | for ( Map . Entry < String , DataSchemaLocation > entry : _schemaResolver . nameToDataSchemaLocations ( ) . entrySet ( ) ) { final File sourceFile = entry . getValue ( ) . getSourceFile ( ) ; if ( sourceFile != null ) { result . getSourceFiles ( ) . add ( sourceFile ) ; } } |
public class HttpUtils { /** * Execute post http response .
* @ param url the url
* @ param entity the json entity
* @ param parameters the parameters
* @ return the http response */
public static HttpResponse executePost ( final String url , final String entity , final Map < String , Object > parameters ) { } ... | return executePost ( url , null , null , entity , parameters ) ; |
public class ConditionalRowMutation { /** * Creates a new instance of the mutation builder . */
public static ConditionalRowMutation create ( String tableId , String rowKey ) { } } | return create ( tableId , ByteString . copyFromUtf8 ( rowKey ) ) ; |
public class URIBuilder { /** * Builds a dataset URI from the given repository URI string , namespace , and
* dataset name .
* @ param repoUri a repository URI string
* @ param namespace a String namespace
* @ param dataset a String dataset name
* @ return a dataset URI for the namespace and dataset name in t... | return build ( URI . create ( repoUri ) , namespace , dataset ) ; |
public class UtlProperties { /** * < p > Evaluate string array ( include non - unique ) properties
* from string with comma delimeter
* and removed new lines and trailing spaces . < / p >
* @ param pSource string
* @ return String [ ] array */
public final String [ ] evalPropsStringsArray ( final String pSource... | List < String > resultList = evalPropsStringsList ( pSource ) ; return resultList . toArray ( new String [ resultList . size ( ) ] ) ; |
public class AmazonLexModelBuildingClient { /** * Creates an alias for the specified version of the bot or replaces an alias for the specified bot . To change the
* version of the bot that the alias points to , replace the alias . For more information about aliases , see
* < a > versioning - aliases < / a > .
* T... | request = beforeClientExecution ( request ) ; return executePutBotAlias ( request ) ; |
public class ThunderExporterService { /** * / * public String sendDataHTTP ( String uri , Object message ) {
* Gson gson = new Gson ( ) ;
* String data = gson . toJson ( message ) ;
* String urlServer = CoreEngine . getInstance ( ) . getConfig ( ) . getUrlH2hWeb ( ) + uri ;
* System . out . println ( " Send Req... | OperatingSystemMXBean operatingSystemMXBean = ( OperatingSystemMXBean ) ManagementFactory . getOperatingSystemMXBean ( ) ; Double cpuLoadProcess = Double . valueOf ( operatingSystemMXBean . getProcessCpuLoad ( ) * 100 ) ; Double cpuLoadSystem = Double . valueOf ( operatingSystemMXBean . getSystemCpuLoad ( ) * 100 ) ; m... |
public class Filter { /** * Set the value for this filter . Note , in the default implementation , the < code > value < / code >
* must implement { @ link java . io . Serializable } .
* @ param value the value */
public void setValue ( Object value ) { } } | if ( LOGGER . isInfoEnabled ( ) && ! ( value instanceof java . io . Serializable ) ) LOGGER . info ( "Warning: setting a filter value tiat is not serializable. The Filter object is serializable and should contain only serializable state" ) ; _value = value ; |
public class ThriftCodecByteCodeGenerator { /** * Defines the generics bridge method with untyped args to the type specific read method . */
private void defineReadBridgeMethod ( ) { } } | classDefinition . addMethod ( new MethodDefinition ( a ( PUBLIC , BRIDGE , SYNTHETIC ) , "read" , type ( Object . class ) , arg ( "protocol" , TProtocol . class ) ) . addException ( Exception . class ) . loadThis ( ) . loadVariable ( "protocol" ) . invokeVirtual ( codecType , "read" , structType , type ( TProtocol . cl... |
public class FP64 { /** * Extends this fingerprint by the characters
* < code > chars [ start ] . . chars [ start + length - 1 ] < / code > .
* @ return
* the resulting fingerprint . */
public FP64 extend ( char [ ] chars , int start , int len ) { } } | int end = start + len ; for ( int i = start ; i < end ; i ++ ) { extend ( chars [ i ] ) ; } return this ; |
public class GreenPepperXmlRpcServerDelegator { /** * { @ inheritDoc } */
public Vector < ? > getListOfSpecificationLocations ( String repositoryUID , String systemUnderTestName ) { } } | return serviceDelegator . getListOfSpecificationLocations ( repositoryUID , systemUnderTestName ) ; |
public class Hyaline { /** * It lets you create a new DTO starting from the annotation - based
* configuration of your entity . This means that any annotation - based
* configuration for JAXB , Jackson or whatever serialization framework you
* are using on your entity T will be kept . However , if you insert an
... | return dtoFromClass ( entity , dtoTemplate , "Hyaline$Proxy$" + System . currentTimeMillis ( ) ) ; |
public class CameraManager { /** * Allows third party apps to specify the scanning rectangle dimensions , rather than determine
* them automatically based on screen resolution .
* @ param width The width in pixels to scan .
* @ param height The height in pixels to scan . */
public synchronized void setManualFrami... | if ( initialized ) { Point screenResolution = configManager . getScreenResolution ( ) ; if ( width > screenResolution . x ) { width = screenResolution . x ; } if ( height > screenResolution . y ) { height = screenResolution . y ; } int leftOffset = ( screenResolution . x - width ) / 2 ; int topOffset = ( screenResoluti... |
public class XPathException { /** * Find the most contained message .
* @ return The error message of the originating exception . */
public String getMessage ( ) { } } | String lastMessage = super . getMessage ( ) ; Throwable exception = m_exception ; while ( null != exception ) { String nextMessage = exception . getMessage ( ) ; if ( null != nextMessage ) lastMessage = nextMessage ; if ( exception instanceof TransformerException ) { TransformerException se = ( TransformerException ) e... |
public class FileBlockStore { /** * Close file */
public void close ( ) { } } | mmaps . clear ( false ) ; try { unlock ( ) ; } catch ( Exception ign ) { } try { fileChannel . close ( ) ; } catch ( Exception ign ) { } try { raf . close ( ) ; } catch ( Exception ign ) { } fileChannel = null ; raf = null ; validState = false ; |
public class CmsSqlManager { /** * Replaces patterns $ { XXX } by another property value , if XXX is a property key with a value . < p > */
protected synchronized void replaceQuerySearchPatterns ( ) { } } | String currentKey = null ; String currentValue = null ; int startIndex = 0 ; int endIndex = 0 ; int lastIndex = 0 ; Iterator < String > allKeys = m_queries . keySet ( ) . iterator ( ) ; while ( allKeys . hasNext ( ) ) { currentKey = allKeys . next ( ) ; currentValue = m_queries . get ( currentKey ) ; startIndex = 0 ; e... |
public class AppServiceCertificateOrdersInner { /** * Verify domain ownership for this certificate order .
* Verify domain ownership for this certificate order .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param certificateOrderName Name of the certificate order .
... | verifyDomainOwnershipWithServiceResponseAsync ( resourceGroupName , certificateOrderName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class UpdateAppRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdateAppRequest updateAppRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( updateAppRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateAppRequest . getAppId ( ) , APPID_BINDING ) ; protocolMarshaller . marshall ( updateAppRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( up... |
public class StorageHandlerImpl { /** * asciidoctor Documentation - tag : : storageHandlerSave [ ] */
public void saveObject ( String breadcrumb , Object object ) { } } | preferences . put ( hash ( breadcrumb ) , gson . toJson ( object ) ) ; |
public class JmsManagedConnectionFactoryImpl { /** * default bus name is " DEFAULT " , null bus name is not valid . */
@ Override public String getBusName ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getBusName" ) ; String busName = jcaConnectionFactory . getBusName ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getBusName" , busName ) ; return busName... |
public class CleverTapAPI { /** * Use this method to opt the current user out of all event / profile tracking .
* You must call this method separately for each active user profile ( e . g . when switching user profiles using onUserLogin ) .
* Once enabled , no events will be saved remotely or locally for the curren... | "unused" , "WeakerAccess" } ) public void setOptOut ( boolean userOptOut ) { final boolean enable = userOptOut ; postAsyncSafely ( "setOptOut" , new Runnable ( ) { @ Override public void run ( ) { // generate the data for a profile push to alert the server to the optOut state change
HashMap < String , Object > optOutMa... |
public class ListDeviceEventsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListDeviceEventsRequest listDeviceEventsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listDeviceEventsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listDeviceEventsRequest . getDeviceId ( ) , DEVICEID_BINDING ) ; protocolMarshaller . marshall ( listDeviceEventsRequest . getFromTimeStamp ( ) , FROMTIMESTAMP_B... |
public class NameService { /** * This method will create a unique name for an INameable object . The name
* will be unque within the session . This will throw an IllegalStateException
* if INameable . setObjectName has previously been called on object .
* @ param namePrefix The prefix of the generated name .
* ... | String name = namePrefix + Integer . toString ( _nextValue ++ ) ; object . setObjectName ( name ) ; |
public class AbstractNucleotideCompoundSet { /** * Loops through all known nucleotides and attempts to find which are
* equivalent to each other . Also takes into account lower casing
* nucleotides as well as upper - cased ones . */
@ SuppressWarnings ( "unchecked" ) protected void calculateIndirectAmbiguities ( ) ... | Map < NucleotideCompound , List < NucleotideCompound > > equivalentsMap = new HashMap < NucleotideCompound , List < NucleotideCompound > > ( ) ; List < NucleotideCompound > ambiguousCompounds = new ArrayList < NucleotideCompound > ( ) ; for ( NucleotideCompound compound : getAllCompounds ( ) ) { if ( ! compound . isAmb... |
public class JAXRSInvoker { /** * Liberty change start - CXF - 7860 */
private List < Object > reprocessFormParams ( Method method , List < Object > origParams , Message m ) { } } | Form form = null ; boolean hasFormParamAnnotations = false ; Object [ ] newValues = new Object [ origParams . size ( ) ] ; java . lang . reflect . Parameter [ ] methodParams = method . getParameters ( ) ; for ( int i = 0 ; i < methodParams . length ; i ++ ) { if ( Form . class . equals ( methodParams [ i ] . getType ( ... |
public class MessageBuilder { /** * Creates a COMMIT message .
* @ param zxid the id of the committed transaction .
* @ return a protobuf message . */
public static Message buildCommit ( Zxid zxid ) { } } | ZabMessage . Zxid cZxid = toProtoZxid ( zxid ) ; Commit commit = Commit . newBuilder ( ) . setZxid ( cZxid ) . build ( ) ; return Message . newBuilder ( ) . setType ( MessageType . COMMIT ) . setCommit ( commit ) . build ( ) ; |
public class Node { /** * Provides lookup of attributes by key .
* @ param key the key of interest
* @ return the attribute matching the key or < code > null < / code > if no match exists */
public Object attribute ( Object key ) { } } | return ( attributes != null ) ? attributes . get ( key ) : null ; |
public class ConnectionFactoryService { /** * Indicates the level of transaction support .
* @ return constant indicating the transaction support of the resource adapter . */
@ Override public TransactionSupportLevel getTransactionSupport ( ) { } } | // If ManagedConnectionFactory implements TransactionSupport , that takes priority
TransactionSupportLevel transactionSupport = mcf instanceof TransactionSupport ? ( ( TransactionSupport ) mcf ) . getTransactionSupport ( ) : null ; // Otherwise get the value from the deployment descriptor
String prop = ( String ) boots... |
public class RedirectFilter { /** * ( non - Javadoc )
* @ see
* com . microsoft . windowsazure . services . core . IdempotentClientFilter # doHandle
* ( com . sun . jersey . api . client . ClientRequest ) */
@ Override public ClientResponse doHandle ( ClientRequest request ) { } } | if ( request == null ) { throw new IllegalArgumentException ( "Request should not be null" ) ; } URI originalURI = request . getURI ( ) ; request . setURI ( locationManager . getRedirectedURI ( originalURI ) ) ; ClientResponse response = getNext ( ) . handle ( request ) ; while ( response . getClientResponseStatus ( ) ... |
public class AdaBoost { /** * Trims the tree model set to a smaller size in case of over - fitting .
* Or if extra decision trees in the model don ' t improve the performance ,
* we may remove them to reduce the model size and also improve the speed of
* prediction .
* @ param ntrees the new ( smaller ) size of... | if ( ntrees > trees . length ) { throw new IllegalArgumentException ( "The new model size is larger than the current size." ) ; } if ( ntrees <= 0 ) { throw new IllegalArgumentException ( "Invalid new model size: " + ntrees ) ; } if ( ntrees < trees . length ) { trees = Arrays . copyOf ( trees , ntrees ) ; alpha = Arra... |
public class VarTensor { /** * Gets the tensor dimensions : dimension i corresponds to the i ' th variable , and the size of
* that dimension is the number of states for the variable . */
private static int [ ] getDims ( VarSet vars ) { } } | int [ ] dims = new int [ vars . size ( ) ] ; for ( int i = 0 ; i < vars . size ( ) ; i ++ ) { dims [ i ] = vars . get ( i ) . getNumStates ( ) ; } return dims ; |
public class SimpleLibContext { /** * this is the amazing functionality provided by simple - lib */
public void printSetting ( String path ) { } } | System . out . println ( "The setting '" + path + "' is: " + config . getString ( path ) ) ; |
public class Bogosort { /** * Sort the list in descending order using this algorithm .
* @ param < E > the type of elements in this list .
* @ param list the list that we want to sort */
public static < E extends Comparable < E > > void sortDescending ( List < E > list ) { } } | while ( ! Sort . isReverseSorted ( list ) ) { FYShuffle . shuffle ( list ) ; } |
public class ModelsEngine { /** * Evaluate the shadow map calling the shadow method .
* @ param h
* the height of the raster .
* @ param w
* the width of the raster .
* @ param sunVector
* @ param inverseSunVector
* @ param normalSunVector
* @ param demWR
* the elevation map .
* @ param dx
* the r... | double casx = 1e6 * sunVector [ 0 ] ; double casy = 1e6 * sunVector [ 1 ] ; int f_i = 0 ; int f_j = 0 ; if ( casx <= 0 ) { f_i = 0 ; } else { f_i = w - 1 ; } if ( casy <= 0 ) { f_j = 0 ; } else { f_j = h - 1 ; } WritableRaster sOmbraWR = CoverageUtilities . createWritableRaster ( w , h , null , null , 1.0 ) ; int j = f... |
public class Word { /** * Realizes the concatenation of this word with several other words .
* @ param words
* the words to concatenate
* @ return the results of the concatenation */
@ SuppressWarnings ( "unchecked" ) @ Nonnull protected Word < I > concatInternal ( Word < ? extends I > ... words ) { } } | if ( words . length == 0 ) { return this ; } int len = length ( ) ; int totalSize = len ; for ( Word < ? extends I > word : words ) { totalSize += word . length ( ) ; } Object [ ] array = new Object [ totalSize ] ; writeToArray ( 0 , array , 0 , len ) ; int currOfs = len ; for ( Word < ? extends I > w : words ) { int w... |
public class Classfile { /** * Link classes . Not threadsafe , should be run in a single - threaded context .
* @ param classNameToClassInfo
* map from class name to class info
* @ param packageNameToPackageInfo
* map from package name to package info
* @ param moduleNameToModuleInfo
* map from module name ... | boolean isModuleDescriptor = false ; boolean isPackageDescriptor = false ; ClassInfo classInfo = null ; if ( className . equals ( "module-info" ) ) { isModuleDescriptor = true ; } else if ( className . equals ( "package-info" ) || className . endsWith ( ".package-info" ) ) { isPackageDescriptor = true ; } else { // Han... |
public class AWSSdkClient { /** * Get list of { @ link AutoScalingGroup } s for a given tag
* @ param tag Tag to filter the auto scaling groups
* @ return List of { @ link AutoScalingGroup } s qualifying the filter tag */
public List < AutoScalingGroup > getAutoScalingGroupsWithTag ( Tag tag ) { } } | final AmazonAutoScaling autoScaling = getAmazonAutoScalingClient ( ) ; final DescribeAutoScalingGroupsRequest describeAutoScalingGroupsRequest = new DescribeAutoScalingGroupsRequest ( ) ; final List < AutoScalingGroup > allAutoScalingGroups = autoScaling . describeAutoScalingGroups ( describeAutoScalingGroupsRequest ) ... |
public class JvmFallbackShutdown { /** * Spawn a background thread which will wait for the specified time , then print out any
* remaining threads and forcibly kill the JVM . Intended to be used before an action that < i > should < / i >
* shut down the JVM but is not guaranteed to - will scream for help if anythin... | Throwable source = new Throwable ( ) ; source . fillInStackTrace ( ) ; if ( inTests ( source ) ) { LOG . warn ( "Asked to register in a test environment. You probably don't want this." ) ; return ; } Thread fallbackTerminateThread = new Thread ( ( ) -> fallbackKill ( waitTime , source ) ) ; fallbackTerminateThread . s... |
public class IOUtils { /** * Returns all the text in the given File .
* @ return The text in the file . May be an empty string if the file is empty .
* If the file cannot be read ( non - existent , etc . ) , then and only then
* the method returns < code > null < / code > . */
public static String slurpFileNoExce... | try { return IOUtils . slurpReader ( new FileReader ( file ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return null ; } |
public class ApiOvhDbaaslogs { /** * Returns details of specified input engine
* REST : GET / dbaas / logs / input / engine / { engineId }
* @ param engineId [ required ] Engine ID */
public OvhEngine input_engine_engineId_GET ( String engineId ) throws IOException { } } | String qPath = "/dbaas/logs/input/engine/{engineId}" ; StringBuilder sb = path ( qPath , engineId ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhEngine . class ) ; |
public class IoUtil { /** * String 转为流
* @ param content 内容
* @ param charset 编码
* @ return 字节流 */
public static ByteArrayInputStream toStream ( String content , Charset charset ) { } } | if ( content == null ) { return null ; } return toStream ( StrUtil . bytes ( content , charset ) ) ; |
public class DBClusterSnapshotAttribute { /** * The values for the manual DB cluster snapshot attribute .
* If the < code > AttributeName < / code > field is set to < code > restore < / code > , then this element returns a list of IDs
* of the AWS accounts that are authorized to copy or restore the manual DB cluste... | if ( attributeValues == null ) { this . attributeValues = null ; return ; } this . attributeValues = new java . util . ArrayList < String > ( attributeValues ) ; |
public class IPAddress { /** * Returns the smallest set of prefix blocks that spans both this and the supplied address or subnet .
* @ param other
* @ return */
protected static < T extends IPAddress > T [ ] getSpanningPrefixBlocks ( T first , T other , UnaryOperator < T > getLower , UnaryOperator < T > getUpper , ... | T [ ] result = checkPrefixBlockContainment ( first , other , prefixAdder , arrayProducer ) ; if ( result != null ) { return result ; } List < IPAddressSegmentSeries > blocks = IPAddressSection . getSpanningBlocks ( first , other , getLower , getUpper , comparator , prefixRemover , IPAddressSection :: splitIntoPrefixBlo... |
public class S3ClientCache { /** * Returns a new client with region configured to
* region .
* Also updates the clientsByRegion map by associating the
* new client with region .
* @ param region
* The region the returned { @ link AmazonS3 } will be
* configured to use .
* @ return A new { @ link AmazonS3 ... | if ( awscredentialsProvider == null ) { throw new IllegalArgumentException ( "No credentials provider found to connect to S3" ) ; } AmazonS3 client = new AmazonS3Client ( awscredentialsProvider ) ; client . setRegion ( RegionUtils . getRegion ( region ) ) ; clientsByRegion . put ( region , client ) ; return client ; |
public class MapConstraints { /** * Returns a constrained view of the specified list multimap , using the
* specified constraint . Any operations that add new mappings will call the
* provided constraint . However , this method does not verify that existing
* mappings satisfy the constraint .
* < p > Note that ... | return new ConstrainedListMultimap < K , V > ( multimap , constraint ) ; |
public class Strings { /** * JavaScript - unescapes the specified text .
* @ param target the text to be unescaped
* @ return the unescaped text .
* @ since 2.0.11 */
public String unescapeJavaScript ( final Object target ) { } } | if ( target == null ) { return null ; } return StringUtils . unescapeJavaScript ( target ) ; |
public class DateUtil { /** * Determines if string is an integer of the radix base number system
* provided .
* @ param s
* String to be evaluated for integer type
* @ param radix
* Base number system ( e . g . , 10 = base 10 number system )
* @ return boolean */
private boolean isInteger ( String s , int r... | Scanner sc = new Scanner ( s . trim ( ) ) ; if ( ! sc . hasNextInt ( radix ) ) return false ; // we know it starts with a valid int , now make sure
// there ' s nothing left !
sc . nextInt ( radix ) ; return ! sc . hasNext ( ) ; |
public class PropertyChangeListeners { /** * Attaches a deep property change listener to the given object , that
* generates logging information about the property change events ,
* and prints them to the standard output .
* @ param object The object */
public static void addDeepConsoleLogger ( Object object ) { ... | addDeepLogger ( object , m -> System . out . println ( m ) ) ; |
public class ClassUtil { /** * 执行方法 < br >
* 可执行Private方法 , 也可执行static方法 < br >
* 执行非static方法时 , 必须满足对象有默认构造方法 < br >
* @ param < T > 对象类型
* @ param classNameWithMethodName 类名和方法名表达式 , 例如 : com . xiaoleilu . hutool . StrUtil # isEmpty或com . xiaoleilu . hutool . StrUtil . isEmpty
* @ param isSingleton 是否为单例对象 ... | if ( StrUtil . isBlank ( classNameWithMethodName ) ) { throw new UtilException ( "Blank classNameDotMethodName!" ) ; } int splitIndex = classNameWithMethodName . lastIndexOf ( '#' ) ; if ( splitIndex <= 0 ) { splitIndex = classNameWithMethodName . lastIndexOf ( '.' ) ; } if ( splitIndex <= 0 ) { throw new UtilException... |
public class CheckpointManager { /** * Returns a { @ link StoredBlock } representing the last checkpoint before the given time , for example , normally
* you would want to know the checkpoint before the earliest wallet birthday . */
public StoredBlock getCheckpointBefore ( long time ) { } } | try { checkArgument ( time > params . getGenesisBlock ( ) . getTimeSeconds ( ) ) ; // This is thread safe because the map never changes after creation .
Map . Entry < Long , StoredBlock > entry = checkpoints . floorEntry ( time ) ; if ( entry != null ) return entry . getValue ( ) ; Block genesis = params . getGenesisBl... |
public class BaseDependencyCheckMojo { /** * Collect dependencies from the dependency management section .
* @ param buildingRequest the Maven project building request
* @ param project the project being analyzed
* @ param nodes the list of dependency nodes
* @ param aggregate whether or not this is an aggregat... | if ( skipDependencyManagement || project . getDependencyManagement ( ) == null ) { return null ; } ExceptionCollection exCol = null ; for ( org . apache . maven . model . Dependency dependency : project . getDependencyManagement ( ) . getDependencies ( ) ) { try { nodes . add ( toDependencyNode ( buildingRequest , null... |
public class ClassUtil { /** * Returns the classloader for the speficied < code > clazz < / code > . Unlike
* { @ link Class # getClassLoader ( ) } this will never return null . */
public static ClassLoader getClassLoader ( Class clazz ) { } } | ClassLoader classLoader = clazz . getClassLoader ( ) ; return classLoader == null ? ClassLoader . getSystemClassLoader ( ) : classLoader ; |
public class ChannelMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Channel channel , ProtocolMarshaller protocolMarshaller ) { } } | if ( channel == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( channel . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( channel . getArn ( ) , ARN_BINDING ) ; protocolMarshaller . marshall ( channel . getStatus ( ) , STATUS_... |
public class ProcessRunnerTask { /** * Get the name of this process and run it . */
public void runTask ( ) { } } | String strProcess = this . getProperty ( DBParams . PROCESS ) ; BaseProcess job = ( BaseProcess ) ClassServiceUtility . getClassService ( ) . makeObjectFromClassName ( strProcess ) ; if ( job != null ) { this . runProcess ( job , m_properties ) ; } else { // NOTE : It is not recommended to start a standalone process , ... |
public class AbstractIoSessionConfig { /** * { @ inheritDoc } */
public final void setAll ( IoSessionConfig config ) { } } | if ( config == null ) { throw new NullPointerException ( "config" ) ; } if ( ENABLE_BUFFER_SIZE ) { System . out . println ( "AbstractIoSessionConfig.setAll()" ) ; setReadBufferSize ( config . getReadBufferSize ( ) ) ; setMinReadBufferSize ( config . getMinReadBufferSize ( ) ) ; setMaxReadBufferSize ( config . getMaxRe... |
public class JumblrClient { /** * Get the posts for a given blog
* @ param blogName the name of the blog
* @ param options the options for this call ( or null )
* @ return a List of posts */
public List < Post > blogPosts ( String blogName , Map < String , ? > options ) { } } | if ( options == null ) { options = Collections . emptyMap ( ) ; } Map < String , Object > soptions = JumblrClient . safeOptionMap ( options ) ; soptions . put ( "api_key" , apiKey ) ; String path = "/posts" ; if ( soptions . containsKey ( "type" ) ) { path += "/" + soptions . get ( "type" ) . toString ( ) ; soptions . ... |
public class JAXBUtil { /** * Unmarshals any class model object .
* @ param source Input source containing a complete PMML schema version 4.3 document or any fragment of it . */
static public Object unmarshal ( Source source ) throws JAXBException { } } | Unmarshaller unmarshaller = createUnmarshaller ( ) ; return unmarshaller . unmarshal ( source ) ; |
public class DistributionUtils { /** * Two stage distribution , dry run and actual promotion to verify correctness .
* @ param distributionBuilder
* @ param client
* @ param listener
* @ param buildName
* @ param buildNumber
* @ throws IOException */
public static boolean distributeAndCheckResponse ( Distri... | // do a dry run first
listener . getLogger ( ) . println ( "Performing dry run distribution (no changes are made during dry run) ..." ) ; if ( ! distribute ( distributionBuilder , client , listener , buildName , buildNumber , true ) ) { return false ; } listener . getLogger ( ) . println ( "Dry run finished successfull... |
public class ParseContext { /** * Consumes the given token . If the current residual text to be parsed
* starts with the parsing index is increased by { @ code token . size ( ) } .
* @ param token The token expected .
* @ return true , if the token could be consumed and the index was increased
* by { @ code tok... | if ( getInput ( ) . toString ( ) . startsWith ( token ) ) { index += token . length ( ) ; return true ; } return false ; |
public class ConstructorUtils { /** * < p > Returns a new instance of the specified class inferring the right constructor
* from the types of the arguments . < / p >
* < p > This locates and calls a constructor .
* The constructor signature must match the argument types exactly . < / p >
* @ param < T > the typ... | args = ArrayUtils . nullToEmpty ( args ) ; final Class < ? > parameterTypes [ ] = ClassUtils . toClass ( args ) ; return invokeExactConstructor ( cls , args , parameterTypes ) ; |
public class ConcurrentNodeMemories { /** * The implementation tries to delay locking as much as possible , by running
* some potentially unsafe operations out of the critical session . In case it
* fails the checks , it will move into the critical sessions and re - check everything
* before effectively doing any... | if ( node . getMemoryId ( ) >= this . memories . length ( ) ) { resize ( node ) ; } Memory memory = this . memories . get ( node . getMemoryId ( ) ) ; if ( memory == null ) { memory = createNodeMemory ( node , wm ) ; } return memory ; |
public class DateTimeUtils { /** * Parse a string ( optionally containing a zone ) as a value of TIMESTAMP type .
* If the string specifies a zone , the zone is discarded .
* For example : { @ code " 2000-01-01 01:23:00 " } is parsed to TIMESTAMP { @ code 2000-01-01T01:23:00}
* and { @ code " 2000-01-01 01:23:00 ... | LocalDateTime localDateTime = TIMESTAMP_WITH_OR_WITHOUT_TIME_ZONE_FORMATTER . parseLocalDateTime ( value ) ; try { return ( long ) getLocalMillis . invokeExact ( localDateTime ) ; } catch ( Throwable e ) { throw new RuntimeException ( e ) ; } |
public class CPInstanceLocalServiceWrapper { /** * Adds the cp instance to the database . Also notifies the appropriate model listeners .
* @ param cpInstance the cp instance
* @ return the cp instance that was added */
@ Override public com . liferay . commerce . product . model . CPInstance addCPInstance ( com . ... | return _cpInstanceLocalService . addCPInstance ( cpInstance ) ; |
public class CoreRepositorySetupService { /** * ACL */
protected void addAcl ( @ Nonnull final Session session , @ Nonnull final String path , @ Nonnull final String principalName , boolean allow , @ Nonnull final String [ ] privilegeKeys , @ Nonnull final Map restrictionKeys ) throws RepositoryException { } } | try { final AccessControlManager acManager = session . getAccessControlManager ( ) ; final PrincipalManager principalManager = ( ( JackrabbitSession ) session ) . getPrincipalManager ( ) ; final JackrabbitAccessControlList policies = AccessControlUtils . getAccessControlList ( acManager , path ) ; final Principal princ... |
public class QuerySpec { /** * Convenient method to specify expressions ( and the associated name map and
* value map ) via { @ link QueryExpressionSpec } . */
@ Beta public QuerySpec withExpressionSpec ( QueryExpressionSpec xspec ) { } } | return withKeyConditionExpression ( xspec . getKeyConditionExpression ( ) ) . withFilterExpression ( xspec . getFilterExpression ( ) ) . withProjectionExpression ( xspec . getProjectionExpression ( ) ) . withNameMap ( xspec . getNameMap ( ) ) . withValueMap ( xspec . getValueMap ( ) ) ; |
public class InboundTransferTask { /** * Cancels all the segments and marks them as finished , sends a cancel command , then completes the task . */
public void cancel ( ) { } } | if ( ! isCancelled ) { isCancelled = true ; IntSet segmentsCopy = getUnfinishedSegments ( ) ; synchronized ( segments ) { unfinishedSegments . clear ( ) ; } if ( trace ) { log . tracef ( "Cancelling inbound state transfer from %s with unfinished segments %s" , source , segmentsCopy ) ; } sendCancelCommand ( segmentsCop... |
public class Status { /** * Method to get a StatusGroup from the cache .
* @ param _ uuid UUID of the StatusGroup wanted .
* @ return StatusGroup
* @ throws CacheReloadException on error */
public static StatusGroup get ( final UUID _uuid ) throws CacheReloadException { } } | final Cache < UUID , StatusGroup > cache = InfinispanCache . get ( ) . < UUID , StatusGroup > getCache ( Status . UUIDCACHE4GRP ) ; if ( ! cache . containsKey ( _uuid ) ) { Status . getStatusGroupFromDB ( Status . SQL_UUID4GRP , String . valueOf ( _uuid ) ) ; } return cache . get ( _uuid ) ; |
public class EngagementCreator { /** * Add the requested post parameters to the Request .
* @ param request Request to add post params to */
private void addPostParams ( final Request request ) { } } | if ( to != null ) { request . addPostParam ( "To" , to . toString ( ) ) ; } if ( from != null ) { request . addPostParam ( "From" , from . toString ( ) ) ; } if ( parameters != null ) { request . addPostParam ( "Parameters" , Converter . mapToJson ( parameters ) ) ; } |
public class IntColumn { /** * Returns a new numeric column initialized with the given name and size . The values in the column are
* integers beginning at startsWith and continuing through size ( exclusive ) , monotonically increasing by 1
* TODO consider a generic fill function including steps or random samples f... | final IntColumn indexColumn = IntColumn . create ( columnName , size ) ; for ( int i = 0 ; i < size ; i ++ ) { indexColumn . set ( i , i + startsWith ) ; } return indexColumn ; |
public class LockSet { /** * Return whether or not this lock set is empty , meaning that no locks have
* a positive lock count .
* @ return true if no locks are held , false if at least one lock is held */
public boolean isEmpty ( ) { } } | for ( int i = 0 ; i + 1 < array . length ; i += 2 ) { int valueNumber = array [ i ] ; if ( valueNumber < 0 ) { return true ; } int myLockCount = array [ i + 1 ] ; if ( myLockCount > 0 ) { return false ; } } return true ; |
public class ResourceGroovyMethods { /** * Helper method to create a buffered writer for a file . If the given
* charset is " UTF - 16BE " or " UTF - 16LE " ( or an equivalent alias ) , the
* requisite byte order mark is written to the stream before the writer
* is returned .
* @ param file a File
* @ param c... | boolean shouldWriteBom = writeBom && ! file . exists ( ) ; if ( append ) { FileOutputStream stream = new FileOutputStream ( file , append ) ; if ( shouldWriteBom ) { IOGroovyMethods . writeUTF16BomIfRequired ( stream , charset ) ; } return new EncodingAwareBufferedWriter ( new OutputStreamWriter ( stream , charset ) ) ... |
public class ComplianceConfig { /** * check for isEnabled */
public boolean isIndexImmutable ( Object request ) { } } | if ( ! this . enabled ) { return false ; } if ( immutableIndicesPatterns . isEmpty ( ) ) { return false ; } final Resolved resolved = irr . resolveRequest ( request ) ; final Set < String > allIndices = resolved . getAllIndices ( ) ; // assert allIndices . size ( ) = = 1 : " only one index here , not " + allIndices ;
/... |
public class DataSinkNode { @ Override public void accept ( Visitor < OptimizerNode > visitor ) { } } | if ( visitor . preVisit ( this ) ) { if ( getPredecessorNode ( ) != null ) { getPredecessorNode ( ) . accept ( visitor ) ; } else { throw new CompilerException ( ) ; } visitor . postVisit ( this ) ; } |
public class KTypeArrayList { /** * { @ inheritDoc } */
@ Override public < T extends KTypeProcedure < ? super KType > > T forEach ( T procedure ) { } } | return forEach ( procedure , 0 , size ( ) ) ; |
public class HBaseClient { /** * Add records to data wrapper .
* @ param columnWrapper
* column wrapper
* @ param embeddableData
* embeddable data
* @ param dataSet
* data collection set */
private void addRecords ( HBaseDataWrapper columnWrapper , List < HBaseDataWrapper > embeddableData , List < HBaseData... | dataSet . add ( columnWrapper ) ; if ( ! embeddableData . isEmpty ( ) ) { dataSet . addAll ( embeddableData ) ; } |
public class MapUtil { /** * 新建TreeMap , Key有序的Map
* @ param map Map
* @ param comparator Key比较器
* @ return TreeMap
* @ since 3.2.3 */
public static < K , V > TreeMap < K , V > newTreeMap ( Map < K , V > map , Comparator < ? super K > comparator ) { } } | final TreeMap < K , V > treeMap = new TreeMap < > ( comparator ) ; if ( false == isEmpty ( map ) ) { treeMap . putAll ( map ) ; } return treeMap ; |
public class DefaultDisseminatorImpl { /** * Returns an HTML rendering of the object profile which contains key
* metadata from the object , plus URLs for the object ' s Dissemination Index
* and Item Index . The data is returned as HTML in a presentation - oriented
* format . This is accomplished by doing an XSL... | try { ObjectProfile profile = m_access . getObjectProfile ( context , reader . GetObjectPID ( ) , asOfDateTime ) ; Reader in = null ; try { ReadableCharArrayWriter out = new ReadableCharArrayWriter ( 1024 ) ; DefaultSerializer . objectProfileToXML ( profile , asOfDateTime , out ) ; out . close ( ) ; in = out . toReader... |
public class Position { /** * From http : / / williams . best . vwh . net / avform . htm ( Latitude of point on GC ) .
* @ param position
* @ param longitudeDegrees
* @ return */
public Double getLatitudeOnGreatCircle ( Position position , double longitudeDegrees ) { } } | double lonR = toRadians ( longitudeDegrees ) ; double lat1R = toRadians ( lat ) ; double lon1R = toRadians ( lon ) ; double lat2R = toRadians ( position . getLat ( ) ) ; double lon2R = toRadians ( position . getLon ( ) ) ; double sinDiffLon1RLon2R = sin ( lon1R - lon2R ) ; if ( abs ( sinDiffLon1RLon2R ) < 0.00000001 ) ... |
public class RetrievalToolConfigParser { /** * Parses command line configuration into an object structure , validates
* correct values along the way .
* Prints a help message and exits the JVM on parse failure .
* @ param args command line configuration values
* @ return populated RetrievalToolConfig */
public ... | RetrievalToolConfig config = null ; try { config = processOptions ( args ) ; } catch ( ParseException e ) { printHelp ( e . getMessage ( ) ) ; } // Make sure work dir is set
RetrievalConfig . setWorkDir ( config . getWorkDir ( ) ) ; config . setWorkDir ( RetrievalConfig . getWorkDir ( ) ) ; return config ; |
public class CommerceShipmentUtil { /** * Returns the last commerce shipment in the ordered set where groupId = & # 63 ; .
* @ param groupId the group ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching commerce shipment , or < cod... | return getPersistence ( ) . fetchByGroupId_Last ( groupId , orderByComparator ) ; |
public class SVGImageView { /** * Attempt to set a picture from a Uri . Return true if it worked . */
private boolean internalSetImageURI ( Uri uri ) { } } | try { InputStream is = getContext ( ) . getContentResolver ( ) . openInputStream ( uri ) ; new LoadURITask ( ) . execute ( is ) ; return true ; } catch ( FileNotFoundException e ) { return false ; } |
public class TimeSeries { /** * Destroy the TimeSeries associated with a Key */
public void destroy ( ) { } } | clear ( ) ; this . client . operate ( null , key , Operation . put ( Bin . asNull ( binName ) ) ) ; |
public class PackageDescriptor { /** * Get a reasonable unique ID for the package .
* @ return The package ID */
public String getPackageId ( ) { } } | StringBuilder sb = new StringBuilder ( ) ; if ( group != null ) sb . append ( group ) ; sb . append ( ":" ) ; if ( name != null ) sb . append ( name ) ; sb . append ( ":" ) ; if ( version != null ) sb . append ( version ) ; sb . append ( ":" ) ; return sb . toString ( ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.