signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class PrincipalAttributeMultifactorAuthenticationTrigger { /** * Resolve multifactor provider by regex predicate set .
* @ param context the context
* @ param service the service
* @ param principal the principal
* @ param providers the providers
* @ return the set */
protected Set < Event > resolveMultifactorProviderViaPredicate ( final Optional < RequestContext > context , final RegisteredService service , final Principal principal , final Collection < MultifactorAuthenticationProvider > providers ) { } } | val attributeNames = commaDelimitedListToSet ( casProperties . getAuthn ( ) . getMfa ( ) . getGlobalPrincipalAttributeNameTriggers ( ) ) ; return multifactorAuthenticationProviderResolver . resolveEventViaPrincipalAttribute ( principal , attributeNames , service , context , providers , input -> providers . stream ( ) . anyMatch ( provider -> input != null && provider . matches ( input ) ) ) ; |
public class AnnotationManager { /** * Find { @ link ru . yandex . qatools . allure . annotations . Issues } annotation and return respective key
* @ return issue keys or empty array if annotation isn ' t present */
public String [ ] getIssueKeys ( ) { } } | Issues issues = getAnnotation ( Issues . class ) ; if ( issues == null ) { return new String [ 0 ] ; } List < String > keys = new ArrayList < > ( ) ; for ( Issue issue : issues . value ( ) ) { keys . add ( issue . value ( ) ) ; } return keys . toArray ( new String [ keys . size ( ) ] ) ; |
public class br { /** * Use this operation to reboot Repeater Instance . */
public static br reboot ( nitro_service client , br resource ) throws Exception { } } | return ( ( br [ ] ) resource . perform_operation ( client , "reboot" ) ) [ 0 ] ; |
public class ReservoirItemsUnion { /** * Returns a byte array representation of this union . This method should be used when the array
* elements are subclasses of a common base class .
* @ param serDe An instance of ArrayOfItemsSerDe
* @ param clazz A class to which the items are cast before serialization
* @ return a byte array representation of this union */
@ SuppressWarnings ( "null" ) // gadgetBytes will be null only if gadget _ = = null AND empty = = true
public byte [ ] toByteArray ( final ArrayOfItemsSerDe < T > serDe , final Class < ? > clazz ) { } } | final int preLongs , outBytes ; final boolean empty = gadget_ == null ; final byte [ ] gadgetBytes = ( gadget_ != null ? gadget_ . toByteArray ( serDe , clazz ) : null ) ; if ( empty ) { preLongs = Family . RESERVOIR_UNION . getMinPreLongs ( ) ; outBytes = 8 ; } else { preLongs = Family . RESERVOIR_UNION . getMaxPreLongs ( ) ; outBytes = ( preLongs << 3 ) + gadgetBytes . length ; // for longs , we know the size
} final byte [ ] outArr = new byte [ outBytes ] ; final WritableMemory mem = WritableMemory . wrap ( outArr ) ; // build preLong
PreambleUtil . insertPreLongs ( mem , preLongs ) ; // Byte 0
PreambleUtil . insertSerVer ( mem , SER_VER ) ; // Byte 1
PreambleUtil . insertFamilyID ( mem , Family . RESERVOIR_UNION . getID ( ) ) ; // Byte 2
if ( empty ) { PreambleUtil . insertFlags ( mem , EMPTY_FLAG_MASK ) ; } else { PreambleUtil . insertFlags ( mem , 0 ) ; // Byte 3
} PreambleUtil . insertMaxK ( mem , maxK_ ) ; // Bytes 4-5
if ( ! empty ) { final int preBytes = preLongs << 3 ; mem . putByteArray ( preBytes , gadgetBytes , 0 , gadgetBytes . length ) ; } return outArr ; |
public class MapUtils { /** * A list of the entries of { @ code map } , ordered by { @ code ordering }
* @ deprecated Because this doesn ' t seem any clearer than doing { @ code ordering . sortedCopy ( map . entrySet ( ) ) }
* directly . */
@ Deprecated public static < K , V > List < Entry < K , V > > sortedCopyOfEntries ( final Map < K , V > map , final Ordering < Map . Entry < K , V > > ordering ) { } } | return ordering . sortedCopy ( map . entrySet ( ) ) ; |
public class CmmnActivity { /** * create a new activity / / / / / */
public CmmnActivity createActivity ( String activityId ) { } } | CmmnActivity activity = new CmmnActivity ( activityId , caseDefinition ) ; if ( activityId != null ) { namedActivities . put ( activityId , activity ) ; } activity . setParent ( this ) ; activities . add ( activity ) ; return activity ; |
public class UnsignedInteger { /** * Returns the result of adding this and { @ code val } . If the result would have more than 32 bits ,
* returns the low 32 bits of the result .
* @ since 14.0 */
@ CheckReturnValue public UnsignedInteger plus ( UnsignedInteger val ) { } } | return fromIntBits ( this . value + checkNotNull ( val ) . value ) ; |
public class DeploymentNode { /** * Adds a relationship between this and another deployment node .
* @ param destination the destination DeploymentNode
* @ param description a short description of the relationship
* @ param technology the technology
* @ return a Relationship object */
public Relationship uses ( DeploymentNode destination , String description , String technology ) { } } | return uses ( destination , description , technology , InteractionStyle . Synchronous ) ; |
public class ConnectivityPredicate { /** * Filter , which returns true if at least one given state occurred
* @ param states NetworkInfo . State , which can have one or more states
* @ return true if at least one given state occurred */
public static Predicate < Connectivity > hasState ( final NetworkInfo . State ... states ) { } } | return new Predicate < Connectivity > ( ) { @ Override public boolean test ( @ NonNull Connectivity connectivity ) throws Exception { for ( NetworkInfo . State state : states ) { if ( connectivity . state ( ) == state ) { return true ; } } return false ; } } ; |
public class XHTMLExtension { /** * Returns the XML representation of a XHTML extension according the specification .
* Usually the XML representation will be inside of a Message XML representation like
* in the following example :
* < pre >
* & lt ; message id = " MlIpV - 4 " to = " gato1 @ gato . home " from = " gato3 @ gato . home / Smack " & gt ;
* & lt ; subject & gt ; Any subject you want & lt ; / subject & gt ;
* & lt ; body & gt ; This message contains something interesting . & lt ; / body & gt ;
* & lt ; html xmlns = " http : / / jabber . org / protocol / xhtml - im " & gt ;
* & lt ; body & gt ; & lt ; p style = ' font - size : large ' & gt ; This message contains something & lt ; em & gt ; interesting & lt ; / em & gt ; . & lt ; / p & gt ; & lt ; / body & gt ;
* & lt ; / html & gt ;
* & lt ; / message & gt ;
* < / pre > */
@ Override public XmlStringBuilder toXML ( org . jivesoftware . smack . packet . XmlEnvironment enclosingNamespace ) { } } | XmlStringBuilder xml = new XmlStringBuilder ( this ) ; xml . rightAngleBracket ( ) ; // Loop through all the bodies and append them to the string buffer
for ( CharSequence body : getBodies ( ) ) { xml . append ( body ) ; } xml . closeElement ( this ) ; return xml ; |
public class CmsImagePreviewDialog { /** * Initializes the preview . < p >
* @ param handler the preview handler */
public void init ( CmsImagePreviewHandler handler ) { } } | m_handler = handler ; m_propertiesTab = new CmsPropertiesTab ( m_galleryMode , m_dialogHeight , m_dialogWidth , m_handler ) ; m_tabbedPanel . add ( m_propertiesTab , Messages . get ( ) . key ( Messages . GUI_PREVIEW_TAB_PROPERTIES_0 ) ) ; if ( ( m_galleryMode == GalleryMode . editor ) || ( m_galleryMode == GalleryMode . widget ) ) { m_imageFormatTab = new CmsImageFormatsTab ( m_galleryMode , m_dialogHeight , m_dialogWidth , handler , null ) ; m_tabbedPanel . add ( m_imageFormatTab , Messages . get ( ) . key ( Messages . GUI_PREVIEW_TAB_IMAGEFORMAT_0 ) ) ; } if ( getGalleryMode ( ) == GalleryMode . editor ) { m_imageEditorFormatsTab = new CmsImageEditorTab ( m_galleryMode , m_dialogHeight , m_dialogWidth , handler ) ; String hideFormatsParam = Window . Location . getParameter ( "hideformats" ) ; boolean hideFormats = "true" . equals ( hideFormatsParam ) ; if ( ! hideFormats ) { m_tabbedPanel . add ( m_imageEditorFormatsTab , Messages . get ( ) . key ( Messages . GUI_PREVIEW_TAB_IMAGEOPTIONS_0 ) ) ; } m_imageAdvancedTab = new CmsImageAdvancedTab ( m_galleryMode , m_dialogHeight , m_dialogWidth , handler ) ; if ( ! hideFormats ) { m_tabbedPanel . add ( m_imageAdvancedTab , Messages . get ( ) . key ( Messages . GUI_PREVIEW_TAB_IMAGEADVANCED_0 ) ) ; } } m_tabbedPanel . addSelectionHandler ( new SelectionHandler < Integer > ( ) { public void onSelection ( SelectionEvent < Integer > event ) { Scheduler . get ( ) . scheduleDeferred ( new ScheduledCommand ( ) { @ SuppressWarnings ( "synthetic-access" ) public void execute ( ) { updateClassForTab ( event . getSelectedItem ( ) . intValue ( ) ) ; } } ) ; } } ) ; |
public class UriUtils { /** * Encodes the given URI port with the given encoding .
* @ param port the port to be encoded
* @ param encoding the character encoding to encode to
* @ return the encoded port
* @ throws UnsupportedEncodingException when the given encoding parameter is not supported */
public static String encodePort ( String port , String encoding ) throws UnsupportedEncodingException { } } | return HierarchicalUriComponents . encodeUriComponent ( port , encoding , HierarchicalUriComponents . Type . PORT ) ; |
public class DescribeFleetsResult { /** * Information about the EC2 Fleets .
* @ return Information about the EC2 Fleets . */
public java . util . List < FleetData > getFleets ( ) { } } | if ( fleets == null ) { fleets = new com . amazonaws . internal . SdkInternalList < FleetData > ( ) ; } return fleets ; |
public class SequenceVectors { /** * Builds vocabulary from provided SequenceIterator instance */
public void buildVocab ( ) { } } | val constructor = new VocabConstructor . Builder < T > ( ) . addSource ( iterator , minWordFrequency ) . setTargetVocabCache ( vocab ) . fetchLabels ( trainSequenceVectors ) . setStopWords ( stopWords ) . enableScavenger ( enableScavenger ) . setEntriesLimit ( vocabLimit ) . allowParallelTokenization ( configuration . isAllowParallelTokenization ( ) ) . setUnk ( useUnknown && unknownElement != null ? unknownElement : null ) . build ( ) ; if ( existingModel != null && lookupTable instanceof InMemoryLookupTable && existingModel . lookupTable ( ) instanceof InMemoryLookupTable ) { log . info ( "Merging existing vocabulary into the current one..." ) ; /* if we have existing model defined , we ' re forced to fetch labels only .
the rest of vocabulary & weights should be transferred from existing model */
constructor . buildMergedVocabulary ( existingModel , true ) ; /* Now we have vocab transferred , and we should transfer syn0 values into lookup table */
( ( InMemoryLookupTable < VocabWord > ) lookupTable ) . consume ( ( InMemoryLookupTable < VocabWord > ) existingModel . lookupTable ( ) ) ; } else { log . info ( "Starting vocabulary building..." ) ; // if we don ' t have existing model defined , we just build vocabulary
constructor . buildJointVocabulary ( false , true ) ; /* if ( useUnknown & & unknownElement ! = null & & ! vocab . containsWord ( unknownElement . getLabel ( ) ) ) {
log . info ( " Adding UNK element . . . " ) ;
unknownElement . setSpecial ( true ) ;
unknownElement . markAsLabel ( false ) ;
unknownElement . setIndex ( vocab . numWords ( ) ) ;
vocab . addToken ( unknownElement ) ; */
// check for malformed inputs . if numWords / numSentences ratio is huge , then user is passing something weird
if ( vocab . numWords ( ) / constructor . getNumberOfSequences ( ) > 1000 ) { log . warn ( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ) ; log . warn ( "! !" ) ; log . warn ( "! Your input looks malformed: number of sentences is too low, model accuracy may suffer !" ) ; log . warn ( "! !" ) ; log . warn ( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ) ; } } |
public class EmbedBuilder { /** * Sets the Image of the embed .
* < p > < b > < a href = " http : / / i . imgur . com / 2hzuHFJ . png " > Example < / a > < / b >
* < p > < b > Uploading images with Embeds < / b >
* < br > When uploading an < u > image < / u >
* ( using { @ link net . dv8tion . jda . core . entities . MessageChannel # sendFile ( java . io . File , net . dv8tion . jda . core . entities . Message ) MessageChannel . sendFile ( . . . ) } )
* you can reference said image using the specified filename as URI { @ code attachment : / / filename . ext } .
* < p > < u > Example < / u >
* < pre > < code >
* MessageChannel channel ; / / = reference of a MessageChannel
* MessageBuilder message = new MessageBuilder ( ) ;
* EmbedBuilder embed = new EmbedBuilder ( ) ;
* InputStream file = new URL ( " https : / / http . cat / 500 " ) . openStream ( ) ;
* embed . setImage ( " attachment : / / cat . png " ) / / we specify this in sendFile as " cat . png "
* . setDescription ( " This is a cute cat : 3 " ) ;
* message . setEmbed ( embed . build ( ) ) ;
* channel . sendFile ( file , " cat . png " , message . build ( ) ) . queue ( ) ;
* < / code > < / pre >
* @ param url
* the url of the image of the embed
* @ throws java . lang . IllegalArgumentException
* < ul >
* < li > If the length of { @ code url } is longer than { @ link net . dv8tion . jda . core . entities . MessageEmbed # URL _ MAX _ LENGTH } . < / li >
* < li > If the provided { @ code url } is not a properly formatted http or https url . < / li >
* < / ul >
* @ return the builder after the image has been set
* @ see net . dv8tion . jda . core . entities . MessageChannel # sendFile ( java . io . File , String , net . dv8tion . jda . core . entities . Message ) MessageChannel . sendFile ( . . . ) */
public EmbedBuilder setImage ( String url ) { } } | if ( url == null ) { this . image = null ; } else { urlCheck ( url ) ; this . image = new MessageEmbed . ImageInfo ( url , null , 0 , 0 ) ; } return this ; |
public class ResizeJobFlowStep { /** * Creates the final HadoopJarStepConfig once you are done configuring the step . You can use
* this as you would any other HadoopJarStepConfig .
* @ return HadoopJarStepConfig configured to perform the specified actions . */
public HadoopJarStepConfig toHadoopJarStepConfig ( ) { } } | if ( args . size ( ) == 0 ) { throw new AmazonServiceException ( "Cannot create a ResizeJobFlowStep with no resize actions." ) ; } if ( wait == false ) { args . add ( "--no-wait" ) ; } if ( onArrested != null ) { args . add ( "--on-arrested" ) ; args . add ( onArrested . toString ( ) ) ; } if ( onFailure != null ) { args . add ( "--on-failure" ) ; args . add ( onFailure . toString ( ) ) ; } return new HadoopJarStepConfig ( ) . withJar ( "s3://" + bucket + "/libs/resize-job-flow/0.1/resize-job-flow.jar" ) . withArgs ( args ) ; |
public class ProtoUtils { /** * createChannelHeader create chainHeader
* @ param type header type . See { @ link ChannelHeader . Builder # setType } .
* @ param txID transaction ID . See { @ link ChannelHeader . Builder # setTxId } .
* @ param channelID channel ID . See { @ link ChannelHeader . Builder # setChannelId } .
* @ param epoch the epoch in which this header was generated . See { @ link ChannelHeader . Builder # setEpoch } .
* @ param timeStamp local time when the message was created . See { @ link ChannelHeader . Builder # setTimestamp } .
* @ param chaincodeHeaderExtension extension to attach dependent on the header type . See { @ link ChannelHeader . Builder # setExtension } .
* @ param tlsCertHash
* @ return a new chain header . */
public static ChannelHeader createChannelHeader ( HeaderType type , String txID , String channelID , long epoch , Timestamp timeStamp , ChaincodeHeaderExtension chaincodeHeaderExtension , byte [ ] tlsCertHash ) { } } | if ( isDebugLevel ) { String tlschs = "" ; if ( tlsCertHash != null ) { tlschs = DatatypeConverter . printHexBinary ( tlsCertHash ) ; } logger . debug ( format ( "ChannelHeader: type: %s, version: 1, Txid: %s, channelId: %s, epoch %d, clientTLSCertificate digest: %s" , type . name ( ) , txID , channelID , epoch , tlschs ) ) ; } ChannelHeader . Builder ret = ChannelHeader . newBuilder ( ) . setType ( type . getNumber ( ) ) . setVersion ( 1 ) . setTxId ( txID ) . setChannelId ( channelID ) . setTimestamp ( timeStamp ) . setEpoch ( epoch ) ; if ( null != chaincodeHeaderExtension ) { ret . setExtension ( chaincodeHeaderExtension . toByteString ( ) ) ; } if ( tlsCertHash != null ) { ret . setTlsCertHash ( ByteString . copyFrom ( tlsCertHash ) ) ; } return ret . build ( ) ; |
public class StringUtil { /** * 先頭の文字を小文字に変換します 。
* @ param text 文字列
* @ return 変換された文字列 。 ただし 、 { @ code text } が { @ code null } の場合は { @ code null } 、 { @ code text }
* が空文字の場合は空文字を返します 。 */
public static String decapitalize ( String text ) { } } | if ( isNullOrEmpty ( text ) ) { return text ; } char chars [ ] = text . toCharArray ( ) ; chars [ 0 ] = Character . toLowerCase ( chars [ 0 ] ) ; return new String ( chars ) ; |
public class NodeGroupConfiguration { /** * A list of Availability Zones to be used for the read replicas . The number of Availability Zones in this list must
* match the value of < code > ReplicaCount < / code > or < code > ReplicasPerNodeGroup < / code > if not specified .
* @ param replicaAvailabilityZones
* A list of Availability Zones to be used for the read replicas . The number of Availability Zones in this
* list must match the value of < code > ReplicaCount < / code > or < code > ReplicasPerNodeGroup < / code > if not
* specified . */
public void setReplicaAvailabilityZones ( java . util . Collection < String > replicaAvailabilityZones ) { } } | if ( replicaAvailabilityZones == null ) { this . replicaAvailabilityZones = null ; return ; } this . replicaAvailabilityZones = new com . amazonaws . internal . SdkInternalList < String > ( replicaAvailabilityZones ) ; |
public class RemoteRuntimeManager { /** * { @ inheritDoc } */
@ Override public synchronized RuntimeEngine getRuntimeEngine ( Context < ? > context ) { } } | Object contextId = context != null ? context . getContextId ( ) : null ; if ( contextId == null ) { contextId = NULL_CONTEXT_ID ; } RuntimeEngine engine = _engines . get ( contextId ) ; if ( engine == null ) { engine = new ExtendedRemoteRuntimeEngine ( _configuration , context ) ; _engines . put ( contextId , engine ) ; } return engine ; |
public class URLUtil { /** * 标准化URL字符串 , 包括 :
* < pre >
* 1 . 多个 / 替换为一个
* < / pre >
* @ param url URL字符串
* @ param isEncodeBody 是否对URL中body部分的中文和特殊字符做转义 ( 不包括http : 和 / )
* @ return 标准化后的URL字符串
* @ since 4.4.1 */
public static String normalize ( String url , boolean isEncodeBody ) { } } | if ( StrUtil . isBlank ( url ) ) { return url ; } final int sepIndex = url . indexOf ( "://" ) ; String pre ; String body ; if ( sepIndex > 0 ) { pre = StrUtil . subPre ( url , sepIndex + 3 ) ; body = StrUtil . subSuf ( url , sepIndex + 3 ) ; } else { pre = "http://" ; body = url ; } final int paramsSepIndex = StrUtil . indexOf ( body , '?' ) ; String params = null ; if ( paramsSepIndex > 0 ) { params = StrUtil . subSuf ( body , paramsSepIndex ) ; body = StrUtil . subPre ( body , paramsSepIndex ) ; } // 去除开头的 \ 或者 /
body = body . replaceAll ( "^[\\/]+" , StrUtil . EMPTY ) ; // 替换多个 \ 或 / 为单个 /
body = body . replace ( "\\" , "/" ) . replaceAll ( "//+" , "/" ) ; if ( isEncodeBody ) { body = encode ( body ) ; } return pre + body + StrUtil . nullToEmpty ( params ) ; |
public class ClassHelper { /** * Resolve the given class name as primitive class , if appropriate ,
* according to the JVM ' s naming rules for primitive classes .
* Also supports the JVM ' s internal class names for primitive arrays . Does
* < i > not < / i > support the " [ ] " suffix notation for primitive arrays ; this is
* only supported by { @ link # forName } .
* @ param name
* the name of the potentially primitive class
* @ return the primitive class , or < code > null < / code > if the name does not
* denote a primitive class or primitive array class */
public static Class < ? > resolvePrimitiveClassName ( String name ) { } } | Class < ? > result = null ; // Most class names will be quite long , considering that they
// SHOULD sit in a package , so a length check is worthwhile .
if ( name != null && name . length ( ) <= 8 ) { // Could be a primitive - likely .
result = ( Class < ? > ) PRIMIIIVE_TYPE_NAME_MAP . get ( name ) ; } return result ; |
public class DeploymentClassFinder { /** * Finds class with should produce global deployment PER project .
* @ return class marked witch @ ArquillianSuiteDeployment annotation */
private static Class < ? > getDeploymentClassFromAnnotation ( ) { } } | // Had a bug that if you open inside eclipse more than one project with @ ArquillianSuiteDeployment and is a dependency , the test doesn ' t run because found more than one @ ArquillianSuiteDeployment .
// Filter the deployment PER project .
final Reflections reflections = new Reflections ( ClasspathHelper . contextClassLoader ( ) . getResource ( "" ) ) ; Set < Class < ? > > results = reflections . getTypesAnnotatedWith ( ArquillianSuiteDeployment . class , true ) ; if ( results . isEmpty ( ) ) { return null ; } // Verify if has more than one @ ArquillianSuiteDeployment . We cannot decide in cases we find more than one class .
// in that case we will return null and hope there is a configuration in arquillian xml .
if ( results . size ( ) > 1 ) { for ( final Class < ? > type : results ) { log . log ( Level . SEVERE , "arquillian-suite-deployment: Duplicated class annotated with @ArquillianSuiteDeployment: {0}" , type . getName ( ) ) ; } throw new IllegalStateException ( "Duplicated classes annotated with @ArquillianSuiteDeployment" ) ; } // Return the single result .
final Class < ? > type = results . iterator ( ) . next ( ) ; log . log ( Level . INFO , "arquillian-suite-deployment: Found class annotated with @ArquillianSuiteDeployment: {0}" , type . getName ( ) ) ; return type ; |
public class XmlStreamReaderUtils { /** * Returns the value of an attribute as a float . If the attribute is empty , this method throws
* an exception .
* @ param reader
* < code > XMLStreamReader < / code > that contains attribute values .
* @ param localName
* local name of attribute ( the namespace is ignored ) .
* @ return value of attribute as float
* @ throws XMLStreamException
* if attribute is empty . */
public static float requiredFloatAttribute ( final XMLStreamReader reader , final String localName ) throws XMLStreamException { } } | return requiredFloatAttribute ( reader , null , localName ) ; |
public class FileUtils { /** * Close the closeable object
* @ param closeable */
public static boolean tryToClose ( Closeable closeable ) { } } | Object token = ThreadIdentityManager . runAsServer ( ) ; try { if ( closeable != null ) { try { closeable . close ( ) ; return true ; } catch ( IOException e ) { // ignore
} } } finally { ThreadIdentityManager . reset ( token ) ; } return false ; |
public class NamespaceApi { /** * Get all namespaces that match a string in their name or path in the specified page range .
* < pre > < code > GitLab Endpoint : GET / namespaces ? search = : query < / code > < / pre >
* @ param query the search string
* @ param page the page to get
* @ param perPage the number of Namespace instances per page
* @ return the Namespace List with the matching namespaces
* @ throws GitLabApiException if any exception occurs */
public List < Namespace > findNamespaces ( String query , int page , int perPage ) throws GitLabApiException { } } | GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "search" , query , true ) . withParam ( PAGE_PARAM , page ) . withParam ( PER_PAGE_PARAM , perPage ) ; Response response = get ( Response . Status . OK , formData . asMap ( ) , "namespaces" ) ; return ( response . readEntity ( new GenericType < List < Namespace > > ( ) { } ) ) ; |
public class PullerInternal { /** * Add a revision to the appropriate queue of revs to individually GET */
@ InterfaceAudience . Private protected void queueRemoteRevision ( RevisionInternal rev ) { } } | if ( rev . isDeleted ( ) ) { deletedRevsToPull . add ( rev ) ; } else { revsToPull . add ( rev ) ; } |
public class SmoothProgressDrawable { /** * / / / / / SETTERS */
@ UiThread public void setInterpolator ( Interpolator interpolator ) { } } | if ( interpolator == null ) throw new IllegalArgumentException ( "Interpolator cannot be null" ) ; mInterpolator = interpolator ; invalidateSelf ( ) ; |
public class MetaConfigPool { /** * { @ inheritDoc }
* @ param variable { @ inheritDoc }
* @ return { @ inheritDoc }
* @ throws NotAvailableException { @ inheritDoc } */
@ Override public String getValue ( final String variable ) throws NotAvailableException { } } | try { return VariableProcessor . resolveVariables ( VariableProcessor . resolveVariable ( variable , variableProviderPool ) , true , variableProviderPool ) ; } catch ( MultiException ex ) { throw new NotAvailableException ( "Variable[" + variable + "]" , ex ) ; } |
public class CreateWorkspacesResult { /** * Information about the WorkSpaces that were created .
* Because this operation is asynchronous , the identifier returned is not immediately available for use with other
* operations . For example , if you call < a > DescribeWorkspaces < / a > before the WorkSpace is created , the information
* returned can be incomplete .
* @ return Information about the WorkSpaces that were created . < / p >
* Because this operation is asynchronous , the identifier returned is not immediately available for use with
* other operations . For example , if you call < a > DescribeWorkspaces < / a > before the WorkSpace is created , the
* information returned can be incomplete . */
public java . util . List < Workspace > getPendingRequests ( ) { } } | if ( pendingRequests == null ) { pendingRequests = new com . amazonaws . internal . SdkInternalList < Workspace > ( ) ; } return pendingRequests ; |
public class CsvMapReader { /** * { @ inheritDoc } */
public Map < String , String > read ( final String ... nameMapping ) throws IOException { } } | if ( nameMapping == null ) { throw new NullPointerException ( "nameMapping should not be null" ) ; } if ( readRow ( ) ) { final Map < String , String > destination = new HashMap < String , String > ( ) ; Util . filterListToMap ( destination , nameMapping , getColumns ( ) ) ; return destination ; } return null ; // EOF |
public class FaceListsImpl { /** * Retrieve a face list ' s information .
* @ param faceListId Id referencing a particular face list .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the FaceList object */
public Observable < FaceList > getAsync ( String faceListId ) { } } | return getWithServiceResponseAsync ( faceListId ) . map ( new Func1 < ServiceResponse < FaceList > , FaceList > ( ) { @ Override public FaceList call ( ServiceResponse < FaceList > response ) { return response . body ( ) ; } } ) ; |
public class YggdrasilAuthenticator { /** * Refreshes the current session manually using token .
* @ param clientToken the client token
* @ param accessToken the access token
* @ throws AuthenticationException If an exception occurs during the
* authentication */
public synchronized void refreshWithToken ( String clientToken , String accessToken ) throws AuthenticationException { } } | authResult = authenticationService . refresh ( Objects . requireNonNull ( clientToken ) , Objects . requireNonNull ( accessToken ) ) ; |
public class WriterFactoryImpl { /** * { @ inheritDoc } */
@ Override public ClassWriter getClassWriter ( TypeElement typeElement , TypeElement prevClass , TypeElement nextClass , ClassTree classTree ) { } } | return new ClassWriterImpl ( configuration , typeElement , prevClass , nextClass , classTree ) ; |
public class authenticationauthnprofile { /** * Use this API to add authenticationauthnprofile . */
public static base_response add ( nitro_service client , authenticationauthnprofile resource ) throws Exception { } } | authenticationauthnprofile addresource = new authenticationauthnprofile ( ) ; addresource . name = resource . name ; addresource . authnvsname = resource . authnvsname ; addresource . authenticationhost = resource . authenticationhost ; addresource . authenticationdomain = resource . authenticationdomain ; addresource . authenticationlevel = resource . authenticationlevel ; return addresource . add_resource ( client ) ; |
public class StackdriverExportUtils { /** * Convert a OpenCensus Distribution to a StackDriver Distribution */
@ VisibleForTesting static Distribution createDistribution ( io . opencensus . metrics . export . Distribution distribution ) { } } | Distribution . Builder builder = Distribution . newBuilder ( ) . setBucketOptions ( createBucketOptions ( distribution . getBucketOptions ( ) ) ) . setCount ( distribution . getCount ( ) ) . setMean ( distribution . getCount ( ) == 0 ? 0 : distribution . getSum ( ) / distribution . getCount ( ) ) . setSumOfSquaredDeviation ( distribution . getSumOfSquaredDeviations ( ) ) ; setBucketCountsAndExemplars ( distribution . getBuckets ( ) , builder ) ; return builder . build ( ) ; |
public class FeatureCollection { /** * Create a new instance of this class by giving the feature collection a single { @ link Feature } .
* @ param feature a single feature
* @ param bbox optionally include a bbox definition as a double array
* @ return a new instance of this class defined by the values passed inside this static factory
* method
* @ since 3.0.0 */
public static FeatureCollection fromFeature ( @ NonNull Feature feature , @ Nullable BoundingBox bbox ) { } } | List < Feature > featureList = Arrays . asList ( feature ) ; return new FeatureCollection ( TYPE , bbox , featureList ) ; |
public class AbstractThresholdingOutputStream { /** * Checks to see if writing the specified number of bytes would cause the
* configured threshold to be exceeded . If so , triggers an event to allow a
* concrete implementation to take action on
* @ param nCount
* The number of bytes about to be written to the underlying output
* stream .
* @ exception IOException
* if an error occurs . */
protected void checkThreshold ( final int nCount ) throws IOException { } } | if ( ! m_bThresholdExceeded && ( m_nWritten + nCount > m_nThreshold ) ) { m_bThresholdExceeded = true ; onThresholdReached ( ) ; } |
public class AWSGreengrassClient { /** * Creates a version of a device definition that has already been defined .
* @ param createDeviceDefinitionVersionRequest
* @ return Result of the CreateDeviceDefinitionVersion operation returned by the service .
* @ throws BadRequestException
* invalid request
* @ sample AWSGreengrass . CreateDeviceDefinitionVersion
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / greengrass - 2017-06-07 / CreateDeviceDefinitionVersion "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public CreateDeviceDefinitionVersionResult createDeviceDefinitionVersion ( CreateDeviceDefinitionVersionRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeCreateDeviceDefinitionVersion ( request ) ; |
public class DefaultTableHeaderCellRenderer { /** * Overloaded to return an icon suitable to the primary sorted column , or null if
* the column is not the primary sort key .
* @ param table the < code > JTable < / code > .
* @ param column the column index .
* @ return the sort icon , or null if the column is unsorted . */
@ SuppressWarnings ( "incomplete-switch" ) protected Icon getIcon ( JTable table , int column ) { } } | SortKey sortKey = getSortKey ( table , column ) ; if ( sortKey != null && table . convertColumnIndexToView ( sortKey . getColumn ( ) ) == column ) { switch ( sortKey . getSortOrder ( ) ) { case ASCENDING : return UIManager . getIcon ( "Table.ascendingSortIcon" ) ; case DESCENDING : return UIManager . getIcon ( "Table.descendingSortIcon" ) ; } } return null ; |
public class S3ConditionFactory { /** * Constructs a new access policy condition that compares an Amazon S3
* canned ACL with the canned ACL specified by an incoming request .
* You can use this condition to ensure that any objects uploaded to an
* Amazon S3 bucket have a specific canned ACL set .
* @ param cannedAcl
* The Amazon S3 canned ACL to compare against .
* @ return A new access control policy condition that compares the Amazon S3
* canned ACL specified in incoming requests against the value
* specified . */
public static Condition newCannedACLCondition ( CannedAccessControlList cannedAcl ) { } } | return new StringCondition ( StringComparisonType . StringEquals , CANNED_ACL_CONDITION_KEY , cannedAcl . toString ( ) ) ; |
public class ConfusionMatrix { /** * Outputs the ConfusionMatrix as comma - separated values for easy import into spreadsheets */
public String toCSV ( ) { } } | StringBuilder builder = new StringBuilder ( ) ; // Header Row
builder . append ( ",,Predicted Class,\n" ) ; // Predicted Classes Header Row
builder . append ( ",," ) ; for ( T predicted : classes ) { builder . append ( String . format ( "%s," , predicted ) ) ; } builder . append ( "Total\n" ) ; // Data Rows
String firstColumnLabel = "Actual Class," ; for ( T actual : classes ) { builder . append ( firstColumnLabel ) ; firstColumnLabel = "," ; builder . append ( String . format ( "%s," , actual ) ) ; for ( T predicted : classes ) { builder . append ( getCount ( actual , predicted ) ) ; builder . append ( "," ) ; } // Actual Class Totals Column
builder . append ( getActualTotal ( actual ) ) ; builder . append ( "\n" ) ; } // Predicted Class Totals Row
builder . append ( ",Total," ) ; for ( T predicted : classes ) { builder . append ( getPredictedTotal ( predicted ) ) ; builder . append ( "," ) ; } builder . append ( "\n" ) ; return builder . toString ( ) ; |
public class JSONTokener { /** * Get the text up but not including the specified character or the
* end of line , whichever comes first . < p >
* @ param d a delimiter character
* @ return a string
* @ throws JSONException if something goes wrong */
public String nextTo ( char d ) throws JSONException { } } | StringBuffer sb = new StringBuffer ( ) ; for ( ; ; ) { char c = next ( ) ; if ( ( c == d ) || ( c == 0 ) || ( c == '\n' ) || ( c == '\r' ) ) { if ( c != 0 ) { back ( ) ; } return sb . toString ( ) . trim ( ) ; } sb . append ( c ) ; } |
public class AdminElevatewordAction { @ Execute public HtmlResponse create ( final CreateForm form ) { } } | verifyCrudMode ( form . crudMode , CrudMode . CREATE ) ; validate ( form , messages -> { } , ( ) -> asEditHtml ( ) ) ; verifyToken ( ( ) -> asEditHtml ( ) ) ; getElevateWord ( form ) . ifPresent ( entity -> { try { elevateWordService . store ( entity ) ; suggestHelper . addElevateWord ( entity . getSuggestWord ( ) , entity . getReading ( ) , entity . getLabelTypeValues ( ) , entity . getPermissions ( ) , entity . getBoost ( ) , false ) ; saveInfo ( messages -> messages . addSuccessCrudCreateCrudTable ( GLOBAL ) ) ; } catch ( final Exception e ) { throwValidationError ( messages -> messages . addErrorsCrudFailedToCreateCrudTable ( GLOBAL , buildThrowableMessage ( e ) ) , ( ) -> asEditHtml ( ) ) ; } } ) . orElse ( ( ) -> { throwValidationError ( messages -> messages . addErrorsCrudFailedToCreateInstance ( GLOBAL ) , ( ) -> asEditHtml ( ) ) ; } ) ; return redirect ( getClass ( ) ) ; |
public class LeaderRole { /** * Appends initial entries to the log to take leadership . */
private CompletableFuture < Void > appendInitialEntries ( ) { } } | final long term = raft . getTerm ( ) ; return appendAndCompact ( new InitializeEntry ( term , appender . getTime ( ) ) ) . thenApply ( index -> null ) ; |
public class JJTMithraQLState { /** * / * Returns the node on the top of the stack , and remove it from the
* stack . */
Node popNode ( ) { } } | if ( -- sp < mk ) { mk = ( ( Integer ) marks . pop ( ) ) . intValue ( ) ; } return ( Node ) nodes . pop ( ) ; |
public class CodedConstant { /** * Gets the map kv message elements .
* @ param name the name
* @ param mapType the map type
* @ return the map kv message elements */
private static MessageElement getMapKVMessageElements ( String name , MapType mapType ) { } } | MessageElement . Builder ret = MessageElement . builder ( ) ; ret . name ( name ) ; DataType keyType = mapType . keyType ( ) ; Builder fieldBuilder = FieldElement . builder ( ) . name ( "key" ) . tag ( 1 ) ; fieldBuilder . type ( keyType ) . label ( FieldElement . Label . OPTIONAL ) ; ret . addField ( fieldBuilder . build ( ) ) ; DataType valueType = mapType . valueType ( ) ; fieldBuilder = FieldElement . builder ( ) . name ( "value" ) . tag ( 2 ) ; fieldBuilder . type ( valueType ) . label ( FieldElement . Label . OPTIONAL ) ; ret . addField ( fieldBuilder . build ( ) ) ; return ret . build ( ) ; |
public class CmsInternalLinkValidationDialog { /** * Commits the edited project to the db . < p > */
@ Override public void actionCommit ( ) { } } | List errors = new ArrayList ( ) ; try { setDialogObject ( m_resources ) ; // refresh the list
Map objects = ( Map ) getSettings ( ) . getListObject ( ) ; if ( objects != null ) { objects . remove ( CmsInternalLinkValidationList . class . getName ( ) ) ; } // forward to the list
getToolManager ( ) . jspForwardTool ( this , "/linkvalidation/internallinks/list" , null ) ; } catch ( Throwable t ) { errors . add ( t ) ; } // set the list of errors to display when saving failed
setCommitErrors ( errors ) ; |
public class ServiceFuture { /** * Creates a ServiceCall from an observable object and a callback .
* @ param observable the observable to create from
* @ param callback the callback to call when events happen
* @ param < T > the type of the response
* @ return the created ServiceCall */
public static < T > ServiceFuture < T > fromResponse ( final Observable < ServiceResponse < T > > observable , final ServiceCallback < T > callback ) { } } | final ServiceFuture < T > serviceFuture = new ServiceFuture < > ( ) ; serviceFuture . subscription = observable . last ( ) . subscribe ( new Action1 < ServiceResponse < T > > ( ) { @ Override public void call ( ServiceResponse < T > t ) { if ( callback != null ) { callback . success ( t . body ( ) ) ; } serviceFuture . set ( t . body ( ) ) ; } } , new Action1 < Throwable > ( ) { @ Override public void call ( Throwable throwable ) { if ( callback != null ) { callback . failure ( throwable ) ; } serviceFuture . setException ( throwable ) ; } } ) ; return serviceFuture ; |
public class ExtensionUtil { /** * Utility method that helps instantiate a class used to extend the data grid .
* @ param className the name of a class to instantiate
* @ param assignableFrom the type that should be assignable from an instance of type < code > className < / code >
* @ return an instance of the given class
* @ throws org . apache . beehive . netui . databinding . datagrid . api . exceptions . DataGridExtensionException
* when an error occurs creating an instance of the class */
public static Object instantiateClass ( String className , Class assignableFrom ) { } } | if ( className == null ) throw new IllegalArgumentException ( Bundle . getErrorString ( "DataGridUtil_CantCreateClass" ) ) ; Class clazz = null ; try { clazz = Class . forName ( className , false , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; } catch ( Exception e ) { assert e instanceof IllegalAccessException || e instanceof InstantiationException || e instanceof ClassNotFoundException : "Caught exception of unexpected type: " + e . getClass ( ) . getName ( ) ; String msg = Bundle . getErrorString ( "DataGridUtil_CantInstantiateClass" , new Object [ ] { e } ) ; LOGGER . error ( msg , e ) ; throw new DataGridExtensionException ( msg , e ) ; } return instantiateClass ( clazz , assignableFrom ) ; |
public class MethodUtils { /** * < p > Return an accessible method ( that is , one that can be invoked via
* reflection ) that implements the specified method , by scanning through
* all implemented interfaces and subinterfaces . If no such method
* can be found , return { @ code null } . < / p >
* < p > There isn ' t any good reason why this method must be private .
* It is because there doesn ' t seem any reason why other classes should
* call this rather than the higher level methods . < / p >
* @ param clazz Parent class for the interfaces to be checked
* @ param methodName Method name of the method we wish to call
* @ param paramTypes The parameter type signatures */
private static Method getAccessibleMethodFromInterfaceNest ( Class < ? > clazz , String methodName , Class < ? > [ ] paramTypes ) { } } | Method method = null ; // Search up the superclass chain
for ( ; clazz != null ; clazz = clazz . getSuperclass ( ) ) { // Check the implemented interfaces of the parent class
Class < ? > [ ] interfaces = clazz . getInterfaces ( ) ; for ( Class < ? > anInterface : interfaces ) { // Is this interface public ?
if ( ! Modifier . isPublic ( anInterface . getModifiers ( ) ) ) { continue ; } // Does the method exist on this interface ?
try { method = anInterface . getDeclaredMethod ( methodName , paramTypes ) ; } catch ( NoSuchMethodException e ) { /* Swallow , if no method is found after the loop then this
* method returns null . */
} if ( method != null ) { return method ; } // Recursively check our parent interfaces
method = getAccessibleMethodFromInterfaceNest ( anInterface , methodName , paramTypes ) ; if ( method != null ) { return method ; } } } // We did not find anything
return null ; |
public class JvmAgent { /** * Entry point for the agent , using dynamic attach
* ( this is post VM initialisation attachment , via com . sun . attach )
* @ param agentArgs arguments as given on the command line */
public static void agentmain ( String agentArgs , Instrumentation instrumentation ) { } } | JvmAgentConfig config = new JvmAgentConfig ( agentArgs ) ; if ( ! config . isModeStop ( ) ) { startAgent ( config , false , instrumentation ) ; } else { stopAgent ( ) ; } |
public class AWSOpsWorksClient { /** * Deregisters an Amazon RDS instance .
* < b > Required Permissions < / b > : To use this action , an IAM user must have a Manage permissions level for the stack ,
* or an attached policy that explicitly grants permissions . For more information on user permissions , see < a
* href = " http : / / docs . aws . amazon . com / opsworks / latest / userguide / opsworks - security - users . html " > Managing User
* Permissions < / a > .
* @ param deregisterRdsDbInstanceRequest
* @ return Result of the DeregisterRdsDbInstance operation returned by the service .
* @ throws ValidationException
* Indicates that a request was not valid .
* @ throws ResourceNotFoundException
* Indicates that a resource was not found .
* @ sample AWSOpsWorks . DeregisterRdsDbInstance
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / opsworks - 2013-02-18 / DeregisterRdsDbInstance "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DeregisterRdsDbInstanceResult deregisterRdsDbInstance ( DeregisterRdsDbInstanceRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDeregisterRdsDbInstance ( request ) ; |
public class FileTransferClient { /** * Handle MBean invocation requests */
public Object handleOperation ( String operation , Object [ ] params ) throws IOException { } } | if ( OPERATION_DOWNLOAD . equals ( operation ) ) { if ( params . length == 2 ) { downloadFile ( ( String ) params [ 0 ] , ( String ) params [ 1 ] ) ; } else { // partial download
return downloadFile ( ( String ) params [ 0 ] , ( String ) params [ 1 ] , ( Long ) params [ 2 ] , ( Long ) params [ 3 ] ) ; } } else if ( OPERATION_UPLOAD . equals ( operation ) ) { uploadFile ( ( String ) params [ 0 ] , ( String ) params [ 1 ] , ( Boolean ) params [ 2 ] ) ; } else if ( OPERATION_DELETE . equals ( operation ) ) { deleteFile ( ( String ) params [ 0 ] ) ; } else if ( OPERATION_DELETE_ALL . equals ( operation ) ) { deleteAll ( ( List < String > ) params [ 0 ] ) ; } else { throw logUnsupportedOperationError ( "handleOperation" , operation ) ; } // currently all operations are void , so return null .
return null ; |
public class AtomicIntegerFieldUpdater { /** * Atomically adds the given value to the current value of the field of
* the given object managed by this updater .
* @ param obj An object whose field to get and set
* @ param delta the value to add
* @ return the updated value */
public int addAndGet ( T obj , int delta ) { } } | int prev , next ; do { prev = get ( obj ) ; next = prev + delta ; } while ( ! compareAndSet ( obj , prev , next ) ) ; return next ; |
public class ApplicationDialog { /** * Returns the title to use upon succesful finish . */
protected String getFinishSuccessTitle ( ) { } } | ActionCommand callingCommand = getCallingCommand ( ) ; if ( callingCommand != null ) { String [ ] successTitleKeys = new String [ ] { callingCommand . getId ( ) + "." + SUCCESS_FINISH_TITLE_KEY , DEFAULT_FINISH_SUCCESS_TITLE_KEY } ; return getApplicationConfig ( ) . messageResolver ( ) . getMessage ( successTitleKeys , getFinishSuccessTitleArguments ( ) ) ; } return getApplicationConfig ( ) . messageResolver ( ) . getMessage ( DEFAULT_FINISH_SUCCESS_TITLE_KEY ) ; |
public class ServerMBean { protected void defineManagedResource ( ) { } } | super . defineManagedResource ( ) ; defineAttribute ( "configuration" ) ; defineAttribute ( "rootWebApp" ) ; defineAttribute ( "webApplicationConfigurationClassNames" ) ; defineOperation ( "addWebApplication" , new String [ ] { "java.lang.String" , "java.lang.String" } , IMPACT_ACTION ) ; defineOperation ( "addWebApplication" , new String [ ] { "java.lang.String" , "java.lang.String" , "java.lang.String" } , IMPACT_ACTION ) ; defineOperation ( "addWebApplications" , new String [ ] { "java.lang.String" , "java.lang.String" } , IMPACT_ACTION ) ; _jettyServer = ( Server ) getManagedResource ( ) ; |
public class AgentActivator { /** * Put event .
* @ param eventType the event type
* @ throws Exception the exception */
private void putEvent ( EventType eventType ) throws Exception { } } | List < EventType > eventTypes = Collections . singletonList ( eventType ) ; int i ; for ( i = 0 ; i < retryNum ; ++ i ) { try { monitoringService . putEvents ( eventTypes ) ; break ; } catch ( Exception e ) { LOG . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } Thread . sleep ( retryDelay ) ; } if ( i == retryNum ) { LOG . warning ( "Could not send events to monitoring service after " + retryNum + " retries." ) ; throw new Exception ( "Send SERVER_START/SERVER_STOP event to SAM Server failed" ) ; } |
public class ModifyDBInstanceRequest { /** * A list of DB security groups to authorize on this DB instance . Changing this setting doesn ' t result in an outage
* and the change is asynchronously applied as soon as possible .
* Constraints :
* < ul >
* < li >
* If supplied , must match existing DBSecurityGroups .
* < / li >
* < / ul >
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setDBSecurityGroups ( java . util . Collection ) } or { @ link # withDBSecurityGroups ( java . util . Collection ) } if you
* want to override the existing values .
* @ param dBSecurityGroups
* A list of DB security groups to authorize on this DB instance . Changing this setting doesn ' t result in an
* outage and the change is asynchronously applied as soon as possible . < / p >
* Constraints :
* < ul >
* < li >
* If supplied , must match existing DBSecurityGroups .
* < / li >
* @ return Returns a reference to this object so that method calls can be chained together . */
public ModifyDBInstanceRequest withDBSecurityGroups ( String ... dBSecurityGroups ) { } } | if ( this . dBSecurityGroups == null ) { setDBSecurityGroups ( new com . amazonaws . internal . SdkInternalList < String > ( dBSecurityGroups . length ) ) ; } for ( String ele : dBSecurityGroups ) { this . dBSecurityGroups . add ( ele ) ; } return this ; |
public class CmsResultsTab { /** * Updates the height ( with border ) of the result list panel according to the search parameter panels shown . < p > */
public void updateListSize ( ) { } } | int paramsHeight = m_params . isVisible ( ) ? m_params . getOffsetHeight ( ) + CmsDomUtil . getCurrentStyleInt ( m_params . getElement ( ) , CmsDomUtil . Style . marginBottom ) : 21 ; int optionsHeight = m_options . getOffsetHeight ( ) + CmsDomUtil . getCurrentStyleInt ( m_options . getElement ( ) , CmsDomUtil . Style . marginBottom ) ; int listTop = paramsHeight + optionsHeight + 5 ; // another sanity check , don ' t set any top value below 35
if ( listTop > 35 ) { m_list . getElement ( ) . getStyle ( ) . setTop ( listTop , Unit . PX ) ; } |
public class DiskBasedCache { /** * Invalidates an entry in the cache .
* @ param key Cache key
* @ param fullExpire True to fully expire the entry , false to soft expire */
@ Override public synchronized void invalidate ( String key , boolean fullExpire ) { } } | Entry entry = get ( key ) ; if ( entry != null ) { entry . softTtl = 0 ; if ( fullExpire ) { entry . ttl = 0 ; } put ( key , entry ) ; } |
public class AbstractConfigObject { /** * This looks up the key with no transformation or type conversion of any
* kind , and returns null if the key is not present . The object must be
* resolved along the nodes needed to get the key or
* ConfigException . NotResolved will be thrown .
* @ param key
* @ return the unmodified raw value or null */
protected final AbstractConfigValue peekAssumingResolved ( String key , Path originalPath ) { } } | try { return attemptPeekWithPartialResolve ( key ) ; } catch ( ConfigException . NotResolved e ) { throw ConfigImpl . improveNotResolved ( originalPath , e ) ; } |
public class GoogleCommon { /** * Before retrieving private key , it makes sure that original private key ' s permission is read only on the owner .
* This is a way to ensure to keep private key private .
* @ param fs
* @ param privateKeyPath
* @ return
* @ throws IOException */
private static Path getPrivateKey ( FileSystem fs , String privateKeyPath ) throws IOException { } } | Path keyPath = new Path ( privateKeyPath ) ; FileStatus fileStatus = fs . getFileStatus ( keyPath ) ; Preconditions . checkArgument ( USER_READ_PERMISSION_ONLY . equals ( fileStatus . getPermission ( ) ) , "Private key file should only have read only permission only on user. " + keyPath ) ; return keyPath ; |
public class CodeJamSession { /** * < p > Static factory method that should be used for creating a session .
* Loads associated contest info and initial values from the given
* < tt > round < / tt > , using the given < tt > executor < / tt > . < / p >
* @ param executor { @ link HttpRequestExecutor } instance to use .
* @ param round Contextual { @ link Round } instance this session is bound to .
* @ return Created session .
* @ throws IOException If any error occurs while retrieving contest info or initial values . */
public static CodeJamSession createSession ( final HttpRequestExecutor executor , final Round round ) throws IOException { } } | final ContestInfo info = ContestInfo . get ( executor , round ) ; final InitialValues values = InitialValues . get ( executor , round ) ; return new CodeJamSession ( executor , round , info , values ) ; |
public class AbstractInstanceManager { /** * Return the proxy instance which corresponds to the given datastore type for
* writing .
* @ param datastoreType
* The datastore type .
* @ param types
* The { @ link DynamicType } .
* @ param < T >
* The instance type .
* @ return The instance . */
public < T > T createInstance ( DatastoreType datastoreType , DynamicType < ? > types ) { } } | return newInstance ( getDatastoreId ( datastoreType ) , datastoreType , types , TransactionalCache . Mode . WRITE ) ; |
public class Configuration { /** * Get a default style . If null a simple black line style will be returned .
* @ param geometryType the name of the geometry type ( point , line , polygon ) */
@ Nonnull public final Style getDefaultStyle ( @ Nonnull final String geometryType ) { } } | String normalizedGeomName = GEOMETRY_NAME_ALIASES . get ( geometryType . toLowerCase ( ) ) ; if ( normalizedGeomName == null ) { normalizedGeomName = geometryType . toLowerCase ( ) ; } Style style = this . defaultStyle . get ( normalizedGeomName . toLowerCase ( ) ) ; if ( style == null ) { style = this . namedStyles . get ( normalizedGeomName . toLowerCase ( ) ) ; } if ( style == null ) { StyleBuilder builder = new StyleBuilder ( ) ; final Symbolizer symbolizer ; if ( isPointType ( normalizedGeomName ) ) { symbolizer = builder . createPointSymbolizer ( ) ; } else if ( isLineType ( normalizedGeomName ) ) { symbolizer = builder . createLineSymbolizer ( Color . black , 2 ) ; } else if ( isPolygonType ( normalizedGeomName ) ) { symbolizer = builder . createPolygonSymbolizer ( Color . lightGray , Color . black , 2 ) ; } else if ( normalizedGeomName . equalsIgnoreCase ( Constants . Style . Raster . NAME ) ) { symbolizer = builder . createRasterSymbolizer ( ) ; } else if ( normalizedGeomName . startsWith ( Constants . Style . OverviewMap . NAME ) ) { symbolizer = createMapOverviewStyle ( normalizedGeomName , builder ) ; } else { final Style geomStyle = this . defaultStyle . get ( Geometry . class . getSimpleName ( ) . toLowerCase ( ) ) ; if ( geomStyle != null ) { return geomStyle ; } else { symbolizer = builder . createPointSymbolizer ( ) ; } } style = builder . createStyle ( symbolizer ) ; } return style ; |
public class CertificateMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Certificate certificate , ProtocolMarshaller protocolMarshaller ) { } } | if ( certificate == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( certificate . getCertificateArn ( ) , CERTIFICATEARN_BINDING ) ; protocolMarshaller . marshall ( certificate . getCertificateId ( ) , CERTIFICATEID_BINDING ) ; protocolMarshaller . marshall ( certificate . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( certificate . getCreationDate ( ) , CREATIONDATE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ArrayByteInput { /** * Creates a new instance of { @ link ArrayByteInput } which reads bytes from given input stream using an array of
* bytes whose { @ code length } equals to specified .
* @ param length the length of the byte array ; must be positive .
* @ param stream the input stream from which bytes are read ; must be not { @ code null } .
* @ return a new instance of { @ link ArrayByteInput } . */
@ SuppressWarnings ( { } } | "Duplicates" } ) public static ArrayByteInput of ( final int length , final InputStream stream ) { if ( length <= 0 ) { throw new IllegalArgumentException ( "length(" + length + ") <= 0" ) ; } if ( stream == null ) { throw new NullPointerException ( "stream is null" ) ; } return new ArrayByteInput ( null ) { @ Override public int read ( ) throws IOException { if ( source == null ) { source = new byte [ length ] ; index = source . length ; } if ( index == source . length ) { final int read = stream . read ( source ) ; if ( read == - 1 ) { throw new EOFException ( ) ; } assert read > 0 ; // source . length > 0
index = 0 ; } return super . read ( ) ; } @ Override public void setSource ( final byte [ ] source ) { throw new UnsupportedOperationException ( ) ; } @ Override public void setIndex ( final int index ) { throw new UnsupportedOperationException ( ) ; } } ; |
public class GeneNamesParser { /** * parses a file from the genenames website
* @ param args */
public static void main ( String [ ] args ) { } } | try { List < GeneName > geneNames = getGeneNames ( ) ; logger . info ( "got {} gene names" , geneNames . size ( ) ) ; for ( GeneName g : geneNames ) { if ( g . getApprovedSymbol ( ) . equals ( "FOLH1" ) ) logger . info ( "Gene Name: {}" , g ) ; } // and returns a list of beans that contains key - value pairs for each gene name
} catch ( Exception e ) { // TODO Auto - generated catch block
logger . error ( "Exception: " , e ) ; } |
public class XString { /** * Compares two strings lexicographically .
* @ param xstr the < code > String < / code > to be compared .
* @ return the value < code > 0 < / code > if the argument string is equal to
* this string ; a value less than < code > 0 < / code > if this string
* is lexicographically less than the string argument ; and a
* value greater than < code > 0 < / code > if this string is
* lexicographically greater than the string argument .
* @ exception java . lang . NullPointerException if < code > anotherString < / code >
* is < code > null < / code > . */
public int compareTo ( XMLString xstr ) { } } | int len1 = this . length ( ) ; int len2 = xstr . length ( ) ; int n = Math . min ( len1 , len2 ) ; int i = 0 ; int j = 0 ; while ( n -- != 0 ) { char c1 = this . charAt ( i ) ; char c2 = xstr . charAt ( j ) ; if ( c1 != c2 ) { return c1 - c2 ; } i ++ ; j ++ ; } return len1 - len2 ; |
public class GeoPackageOverlayFactory { /** * Create a composite overlay by first adding tile overlays for the tile DAOs followed by the provided overlay
* @ param tileDaos collection of tile daos
* @ param overlay bounded overlay
* @ return composite overlay */
public static CompositeOverlay getCompositeOverlay ( Collection < TileDao > tileDaos , BoundedOverlay overlay ) { } } | CompositeOverlay compositeOverlay = getCompositeOverlay ( tileDaos ) ; compositeOverlay . addOverlay ( overlay ) ; return compositeOverlay ; |
public class FctConvertersToFromString { /** * < p > Create put CnvTfsHasId ( String ) . < / p >
* @ param pBeanName - bean name
* @ param pClass - bean class
* @ param pIdName - bean ID name
* @ return requested CnvTfsHasId ( String )
* @ throws Exception - an exception */
protected final CnvTfsHasId < IHasId < String > , String > createHasStringIdConverter ( final String pBeanName , final Class pClass , final String pIdName ) throws Exception { } } | CnvTfsHasId < IHasId < String > , String > convrt = new CnvTfsHasId < IHasId < String > , String > ( ) ; convrt . setUtlReflection ( getUtlReflection ( ) ) ; convrt . setIdConverter ( lazyGetCnvTfsString ( ) ) ; convrt . init ( pClass , pIdName ) ; this . convertersMap . put ( pBeanName , convrt ) ; return convrt ; |
public class StopAccessLoggingRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( StopAccessLoggingRequest stopAccessLoggingRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( stopAccessLoggingRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( stopAccessLoggingRequest . getContainerName ( ) , CONTAINERNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class AWSBackupClient { /** * Returns metadata of your saved backup plans , including Amazon Resource Names ( ARNs ) , plan IDs , creation and
* deletion dates , version IDs , plan names , and creator request IDs .
* @ param listBackupPlansRequest
* @ return Result of the ListBackupPlans operation returned by the service .
* @ throws ResourceNotFoundException
* A resource that is required for the action doesn ' t exist .
* @ throws InvalidParameterValueException
* Indicates that something is wrong with a parameter ' s value . For example , the value is out of range .
* @ throws MissingParameterValueException
* Indicates that a required parameter is missing .
* @ throws ServiceUnavailableException
* The request failed due to a temporary failure of the server .
* @ sample AWSBackup . ListBackupPlans
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / backup - 2018-11-15 / ListBackupPlans " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public ListBackupPlansResult listBackupPlans ( ListBackupPlansRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListBackupPlans ( request ) ; |
public class AbstractSEPAGenerator { /** * Schreibt die Bean mittels JAXB in den Strean .
* @ param e das zu schreibende JAXBElement mit der Bean .
* @ param os der OutputStream , in den das XML geschrieben wird .
* @ param validate true , wenn das erzeugte XML gegen das PAIN - Schema validiert werden soll .
* @ throws Exception */
protected void marshal ( JAXBElement e , OutputStream os , boolean validate ) throws Exception { } } | JAXBContext jaxbContext = JAXBContext . newInstance ( e . getDeclaredType ( ) ) ; Marshaller marshaller = jaxbContext . createMarshaller ( ) ; // Wir verwenden hier hart UTF - 8 . Siehe http : / / www . onlinebanking - forum . de / forum / topic . php ? p = 107420 # real107420
marshaller . setProperty ( Marshaller . JAXB_ENCODING , ENCODING ) ; // Siehe https : / / groups . google . com / d / msg / hbci4java / RYHCai _ TzHM / 72Bx51B9bXUJ
if ( System . getProperty ( "sepa.pain.formatted" , "false" ) . equalsIgnoreCase ( "true" ) ) marshaller . setProperty ( Marshaller . JAXB_FORMATTED_OUTPUT , Boolean . TRUE ) ; SepaVersion version = this . getSepaVersion ( ) ; if ( version != null ) { String schemaLocation = version . getSchemaLocation ( ) ; if ( schemaLocation != null ) { LOG . fine ( "appending schemaLocation " + schemaLocation ) ; marshaller . setProperty ( Marshaller . JAXB_SCHEMA_LOCATION , schemaLocation ) ; } String file = version . getFile ( ) ; if ( file != null ) { if ( validate ) { Source source = null ; InputStream is = this . getClass ( ) . getClassLoader ( ) . getResourceAsStream ( file ) ; if ( is != null ) { source = new StreamSource ( is ) ; } else { // Fallback auf File - Objekt
File f = new File ( file ) ; if ( f . isFile ( ) && f . canRead ( ) ) source = new StreamSource ( f ) ; } if ( source == null ) throw new HBCI_Exception ( "schema validation activated against " + file + " - but schema file " + "could not be found" ) ; LOG . fine ( "activating schema validation against " + file ) ; SchemaFactory schemaFactory = SchemaFactory . newInstance ( XMLConstants . W3C_XML_SCHEMA_NS_URI ) ; Schema schema = schemaFactory . newSchema ( source ) ; marshaller . setSchema ( schema ) ; } } } marshaller . marshal ( e , os ) ; |
public class AwsSecurityFindingFilters { /** * The ARN of the solution that generated a related finding .
* @ param relatedFindingsProductArn
* The ARN of the solution that generated a related finding . */
public void setRelatedFindingsProductArn ( java . util . Collection < StringFilter > relatedFindingsProductArn ) { } } | if ( relatedFindingsProductArn == null ) { this . relatedFindingsProductArn = null ; return ; } this . relatedFindingsProductArn = new java . util . ArrayList < StringFilter > ( relatedFindingsProductArn ) ; |
public class LocalDate { /** * Gets the value of the specified field from this date as a { @ code long } .
* This queries this date for the value of the specified field .
* If it is not possible to return the value , because the field is not supported
* or for some other reason , an exception is thrown .
* If the field is a { @ link ChronoField } then the query is implemented here .
* The { @ link # isSupported ( TemporalField ) supported fields } will return valid
* values based on this date .
* All other { @ code ChronoField } instances will throw an { @ code UnsupportedTemporalTypeException } .
* If the field is not a { @ code ChronoField } , then the result of this method
* is obtained by invoking { @ code TemporalField . getFrom ( TemporalAccessor ) }
* passing { @ code this } as the argument . Whether the value can be obtained ,
* and what the value represents , is determined by the field .
* @ param field the field to get , not null
* @ return the value for the field
* @ throws DateTimeException if a value for the field cannot be obtained
* @ throws UnsupportedTemporalTypeException if the field is not supported
* @ throws ArithmeticException if numeric overflow occurs */
@ Override public long getLong ( TemporalField field ) { } } | if ( field instanceof ChronoField ) { if ( field == EPOCH_DAY ) { return toEpochDay ( ) ; } if ( field == PROLEPTIC_MONTH ) { return getProlepticMonth ( ) ; } return get0 ( field ) ; } return field . getFrom ( this ) ; |
public class VLDockingBeanPostProcessor { /** * Gets the configured template for the given view descriptor .
* @ param viewDescriptor the view descriptor .
* @ return the more suitable template . */
private VLDockingViewDescriptor getTemplate ( ViewDescriptor viewDescriptor ) { } } | Assert . notNull ( viewDescriptor , "viewDescriptor" ) ; final VLDockingViewDescriptor vlDockingViewDescriptor ; vlDockingViewDescriptor = new VLDockingViewDescriptor ( ) ; return vlDockingViewDescriptor ; |
public class Cob2AvroGenerator { /** * Produce the avro schema .
* @ param xmlSchemaSource the XML schema source
* @ param targetPackageName the target Avro package name
* @ param targetAvroSchemaName the target Avro schema name
* @ return the generated Avro schema
* @ throws IOException if serialization fails */
private String generateAvroSchema ( String xmlSchemaSource , String targetPackageName , String targetAvroSchemaName ) throws IOException { } } | log . debug ( "Avro schema {} generation started" , targetAvroSchemaName + AVSC_FILE_EXTENSION ) ; String avroSchemaSource = cob2AvroTranslator . translate ( new StringReader ( xmlSchemaSource ) , targetPackageName , targetAvroSchemaName ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Generated Avro Schema: " ) ; log . debug ( avroSchemaSource ) ; } log . debug ( "Avro schema {} generation ended" , targetAvroSchemaName + AVSC_FILE_EXTENSION ) ; return avroSchemaSource ; |
public class AbstractRegionPainter { /** * Creates a simple horizontal gradient using the shape for bounds and the
* colors for top , two middle , and bottom colors .
* @ param s the shape to use for bounds .
* @ param colors the colors to use for the gradient .
* @ return the gradient . */
protected Paint createHorizontalGradient ( Shape s , FourColors colors ) { } } | Rectangle2D bounds = s . getBounds2D ( ) ; float x = ( float ) bounds . getX ( ) ; float y = ( float ) bounds . getY ( ) ; float w = ( float ) bounds . getWidth ( ) ; float h = ( float ) bounds . getHeight ( ) ; return createGradient ( x , ( 0.5f * h ) + y , x + w , ( 0.5f * h ) + y , new float [ ] { 0f , 0.45f , 0.62f , 1f } , new Color [ ] { colors . top , colors . upperMid , colors . lowerMid , colors . bottom } ) ; |
public class Shape { /** * Prints the { @ link IntBuffer }
* @ param buffer the buffer to print
* @ return the to string for the buffer */
public static String bufferToString ( IntBuffer buffer ) { } } | StringBuilder builder = new StringBuilder ( ) ; int rank = buffer . get ( 0 ) ; builder . append ( "[ " ) . append ( rank ) . append ( ", " ) ; for ( int p = 1 ; p < rank * 2 + 4 ; p ++ ) { builder . append ( buffer . get ( p ) ) ; if ( p < rank * 2 + 4 - 1 ) builder . append ( ", " ) ; } builder . append ( "]" ) ; return builder . toString ( ) ; |
public class MethodCompilerPass { /** * Adds a node that may represent a function signature ( if it ' s a function
* itself or the name of a function ) . */
private void addPossibleSignature ( String name , Node node , NodeTraversal t ) { } } | if ( node . isFunction ( ) ) { // The node we ' re looking at is a function , so we can add it directly
addSignature ( name , node , t . getSourceName ( ) ) ; } else { nonMethodProperties . add ( name ) ; } |
public class ExtensionsDao { /** * Query by extension name
* @ param extensionName
* extension name
* @ return extensions
* @ throws SQLException
* upon failure */
public List < Extensions > queryByExtension ( String extensionName ) throws SQLException { } } | QueryBuilder < Extensions , Void > qb = queryBuilder ( ) ; setUniqueWhere ( qb . where ( ) , extensionName , false , null , false , null ) ; List < Extensions > extensions = qb . query ( ) ; return extensions ; |
public class ApplicationDialog { /** * Returns the message to use upon succesful finish . */
protected String getFinishSuccessMessage ( ) { } } | ActionCommand callingCommand = getCallingCommand ( ) ; if ( callingCommand != null ) { String [ ] successMessageKeys = new String [ ] { callingCommand . getId ( ) + "." + SUCCESS_FINISH_MESSAGE_KEY , DEFAULT_FINISH_SUCCESS_MESSAGE_KEY } ; return getApplicationConfig ( ) . messageResolver ( ) . getMessage ( successMessageKeys , getFinishSuccessMessageArguments ( ) ) ; } return getApplicationConfig ( ) . messageResolver ( ) . getMessage ( DEFAULT_FINISH_SUCCESS_MESSAGE_KEY ) ; |
public class DatabaseRecommendedActionsInner { /** * Gets a database recommended action .
* @ 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 name of the server .
* @ param databaseName The name of the database .
* @ param advisorName The name of the Database Advisor .
* @ param recommendedActionName The name of Database Recommended Action .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the RecommendedActionInner object */
public Observable < RecommendedActionInner > getAsync ( String resourceGroupName , String serverName , String databaseName , String advisorName , String recommendedActionName ) { } } | return getWithServiceResponseAsync ( resourceGroupName , serverName , databaseName , advisorName , recommendedActionName ) . map ( new Func1 < ServiceResponse < RecommendedActionInner > , RecommendedActionInner > ( ) { @ Override public RecommendedActionInner call ( ServiceResponse < RecommendedActionInner > response ) { return response . body ( ) ; } } ) ; |
import java . io . * ; import java . util . * ; class DifferenceNestedTuples { /** * This function calculates the differences between elements of two given nested tuples .
* Examples :
* differenceNestedTuples ( new int [ ] [ ] { { 1 , 3 } , { 4 , 5 } , { 2 , 9 } , { 1 , 10 } } , new int [ ] [ ] { { 6 , 7 } , { 3 , 9 } , { 1 , 1 } , { 7 , 3 } } )
* - > { { - 5 , - 4 } , { 1 , - 4 } , { 1 , 8 } , { - 6 , 7 } }
* differenceNestedTuples ( new int [ ] [ ] { { 13 , 4 } , { 14 , 6 } , { 13 , 10 } , { 12 , 11 } } , new int [ ] [ ] { { 19 , 8 } , { 14 , 10 } , { 12 , 2 } , { 18 , 4 } } )
* - > { { - 6 , - 4 } , { 0 , - 4 } , { 1 , 8 } , { - 6 , 7 } }
* differenceNestedTuples ( new int [ ] [ ] { { 19 , 5 } , { 18 , 7 } , { 19 , 11 } , { 17 , 12 } } , new int [ ] [ ] { { 12 , 9 } , { 17 , 11 } , { 13 , 3 } , { 19 , 5 } } )
* - > { { 7 , - 4 } , { 1 , - 4 } , { 6 , 8 } , { - 2 , 7 } }
* @ param tuple1 The first nested tuple .
* @ param tuple2 The second nested tuple .
* @ return A nested tuple contains the differences of the corresponding elements in the input tuples . */
public static int [ ] [ ] differenceNestedTuples ( int [ ] [ ] tuple1 , int [ ] [ ] tuple2 ) { } } | int [ ] [ ] result = new int [ tuple1 . length ] [ tuple1 [ 0 ] . length ] ; for ( int i = 0 ; i < tuple1 . length ; i ++ ) { for ( int j = 0 ; j < tuple1 [ i ] . length ; j ++ ) { result [ i ] [ j ] = tuple1 [ i ] [ j ] - tuple2 [ i ] [ j ] ; } } return result ; |
public class ConfigurationUtils { /** * Calls { @ link ConfigurationComponent # basicValidate ( String ) } on the supplied component if not null
* @ param component the nullable component
* @ param section the configuration section
* @ param < F > the component type
* @ throws ConfigException validation failure
* @ see SimpleComponent for basic usage */
public static < F extends ConfigurationComponent < F > > void defaultValidate ( final F component , final String section ) throws ConfigException { } } | try { final Class < ? > type = component . getClass ( ) ; final BeanInfo beanInfo = Introspector . getBeanInfo ( type ) ; for ( final PropertyDescriptor propertyDescriptor : beanInfo . getPropertyDescriptors ( ) ) { if ( ConfigurationComponent . class . isAssignableFrom ( propertyDescriptor . getPropertyType ( ) ) ) { @ SuppressWarnings ( "rawtypes" ) final ConfigurationComponent subComponent = ( ConfigurationComponent ) propertyDescriptor . getReadMethod ( ) . invoke ( component ) ; basicValidate ( subComponent , section ) ; } } } catch ( final IntrospectionException | IllegalAccessException | InvocationTargetException e ) { throw new ConfigException ( "Error performing config bean introspection" , e ) ; } |
public class AVIMConversationsQuery { /** * 增加查询条件 , 指定聊天室的组员条件满足条件的才返回
* @ param peerIds
* @ param includeSelf 是否包含自己
* @ return */
public AVIMConversationsQuery withMembers ( List < String > peerIds , boolean includeSelf ) { } } | Set < String > targetPeerIds = new HashSet < String > ( peerIds ) ; if ( includeSelf ) { targetPeerIds . add ( client . getClientId ( ) ) ; } containsMembers ( new LinkedList < String > ( targetPeerIds ) ) ; this . whereSizeEqual ( Conversation . MEMBERS , targetPeerIds . size ( ) ) ; return this ; |
public class ReversePurgeLongHashMap { /** * Returns an instance of this class from the given String ,
* which must be a String representation of this class .
* @ param string a String representation of this class .
* @ return an instance of this class . */
static ReversePurgeLongHashMap getInstance ( final String string ) { } } | final String [ ] tokens = string . split ( "," ) ; if ( tokens . length < 2 ) { throw new SketchesArgumentException ( "String not long enough to specify length and capacity." ) ; } final int numActive = Integer . parseInt ( tokens [ 0 ] ) ; final int length = Integer . parseInt ( tokens [ 1 ] ) ; final ReversePurgeLongHashMap table = new ReversePurgeLongHashMap ( length ) ; int j = 2 ; for ( int i = 0 ; i < numActive ; i ++ ) { final long key = Long . parseLong ( tokens [ j ++ ] ) ; final long value = Long . parseLong ( tokens [ j ++ ] ) ; table . adjustOrPutValue ( key , value ) ; } return table ; |
public class ClientInterceptors { /** * Create a new { @ link Channel } that will call { @ code interceptors } before starting a call on the
* given channel . The last interceptor will have its { @ link ClientInterceptor # interceptCall }
* called first .
* @ param channel the underlying channel to intercept .
* @ param interceptors array of interceptors to bind to { @ code channel } .
* @ return a new channel instance with the interceptors applied . */
public static Channel intercept ( Channel channel , ClientInterceptor ... interceptors ) { } } | return intercept ( channel , Arrays . asList ( interceptors ) ) ; |
public class GenericFilter { /** * Called by the web container to indicate to a filter that it is being
* placed into service .
* This implementation stores the { @ code FilterConfig } object it
* receives from the servlet container for later use .
* Generally , there ' s no reason to override this method , override the
* no - argument { @ code init } instead . However , < em > if < / em > you are
* overriding this form of the method ,
* always call { @ code super . init ( config ) } .
* This implementation will also set all configured key / value pairs , that
* have a matching setter method annotated with { @ link InitParam } .
* @ param pConfig the filter config
* @ throws ServletException if an error occurs during init
* @ see Filter # init ( javax . servlet . FilterConfig )
* @ see # init ( ) init
* @ see BeanUtil # configure ( Object , java . util . Map , boolean ) */
public void init ( final FilterConfig pConfig ) throws ServletException { } } | if ( pConfig == null ) { throw new ServletConfigException ( "filter config == null" ) ; } // Store filter config
filterConfig = pConfig ; // Configure this
try { BeanUtil . configure ( this , ServletUtil . asMap ( pConfig ) , true ) ; } catch ( InvocationTargetException e ) { throw new ServletConfigException ( "Could not configure " + getFilterName ( ) , e . getCause ( ) ) ; } // Create run - once attribute name
attribRunOnce = pConfig . getFilterName ( ) + ATTRIB_RUN_ONCE_EXT ; log ( "init (oncePerRequest=" + oncePerRequest + ", attribRunOnce=" + attribRunOnce + ")" ) ; init ( ) ; |
public class VaultDriverBase { /** * Creates a stub method for an abstract method , typically a createXXX
* method . */
protected < S > MethodVault < S > newMethod ( Method method ) { } } | if ( ! Modifier . isAbstract ( method . getModifiers ( ) ) ) { throw new IllegalStateException ( String . valueOf ( method ) ) ; } else if ( method . getName ( ) . startsWith ( "create" ) ) { Method target = assetMethod ( method ) ; if ( target != null ) { return newCreateMethod ( target ) ; } else { return newCreateMethodDTO ( method ) ; } } else if ( method . getName ( ) . startsWith ( "delete" ) ) { Method target = assetMethod ( method ) ; if ( target != null ) { return newDeleteMethod ( target ) ; } else { return newDeleteMethodDTO ( method ) ; } } else { return new MethodVaultNull < > ( method . getName ( ) + " " + getClass ( ) . getName ( ) ) ; } |
public class Record { /** * Get grouping { @ link LongWritable } value
* @ param label target label
* @ return { @ link LongWritable } value of the label . If it is not null . */
public LongWritable getGroupingLongWritable ( String label ) { } } | HadoopObject o = getHadoopObject ( KEY , label , ObjectUtil . LONG , "Long" ) ; if ( o == null ) { return null ; } return ( LongWritable ) o . getObject ( ) ; |
public class DocumentClassifierEvaluator { /** * Evaluates the given reference { @ link DocSample } object .
* This is done by categorizing the document from the provided
* { @ link DocSample } . The detected category is then used
* to calculate and update the score .
* @ param sample the reference { @ link DocSample } . */
public DocSample processSample ( DocSample sample ) { } } | if ( sample . isClearAdaptiveDataSet ( ) ) { this . docClassifier . clearFeatureData ( ) ; } String [ ] document = sample . getTokens ( ) ; String cat = docClassifier . classify ( document ) ; if ( sample . getLabel ( ) . equals ( cat ) ) { accuracy . add ( 1 ) ; } else { accuracy . add ( 0 ) ; } return new DocSample ( cat , sample . getTokens ( ) , sample . isClearAdaptiveDataSet ( ) ) ; |
public class CmsParameterConfiguration { /** * Adds a parameter , parsing the value if required . < p >
* @ param key the parameter to add
* @ param value the value of the parameter */
private void addInternal ( String key , String value ) { } } | Object currentObj = m_configurationObjects . get ( key ) ; String currentStr = get ( key ) ; if ( currentObj instanceof String ) { // one object already in map - convert it to a list
ArrayList < String > values = new ArrayList < String > ( 2 ) ; values . add ( currentStr ) ; values . add ( value ) ; m_configurationObjects . put ( key , values ) ; m_configurationStrings . put ( key , currentStr + ParameterTokenizer . COMMA + value ) ; } else if ( currentObj instanceof List ) { // already a list - just add the new token
@ SuppressWarnings ( "unchecked" ) List < String > list = ( List < String > ) currentObj ; list . add ( value ) ; m_configurationStrings . put ( key , currentStr + ParameterTokenizer . COMMA + value ) ; } else { m_configurationObjects . put ( key , value ) ; m_configurationStrings . put ( key , value ) ; } |
public class I18nSpecificInList { /** * < p > Setter for itemId . < / p >
* @ param pItemId reference */
public final void setItemId ( final Long pItemId ) { } } | this . itemId = pItemId ; if ( this . itsId == null ) { this . itsId = new IdI18nSpecificInList ( ) ; } this . itsId . setItemId ( this . itemId ) ; |
public class GetNamespaceRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetNamespaceRequest getNamespaceRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getNamespaceRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getNamespaceRequest . getId ( ) , ID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class SOM { /** * Sets the rate at which input is incorporated at each iteration of the SOM
* algorithm
* @ param initialLearningRate the rate the SOM learns at */
public void setInitialLearningRate ( double initialLearningRate ) { } } | if ( Double . isInfinite ( initialLearningRate ) || Double . isNaN ( initialLearningRate ) || initialLearningRate <= 0 ) throw new ArithmeticException ( "Learning rate must be a positive constant, not " + initialLearningRate ) ; this . initialLearningRate = initialLearningRate ; |
public class GeometryUtil { /** * Centers the molecule in the given area . See comment for center ( IAtomContainer atomCon ,
* Dimension areaDim , HashMap renderingCoordinates ) for details on coordinate sets
* @ param atomCon molecule to be centered
* @ param areaDim dimension in which the molecule is to be centered , array containing
* { width , height } */
public static void center ( IAtomContainer atomCon , double [ ] areaDim ) { } } | double [ ] molDim = get2DDimension ( atomCon ) ; double transX = ( areaDim [ 0 ] - molDim [ 0 ] ) / 2 ; double transY = ( areaDim [ 1 ] - molDim [ 1 ] ) / 2 ; translateAllPositive ( atomCon ) ; translate2D ( atomCon , new Vector2d ( transX , transY ) ) ; |
public class FileSystemLocationScanner { /** * Converts this file into a resource name on the classpath by cutting of the file path
* to the classpath root .
* @ param classPathRootOnDisk The location of the classpath root on disk , with a trailing slash .
* @ param file The file .
* @ return The resource name on the classpath . */
private String toResourceNameOnClasspath ( String classPathRootOnDisk , File file ) { } } | String fileName = file . getAbsolutePath ( ) . replace ( "\\" , "/" ) ; return fileName . substring ( classPathRootOnDisk . length ( ) ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.