signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class DoubleStreamEx { /** * Returns an { @ link EntryStream } consisting of the { @ link Entry } objects * which keys and values are results of applying the given functions to the * elements of this stream . * This is an intermediate operation . * @ param < K > The { @ code Entry } key type * @ param ...
return new EntryStream < > ( stream ( ) . mapToObj ( t -> new AbstractMap . SimpleImmutableEntry < > ( keyMapper . apply ( t ) , valueMapper . apply ( t ) ) ) , context ) ;
public class Expect4j { /** * TODO * @ param matches TODO * @ return TODO */ protected TimeoutMatch findTimeout ( Match matches [ ] ) { } }
TimeoutMatch ourTimeout = null ; for ( int i = 0 ; i < matches . length ; i ++ ) { if ( matches [ i ] instanceof TimeoutMatch ) ourTimeout = ( TimeoutMatch ) matches [ i ] ; } /* TODO : candidate for removal ? if ( ourTimeout = = null ) { / / Have to create our own ourTimeout = new TimeoutMatch ( null ) ; */ retu...
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public IfcPileConstructionEnum createIfcPileConstructionEnumFromString ( EDataType eDataType , String initialValue ) { } }
IfcPileConstructionEnum result = IfcPileConstructionEnum . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ;
public class Flowable { /** * Returns a Single that emits a single HashMap containing values corresponding to items emitted by the * finite source Publisher , mapped by the keys returned by a specified { @ code keySelector } function . * < img width = " 640 " height = " 305 " src = " https : / / raw . github . com ...
ObjectHelper . requireNonNull ( keySelector , "keySelector is null" ) ; ObjectHelper . requireNonNull ( valueSelector , "valueSelector is null" ) ; return collect ( HashMapSupplier . < K , V > asCallable ( ) , Functions . toMapKeyValueSelector ( keySelector , valueSelector ) ) ;
public class JwtBuilder { /** * 校验token是否合法 * @ param token token的值 * @ return true : 合法 , false : 非法 */ @ SuppressWarnings ( "all" ) public JwtAuth getJwtAuth ( String token ) { } }
Claims claims = this . getClaimsFromToken ( token ) ; List < String > roles = ( List < String > ) claims . get ( CLAIM_KEY_ROLE ) ; return new JwtAuth ( ( String ) claims . get ( CLAIM_KEY_ID ) , ( String ) claims . get ( CLAIM_KEY_LOGIN_NAME ) , ( String ) claims . get ( CLAIM_KEY_MICK_NAME ) , ( String ) claims . get...
public class BoxUser { /** * A convenience method to create an empty user with just the id and type fields set . This allows * the ability to interact with the content sdk in a more descriptive and type safe manner * @ param userId the id of user to create * @ return an empty BoxUser object that only contains id ...
JsonObject object = new JsonObject ( ) ; object . add ( BoxCollaborator . FIELD_ID , userId ) ; object . add ( BoxCollaborator . FIELD_TYPE , BoxUser . TYPE ) ; BoxUser user = new BoxUser ( ) ; user . createFromJson ( object ) ; return user ;
public class ChainedAllReduceDriver { @ Override public void setup ( AbstractInvokable parent ) { } }
@ SuppressWarnings ( "unchecked" ) final ReduceFunction < IT > red = BatchTask . instantiateUserCode ( this . config , userCodeClassLoader , ReduceFunction . class ) ; this . reducer = red ; FunctionUtils . setFunctionRuntimeContext ( red , getUdfRuntimeContext ( ) ) ; TypeSerializerFactory < IT > serializerFactory = t...
public class EnglishAndChineseHeadRules { /** * Head finder using English NP rules and the Chinese head table as defined in * Honglin Sun and Daniel Jurafsky . 2004 . Shallow Semantic Parsing of Chinese . In North American * Chapter of the ACL : Human Language Technologies ( NAACL - HLT ) , pages 249256 , Boston , ...
final boolean headInitial = true ; final CharSource resource = Resources . asCharSource ( EnglishAndChineseHeadRules . class . getResource ( "ch_heads.sun.txt" ) , Charsets . UTF_8 ) ; final ImmutableMap < Symbol , HeadRule < NodeT > > headRules = headRulesFromResources ( headInitial , resource ) ; return MapHeadFinder...
public class HelperFunctions { /** * Determine the type , old or young , based on the name of the collector . */ static GcType getGcType ( String name ) { } }
GcType t = KNOWN_COLLECTOR_NAMES . get ( name ) ; return ( t == null ) ? GcType . UNKNOWN : t ;
public class XAttributeUtils { /** * Composes the appropriate attribute type from the string - based information * found , e . g . , in XML serializations . * @ param factory * Factory to use for creating the attribute . * @ param key * Key of the attribute . * @ param value * Value of the attribute . *...
type = type . trim ( ) ; if ( type . equalsIgnoreCase ( "LIST" ) ) { XAttributeList attr = factory . createAttributeList ( key , extension ) ; return attr ; } else if ( type . equalsIgnoreCase ( "CONTAINER" ) ) { XAttributeContainer attr = factory . createAttributeContainer ( key , extension ) ; return attr ; } else if...
public class TargetValidator { /** * Parses the target properties for a given component . * @ param projectDirectory the project ' s directory * @ param c a component * @ return a non - null list of errors */ public static List < ModelError > parseTargetProperties ( File projectDirectory , Component c ) { } }
List < ModelError > errors ; File dir = ResourceUtils . findInstanceResourcesDirectory ( projectDirectory , c ) ; if ( dir . isDirectory ( ) && ! Utils . listAllFiles ( dir , Constants . FILE_EXT_PROPERTIES ) . isEmpty ( ) ) errors = parseDirectory ( dir , c ) ; else errors = new ArrayList < > ( 0 ) ; return errors ;
public class FileOutputCommitter { /** * Mark the output dir of the job for which the context is passed . */ private void markOutputDirSuccessful ( JobContext context ) throws IOException { } }
if ( outputPath != null ) { FileSystem fileSys = outputPath . getFileSystem ( context . getConfiguration ( ) ) ; if ( fileSys . exists ( outputPath ) ) { // create a file in the folder to mark it Path filePath = new Path ( outputPath , SUCCEEDED_FILE_NAME ) ; fileSys . create ( filePath ) . close ( ) ; } }
public class Identifier { /** * Converts identifier to a byte array * @ param bigEndian true if bytes are MSB first * @ return a new byte array with a copy of the value */ @ TargetApi ( Build . VERSION_CODES . GINGERBREAD ) public byte [ ] toByteArrayOfSpecifiedEndianness ( boolean bigEndian ) { } }
byte [ ] copy = Arrays . copyOf ( mValue , mValue . length ) ; if ( ! bigEndian ) { reverseArray ( copy ) ; } return copy ;
public class BindTypeBuilder { /** * Generate parser on xml end element . * @ param context * the context * @ param methodBuilder * the method builder * @ param instanceName * the instance name * @ param parserName * the parser name * @ param entity * the entity */ private static void generateParser...
methodBuilder . beginControlFlow ( "if (elementName.equals($L.getName()))" , parserName ) ; methodBuilder . addStatement ( "currentTag = elementName" ) ; methodBuilder . addStatement ( "elementName = null" ) ; methodBuilder . endControlFlow ( ) ;
public class PubSubInputHandler { /** * ( non - Javadoc ) * @ see com . ibm . ws . sib . processor . impl . interfaces . MessageDeliverer # checkAbleToAcceptMessage */ @ Override public int checkAbleToAcceptMessage ( JsDestinationAddress addr ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "checkAbleToAcceptMessage" , addr ) ; int blockingReason = DestinationHandler . OUTPUT_HANDLER_FOUND ; // we check the remoteQueueHighLimit in this case . // See defect 281311 boolean canAccept = ! _itemStream . isRemoteQueu...
public class LocalHostAddressFunction { /** * { @ inheritDoc } */ public String execute ( List < String > parameterList , TestContext context ) { } }
if ( ! parameterList . isEmpty ( ) ) { throw new InvalidFunctionUsageException ( "Unexpected parameter for function." ) ; } try { return InetAddress . getLocalHost ( ) . getHostName ( ) ; } catch ( UnknownHostException e ) { throw new CitrusRuntimeException ( "Unable to locate local host address" , e ) ; }
public class JQMCommon { /** * Expensive , based on jQuery , realistic visibility check . */ public static boolean isRealHidden ( Widget widget ) { } }
if ( widget == null || ! widget . isAttached ( ) ) return true ; Element elt = widget . getElement ( ) ; return ! UIObject . isVisible ( elt ) || Mobile . isHidden ( elt ) ;
public class VdmLaunchConfigurationDelegate { /** * generate commandline argments for the debugger and create the debug target * @ param launch * @ param configuration * @ param mode * @ param monitor * @ return * @ throws CoreException */ private List < String > initializeLaunch ( ILaunch launch , ILaunchC...
List < String > commandList = null ; Integer debugSessionId = Integer . valueOf ( getSessionId ( ) ) ; if ( useRemoteDebug ( configuration ) ) { debugSessionId = 1 ; } commandList = new ArrayList < String > ( ) ; IVdmProject vdmProject = getVdmProject ( configuration ) ; Assert . isNotNull ( vdmProject , " Project not ...
public class SortaServiceImpl { /** * A helper function to calculate the best NGram score from a list ontologyTerm synonyms */ private Entity findSynonymWithHighestNgramScore ( String ontologyIri , String queryString , Entity ontologyTermEntity ) { } }
Iterable < Entity > entities = ontologyTermEntity . getEntities ( OntologyTermMetadata . ONTOLOGY_TERM_SYNONYM ) ; if ( Iterables . size ( entities ) > 0 ) { String cleanedQueryString = removeIllegalCharWithSingleWhiteSpace ( queryString ) ; // Calculate the Ngram silmiarity score for all the synonyms and sort them in ...
public class AbstractLinear { /** * Returns the background image with the currently active backgroundcolor * with the given width and height . * @ param WIDTH * @ param HEIGHT * @ param image * @ return buffered image containing the background with the selected background design */ protected BufferedImage cre...
if ( WIDTH <= 0 || HEIGHT <= 0 ) { return UTIL . createImage ( 1 , 1 , Transparency . TRANSLUCENT ) ; } if ( image == null ) { image = UTIL . createImage ( WIDTH , HEIGHT , Transparency . TRANSLUCENT ) ; } final Graphics2D G2 = image . createGraphics ( ) ; G2 . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , Ren...
public class StringValue { /** * Sets the contents of this string to the contents of the given < tt > CharBuffer < / tt > . * The characters between the buffer ' s current position ( inclusive ) and the buffer ' s * limit ( exclusive ) will be stored in this string . * @ param buffer The character buffer to read ...
checkNotNull ( buffer ) ; final int len = buffer . length ( ) ; ensureSize ( len ) ; buffer . get ( this . value , 0 , len ) ; this . len = len ; this . hashCode = 0 ;
public class CmsAvailabilityDialog { /** * Initializes the values for the notification widgets . < p > */ public void initNotification ( ) { } }
if ( m_dialogContext . getResources ( ) . size ( ) == 1 ) { CmsResource resource = m_dialogContext . getResources ( ) . get ( 0 ) ; try { m_availabilityInfo = getAvailabilityInfo ( A_CmsUI . getCmsObject ( ) , resource ) ; m_initialNotificationInterval = "" + m_availabilityInfo . getNotificationInterval ( ) ; m_initial...
public class ViewMetadata { /** * < p class = " changed _ added _ 2_2 " > Utility method to determine if the * the provided { @ link UIViewRoot } has metadata . The default implementation will * return true if the provided { @ code UIViewRoot } has a facet * named { @ link UIViewRoot # METADATA _ FACET _ NAME } a...
boolean result = false ; UIComponent metadataFacet = root . getFacet ( UIViewRoot . METADATA_FACET_NAME ) ; if ( null != metadataFacet ) { result = 0 < metadataFacet . getChildCount ( ) ; } return result ;
public class LdapTemplate { /** * { @ inheritDoc } */ @ Override public < T > List < T > search ( String base , String filter , ContextMapper < T > mapper ) { } }
return search ( base , filter , defaultSearchScope , mapper ) ;
public class JSTypeRegistry { /** * Creates a templatized instance of the specified type . Only ObjectTypes * can currently be templatized ; extend the logic in this function when * more types can be templatized . * @ param baseType the type to be templatized . * @ param templatizedTypes a list of the template ...
return createTemplatizedType ( baseType , ImmutableList . copyOf ( templatizedTypes ) ) ;
public class SimpleQueryEsSink { /** * ( non - Javadoc ) * @ see com . sematext . ag . sink . Sink # write ( com . sematext . ag . Event ) */ @ Override public boolean write ( SimpleSearchEvent event ) { } }
HttpGet httpGet = new HttpGet ( esBaseUrl + ES_QUERY_TEMPLATE . replace ( "${INDEX_NAME}" , indexName ) . replace ( "${QUERY_STRING}" , event . getQueryString ( ) . replace ( " " , "+" ) ) ) ; LOG . info ( "Sending ES search event " + httpGet . getRequestLine ( ) ) ; return execute ( httpGet ) ;
public class Converter { /** * Transforms different objects ( BigDecimal , Integer ) to Integer . * @ param value * The object to transform * @ return * The double value */ public static Integer asInteger ( Object value ) { } }
int intValue ; switch ( value . getClass ( ) . getCanonicalName ( ) ) { case "java.math.BigDecimal" : intValue = ( ( BigDecimal ) value ) . intValue ( ) ; break ; case "java.lang.Boolean" : intValue = ( Boolean ) value ? 1 : 0 ; break ; case "java.lang.Integer" : intValue = ( Integer ) value ; break ; default : intValu...
public class PasswordPolicyService { /** * Returns whether the given password matches any of the user ' s previous * passwords . Regardless of the value specified here , the maximum number of * passwords involved in this check depends on how many previous passwords * were actually recorded , which depends on the ...
// No need to compare if no history is relevant if ( historySize <= 0 ) return false ; // Check password against all recorded hashes List < PasswordRecordModel > history = passwordRecordMapper . select ( username , historySize ) ; for ( PasswordRecordModel record : history ) { byte [ ] hash = encryptionService . create...
public class DnsClient { /** * 查询域名 * @ param domain 域名参数 * @ return ip 列表 * @ throws IOException 网络异常或者无法解析抛出异常 */ private String [ ] queryInternal ( Domain domain ) throws IOException { } }
Record [ ] records = null ; if ( domain . hostsFirst ) { String [ ] ret = hosts . query ( domain . domain ) ; if ( ret != null && ret . length != 0 ) { return ret ; } } synchronized ( cache ) { if ( Network . isNetworkChanged ( ) ) { cache . clear ( ) ; synchronized ( resolvers ) { index = 0 ; } } else { records = cach...
public class FutureConverter { /** * Converts Spring 4 { @ link org . springframework . util . concurrent . ListenableFuture } * to Guava { @ link com . google . common . util . concurrent . ListenableFuture } . */ public static < T > com . google . common . util . concurrent . ListenableFuture < T > toGuavaListenabl...
return GuavaFutureUtils . createListenableFuture ( SpringFutureUtils . createValueSourceFuture ( springListenableFuture ) ) ;
public class CommerceTaxFixedRatePersistenceImpl { /** * Returns the last commerce tax fixed rate in the ordered set where CPTaxCategoryId = & # 63 ; . * @ param CPTaxCategoryId the cp tax category ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return...
CommerceTaxFixedRate commerceTaxFixedRate = fetchByCPTaxCategoryId_Last ( CPTaxCategoryId , orderByComparator ) ; if ( commerceTaxFixedRate != null ) { return commerceTaxFixedRate ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "CPTaxCategoryId=" ) ; msg . ap...
public class FBOGraphics { /** * Bind to the FBO created */ private void bind ( ) { } }
EXTFramebufferObject . glBindFramebufferEXT ( EXTFramebufferObject . GL_FRAMEBUFFER_EXT , FBO ) ; GL11 . glReadBuffer ( EXTFramebufferObject . GL_COLOR_ATTACHMENT0_EXT ) ;
public class KeyVaultClientBaseImpl { /** * Gets the specified deleted storage account . * The Get Deleted Storage Account operation returns the specified deleted storage account along with its attributes . This operation requires the storage / get permission . * @ param vaultBaseUrl The vault name , for example ht...
return getDeletedStorageAccountWithServiceResponseAsync ( vaultBaseUrl , storageAccountName ) . map ( new Func1 < ServiceResponse < DeletedStorageBundle > , DeletedStorageBundle > ( ) { @ Override public DeletedStorageBundle call ( ServiceResponse < DeletedStorageBundle > response ) { return response . body ( ) ; } } )...
public class HandlebarsHelper { /** * Handle invalid helper data without exception details or because none was thrown . * @ param message message to log and return * @ return a message which will be used as content */ protected String handleError ( final String message ) { } }
notifier ( ) . error ( formatMessage ( message ) ) ; return formatMessage ( message ) ;
public class SoyFileSet { /** * Compiles this Soy file set into JS source code files and returns these JS files as a list of * strings , one per file . * < p > TODO ( lukes ) : deprecate and delete localized builds * @ param jsSrcOptions The compilation options for the JS Src output target . * @ param msgBundle...
resetErrorReporter ( ) ; // JS has traditionally allowed unknown globals , as a way for soy to reference normal js enums // and constants . For consistency / reusability of templates it would be nice to not allow that // but the cat is out of the bag . PassManager . Builder builder = passManagerBuilder ( ) . allowUnkno...
public class InApplicationMonitor { /** * This method was intended to register module names with their * current version identifier . * This could / should actually be generalized into an non numeric * state value * @ param name name of the versionized " thing " ( class , module etc . ) * @ param version iden...
Version versionToAdd = new Version ( keyHandler . handle ( name ) , version ) ; getCorePlugin ( ) . registerVersion ( versionToAdd ) ;
public class DirectQuickSelectSketchR { /** * restricted methods */ @ Override long [ ] getCache ( ) { } }
final long lgArrLongs = mem_ . getByte ( LG_ARR_LONGS_BYTE ) & 0XFF ; final int preambleLongs = mem_ . getByte ( PREAMBLE_LONGS_BYTE ) & 0X3F ; final long [ ] cacheArr = new long [ 1 << lgArrLongs ] ; final WritableMemory mem = WritableMemory . wrap ( cacheArr ) ; mem_ . copyTo ( preambleLongs << 3 , mem , 0 , 8 << lgA...
public class EXXAdapters { public static String convertByType ( OrderType orderType ) { } }
return OrderType . BID . equals ( orderType ) ? IConstants . BUY : IConstants . SELL ;
public class DescribeInterconnectsResult { /** * The interconnects . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setInterconnects ( java . util . Collection ) } or { @ link # withInterconnects ( java . util . Collection ) } if you want * to override the...
if ( this . interconnects == null ) { setInterconnects ( new com . amazonaws . internal . SdkInternalList < Interconnect > ( interconnects . length ) ) ; } for ( Interconnect ele : interconnects ) { this . interconnects . add ( ele ) ; } return this ;
public class SetCache { /** * Returns the cached { @ link UnsortedGrouping } for the given ID . * @ param id Set ID * @ param < T > UnsortedGrouping type * @ return Cached UnsortedGrouping * @ throws IllegalStateException if the cached set is not an UnsortedGrouping */ @ SuppressWarnings ( "unchecked" ) public ...
return verifyType ( id , unsortedGroupings . get ( id ) , SetType . UNSORTED_GROUPING ) ;
public class DefaultImportationLinker { /** * Bind the { @ link ImportDeclaration } matching the filter ImportDeclarationFilter . * Check if metadata of the ImportDeclaration match the filter exposed by the { @ link ImporterService } s bound . * If the ImportDeclaration matches the ImporterService filter , link the...
synchronized ( lock ) { declarationsManager . add ( importDeclarationSRef ) ; if ( ! declarationsManager . matched ( importDeclarationSRef ) ) { LOG . debug ( "No service matching was found, ignoring service reference." ) ; return ; } LOG . debug ( linkerName + " : Bind the ImportDeclaration " + declarationsManager . g...
public class CollectionResource { /** * { @ inheritDoc } */ @ Override public Set < HierarchicalProperty > getProperties ( boolean namesOnly ) throws PathNotFoundException , AccessDeniedException , RepositoryException { } }
Set < HierarchicalProperty > props = super . getProperties ( namesOnly ) ; PropertyIterator jcrProps = node . getProperties ( ) ; while ( jcrProps . hasNext ( ) ) { Property property = jcrProps . nextProperty ( ) ; if ( ! COLLECTION_SKIP . contains ( property . getName ( ) ) ) { QName name = namespaceContext . createQN...
public class DefaultCommandManager { /** * Create a command group which holds all the given members . * @ param groupId the id to configure the group . * @ param members members to add to the group . * @ param configurer the configurer to use . * @ return a { @ link CommandGroup } which contains all the members...
return createCommandGroup ( groupId , members , false , configurer ) ;
public class X509CertInfo { /** * This routine unmarshals the certificate information . */ private void parse ( DerValue val ) throws CertificateParsingException , IOException { } }
DerInputStream in ; DerValue tmp ; if ( val . tag != DerValue . tag_Sequence ) { throw new CertificateParsingException ( "signed fields invalid" ) ; } rawCertInfo = val . toByteArray ( ) ; in = val . data ; // Version tmp = in . getDerValue ( ) ; if ( tmp . isContextSpecific ( ( byte ) 0 ) ) { version = new Certificate...
public class Broadcaster { /** * An S3 . m3u8 upload completed . * Called on a background thread */ private void onManifestUploaded ( S3UploadEvent uploadEvent ) { } }
if ( mDeleteAfterUploading ) { if ( VERBOSE ) Log . i ( TAG , "Deleting " + uploadEvent . getFile ( ) . getAbsolutePath ( ) ) ; uploadEvent . getFile ( ) . delete ( ) ; String uploadUrl = uploadEvent . getDestinationUrl ( ) ; if ( uploadUrl . substring ( uploadUrl . lastIndexOf ( File . separator ) + 1 ) . equals ( "vo...
public class Range { /** * Checks whether this range is before the specified element . * @ param element the element to check for , null returns false * @ return true if this range is entirely before the specified element */ public boolean isBefore ( T element ) { } }
if ( element == null ) { return false ; } return comparator . compare ( element , max ) > 0 ;
public class ConfigurationsInner { /** * Configures the HTTP settings on the specified cluster . This API is deprecated , please use UpdateGatewaySettings in cluster endpoint instead . * @ param resourceGroupName The name of the resource group . * @ param clusterName The name of the cluster . * @ param configurat...
return beginUpdateWithServiceResponseAsync ( resourceGroupName , clusterName , configurationName , parameters ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ;
public class PiwikRequest { /** * Set a stored parameter . * @ param key the parameter ' s key * @ param value the parameter ' s value . Removes the parameter if null */ private void setParameter ( String key , Object value ) { } }
if ( value == null ) { parameters . remove ( key ) ; } else { parameters . put ( key , value ) ; }
public class TimeoutManager { public synchronized void start ( ) { } }
if ( thread == null ) { thread = new Thread ( this , "Lasta_Di-TimeoutManager" ) ; thread . setDaemon ( true ) ; thread . start ( ) ; }
public class RoseFilter { /** * 实现 { @ link GenericFilterBean # initFilterBean ( ) } , 对 Rose 进行初始化 */ @ Override protected final void initFilterBean ( ) throws ServletException { } }
try { long startTime = System . currentTimeMillis ( ) ; if ( logger . isInfoEnabled ( ) ) { logger . info ( "[init] call 'init/rootContext'" ) ; } if ( logger . isDebugEnabled ( ) ) { StringBuilder sb = new StringBuilder ( ) ; @ SuppressWarnings ( "unchecked" ) Enumeration < String > iter = getFilterConfig ( ) . getIni...
public class AbstractFuture { /** * Subclasses should invoke this method to set the result of the computation * to an error , { @ code throwable } . This will set the state of the future to * { @ link AbstractFuture . Sync # COMPLETED } and invoke the listeners if the * state was successfully changed . * @ para...
boolean result = sync . setException ( checkNotNull ( throwable ) ) ; if ( result ) { executionList . execute ( ) ; } return result ;
public class DatePropertyParser { /** * Try to parse source string as a ISO8601 date . * @ param source * @ return null if unable to parse */ public static Date parseISO8601DateString ( String source ) { } }
final String [ ] supportedFormats = new String [ ] { "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" , "yyyy-MM-dd'T'HH:mm:ssXXX" , "yyyy-MM-dd'T'HH:mm:ssZ" , "yyyy-MM-dd'T'HH:mm:ss.SSSZ" } ; // SimpleDateFormat is not fully ISO8601 compatible , so we replace ' Z ' by + 0000 if ( StringUtils . contains ( source , "Z" ) ) { source = Str...
public class RetriableStream { /** * Adds grpc - previous - rpc - attempts in the headers of a retry / hedging RPC . */ @ VisibleForTesting final Metadata updateHeaders ( Metadata originalHeaders , int previousAttemptCount ) { } }
Metadata newHeaders = new Metadata ( ) ; newHeaders . merge ( originalHeaders ) ; if ( previousAttemptCount > 0 ) { newHeaders . put ( GRPC_PREVIOUS_RPC_ATTEMPTS , String . valueOf ( previousAttemptCount ) ) ; } return newHeaders ;
public class ViewUtils { /** * Convert the pixels to dips , based on density scale * @ param windowManager the window manager of the display to use the scale density of . * @ param pixel to be converted value . * @ return converted value ( dip ) . */ public static float pixelToDip ( WindowManager windowManager , ...
DisplayMetrics metrics = new DisplayMetrics ( ) ; windowManager . getDefaultDisplay ( ) . getMetrics ( metrics ) ; return metrics . scaledDensity * pixel ;
public class ProximityTracker { /** * Computes the geometric distance between the supplied two points . */ public static int distance ( int x1 , int y1 , int x2 , int y2 ) { } }
int dx = x1 - x2 , dy = y1 - y2 ; return ( int ) Math . sqrt ( dx * dx + dy * dy ) ;
public class DumpProcessingController { /** * Stores a registered processor object in a map of processors . Used * internally to keep { @ link EntityDocumentProcessor } and * { @ link MwRevisionProcessor } objects . * @ param processor * the processor object to register * @ param model * the content model t...
this . preferCurrent = this . preferCurrent && onlyCurrentRevisions ; ListenerRegistration listenerRegistration = new ListenerRegistration ( model , onlyCurrentRevisions ) ; if ( ! processors . containsKey ( listenerRegistration ) ) { processors . put ( listenerRegistration , new ArrayList < > ( ) ) ; } processors . ge...
public class SetUtils { /** * Determines the intersection of a collection of sets . * @ param < T > * @ param sets * Basic collection of sets . * @ return The set of common elements of all given sets . */ public static < T > Set < T > intersection ( Set < T > ... sets ) { } }
return intersection ( Arrays . asList ( sets ) ) ;
public class Link { /** * Create a Builder instance and initialize it from a prototype Link . * @ param prototype the prototype link * @ return a Builder for a Link . * @ since 0.1.0 */ public static Builder copyOf ( final Link prototype ) { } }
return new Builder ( prototype . rel , prototype . href ) . withType ( prototype . type ) . withProfile ( prototype . profile ) . withTitle ( prototype . title ) . withName ( prototype . name ) . withDeprecation ( prototype . deprecation ) . withHrefLang ( prototype . hreflang ) ;
public class ClassAccessor { /** * Returns an { @ link ObjectAccessor } for an instance of T where all the * fields are initialized to their default values . I . e . , 0 for ints , and * null for objects ( except when the field is marked with a NonNull * annotation ) . * @ param enclosingType Describes the type...
ObjectAccessor < T > result = buildObjectAccessor ( ) ; for ( Field field : FieldIterable . of ( type ) ) { if ( NonnullAnnotationVerifier . fieldIsNonnull ( field , annotationCache ) || nonnullFields . contains ( field . getName ( ) ) ) { FieldAccessor accessor = result . fieldAccessorFor ( field ) ; accessor . change...
public class SparkCommandExample { /** * An Example of submitting Spark Command as a Scala program . * Similarly , we can submit Spark Command as a SQL query , R program * and Java program . */ private static void submitScalaProgram ( QdsClient client ) throws Exception { } }
String sampleProgram = "println(\"hello world\")" ; SparkCommandBuilder sparkBuilder = client . command ( ) . spark ( ) ; // Give a name to the command . ( Optional ) sparkBuilder . name ( "spark-scala-test" ) ; // Setting the program here sparkBuilder . program ( sampleProgram ) ; // setting the language here sparkBui...
public class JSRepeated { /** * Set the bounds ( default is { 0 , unbounded } ) . Use maxOccurs = - 1 to indicate * " unbounded . " */ public void setBounds ( int minOccurs , int maxOccurs ) { } }
if ( minOccurs < 0 || maxOccurs < - 1 ) throw new IllegalArgumentException ( "Bounds cannot be negative" ) ; else if ( maxOccurs > 0 && minOccurs > maxOccurs ) throw new IllegalArgumentException ( "Minimum bounds less than maximum bounds" ) ; limits = new int [ ] { minOccurs , maxOccurs } ;
public class BinaryAnnotationMappingDeriver { /** * Creates a mapping result from supplied binary annotations . * @ param binaryAnnotations binary annotations of span * @ return mapping result */ public MappingResult mappingResult ( List < BinaryAnnotation > binaryAnnotations ) { } }
if ( binaryAnnotations == null ) { return new MappingResult ( ) ; } List < String > componentTypes = new ArrayList < > ( ) ; List < String > endpointTypes = new ArrayList < > ( ) ; MappingResult . Builder mappingBuilder = MappingResult . builder ( ) ; for ( BinaryAnnotation binaryAnnotation : binaryAnnotations ) { if (...
public class InjectionPointImpl { /** * / * ( non - Javadoc ) * @ see org . jboss . arquillian . api . InjectionPoint # set ( org . jboss . arquillian . api . Instance ) */ @ Override public void set ( Instance < ? > value ) throws InvocationException { } }
try { if ( ! field . isAccessible ( ) ) { field . setAccessible ( true ) ; } field . set ( target , value ) ; } catch ( Exception e ) { throw new InvocationException ( e . getCause ( ) ) ; }
public class BackupLongTermRetentionPoliciesInner { /** * Creates or updates a database backup long term retention policy . * @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal . * @ param serverName The n...
return beginCreateOrUpdateWithServiceResponseAsync ( resourceGroupName , serverName , databaseName , parameters ) . map ( new Func1 < ServiceResponse < BackupLongTermRetentionPolicyInner > , BackupLongTermRetentionPolicyInner > ( ) { @ Override public BackupLongTermRetentionPolicyInner call ( ServiceResponse < BackupLo...
public class JsMessageFactoryImpl { /** * Extract the class name from the buffer containing the ( first part of ) a restored value . * @ param buffer The buffer * @ param offset The offset of the classname ' s encoded bytes in the buffer * @ param length The length of the classname ' s encoded bytes * @ return ...
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getClassName" , new Object [ ] { offset , length } ) ; // If the classname has a length of 0 then we ' ve been given rubbish so pack it in now if ( length == 0 ) { throw new IllegalArgumentException ( "Invalid buffer: class...
public class BlockBox { /** * Returns true if the element displays at least something */ @ Override public boolean affectsDisplay ( ) { } }
boolean ret = containsFlow ( ) ; // non - zero top or left border if ( border . top > 0 || border . bottom > 0 ) ret = true ; // the same with padding if ( padding . top > 0 || padding . bottom > 0 ) ret = true ; return ret ;
public class StorePackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getDensityCollection ( ) { } }
if ( densityCollectionEClass == null ) { densityCollectionEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( StorePackage . eNS_URI ) . getEClassifiers ( ) . get ( 120 ) ; } return densityCollectionEClass ;
public class BccClient { /** * authorizing a security group rule to a specified security group * @ param request The request containing all options for authorizing security group rule */ public void authorizeSecurityGroupRule ( SecurityGroupRuleOperateRequest request ) { } }
checkNotNull ( request , "request should not be null." ) ; checkStringNotEmpty ( request . getSecurityGroupId ( ) , "securityGroupId should not be empty." ) ; if ( Strings . isNullOrEmpty ( request . getClientToken ( ) ) ) { request . setClientToken ( this . generateClientToken ( ) ) ; } if ( null == request . getRule ...
public class CPDefinitionVirtualSettingUtil { /** * Returns the first cp definition virtual setting in the ordered set where uuid = & # 63 ; and companyId = & # 63 ; . * @ param uuid the uuid * @ param companyId the company ID * @ param orderByComparator the comparator to order the set by ( optionally < code > nu...
return getPersistence ( ) . fetchByUuid_C_First ( uuid , companyId , orderByComparator ) ;
public class BasicOperationsBenchmark { /** * Encode a span using binary format . */ @ Benchmark @ BenchmarkMode ( Mode . AverageTime ) @ OutputTimeUnit ( TimeUnit . NANOSECONDS ) public byte [ ] encodeSpanBinary ( Data data ) { } }
return data . propagation . getBinaryFormat ( ) . toByteArray ( data . spanToEncode . getContext ( ) ) ;
public class BatchStore { /** * - - - - - process methods */ @ Process ( actionType = InitBatch . class ) public void init ( final Dispatcher . Channel channel ) { } }
List < ModelNode > steps = new ArrayList < > ( ) ; steps . add ( readResourceOp ( BATCH_ADDRESS ) ) ; steps . add ( readResourceOp ( THREAD_POOL_ADDRESS ) ) ; steps . add ( readResourceOp ( JOB_REPOSITORY_ADDRESS ) ) ; steps . add ( readThreadFactoriesOp ( ) ) ; final ModelNode comp = new ModelNode ( ) ; comp . get ( A...
public class ListPrincipalsResult { /** * The principals . * @ param principals * The principals . */ public void setPrincipals ( java . util . Collection < Principal > principals ) { } }
if ( principals == null ) { this . principals = null ; return ; } this . principals = new java . util . ArrayList < Principal > ( principals ) ;
public class SpanOperationsBenchmark { /** * Add an annotation as description only . */ @ Benchmark @ BenchmarkMode ( Mode . AverageTime ) @ OutputTimeUnit ( TimeUnit . NANOSECONDS ) public Span addAnnotationEmpty ( Data data ) { } }
Span span = data . annotationSpanEmpty ; span . addAnnotation ( ANNOTATION_DESCRIPTION ) ; return span ;
public class ListWidget { /** * Get all views from the list content * @ return list of views currently visible */ public List < Widget > getAllViews ( ) { } }
List < Widget > views = new ArrayList < > ( ) ; for ( Widget child : mContent . getChildren ( ) ) { Widget item = ( ( ListItemHostWidget ) child ) . getGuest ( ) ; if ( item != null ) { views . add ( item ) ; } } return views ;
public class Group { /** * command _ inout _ reply */ public GroupCmdReplyList command_inout_reply ( final int rid , final int tmo ) throws DevFailed { } }
final Integer rid_obj = new Integer ( rid ) ; final Boolean fwd = ( Boolean ) arp . get ( rid_obj ) ; if ( fwd == null ) { Except . throw_exception ( "API_BadAsynPollId" , "Invalid asynch. request identifier specified" , "Group.command_inout_reply" ) ; } arp . remove ( rid_obj ) ; return command_inout_reply_i ( rid , t...
public class QrPose3DUtils { /** * Specifies transform from pixel to normalize image coordinates */ public void setLensDistortion ( Point2Transform2_F64 pixelToNorm , Point2Transform2_F64 undistToDist ) { } }
if ( pixelToNorm == null ) { this . pixelToNorm = new DoNothing2Transform2_F64 ( ) ; this . undistToDist = new DoNothing2Transform2_F64 ( ) ; } else { this . pixelToNorm = pixelToNorm ; this . undistToDist = undistToDist ; }
public class HadoopSecurityManager_H_2_0 { /** * function to fetch hcat token as per the specified hive configuration and then store the token * in to the credential store specified . * @ param userToProxy String value indicating the name of the user the token will be fetched for . * @ param hiveConf the configur...
logger . info ( HiveConf . ConfVars . METASTOREURIS . varname + ": " + hiveConf . get ( HiveConf . ConfVars . METASTOREURIS . varname ) ) ; logger . info ( HiveConf . ConfVars . METASTORE_USE_THRIFT_SASL . varname + ": " + hiveConf . get ( HiveConf . ConfVars . METASTORE_USE_THRIFT_SASL . varname ) ) ; logger . info ( ...
public class OnePhaseResourceImpl { /** * Prepare a transaction . * < p > This is the first phase of the two - phase commit protocol . * @ return * @ exception XAException * @ exception SystemException */ public final int prepare ( ) throws XAException { } }
if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "prepare" , _resource ) ; // The underlying adapter OnePhaseXAResource will throw an // exception with FFDC specific to the wrappered RM . try { _resource . prepare ( _xid ) ; } finally { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "prepare" ) ; } // If the resource ...
public class MediaEndpoint { /** * Creates the endpoint ( RTP or WebRTC ) and any other additional elements ( if * needed ) . * @ param endpointLatch */ protected void internalEndpointInitialization ( final CountDownLatch endpointLatch ) { } }
if ( this . isWeb ( ) ) { WebRtcEndpoint . Builder builder = new WebRtcEndpoint . Builder ( pipeline ) ; /* * if ( this . dataChannels ) { builder . useDataChannels ( ) ; } */ builder . buildAsync ( new Continuation < WebRtcEndpoint > ( ) { @ Override public void onSuccess ( WebRtcEndpoint result ) throws Exception { w...
public class MtasTokenCollection { /** * Prints the . * @ throws MtasParserException the mtas parser exception */ public void print ( ) throws MtasParserException { } }
Iterator < MtasToken > it = this . iterator ( ) ; while ( it . hasNext ( ) ) { MtasToken token = it . next ( ) ; System . out . println ( token ) ; }
public class DescribeScheduledInstancesRequest { /** * The Scheduled Instance IDs . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setScheduledInstanceIds ( java . util . Collection ) } or { @ link # withScheduledInstanceIds ( java . util . Collection ) } ...
if ( this . scheduledInstanceIds == null ) { setScheduledInstanceIds ( new com . amazonaws . internal . SdkInternalList < String > ( scheduledInstanceIds . length ) ) ; } for ( String ele : scheduledInstanceIds ) { this . scheduledInstanceIds . add ( ele ) ; } return this ;
public class ServerBuilder { /** * Adds a new { @ link ServerPort } that listens to the specified { @ code port } of all available network * interfaces using the specified protocol . * @ deprecated Use { @ link # http ( int ) } or { @ link # https ( int ) } . * @ see < a href = " # no _ port _ specified " > What ...
return port ( port , SessionProtocol . of ( requireNonNull ( protocol , "protocol" ) ) ) ;
public class HazardCurve { /** * Create a discount curve from given times and given zero rates using default interpolation and extrapolation methods . * The discount factor is determined by * < code > * givenSurvivalProbabilities [ timeIndex ] = givenSurvivalProbabilities [ timeIndex - 1 ] * Math . exp ( - givenH...
double [ ] givenSurvivalProbabilities = new double [ givenHazardRates . length ] ; if ( givenHazardRates [ 0 ] < 0 ) { throw new IllegalArgumentException ( "First hazard rate is not positive" ) ; } // initialize the term structure givenSurvivalProbabilities [ 0 ] = Math . exp ( - givenHazardRates [ 0 ] * times [ 0 ] ) ...
public class Seconds { /** * Obtains a { @ code Seconds } representing the number of seconds * equivalent to a number of hours . * The resulting amount will be second - based , with the number of seconds * equal to the number of hours multiplied by 3600. * @ param hours the number of hours , positive or negativ...
if ( hours == 0 ) { return ZERO ; } return new Seconds ( Math . multiplyExact ( hours , SECONDS_PER_HOUR ) ) ;
public class FileInfo { /** * Converts the given path to look like a directory path . * If the path already looks like a directory path then * this call is a no - op . * @ param path Path to convert . * @ return Directory path for the given path . */ public static URI convertToDirectoryPath ( PathCodec pathCode...
StorageResourceId resourceId = pathCodec . validatePathAndGetId ( path , true ) ; if ( resourceId . isStorageObject ( ) ) { if ( ! objectHasDirectoryPath ( resourceId . getObjectName ( ) ) ) { resourceId = convertToDirectoryPath ( resourceId ) ; path = pathCodec . getPath ( resourceId . getBucketName ( ) , resourceId ....
public class ControlBrowseStatusImpl { /** * Get summary trace line for this message * Javadoc description supplied by ControlMessage interface . */ public void getTraceSummaryLine ( StringBuilder buff ) { } }
// Get the common fields for control messages super . getTraceSummaryLine ( buff ) ; buff . append ( ",browseID=" ) ; buff . append ( getBrowseID ( ) ) ; buff . append ( ",status=" ) ; buff . append ( getStatus ( ) ) ;
public class TimeUtil { /** * 格式化日期 * < p > Function : formatDate < / p > * < p > Description : < / p > * @ param timeType * @ param date * @ return * @ author acexy @ thankjava . com * @ date 2015年6月18日 上午10:01:09 * @ version 1.0 */ public static String formatDate ( TimeType timeType , Date date ) { } ...
return getDateFormat ( timeType ) . format ( date ) ;
public class Transform1D { /** * Translate . * < p > If the given < var > path < / var > contains only one segment , * the transformation will follow the segment ' s direction . * @ param thePath the path to follow . * @ param move where < code > x < / code > is the curviline coordinate and < code > y < / code ...
translate ( thePath , null , move ) ;
public class LinearEquationSystem { /** * solves linear system with the chosen method * @ param method the pivot search method */ private void solve ( int method ) throws NullPointerException { } }
// solution exists if ( solved ) { return ; } // bring in reduced row echelon form if ( ! reducedRowEchelonForm ) { reducedRowEchelonForm ( method ) ; } if ( ! isSolvable ( method ) ) { if ( LOG . isDebugging ( ) ) { LOG . debugFine ( "Equation system is not solvable!" ) ; } return ; } // compute one special solution f...
public class AvatarNodeZkUtil { /** * This method tries to update the information in ZooKeeper For every address * of the NameNode it is being run for ( fs . default . name , * dfs . namenode . dn - address , dfs . namenode . http . address ) if they are present . It * also creates information for aliases in ZooK...
String connection = conf . get ( FSConstants . FS_HA_ZOOKEEPER_QUORUM ) ; if ( connection == null ) return ; AvatarZooKeeperClient zk = new AvatarZooKeeperClient ( conf , null ) ; if ( registerClientProtocolAddress ( zk , originalConf , conf , toOverwrite ) ) { return ; } registerDnProtocolAddress ( zk , originalConf ,...
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EEnum getIfcPileTypeEnum ( ) { } }
if ( ifcPileTypeEnumEEnum == null ) { ifcPileTypeEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 1031 ) ; } return ifcPileTypeEnumEEnum ;
public class KunderaMetadataManager { /** * Gets the metamodel . * @ param persistenceUnits * the persistence units * @ return the metamodel */ public static MetamodelImpl getMetamodel ( final KunderaMetadata kunderaMetadata , String ... persistenceUnits ) { } }
MetamodelImpl metamodel = null ; for ( String pu : persistenceUnits ) { metamodel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( pu ) ; if ( metamodel != null ) { return metamodel ; } } // FIXME : I need to verify this why we need common entity metadata now ! // if ( metamodel = = nul...
public class JKObjectUtil { /** * Creates the instance for generic class . * @ param < T > the generic type * @ param parent the parent * @ return the t */ public static < T > T createInstanceForGenericClass ( Object parent ) { } }
try { Object instance = getGenericClassFromParent ( parent ) . newInstance ( ) ; return ( T ) instance ; } catch ( InstantiationException | IllegalAccessException e ) { JK . throww ( e ) ; } return null ;
public class ArrayMask { /** * Writes this mask to the specified output stream . */ public void writeTo ( ObjectOutputStream out ) throws IOException { } }
out . writeShort ( _mask . length ) ; out . write ( _mask ) ;
public class ZooKeeperMasterModel { /** * Returns a list of the hosts / agents that have been registered . */ @ Override public List < String > listHosts ( ) { } }
try { // TODO ( dano ) : only return hosts whose agents completed registration ( i . e . has id nodes ) return provider . get ( "listHosts" ) . getChildren ( Paths . configHosts ( ) ) ; } catch ( KeeperException . NoNodeException e ) { return emptyList ( ) ; } catch ( KeeperException e ) { throw new HeliosRuntimeExcept...
public class AptType { /** * Checks a MethodDeclaration for a ' private ' modifier . * @ param md MethodDeclaration to check . * @ return true if private modifier is present . */ protected boolean isPrivateMethod ( MethodDeclaration md ) { } }
Collection < Modifier > modifiers = md . getModifiers ( ) ; for ( Modifier m : modifiers ) { if ( m . compareTo ( Modifier . PRIVATE ) == 0 ) return true ; } return false ;
public class KatharsisClient { /** * Sets the factory to use to create action stubs ( like JAX - RS annotated * repository methods ) . * @ param actionStubFactory * to use */ public void setActionStubFactory ( ActionStubFactory actionStubFactory ) { } }
this . actionStubFactory = actionStubFactory ; if ( actionStubFactory != null ) { actionStubFactory . init ( new ActionStubFactoryContext ( ) { @ Override public ServiceUrlProvider getServiceUrlProvider ( ) { return moduleRegistry . getResourceRegistry ( ) . getServiceUrlProvider ( ) ; } @ Override public HttpAdapter g...
public class Redwood { /** * Various informal tests of Redwood functionality * @ param args Unused */ public static void main ( String [ ] args ) { } }
// - - STRESS TEST THREADS - - Runnable [ ] tasks = new Runnable [ 1000 ] ; for ( int i = 0 ; i < tasks . length ; i ++ ) { final int fI = i ; tasks [ i ] = new Runnable ( ) { public void run ( ) { startTrack ( "Runnable " + fI ) ; log ( Thread . currentThread ( ) . getId ( ) ) ; log ( "message " + fI + ".1" ) ; log ( ...
public class SAML2AuthnResponseValidator { /** * Searches the sessionIndex in the assertion * @ param subjectAssertion assertion from the response * @ return the sessionIndex if found in the assertion */ protected String getSessionIndex ( final Assertion subjectAssertion ) { } }
List < AuthnStatement > authnStatements = subjectAssertion . getAuthnStatements ( ) ; if ( authnStatements != null && authnStatements . size ( ) > 0 ) { AuthnStatement statement = authnStatements . get ( 0 ) ; if ( statement != null ) { return statement . getSessionIndex ( ) ; } } return null ;
public class MediumOrientationImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
switch ( featureID ) { case AfplibPackage . MEDIUM_ORIENTATION__MED_ORIENT : return getMedOrient ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;