signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class RemoteDomainConnectionService { /** * Handles logging tasks related to a failure to connect to a remote HC .
* @ param uri the URI at which the connection attempt was made . Can be { @ code null } indicating a failure to discover the HC
* @ param discoveryOption the { @ code DiscoveryOption } used to determine { @ code uri }
* @ param moreOptions { @ code true } if there are more untried discovery options
* @ param e the exception */
static void logConnectionException ( URI uri , DiscoveryOption discoveryOption , boolean moreOptions , Exception e ) { } } | if ( uri == null ) { HostControllerLogger . ROOT_LOGGER . failedDiscoveringMaster ( discoveryOption , e ) ; } else { HostControllerLogger . ROOT_LOGGER . cannotConnect ( uri , e ) ; } if ( ! moreOptions ) { // All discovery options have been exhausted
HostControllerLogger . ROOT_LOGGER . noDiscoveryOptionsLeft ( ) ; } |
public class Gmap3WicketToDoItems { /** * region > complete ( action ) */
@ Action ( semantics = SemanticsOf . SAFE ) @ MemberOrder ( sequence = "3" ) public List < Gmap3ToDoItem > complete ( ) { } } | final List < Gmap3ToDoItem > items = completeNoUi ( ) ; if ( items . isEmpty ( ) ) { messageService . informUser ( "No to-do items have yet been completed :-(" ) ; } return items ; |
public class Bean { /** * Get the values of a property on a bean .
* @ param propertyName of the property as defined by the bean ' s schema .
* @ return final String representations of the property that conforms to
* its type as defined by the bean ' s schema . */
public List < String > getValues ( final String propertyName ) { } } | Preconditions . checkNotNull ( propertyName ) ; List < String > values = properties . get ( propertyName ) ; if ( values == null ) { return null ; } // creates a shallow defensive copy
return new ArrayList < > ( values ) ; |
public class UrlUtils { /** * Download data from an URL with a POST request , if necessary converting from a character encoding .
* @ param sUrl The full URL used to download the content .
* @ param encoding An encoding , e . g . UTF - 8 , ISO - 8859-15 . Can be null .
* @ param postRequestBody the body of the POST request , e . g . request parameters ; must not be null
* @ param contentType the content - type of the POST request ; may be null
* @ param timeout The timeout in milliseconds that is used for both connection timeout and read timeout .
* @ param sslFactory The SSLFactory to use for the connection , this allows to support custom SSL certificates
* @ return The response from the HTTP POST call .
* @ throws IOException If accessing the resource fails . */
public static String retrieveDataPost ( String sUrl , String encoding , String postRequestBody , String contentType , int timeout , SSLSocketFactory sslFactory ) throws IOException { } } | return retrieveStringInternalPost ( sUrl , encoding , postRequestBody , contentType , timeout , sslFactory ) ; |
public class DerbyPersistenceManager { /** * { @ inheritDoc } */
public void init ( PMContext context ) throws Exception { } } | // init default values
if ( getDriver ( ) == null ) { setDriver ( DERBY_EMBEDDED_DRIVER ) ; } if ( getDatabaseType ( ) == null ) { setDatabaseType ( "derby" ) ; } if ( getUrl ( ) == null ) { setUrl ( "jdbc:derby:" + context . getHomeDir ( ) . getPath ( ) + "/db/itemState;create=true" ) ; } if ( getSchemaObjectPrefix ( ) == null ) { setSchemaObjectPrefix ( "" ) ; } super . init ( context ) ; // set properties
if ( DERBY_EMBEDDED_DRIVER . equals ( getDriver ( ) ) ) { conHelper . exec ( "CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY " + "('derby.storage.initialPages', '" + derbyStorageInitialPages + "')" ) ; conHelper . exec ( "CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY " + "('derby.storage.minimumRecordSize', '" + derbyStorageMinimumRecordSize + "')" ) ; conHelper . exec ( "CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY " + "('derby.storage.pageCacheSize', '" + derbyStoragePageCacheSize + "')" ) ; conHelper . exec ( "CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY " + "('derby.storage.pageReservedSpace', '" + derbyStoragePageReservedSpace + "')" ) ; conHelper . exec ( "CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY " + "('derby.storage.pageSize', '" + derbyStoragePageSize + "')" ) ; } |
public class IntAVLTree { /** * Return the highest node that is strictly less than < code > node < / code > . */
public final int prev ( int node ) { } } | final int left = left ( node ) ; if ( left != NIL ) { return last ( left ) ; } else { int parent = parent ( node ) ; while ( parent != NIL && node == left ( parent ) ) { node = parent ; parent = parent ( parent ) ; } return parent ; } |
public class ApiOvhMe { /** * Get this object properties
* REST : GET / me / autorenew */
public OvhNicAutorenewInfos autorenew_GET ( ) throws IOException { } } | String qPath = "/me/autorenew" ; StringBuilder sb = path ( qPath ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhNicAutorenewInfos . class ) ; |
public class VMath { /** * Matrix multiplication , m1 * m2 < sup > T < / sup >
* @ param m1 Input matrix
* @ param m2 another matrix
* @ return Matrix product , m1 * m2 < sup > T < / sup > */
public static double [ ] [ ] timesTranspose ( final double [ ] [ ] m1 , final double [ ] [ ] m2 ) { } } | final int rowdim1 = m1 . length , coldim1 = getColumnDimensionality ( m1 ) ; final int rowdim2 = m2 . length ; assert coldim1 == getColumnDimensionality ( m2 ) : ERR_MATRIX_INNERDIM ; final double [ ] [ ] re = new double [ rowdim1 ] [ rowdim2 ] ; for ( int j = 0 ; j < rowdim2 ; j ++ ) { final double [ ] Browj = m2 [ j ] ; // multiply it with each row from A
for ( int i = 0 ; i < rowdim1 ; i ++ ) { final double [ ] Arowi = m1 [ i ] ; double s = 0 ; // assert Arowi . length = = coldim1 : ERR _ MATRIX _ RAGGED ;
// assert Browj . length = = coldim1 : ERR _ MATRIX _ INNERDIM ;
for ( int k = 0 ; k < coldim1 ; k ++ ) { s += Arowi [ k ] * Browj [ k ] ; } re [ i ] [ j ] = s ; } } return re ; |
public class AbstractFactorGraphBuilder { /** * Adds a parameterized factor to the log linear model being
* constructed .
* @ param factor */
public void addFactor ( String factorName , T factor , VariablePattern factorPattern ) { } } | parametricFactors . add ( factor ) ; factorPatterns . add ( factorPattern ) ; parametricFactorNames . add ( factorName ) ; |
public class Validate { /** * Validates the formatted string against the CPE 2.3 specification .
* @ param value the value to validate
* @ return the validation status given value ;
* @ see us . springett . parsers . cpe . util . Status # isValid ( ) */
public static Status formattedString ( String value ) { } } | boolean result = true ; try { Cpe23PartIterator instance ; try { instance = new Cpe23PartIterator ( value ) ; } catch ( CpeParsingException ex ) { LOG . warn ( "The CPE (" + value + ") is invalid as it is not in the formatted string format" ) ; return Status . INVALID ; } try { // part
Part . getEnum ( instance . next ( ) ) ; } catch ( CpeParsingException ex ) { LOG . warn ( "The CPE (" + value + ") is invalid as it has an invalid part attribute" ) ; return Status . INVALID_PART ; } Status status ; // vendor
status = Validate . component ( instance . next ( ) ) ; if ( ! status . isValid ( ) ) { LOG . warn ( "The CPE (" + value + ") has an invalid vendor - " + status . getMessage ( ) ) ; return status ; } // product
status = Validate . component ( instance . next ( ) ) ; if ( ! status . isValid ( ) ) { LOG . warn ( "The CPE (" + value + ") has an invalid product - " + status . getMessage ( ) ) ; return status ; } // version
status = Validate . component ( instance . next ( ) ) ; if ( ! status . isValid ( ) ) { LOG . warn ( "The CPE (" + value + ") has an version version - " + status . getMessage ( ) ) ; return status ; } // update
status = Validate . component ( instance . next ( ) ) ; if ( ! status . isValid ( ) ) { LOG . warn ( "The CPE (" + value + ") has an invalid update - " + status . getMessage ( ) ) ; return status ; } // edition
status = Validate . component ( instance . next ( ) ) ; if ( ! status . isValid ( ) ) { LOG . warn ( "The CPE (" + value + ") has an invalid edition - " + status . getMessage ( ) ) ; return status ; } // language
status = Validate . component ( instance . next ( ) ) ; if ( ! status . isValid ( ) ) { LOG . warn ( "The CPE (" + value + ") has an invalid language - " + status . getMessage ( ) ) ; return status ; } // swEdition
status = Validate . component ( instance . next ( ) ) ; if ( ! status . isValid ( ) ) { LOG . warn ( "The CPE (" + value + ") has an invalid swEdition - " + status . getMessage ( ) ) ; return status ; } // targetSw
status = Validate . component ( instance . next ( ) ) ; if ( ! status . isValid ( ) ) { LOG . warn ( "The CPE (" + value + ") has an invalid targetSw - " + status . getMessage ( ) ) ; return status ; } // targetHw
status = Validate . component ( instance . next ( ) ) ; if ( ! status . isValid ( ) ) { LOG . warn ( "The CPE (" + value + ") has an invalid targetHw - " + status . getMessage ( ) ) ; return status ; } // other
status = Validate . component ( instance . next ( ) ) ; if ( ! status . isValid ( ) ) { LOG . warn ( "The CPE (" + value + ") has an invalid other attribute - " + status . getMessage ( ) ) ; return status ; } if ( instance . hasNext ( ) ) { LOG . warn ( Status . TOO_MANY_ELEMENTS . getMessage ( ) ) ; return Status . TOO_MANY_ELEMENTS ; } } catch ( NoSuchElementException ex ) { LOG . warn ( Status . TOO_FEW_ELEMENTS . getMessage ( ) ) ; return Status . TOO_FEW_ELEMENTS ; } return Status . VALID ; |
public class Sentence { /** * 按照 PartOfSpeechTagDictionary 指定的映射表将复合词词语词性翻译过去
* @ return */
public Sentence translateCompoundWordLabels ( ) { } } | for ( IWord word : wordList ) { if ( word instanceof CompoundWord ) word . setLabel ( PartOfSpeechTagDictionary . translate ( word . getLabel ( ) ) ) ; } return this ; |
public class MultiStringDistance { /** * Default main routine for testing */
final protected static void doMain ( StringDistance d , String [ ] argv ) { } } | if ( argv . length != 2 ) { System . out . println ( "usage: string1 string2" ) ; } else { System . out . println ( d . explainScore ( argv [ 0 ] , argv [ 1 ] ) ) ; } |
public class JdbcCpoXaAdapter { /** * Returns true if the TrxAdapter is processing a request , false if it is not */
@ Override public boolean isBusy ( ) throws CpoException { } } | JdbcCpoAdapter currentResource = getCurrentResource ( ) ; if ( currentResource != getLocalResource ( ) ) return ( ( JdbcCpoTrxAdapter ) currentResource ) . isBusy ( ) ; else return false ; |
public class SystemStatsCollector { /** * Get the process id , the total memory size and determine the
* best way to get the RSS on an ongoing basis . */
private static synchronized void initialize ( ) { } } | PlatformProperties pp = PlatformProperties . getPlatformProperties ( ) ; String processName = java . lang . management . ManagementFactory . getRuntimeMXBean ( ) . getName ( ) ; String pidString = processName . substring ( 0 , processName . indexOf ( '@' ) ) ; pid = Integer . valueOf ( pidString ) ; initialized = true ; // get the RSS and other stats from scraping " ps " from the command line
PSScraper . PSData psdata = PSScraper . getPSData ( pid ) ; assert ( psdata . rss > 0 ) ; // figure out how much memory this thing has
memorysize = pp . ramInMegabytes ; assert ( memorysize > 0 ) ; // now try to figure out the best way to get the rss size
long rss = - 1 ; // try the mac method
try { rss = ExecutionEngine . nativeGetRSS ( ) ; } // This catch is broad to specifically include the UnsatisfiedLinkError that arises when
// using the hsqldb backend on linux - - along with any other exceptions that might arise .
// Otherwise , the hsql backend would get an annoying report to stdout
// as the useless stats thread got needlessly killed .
catch ( Throwable e ) { } if ( rss > 0 ) mode = GetRSSMode . MACOSX_NATIVE ; // try procfs
rss = getRSSFromProcFS ( ) ; if ( rss > 0 ) mode = GetRSSMode . PROCFS ; // notify users if stats collection might be slow
if ( mode == GetRSSMode . PS ) { VoltLogger logger = new VoltLogger ( "HOST" ) ; logger . warn ( "System statistics will be collected in a sub-optimal " + "manner because either procfs couldn't be read from or " + "the native library couldn't be loaded." ) ; } |
public class ValueAddressRange { /** * Is the IP address within the range ( this ) . In some sense this is the opposite of the usual
* interpretation of the containedBy ( ) function . However , it ' s the best I can think of . If , you
* think of the string comparisons as asking the question " does the input match the value " where the value
* has an implicit wildard at the beginning and end , then the interpretation here is essentially the same .
* Yes , this is strained , but it ' s the best I can think of for now . */
@ Override public boolean containedBy ( IValue ip ) throws FilterException { } } | return range . inRange ( ( ( ValueIPAddress ) ip ) . getIP ( ) ) ; |
public class ResourceAnnotationInjectionProvider { /** * Inject resources in specified field . */
protected static void lookupFieldResource ( javax . naming . Context context , Object instance , Field field , String name ) throws NamingException , IllegalAccessException { } } | Object lookedupResource ; if ( ( name != null ) && ( name . length ( ) > 0 ) ) { // TODO local or global JNDI
lookedupResource = context . lookup ( JAVA_COMP_ENV + name ) ; } else { // TODO local or global JNDI
lookedupResource = context . lookup ( JAVA_COMP_ENV + instance . getClass ( ) . getName ( ) + "/" + field . getName ( ) ) ; } boolean accessibility = field . isAccessible ( ) ; field . setAccessible ( true ) ; field . set ( instance , lookedupResource ) ; field . setAccessible ( accessibility ) ; |
public class Reflections { /** * get all methods annotated with a given annotation , including annotation member values matching
* < p / > depends on MethodAnnotationsScanner configured */
public Set < Method > getMethodsAnnotatedWith ( final Annotation annotation ) { } } | return filter ( getMethodsAnnotatedWith ( annotation . annotationType ( ) ) , withAnnotation ( annotation ) ) ; |
public class ResourceHandle { /** * < pre >
* Container in which this resource is placed .
* < / pre >
* < code > optional string container = 2 ; < / code > */
public com . google . protobuf . ByteString getContainerBytes ( ) { } } | java . lang . Object ref = container_ ; if ( ref instanceof java . lang . String ) { com . google . protobuf . ByteString b = com . google . protobuf . ByteString . copyFromUtf8 ( ( java . lang . String ) ref ) ; container_ = b ; return b ; } else { return ( com . google . protobuf . ByteString ) ref ; } |
public class OfflineMessageManager { /** * Returns a List of the offline < tt > Messages < / tt > whose stamp matches the specified
* request . The request will include the list of stamps that uniquely identifies
* the offline messages to retrieve . The returned offline messages will not be deleted
* from the server . Use { @ link # deleteMessages ( java . util . List ) } to delete the messages .
* @ param nodes the list of stamps that uniquely identifies offline message .
* @ return a List with the offline < tt > Messages < / tt > that were received as part of
* this request .
* @ throws XMPPErrorException If the user is not allowed to make this request or the server does
* not support offline message retrieval .
* @ throws NoResponseException if there was no response from the server .
* @ throws NotConnectedException
* @ throws InterruptedException */
public List < Message > getMessages ( final List < String > nodes ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } } | List < Message > messages = new ArrayList < > ( nodes . size ( ) ) ; OfflineMessageRequest request = new OfflineMessageRequest ( ) ; for ( String node : nodes ) { OfflineMessageRequest . Item item = new OfflineMessageRequest . Item ( node ) ; item . setAction ( "view" ) ; request . addItem ( item ) ; } // Filter offline messages that were requested by this request
StanzaFilter messageFilter = new AndFilter ( PACKET_FILTER , new StanzaFilter ( ) { @ Override public boolean accept ( Stanza packet ) { OfflineMessageInfo info = packet . getExtension ( "offline" , namespace ) ; return nodes . contains ( info . getNode ( ) ) ; } } ) ; int pendingNodes = nodes . size ( ) ; try ( StanzaCollector messageCollector = connection . createStanzaCollector ( messageFilter ) ) { connection . createStanzaCollectorAndSend ( request ) . nextResultOrThrow ( ) ; // Collect the received offline messages
Message message ; do { message = messageCollector . nextResult ( ) ; if ( message != null ) { messages . add ( message ) ; pendingNodes -- ; } else if ( message == null && pendingNodes > 0 ) { LOGGER . log ( Level . WARNING , "Did not receive all expected offline messages. " + pendingNodes + " are missing." ) ; } } while ( message != null && pendingNodes > 0 ) ; } return messages ; |
public class RepositoryUtils { /** * Extra repository id from given SCM URL
* @ param url
* @ return repository id or null if extraction fails */
public static RepositoryId extractRepositoryFromScmUrl ( String url ) { } } | if ( StringUtils . isEmpty ( url ) ) return null ; int ghIndex = url . indexOf ( HOST_DEFAULT ) ; if ( ghIndex == - 1 || ghIndex + 1 >= url . length ( ) ) return null ; if ( ! url . endsWith ( SUFFIX_GIT ) ) return null ; url = url . substring ( ghIndex + HOST_DEFAULT . length ( ) + 1 , url . length ( ) - SUFFIX_GIT . length ( ) ) ; return RepositoryId . createFromId ( url ) ; |
public class RemotingSpringBeanFactory { /** * Method to create a spring managed { @ link BeanManagerImpl } instance in client scope .
* @ return the instance */
@ Bean ( name = "beanManager" ) @ ClientScope protected BeanManager createManager ( RemotingContext remotingContext ) { } } | Assert . requireNonNull ( remotingContext , "remotingContext" ) ; return remotingContext . getBeanManager ( ) ; |
public class ClassGenerator { /** * Generate a list of formal parameter names given a size . */
List < String > argNames ( int size ) { } } | List < String > argNames = new ArrayList < > ( ) ; for ( int i = 0 ; i < size ; i ++ ) { argNames . add ( StubKind . FACTORY_METHOD_ARG . format ( i ) ) ; } return argNames ; |
public class UserConfigurationsCollection { /** * Gets a configuration .
* @ param key the configuration key
* @ return a map , or null if the key is not found */
public synchronized Map < String , Object > getConfiguration ( String key ) { } } | return Optional . ofNullable ( inventory . get ( key ) ) . flatMap ( v -> v . getConfiguration ( ) ) . map ( v -> v . getMap ( ) ) . orElse ( null ) ; |
public class MediaFormat { /** * Returns the ratio defined in the media format definition .
* If no ratio is defined an the media format has a fixed with / height it is calculated automatically .
* Otherwise 0 is returned .
* @ return Ratio */
public double getRatio ( ) { } } | // get ratio from media format definition
if ( this . ratio > 0 ) { return this . ratio ; } // get ratio from media format definition calculated from ratio sample / display values
if ( this . ratioWidth > 0 && this . ratioHeight > 0 ) { return this . ratioWidth / this . ratioHeight ; } // otherwise calculate ratio
if ( isFixedDimension ( ) && this . width > 0 && this . height > 0 ) { return ( double ) this . width / ( double ) this . height ; } return 0d ; |
public class JSDocInfo { /** * Documents the throws ( i . e . adds it to the throws list ) . */
boolean documentThrows ( JSTypeExpression type , String throwsDescription ) { } } | if ( ! lazyInitDocumentation ( ) ) { return true ; } if ( documentation . throwsDescriptions == null ) { documentation . throwsDescriptions = new LinkedHashMap < > ( ) ; } if ( ! documentation . throwsDescriptions . containsKey ( type ) ) { documentation . throwsDescriptions . put ( type , throwsDescription ) ; return true ; } return false ; |
public class CliticSplitter { /** * Takes word , posTag and lemma as input and finds if any clitic pronouns are
* in verbs .
* @ param word
* the original word possibly containing clitic pronoun
* @ param posTag
* the postag
* @ param lemma
* the lemma
* @ param lemmatizer
* the lemmatizer
* @ return the new pos and lemma after clitic splitting
* @ throws IOException if io problems */
public List < String > tagClitics ( String word , String posTag , String lemma , MorfologikLemmatizer lemmatizer ) throws IOException { } } | List < String > newCliticElems = new ArrayList < String > ( ) ; Clitic match = cliticMatcher ( word , posTag ) ; if ( match != null ) { addCliticComponents ( word , posTag , lemmatizer , match , newCliticElems ) ; } return newCliticElems ; |
public class JmsQueueImpl { /** * Set the QueueName .
* Note that this method is used to provide a Java Bean interface to
* the property ' queueName ' , and is not a JMS method as such .
* @ param qName
* @ throws JMSException */
@ Override public void setQueueName ( String qName ) throws JMSException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setQueueName" , qName ) ; setDestName ( qName ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setQueueName" ) ; |
public class GroupsInterface { /** * Request to join a group .
* Note : if a group has rules , the client must display the rules to the user and the user must accept them ( which is indicated by passing a true value to
* acceptRules ) prior to making the join request .
* @ param groupId
* - groupId parameter
* @ param message
* - ( required ) message to group administrator
* @ param acceptRules
* - ( required ) parameter indicating user has accepted groups rules */
public void joinRequest ( String groupId , String message , boolean acceptRules ) throws FlickrException { } } | Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_JOIN_REQUEST ) ; parameters . put ( "group_id" , groupId ) ; parameters . put ( "message" , message ) ; parameters . put ( "accept_rules" , acceptRules ) ; Response response = transportAPI . post ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } |
public class CmsJspTagInfo { /** * Returns the title of a page delivered from OpenCms , usually used for the < code > & lt ; title & gt ; < / code > tag of
* a HTML page . < p >
* If no title information has been found , the empty String " " is returned . < p >
* @ param controller the current OpenCms request controller
* @ param req the current request
* @ return the title of a page delivered from OpenCms */
public static String getTitleInfo ( CmsFlexController controller , HttpServletRequest req ) { } } | String result = null ; CmsObject cms = controller . getCmsObject ( ) ; try { CmsJspStandardContextBean contextBean = CmsJspStandardContextBean . getInstance ( req ) ; if ( contextBean . isDetailRequest ( ) ) { // this is a request to a detail page
CmsResource res = contextBean . getDetailContent ( ) ; CmsXmlContent content = CmsXmlContentFactory . unmarshal ( cms , res , req ) ; result = content . getHandler ( ) . getTitleMapping ( cms , content , cms . getRequestContext ( ) . getLocale ( ) ) ; if ( result == null ) { // title not found , maybe no mapping OR not available in the current locale
// read the title of the detail resource as fall back ( may contain mapping from another locale )
result = cms . readPropertyObject ( res , CmsPropertyDefinition . PROPERTY_TITLE , false ) . getValue ( ) ; } } if ( result == null ) { // read the title of the requested resource as fall back
result = cms . readPropertyObject ( cms . getRequestContext ( ) . getUri ( ) , CmsPropertyDefinition . PROPERTY_TITLE , true ) . getValue ( ) ; } } catch ( CmsException e ) { // NOOP , result will be null
} if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( result ) ) { result = "" ; } return result ; |
public class BooleanPath { /** * Method to construct the equals expression for boolean
* @ param value the boolean value
* @ return Expression */
public Expression < Boolean > eq ( Boolean value ) { } } | String valueString = value . toString ( ) ; return new Expression < Boolean > ( this , Operation . eq , valueString ) ; |
public class XmlUtil { /** * 读取解析XML文件
* @ param file XML文件
* @ return XML文档对象 */
public static Document readXML ( File file ) { } } | Assert . notNull ( file , "Xml file is null !" ) ; if ( false == file . exists ( ) ) { throw new UtilException ( "File [{}] not a exist!" , file . getAbsolutePath ( ) ) ; } if ( false == file . isFile ( ) ) { throw new UtilException ( "[{}] not a file!" , file . getAbsolutePath ( ) ) ; } try { file = file . getCanonicalFile ( ) ; } catch ( IOException e ) { // ignore
} BufferedInputStream in = null ; try { in = FileUtil . getInputStream ( file ) ; return readXML ( in ) ; } finally { IoUtil . close ( in ) ; } |
public class MainFrame { /** * GEN - LAST : event _ menuHelpHelpActionPerformed */
private void enableMenu ( final JMenu menu ) { } } | menu . setEnabled ( true ) ; for ( final Component c : menu . getMenuComponents ( ) ) { if ( c instanceof JMenu ) { enableMenu ( ( JMenu ) c ) ; } else if ( c instanceof JMenuItem ) { ( ( JMenuItem ) c ) . setEnabled ( true ) ; } } |
public class InjectionProcessor { /** * Creates and adds a new injection binding , or merges the data in an
* annotation with an existing injection binding .
* @ param instanceClass the class that contained the annotation
* @ param member the member in class that contained the annotation , or
* < tt > null < / tt > if the annotation was found at the class level
* @ param annotation the annotation data */
void addOrMergeInjectionBinding ( Class < ? > instanceClass , Member member , A annotation ) throws InjectionException { } } | String jndiName = getJndiName ( annotation ) ; String propertyName = null ; if ( jndiName == null || jndiName . length ( ) == 0 ) { if ( member == null ) { validateMissingJndiName ( instanceClass , annotation ) ; return ; } propertyName = getJavaBeansPropertyName ( member ) ; if ( propertyName == null && ! isNonJavaBeansPropertyMethodAllowed ( ) ) { Tr . error ( tc , "NOT_A_SETTER_METHOD_ON_METHOD_ANNOTATION_CWNEN0008E" , member . getName ( ) ) ; if ( isValidationFailable ( ) ) // F50309.6
{ throw new InjectionException ( "The " + member . getDeclaringClass ( ) + '.' + member . getName ( ) + " method is annotated @" + annotation . annotationType ( ) . getSimpleName ( ) + ", but it is not a setter method." ) ; } return ; } } InjectionBinding < ? > resultInjectionBinding ; if ( jndiName == null ) // F50309.5
{ if ( ivSimpleInjectionBindings == null ) { ivSimpleInjectionBindings = new LinkedHashMap < Member , InjectionBinding < A > > ( ) ; } // If the binding already exists for this member ; no need to merge or add
// the target since same member processed from a different subclass . PM88594
if ( ivSimpleInjectionBindings . containsKey ( member ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "binding found, merge not needed : " + member ) ; return ; } InjectionBinding < A > injectionBinding = createInjectionBinding ( annotation , instanceClass , member , null ) ; resultInjectionBinding = injectionBinding ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "adding " + injectionBinding ) ; ivSimpleInjectionBindings . put ( member , injectionBinding ) ; } else { if ( propertyName != null ) { jndiName = instanceClass . getCanonicalName ( ) + '/' + propertyName ; } InjectionBinding < A > injectionBinding = getInjectionBindingForAnnotation ( jndiName ) ; if ( injectionBinding == null ) { resultInjectionBinding = addOrMergeOverrideInjectionBinding ( instanceClass , member , annotation , jndiName ) ; // d675843.2
if ( resultInjectionBinding == null ) { injectionBinding = createInjectionBinding ( annotation , instanceClass , member , jndiName ) ; resultInjectionBinding = injectionBinding ; updateInjectionBinding ( jndiName , injectionBinding ) ; addInjectionBinding ( injectionBinding ) ; } } else { resultInjectionBinding = injectionBinding ; injectionBinding . merge ( annotation , instanceClass , member ) ; // d675172.1
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "merged " + injectionBinding ) ; } } if ( member == null ) { resultInjectionBinding . addInjectionClass ( instanceClass ) ; // F743-30682
} else { resultInjectionBinding . addInjectionTarget ( member ) ; } |
public class PluralizerRegistry { /** * Registers a pluralizer
* @ param l
* @ param p
* @ return the pluralizer previously registered for that locale ,
* or { @ code null } */
public synchronized Pluralizer register ( Locale l , Pluralizer p ) { } } | return pluralizers . put ( l , p ) ; |
public class JpaStorageInitializer { /** * Lookup the datasource in JNDI .
* @ param dsJndiLocation */
private static DataSource lookupDS ( String dsJndiLocation ) { } } | DataSource ds ; try { InitialContext ctx = new InitialContext ( ) ; ds = ( DataSource ) ctx . lookup ( dsJndiLocation ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } if ( ds == null ) { throw new RuntimeException ( "Datasource not found: " + dsJndiLocation ) ; // $ NON - NLS - 1 $
} return ds ; |
public class Presenter { /** * Called to surrender control of this view , e . g . when the view is detached . If and only if
* the given view matches the last passed to { @ link # takeView } , the reference to the view is
* cleared .
* Mismatched views are a no - op , not an error . This is to provide protection in the
* not uncommon case that dropView and takeView are called out of order . For example , an
* activity ' s views are typically inflated in { @ link
* android . app . Activity # onCreate } , but are only detached some time after { @ link
* android . app . Activity # onDestroy ( ) onExitScope } . It ' s possible for a view from one activity
* to be detached well after the window for the next activity has its views inflated & mdash ; that
* is , after the next activity ' s onResume call . */
public void dropView ( V view ) { } } | if ( view == null ) throw new NullPointerException ( "dropped view must not be null" ) ; if ( view == this . view ) { loaded = false ; this . view = null ; } |
public class CmsRequestUtil { /** * Gets the value of a specific cookie from an array of cookies . < p >
* @ param cookies the cookie array
* @ param name the name of the cookie we want
* @ return the cookie value , or null if cookie with the given name wasn ' t found */
public static String getCookieValue ( Cookie [ ] cookies , String name ) { } } | for ( int i = 0 ; ( cookies != null ) && ( i < cookies . length ) ; i ++ ) { if ( name . equalsIgnoreCase ( cookies [ i ] . getName ( ) ) ) { return cookies [ i ] . getValue ( ) ; } } return null ; |
public class JmxClient { /** * Set a multiple attributes at once on the server . */
public void setAttributes ( String domainName , String beanName , List < Attribute > attributes ) throws Exception { } } | setAttributes ( ObjectNameUtil . makeObjectName ( domainName , beanName ) , attributes ) ; |
public class DocTreeScanner { /** * { @ inheritDoc } This implementation scans the children in left to right order .
* @ param node { @ inheritDoc }
* @ param p { @ inheritDoc }
* @ return the result of scanning */
@ Override public R visitStartElement ( StartElementTree node , P p ) { } } | return scan ( node . getAttributes ( ) , p ) ; |
public class Objects { /** * Copy object deeply
* @ param orig
* @ return */
public static < T > T copy ( T orig ) { } } | if ( orig == null ) return null ; try { ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; ObjectOutputStream oos = new ObjectOutputStream ( bos ) ; oos . writeObject ( orig ) ; oos . flush ( ) ; ByteArrayInputStream bin = new ByteArrayInputStream ( bos . toByteArray ( ) ) ; ObjectInputStream ois = new ObjectInputStream ( bin ) ; return ( T ) ois . readObject ( ) ; } catch ( Exception e ) { throw S1SystemError . wrap ( e ) ; } |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link Vendor } { @ code > } } */
@ XmlElementDecl ( namespace = "http://schema.intuit.com/finance/v3" , name = "Vendor" , substitutionHeadNamespace = "http://schema.intuit.com/finance/v3" , substitutionHeadName = "IntuitObject" ) public JAXBElement < Vendor > createVendor ( Vendor value ) { } } | return new JAXBElement < Vendor > ( _Vendor_QNAME , Vendor . class , null , value ) ; |
public class CompositeSortedIterator { /** * / * ( non - Javadoc )
* @ see org . archive . wayback . util . Cleanable # clean ( ) */
public void close ( ) throws IOException { } } | for ( int i = 0 ; i < components . size ( ) ; i ++ ) { PeekableIterator < E > pi = components . get ( i ) ; // Catch exception so that we can still close others
try { pi . close ( ) ; } catch ( IOException io ) { LOGGER . warning ( io . toString ( ) ) ; } } |
public class MapMessage { /** * Set the message data as a DOM Hierarchy .
* @ return True if successful . */
public static boolean convertDOMtoMap ( Node nodeXML , Map < String , Object > map , boolean bProcessChildren ) { } } | NodeList nodeList = nodeXML . getChildNodes ( ) ; for ( int i = 0 ; i < nodeList . getLength ( ) ; i ++ ) { Node node = nodeList . item ( i ) ; String strKey = node . getNodeName ( ) ; short sNodeType = node . getNodeType ( ) ; if ( sNodeType == Node . ELEMENT_NODE ) { String strValue = Constant . BLANK ; if ( node . getChildNodes ( ) == null ) strValue = null ; else if ( node . getChildNodes ( ) . getLength ( ) == 0 ) strValue = null ; else if ( ( node . getChildNodes ( ) . getLength ( ) == 1 ) && ( node . getChildNodes ( ) . item ( 0 ) . getNodeType ( ) == Node . TEXT_NODE ) ) strValue = node . getChildNodes ( ) . item ( 0 ) . getNodeValue ( ) ; else if ( bProcessChildren ) MapMessage . convertDOMtoMap ( node , map , bProcessChildren ) ; if ( ( strValue != Constant . BLANK ) && ( strValue != null ) ) map . put ( strKey , strValue ) ; // ? else
// ? Util . getLogger ( ) . warning ( " - - - - - Error - Create Non - text map node ? - - - - - " ) ;
} else // if ( sNodeType = = Node . TEXT _ NODE )
{ } } return true ; // Success |
public class TypeTransformationParser { /** * A record type expression must be of the form :
* record ( RecordExp , RecordExp , . . . ) */
private boolean validRecordTypeExpression ( Node expr ) { } } | // The expression must have at least two children . The record keyword and
// a record expression
if ( ! checkParameterCount ( expr , Keywords . RECORD ) ) { return false ; } // Each child must be a valid record
for ( int i = 0 ; i < getCallParamCount ( expr ) ; i ++ ) { if ( ! validRecordParam ( getCallArgument ( expr , i ) ) ) { warnInvalidInside ( Keywords . RECORD . name , expr ) ; return false ; } } return true ; |
public class IntegerChromosome { /** * Create a new random chromosome .
* @ since 4.0
* @ param min the min value of the { @ link IntegerGene } s ( inclusively ) .
* @ param max the max value of the { @ link IntegerGene } s ( inclusively ) .
* @ param lengthRange the allowed length range of the chromosome .
* @ return a new { @ code IntegerChromosome } with the given parameter
* @ throws IllegalArgumentException if the length of the gene sequence is
* empty , doesn ' t match with the allowed length range , the minimum
* or maximum of the range is smaller or equal zero or the given
* range size is zero .
* @ throws NullPointerException if the given { @ code lengthRange } is
* { @ code null } */
public static IntegerChromosome of ( final int min , final int max , final IntRange lengthRange ) { } } | final ISeq < IntegerGene > values = IntegerGene . seq ( min , max , lengthRange ) ; return new IntegerChromosome ( values , lengthRange ) ; |
public class GenerateDOTMojo { /** * Generates the DOT file for a given addonId
* @ param addonResolver
* @ param id
* @ return generated file */
private File generateDOTFile ( AddonDependencyResolver addonResolver , AddonId id , String fileName ) { } } | File parent = new File ( outputDirectory ) ; parent . mkdirs ( ) ; File file = new File ( parent , fileName ) ; getLog ( ) . info ( "Generating " + file ) ; AddonInfo addonInfo = addonResolver . resolveAddonDependencyHierarchy ( id ) ; toDOT ( file , toGraph ( addonResolver , addonInfo ) ) ; return file ; |
public class Huff { /** * Recur from a symbol back , emitting bits . We recur before emitting to
* make the bits come out in the right order .
* @ param symbol
* The symbol to write .
* @ param bitwriter
* The bitwriter to write it to .
* @ throws JSONException */
private void write ( Symbol symbol , BitWriter bitwriter ) throws JSONException { } } | try { Symbol back = symbol . back ; if ( back != null ) { this . width += 1 ; write ( back , bitwriter ) ; if ( back . zero == symbol ) { bitwriter . zero ( ) ; } else { bitwriter . one ( ) ; } } } catch ( Throwable e ) { throw new JSONException ( e ) ; } |
public class UTF8ByteArrayUtils { /** * Find the first occured tab in a UTF - 8 encoded string
* @ param utf a byte array containing a UTF - 8 encoded string
* @ param start starting offset
* @ param length no . of bytes
* @ return position that first tab occures otherwise - 1 */
public static int findTab ( byte [ ] utf , int start , int length ) { } } | for ( int i = start ; i < ( start + length ) ; i ++ ) { if ( utf [ i ] == ( byte ) '\t' ) { return i ; } } return - 1 ; |
public class H2DBLock { /** * Releases the lock on the H2 database . */
public void release ( ) { } } | if ( lock != null ) { try { lock . release ( ) ; lock = null ; } catch ( IOException ex ) { LOGGER . debug ( "Failed to release lock" , ex ) ; } } if ( file != null ) { try { file . close ( ) ; file = null ; } catch ( IOException ex ) { LOGGER . debug ( "Unable to delete lock file" , ex ) ; } } if ( lockFile != null && lockFile . isFile ( ) ) { final String msg = readLockFile ( ) ; if ( msg != null && msg . equals ( magic ) && ! lockFile . delete ( ) ) { LOGGER . error ( "Lock file '{}' was unable to be deleted. Please manually delete this file." , lockFile . toString ( ) ) ; lockFile . deleteOnExit ( ) ; } } lockFile = null ; removeShutdownHook ( ) ; final Timestamp timestamp = new Timestamp ( System . currentTimeMillis ( ) ) ; LOGGER . debug ( "Lock released ({}) {} @ {}" , Thread . currentThread ( ) . getName ( ) , magic , timestamp . toString ( ) ) ; |
public class HelloSignClient { /** * Creates a new Signature Request based on the template provided .
* @ param req TemplateSignatureRequest
* @ return SignatureRequest
* @ throws HelloSignException thrown if there ' s a problem processing the
* HTTP request or the JSON response . */
public SignatureRequest sendTemplateSignatureRequest ( TemplateSignatureRequest req ) throws HelloSignException { } } | return new SignatureRequest ( httpClient . withAuth ( auth ) . withPostFields ( req . getPostFields ( ) ) . post ( BASE_URI + TEMPLATE_SIGNATURE_REQUEST_URI ) . asJson ( ) ) ; |
public class LayerTree { /** * Processes a treeNode ( add it to the TreeGrid )
* @ param treeNode
* The treeNode to process
* @ param nodeRoot
* The root node to which the treeNode has te be added
* @ param tree
* The tree to which the node has to be added
* @ param mapModel
* map model
* @ param refresh
* True if the tree is refreshed ( causing it to keep its expanded state ) */
private void processNode ( final ClientLayerTreeNodeInfo treeNode , final TreeNode nodeRoot , final Tree tree , final MapModel mapModel , final boolean refresh ) { } } | if ( null != treeNode ) { String treeNodeLabel = treeNode . getLabel ( ) ; final TreeNode node = new TreeNode ( treeNodeLabel ) ; tree . add ( node , nodeRoot ) ; // ( final leafs )
for ( ClientLayerInfo info : treeNode . getLayers ( ) ) { Layer < ? > layer = mapModel . getLayer ( info . getId ( ) ) ; tree . add ( new LayerTreeTreeNode ( this . tree , layer ) , node ) ; } // treeNodes
List < ClientLayerTreeNodeInfo > children = treeNode . getTreeNodes ( ) ; for ( ClientLayerTreeNodeInfo newNode : children ) { processNode ( newNode , node , tree , mapModel , refresh ) ; } // expand tree nodes
// when not refreshing expand them like configured
// when refreshing expand them as before the refresh
boolean isTreeNodeExpanded = treeNode . isExpanded ( ) ; if ( ! refresh ) { if ( isTreeNodeExpanded ) { tree . openFolder ( node ) ; } } else { // TODO close previously opened tree nodes , close others
} } |
public class BodyContentImpl { /** * Print a double - precision floating - point number . The string produced by
* < code > { @ link java . lang . String # valueOf ( double ) } < / code > is translated into
* bytes according to the platform ' s default character encoding , and these
* bytes are written in exactly the manner of the < code > { @ link
* # write ( int ) } < / code > method .
* @ param d The < code > double < / code > to be printed
* @ throws IOException */
public void print ( double d ) throws IOException { } } | if ( writer != null ) { writer . write ( String . valueOf ( d ) ) ; } else { write ( String . valueOf ( d ) ) ; } |
public class Transaction { /** * < p > Returns the list of transacion outputs , whether spent or unspent , that match a wallet by address or that are
* watched by a wallet , i . e . , transaction outputs whose script ' s address is controlled by the wallet and transaction
* outputs whose script is watched by the wallet . < / p >
* @ param transactionBag The wallet that controls addresses and watches scripts .
* @ return linked list of outputs relevant to the wallet in this transaction */
public List < TransactionOutput > getWalletOutputs ( TransactionBag transactionBag ) { } } | List < TransactionOutput > walletOutputs = new LinkedList < > ( ) ; for ( TransactionOutput o : outputs ) { if ( ! o . isMineOrWatched ( transactionBag ) ) continue ; walletOutputs . add ( o ) ; } return walletOutputs ; |
public class FirstNonNullHelper { /** * Gets first result of function which is not null .
* @ param < T > type of values .
* @ param < R > element to return .
* @ param function function to apply to each value .
* @ param suppliers all possible suppliers that might be able to supply a value .
* @ return first result which was not null ,
* OR < code > null < / code > if result for all supplier ' s values was < code > null < / code > . */
public static < T , R > R firstNonNull ( Function < T , R > function , Supplier < Collection < T > > ... suppliers ) { } } | Stream < Supplier < R > > resultStream = Stream . of ( suppliers ) . map ( s -> ( ( ) -> firstNonNull ( function , s . get ( ) ) ) ) ; return firstNonNull ( Supplier :: get , resultStream ) ; |
public class PartitionEventManager { /** * Sends a { @ link MigrationEvent } to the registered event listeners . */
void sendMigrationEvent ( final MigrationInfo migrationInfo , final MigrationEvent . MigrationStatus status ) { } } | if ( migrationInfo . getSourceCurrentReplicaIndex ( ) != 0 && migrationInfo . getDestinationNewReplicaIndex ( ) != 0 ) { // only fire events for 0th replica migrations
return ; } ClusterServiceImpl clusterService = node . getClusterService ( ) ; MemberImpl current = clusterService . getMember ( migrationInfo . getSourceAddress ( ) ) ; MemberImpl newOwner = clusterService . getMember ( migrationInfo . getDestinationAddress ( ) ) ; MigrationEvent event = new MigrationEvent ( migrationInfo . getPartitionId ( ) , current , newOwner , status ) ; EventService eventService = nodeEngine . getEventService ( ) ; Collection < EventRegistration > registrations = eventService . getRegistrations ( SERVICE_NAME , MIGRATION_EVENT_TOPIC ) ; eventService . publishEvent ( SERVICE_NAME , registrations , event , event . getPartitionId ( ) ) ; |
public class Primitive { /** * Get the corresponding primitive TYPE class for the java . lang wrapper
* class type .
* e . g . Integer . class - > Integer . TYPE */
public static Class < ? > unboxType ( Class < ? > wrapperType ) { } } | Class < ? > c = wrapperMap . get ( wrapperType ) ; if ( c != null ) return c ; throw new InterpreterError ( "Not a primitive wrapper type: " + wrapperType ) ; |
public class Event { /** * Return this event ' s data parsed into the given type .
* @ param dataType class to parse data
* @ param < R > type to parse the data into
* @ return the data */
public < R > R getData ( Class < R > dataType ) { } } | return GSON . fromJson ( data , dataType ) ; |
public class AptControlInterface { /** * Returns the AptEventSet with the specified name */
public AptEventSet getEventSet ( String name ) { } } | for ( AptEventSet eventSet : getEventSets ( ) ) if ( eventSet . getClassName ( ) . equals ( name ) ) return eventSet ; if ( _superClass != null ) return _superClass . getEventSet ( name ) ; return null ; |
public class IpcLogger { /** * Called by the entry to log the request . */
void log ( IpcLogEntry entry ) { } } | Level level = entry . getLevel ( ) ; Predicate < Marker > enabled ; BiConsumer < Marker , String > log ; switch ( level ) { case TRACE : enabled = logger :: isTraceEnabled ; log = logger :: trace ; break ; case DEBUG : enabled = logger :: isDebugEnabled ; log = logger :: debug ; break ; case INFO : enabled = logger :: isInfoEnabled ; log = logger :: info ; break ; case WARN : enabled = logger :: isWarnEnabled ; log = logger :: warn ; break ; case ERROR : enabled = logger :: isErrorEnabled ; log = logger :: error ; break ; default : enabled = logger :: isDebugEnabled ; log = logger :: debug ; break ; } if ( enabled . test ( entry . getMarker ( ) ) ) { log . accept ( entry . getMarker ( ) , entry . toString ( ) ) ; } // For successful responses we can reuse the entry to avoid additional allocations . Failed
// requests might have retries so we just reset the response portion to avoid incorrectly
// having state bleed through from one request to the next .
if ( entry . isSuccessful ( ) ) { entry . reset ( ) ; entries . offer ( entry ) ; } else { entry . resetForRetry ( ) ; } |
public class ArrayWrappedCallByReference { /** * processes a store to an array element to see if this array is being used as a wrapper array , and if so records the register that is stored within it .
* @ return the user value representing the stored register value */
@ Nullable private Integer processArrayElementStore ( ) { } } | if ( stack . getStackDepth ( ) >= 2 ) { OpcodeStack . Item itm = stack . getStackItem ( 2 ) ; int reg = itm . getRegisterNumber ( ) ; if ( reg != - 1 ) { WrapperInfo wi = wrappers . get ( Integer . valueOf ( reg ) ) ; if ( wi != null ) { OpcodeStack . Item elItm = stack . getStackItem ( 0 ) ; wi . wrappedReg = elItm . getRegisterNumber ( ) ; } } else { OpcodeStack . Item elItm = stack . getStackItem ( 0 ) ; reg = elItm . getRegisterNumber ( ) ; if ( reg != - 1 ) { return Integer . valueOf ( reg ) ; } } } return null ; |
public class Component { /** * Gets the type of this component ( e . g . a fully qualified Java interface / class name ) .
* @ return the type , as a String */
@ JsonIgnore public CodeElement getType ( ) { } } | return codeElements . stream ( ) . filter ( ce -> ce . getRole ( ) == CodeElementRole . Primary ) . findFirst ( ) . orElse ( null ) ; |
public class FileSystemUtilities { /** * Retrieves the URL for the supplied File . Convenience method which hides exception handling
* for the operation in question .
* @ param aFile A File for which the URL should be retrieved .
* @ return The URL for the supplied aFile .
* @ throws java . lang . IllegalArgumentException if getting the URL yielded a MalformedURLException . */
public static URL getUrlFor ( final File aFile ) throws IllegalArgumentException { } } | // Check sanity
Validate . notNull ( aFile , "aFile" ) ; try { return aFile . toURI ( ) . normalize ( ) . toURL ( ) ; } catch ( MalformedURLException e ) { throw new IllegalArgumentException ( "Could not retrieve the URL from file [" + getCanonicalPath ( aFile ) + "]" , e ) ; } |
public class HibernateQueryModelDAO { @ Override public T findUniqueUsingQueryModel ( QueryModel queryModel ) throws NoSuchItemException , TooManyItemsException , JeppettoException { } } | T result ; try { if ( accessControlContextProvider == null || accessControlHelper . annotationAllowsAccess ( persistentClass , queryModel . getAccessControlContext ( ) , AccessType . Read ) ) { // noinspection unchecked
result = ( T ) buildCriteria ( queryModel ) . uniqueResult ( ) ; } else { // noinspection unchecked
result = ( T ) createAccessControlledQuery ( queryModel ) . uniqueResult ( ) ; } } catch ( NonUniqueObjectException e ) { throw new TooManyItemsException ( e . getMessage ( ) ) ; } catch ( HibernateException e ) { throw new JeppettoException ( e ) ; } if ( result == null ) { throw new NoSuchItemException ( persistentClass . getSimpleName ( ) , queryModel . toString ( ) ) ; } return result ; |
public class AmazonCognitoIdentityClient { /** * Registers ( or retrieves ) a Cognito < code > IdentityId < / code > and an OpenID Connect token for a user authenticated
* by your backend authentication process . Supplying multiple logins will create an implicit linked account . You can
* only specify one developer provider as part of the < code > Logins < / code > map , which is linked to the identity pool .
* The developer provider is the " domain " by which Cognito will refer to your users .
* You can use < code > GetOpenIdTokenForDeveloperIdentity < / code > to create a new identity and to link new logins ( that
* is , user credentials issued by a public provider or developer provider ) to an existing identity . When you want to
* create a new identity , the < code > IdentityId < / code > should be null . When you want to associate a new login with an
* existing authenticated / unauthenticated identity , you can do so by providing the existing < code > IdentityId < / code > .
* This API will create the identity in the specified < code > IdentityPoolId < / code > .
* You must use AWS Developer credentials to call this API .
* @ param getOpenIdTokenForDeveloperIdentityRequest
* Input to the < code > GetOpenIdTokenForDeveloperIdentity < / code > action .
* @ return Result of the GetOpenIdTokenForDeveloperIdentity operation returned by the service .
* @ throws InvalidParameterException
* Thrown for missing or bad input parameter ( s ) .
* @ throws ResourceNotFoundException
* Thrown when the requested resource ( for example , a dataset or record ) does not exist .
* @ throws NotAuthorizedException
* Thrown when a user is not authorized to access the requested resource .
* @ throws ResourceConflictException
* Thrown when a user tries to use a login which is already linked to another account .
* @ throws TooManyRequestsException
* Thrown when a request is throttled .
* @ throws InternalErrorException
* Thrown when the service encounters an error during processing the request .
* @ throws DeveloperUserAlreadyRegisteredException
* The provided developer user identifier is already registered with Cognito under a different identity ID .
* @ sample AmazonCognitoIdentity . GetOpenIdTokenForDeveloperIdentity
* @ see < a
* href = " http : / / docs . aws . amazon . com / goto / WebAPI / cognito - identity - 2014-06-30 / GetOpenIdTokenForDeveloperIdentity "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public GetOpenIdTokenForDeveloperIdentityResult getOpenIdTokenForDeveloperIdentity ( GetOpenIdTokenForDeveloperIdentityRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetOpenIdTokenForDeveloperIdentity ( request ) ; |
public class CliConfig { /** * Returns a CliConfig instance with values from a config file from under the users home
* directory :
* < p > & lt ; user . home & gt ; / . helios / config
* < p > If the file is not found , a CliConfig with pre - defined values will be returned .
* @ return The configuration
* @ throws IOException If the file exists but could not be read
* @ throws URISyntaxException If a HELIOS _ MASTER env var is present and doesn ' t parse as a URI */
public static CliConfig fromUserConfig ( final Map < String , String > environmentVariables ) throws IOException , URISyntaxException { } } | final String userHome = System . getProperty ( "user.home" ) ; final String defaults = userHome + File . separator + CONFIG_PATH ; final File defaultsFile = new File ( defaults ) ; return fromFile ( defaultsFile , environmentVariables ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcWallType ( ) { } } | if ( ifcWallTypeEClass == null ) { ifcWallTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 761 ) ; } return ifcWallTypeEClass ; |
public class TreeRenderer { /** * If needed , render the selection link around the icon for this node .
* Note that the tag rendered here needs to be closed after the actual
* icon and label are rendered .
* @ param writer the appender where the tree markup is appended
* @ param node the node to render
* @ param nodeName the unique name of the node
* @ param attrs renderer for supported attributes
* @ param state the set of tree properties that are used to render the tree markup
* @ return the selection link ( or span ) tag renderer to close after the item
* icon and label rendered
* @ throws JspException */
protected TagRenderingBase renderSelectionLink ( AbstractRenderAppender writer , TreeElement node , String nodeName , AttributeRenderer attrs , InheritableState state ) throws JspException { } } | // calculate the selection link for this node
String selectionLink = getSelectionlink ( node , nodeName , state ) ; TagRenderingBase endRender = null ; // if there is a selection link we need to put an anchor out .
if ( selectionLink != null ) { _anchorState . clear ( ) ; _anchorState . href = selectionLink ; String target = node . getTarget ( ) ; if ( target == null ) { target = state . getSelectionTarget ( ) ; } _anchorState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , TARGET , target ) ; String title = node . getTitle ( ) ; _anchorState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , TITLE , title ) ; // set the selection styles
if ( node . isSelected ( ) ) { _anchorState . style = _trs . selectedStyle ; _anchorState . styleClass = _trs . selectedStyleClass ; } else { _anchorState . style = _trs . unselectedStyle ; _anchorState . styleClass = _trs . unselectedStyleClass ; } if ( _anchorState . style == null && _anchorState . styleClass == null ) { _anchorState . style = "text-decoration: none" ; } // render any attributes applied to the HTML
attrs . renderSelectionLink ( _anchorState , node ) ; // render the runAtClient attributes
if ( _trs . runAtClient ) { String action = node . getClientAction ( ) ; if ( action != null ) { action = HtmlUtils . escapeEscapes ( action ) ; action = ScriptRequestState . getString ( "netuiAction" , new Object [ ] { action } ) ; } _anchorState . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , ONCLICK , action ) ; // Jira 299
// _ anchorState . onClick = action ;
} // actually render the anchor .
renderSelectionLinkPrefix ( writer , node ) ; _anchorRenderer . doStartTag ( writer , _anchorState ) ; endRender = _anchorRenderer ; } else { // This node doesn ' s support selection . This means we consider it disabled . We will
// put a span around it and set the style / class to indicate that it is disabled .
_spanState . clear ( ) ; _spanState . styleClass = _trs . disabledStyleClass ; _spanState . style = _trs . disabledStyle ; renderSelectionLinkPrefix ( writer , node ) ; _spanRenderer . doStartTag ( writer , _spanState ) ; endRender = _spanRenderer ; } return endRender ; |
public class ElementMatchers { /** * Matches a { @ link MethodDescription } by applying an iterable collection of element matcher on any parameter ' s { @ link TypeDescription } .
* @ param matchers The matcher that are applied onto the parameter types of the matched method description .
* @ param < T > The type of the matched object .
* @ return A matcher that matches a method description by applying another element matcher onto each parameter ' s type . */
public static < T extends MethodDescription > ElementMatcher . Junction < T > takesArguments ( ElementMatcher < ? super Iterable < ? extends TypeDescription > > matchers ) { } } | return new MethodParametersMatcher < T > ( new MethodParameterTypesMatcher < ParameterList < ? > > ( erasures ( matchers ) ) ) ; |
public class IOUtils { /** * Calculates GCG checksum for a given sequence
* @ param sequence given sequence
* @ return GCG checksum */
public static < S extends Sequence < C > , C extends Compound > int getGCGChecksum ( S sequence ) { } } | String s = sequence . toString ( ) . toUpperCase ( ) ; int count = 0 , check = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { count ++ ; check += count * s . charAt ( i ) ; if ( count == 57 ) { count = 0 ; } } return check % 10000 ; |
public class OidcIdTokenSigningAndEncryptionService { /** * Should sign token for service ?
* @ param svc the svc
* @ return the boolean */
@ Override protected boolean shouldSignTokenFor ( final OidcRegisteredService svc ) { } } | if ( AlgorithmIdentifiers . NONE . equalsIgnoreCase ( svc . getIdTokenSigningAlg ( ) ) ) { LOGGER . warn ( "ID token signing algorithm is set to none for [{}] and ID token will not be signed" , svc . getServiceId ( ) ) ; return false ; } return svc . isSignIdToken ( ) ; |
public class WebContainer { /** * DS method for setting the class loading service reference .
* @ param service */
@ Reference ( service = ClassLoadingService . class , name = "classLoadingService" ) protected void setClassLoadingService ( ServiceReference < ClassLoadingService > ref ) { } } | classLoadingSRRef . setReference ( ref ) ; |
public class BoltClientTransport { /** * 同步调用
* @ param request 请求对象
* @ param invokeContext 调用上下文
* @ param timeoutMillis 超时时间 ( 毫秒 )
* @ throws RemotingException 远程调用异常
* @ throws InterruptedException 中断异常
* @ since 5.2.0 */
protected void doOneWay ( SofaRequest request , InvokeContext invokeContext , int timeoutMillis ) throws RemotingException , InterruptedException { } } | RPC_CLIENT . oneway ( url , request , invokeContext ) ; |
public class ModelsImpl { /** * Gets all custom prebuilt entities information of this application .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the List & lt ; EntityExtractor & gt ; object */
public Observable < List < EntityExtractor > > listCustomPrebuiltEntitiesAsync ( UUID appId , String versionId ) { } } | return listCustomPrebuiltEntitiesWithServiceResponseAsync ( appId , versionId ) . map ( new Func1 < ServiceResponse < List < EntityExtractor > > , List < EntityExtractor > > ( ) { @ Override public List < EntityExtractor > call ( ServiceResponse < List < EntityExtractor > > response ) { return response . body ( ) ; } } ) ; |
public class JDBCDriverService { /** * Utility method for creating all types of data sources .
* Precondition : invoker must have at least a read lock on this JDBC driver service .
* @ param type data source interface in javax . sql package
* @ param className name of data source class to create
* @ param props typed data source properties
* @ param dsID identifier for the data source
* @ return the data source
* @ throws SQLException if an error occurs */
private < T extends CommonDataSource > T create ( final String className , final Hashtable < ? , ? > props , String dsID ) throws SQLException { } } | if ( classloader != null && className . startsWith ( "org.apache.derby.jdbc.Embedded" ) && isDerbyEmbedded . compareAndSet ( false , true ) ) { embDerbyRefCount . add ( classloader ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "ref count for shutdown" , classloader , embDerbyRefCount ) ; } final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "create" , className , classloader , PropertyService . hidePasswords ( props ) ) ; // Add a value for connectionFactoryClassName when using UCP if one is not specified
if ( className . startsWith ( "oracle.ucp.jdbc" ) && ! props . containsKey ( "connectionFactoryClassName" ) ) { if ( className . equals ( "oracle.ucp.jdbc.PoolDataSourceImpl" ) && props instanceof PropertyService ) { if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Setting connectionFactoryClassName property to oracle.jdbc.pool.OracleDataSource" ) ; ( ( PropertyService ) props ) . setProperty ( "connectionFactoryClassName" , "oracle.jdbc.pool.OracleDataSource" ) ; } else if ( className . equals ( "oracle.ucp.jdbc.PoolXADataSourceImpl" ) && props instanceof PropertyService ) { if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Setting connectionFactoryClassName property to oracle.jdbc.xa.client.OracleXADataSource" ) ; ( ( PropertyService ) props ) . setProperty ( "connectionFactoryClassName" , "oracle.jdbc.xa.client.OracleXADataSource" ) ; } } try { T ds = AccessController . doPrivileged ( new PrivilegedExceptionAction < T > ( ) { public T run ( ) throws Exception { ClassLoader loader , origTCCL = Thread . currentThread ( ) . getContextClassLoader ( ) ; try { if ( classloader == null ) loader = origTCCL ; // Use thread context class loader of application in absence of server configured library
else Thread . currentThread ( ) . setContextClassLoader ( loader = classloader ) ; @ SuppressWarnings ( "unchecked" ) Class < T > dsClass = ( Class < T > ) loader . loadClass ( className ) ; introspectedClasses . add ( dsClass ) ; T ds = dsClass . newInstance ( ) ; // Set all of the JDBC vendor properties
Hashtable < ? , ? > p = ( Hashtable < ? , ? > ) props . clone ( ) ; for ( PropertyDescriptor descriptor : Introspector . getBeanInfo ( dsClass ) . getPropertyDescriptors ( ) ) { String name = descriptor . getName ( ) ; Object value = p . remove ( name ) ; // handle osgi vs non - osgi URL property
if ( value == null && name . equals ( "url" ) ) { value = p . remove ( "URL" ) ; } boolean isPassword = PropertyService . isPassword ( name ) ; if ( value != null ) try { if ( value instanceof String ) { String str = ( String ) value ; // Decode passwords
if ( isPassword ) str = PasswordUtil . getCryptoAlgorithm ( str ) == null ? str : PasswordUtil . decode ( str ) ; setProperty ( ds , descriptor , str , ! isPassword ) ; } else { // Property already has correct non - String type
if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "set " + name + " = " + value ) ; descriptor . getWriteMethod ( ) . invoke ( ds , value ) ; } } catch ( Throwable x ) { if ( x instanceof InvocationTargetException ) x = x . getCause ( ) ; FFDCFilter . processException ( x , getClass ( ) . getName ( ) , "217" , this , new Object [ ] { className , name , value } ) ; boolean isURL = ( "URL" . equals ( name ) || "url" . equals ( name ) ) && value instanceof String ; SQLException failure = connectorSvc . ignoreWarnOrFail ( tc , x , SQLException . class , "PROP_SET_ERROR" , name , "=" + ( isPassword ? "******" : isURL ? PropertyService . filterURL ( ( String ) value ) : value ) , AdapterUtil . stackTraceToString ( x ) ) ; if ( failure != null ) throw failure ; } } // Are there any properties remaining for which we couldn ' t find setters ?
if ( ! p . isEmpty ( ) ) for ( Object propertyName : p . keySet ( ) ) // Filter out properties that only apply to XA or that shouldn ' t be set on the driver
if ( ( ! PROPS_FOR_XA_ONLY . contains ( propertyName ) || ds instanceof XADataSource ) && ! PROPS_NOT_SET_ON_DRIVER . contains ( propertyName ) ) { SQLException failure = connectorSvc . ignoreWarnOrFail ( tc , null , SQLException . class , "PROP_NOT_FOUND" , className , propertyName ) ; if ( failure != null ) throw failure ; } return ds ; } finally { if ( classloader != null ) Thread . currentThread ( ) . setContextClassLoader ( origTCCL ) ; } } } ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "create" , ds ) ; return ds ; } catch ( PrivilegedActionException privX ) { Throwable x = privX . getCause ( ) ; FFDCFilter . processException ( x , JDBCDriverService . class . getName ( ) , "234" ) ; int lastDot = className . lastIndexOf ( '.' ) ; Set < String > searched = Collections . singleton ( lastDot > 0 ? className . substring ( 0 , lastDot ) : className ) ; SQLException sqlX = x instanceof ClassNotFoundException ? classNotFound ( className , searched , dsID , x ) : x instanceof SQLException ? ( SQLException ) x : new SQLNonTransientException ( x ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "create" , x ) ; throw sqlX ; } |
public class TypeLoaderAccess { /** * Gets an intrinsic type based on a fully - qualified name . This could either be the name of an entity ,
* like " entity . User " , the name of a typekey , like " typekey . SystemPermission " , or a class name , like
* " java . lang . String " . Names can have [ ] appended to them to create arrays , and multi - dimensional arrays
* are supported .
* @ param fullyQualifiedName the fully qualified name of the type
* @ return the corresponding IType
* @ throws RuntimeException if the specified name doesn ' t correspond to any type */
public IType getByFullName ( String fullyQualifiedName ) { } } | try { return getIntrinsicTypeByFullName ( fullyQualifiedName ) ; } catch ( ClassNotFoundException e ) { throw new RuntimeExceptionWithNoStacktrace ( e ) ; } |
public class Threshold { /** * Adds a metric value to the metric value queue .
* @ param metricValues
* bunch of values */
public void accumulate ( List < ? extends StandardMetricResult > metricValues ) { } } | if ( metricValues == null || metricValues . isEmpty ( ) ) return ; for ( StandardMetricResult v : metricValues ) { if ( lastOffset < v . offset ) values . put ( v . value . intValue ( ) ) ; } lastOffset = ListUtils . last ( metricValues ) . offset ; |
public class MultiLayerNetwork { /** * Perform inference and then calculate the F1 score of the output ( input ) vs . the labels .
* @ param input the input to perform inference with
* @ param labels the true labels
* @ return the score for the given input , label pairs */
@ Override public double f1Score ( INDArray input , INDArray labels ) { } } | feedForward ( input ) ; setLabels ( labels ) ; Evaluation eval = new Evaluation ( ) ; eval . eval ( labels , output ( input ) ) ; return eval . f1 ( ) ; |
public class CassQuery { /** * Adds the where clause .
* @ param builder
* the builder */
void addWhereClause ( StringBuilder builder ) { } } | if ( ! getKunderaQuery ( ) . getFilterClauseQueue ( ) . isEmpty ( ) ) { builder . append ( CQLTranslator . ADD_WHERE_CLAUSE ) ; } |
public class DateFormatPool { /** * Release a resource and put it back in the pool of free resources .
* @ param o The object to return to the pool */
public void release ( Object o ) { } } | synchronized ( this ) { usedPool . remove ( o ) ; freePool . add ( o ) ; notify ( ) ; } |
public class InstallationRegistrationEndpoint { /** * returns application if the masterSecret is valid for the request
* PushApplicationEntity */
private Variant loadVariantWhenAuthorized ( final HttpServletRequest request ) { } } | // extract the pushApplicationID and its secret from the HTTP Basic
// header :
final String [ ] credentials = HttpBasicHelper . extractUsernameAndPasswordFromBasicHeader ( request ) ; final String variantID = credentials [ 0 ] ; final String secret = credentials [ 1 ] ; final Variant variant = genericVariantService . findByVariantID ( variantID ) ; if ( variant != null && variant . getSecret ( ) . equals ( secret ) ) { return variant ; } // unauthorized . . .
return null ; |
public class Path { /** * Accept a PathVisitor , starting from a given BasicBlock and
* InstructionHandle .
* @ param cfg
* the control flow graph
* @ param visitor
* a PathVisitor
* @ param startBlock
* BasicBlock where traversal should start
* @ param startHandle
* InstructionHandle within the start block where traversal
* should start */
public void acceptVisitorStartingFromLocation ( CFG cfg , PathVisitor visitor , BasicBlock startBlock , InstructionHandle startHandle ) { } } | // Find the start block in the path
int index ; for ( index = 0 ; index < getLength ( ) ; index ++ ) { if ( getBlockIdAt ( index ) == startBlock . getLabel ( ) ) { break ; } } assert index < getLength ( ) ; Iterator < InstructionHandle > i = startBlock . instructionIterator ( ) ; // Position iterator at start instruction handle
if ( startHandle != startBlock . getFirstInstruction ( ) ) { while ( i . hasNext ( ) ) { InstructionHandle handle = i . next ( ) ; if ( handle . getNext ( ) == startHandle ) { break ; } } } BasicBlock basicBlock = startBlock ; while ( true ) { // visit block
visitor . visitBasicBlock ( basicBlock ) ; // visit instructions in block
while ( i . hasNext ( ) ) { visitor . visitInstructionHandle ( i . next ( ) ) ; } // end of path ?
index ++ ; if ( index >= getLength ( ) ) { break ; } // visit edge
BasicBlock next = cfg . lookupBlockByLabel ( getBlockIdAt ( index ) ) ; Edge edge = cfg . lookupEdge ( basicBlock , next ) ; assert edge != null ; visitor . visitEdge ( edge ) ; // continue to next block
basicBlock = next ; i = basicBlock . instructionIterator ( ) ; } |
public class CmsUpdateBean { /** * Creates a new instance of the setup Bean . < p >
* @ param webAppRfsPath path to the OpenCms web application
* @ param servletMapping the OpenCms servlet mapping
* @ param defaultWebApplication the name of the default web application */
@ Override public void init ( String webAppRfsPath , String servletMapping , String defaultWebApplication ) { } } | try { super . init ( webAppRfsPath , servletMapping , defaultWebApplication ) ; CmsUpdateInfo . INSTANCE . setAdeModuleVersion ( getInstalledModules ( ) . get ( "org.opencms.ade.containerpage" ) ) ; if ( m_workplaceUpdateThread != null ) { if ( m_workplaceUpdateThread . isAlive ( ) ) { m_workplaceUpdateThread . kill ( ) ; } m_workplaceUpdateThread = null ; } if ( m_dbUpdateThread != null ) { if ( m_dbUpdateThread . isAlive ( ) ) { m_dbUpdateThread . kill ( ) ; } m_dbUpdateThread = null ; m_newLoggingOffset = 0 ; m_oldLoggingOffset = 0 ; } } catch ( Exception e ) { e . printStackTrace ( ) ; throw new RuntimeException ( e ) ; } |
public class CDI12ContainerConfig { /** * Updates the current configuration properties
* @ param properties the updated configuration properties */
protected void updateConfiguration ( Map < String , Object > properties ) { } } | if ( properties != null ) { this . properties . clear ( ) ; this . properties . putAll ( properties ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Current Properties: " + this . properties ) ; } |
public class SparseMisoSceneModel { /** * Returns the key for the specified section . */
protected final int key ( int x , int y ) { } } | int sx = MathUtil . floorDiv ( x , swidth ) ; int sy = MathUtil . floorDiv ( y , sheight ) ; return ( sx << 16 ) | ( sy & 0xFFFF ) ; |
public class nssimpleacl6 { /** * Use this API to flush nssimpleacl6 resources . */
public static base_responses flush ( nitro_service client , nssimpleacl6 resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { nssimpleacl6 flushresources [ ] = new nssimpleacl6 [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { flushresources [ i ] = new nssimpleacl6 ( ) ; flushresources [ i ] . estsessions = resources [ i ] . estsessions ; } result = perform_operation_bulk_request ( client , flushresources , "flush" ) ; } return result ; |
public class DecoratingDynamicTypeBuilder { /** * { @ inheritDoc } */
public MethodDefinition . ImplementationDefinition . Optional < T > implement ( Collection < ? extends TypeDefinition > interfaceTypes ) { } } | throw new UnsupportedOperationException ( "Cannot implement interface for decorated type: " + instrumentedType ) ; |
public class XTryCatchFinallyExpressionImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EList < XVariableDeclaration > getResources ( ) { } } | if ( resources == null ) { resources = new EObjectContainmentEList < XVariableDeclaration > ( XVariableDeclaration . class , this , XbasePackage . XTRY_CATCH_FINALLY_EXPRESSION__RESOURCES ) ; } return resources ; |
public class DropWizardUtils { /** * Returns the metric name .
* @ param name the initial metric name
* @ param type the initial type of the metric .
* @ return a string the unique metric name */
static String generateFullMetricName ( String name , String type ) { } } | return SOURCE + DELIMITER + name + DELIMITER + type ; |
public class OdsElements { /** * Create an automatic style for this TableCellStyle and this type of cell .
* Do not produce any effect if the type is Type . STRING or Type . VOID
* @ param style the style of the cell ( color , data style , etc . )
* @ param type the type of the cell */
public void addChildCellStyle ( final TableCellStyle style , final TableCell . Type type ) { } } | this . contentElement . addChildCellStyle ( style , type ) ; |
public class FileUtil { /** * 将String写入文件 , UTF - 8编码追加模式
* @ param content 写入的内容
* @ param file 文件
* @ return 写入的文件
* @ throws IORuntimeException IO异常
* @ since 3.1.2 */
public static File appendUtf8String ( String content , File file ) throws IORuntimeException { } } | return appendString ( content , file , CharsetUtil . CHARSET_UTF_8 ) ; |
public class DoGet { /** * Return this as the Date / Time format for displaying Creation + Modification dates
* @ param browserLocale
* @ return DateFormat used to display creation and modification dates */
protected DateFormat getDateTimeFormat ( Locale browserLocale ) { } } | return DateFormat . getDateTimeInstance ( DateFormat . SHORT , DateFormat . MEDIUM , browserLocale ) ; |
public class GVRPicker { /** * Sets the origin and direction of the pick ray .
* @ param ox X coordinate of origin .
* @ param oy Y coordinate of origin .
* @ param oz Z coordinate of origin .
* @ param dx X coordinate of ray direction .
* @ param dy Y coordinate of ray direction .
* @ param dz Z coordinate of ray direction .
* The coordinate system of the ray depends on the whether the
* picker is attached to a scene object or not . When attached
* to a scene object , the ray is in the coordinate system of
* that object where ( 0 , 0 , 0 ) is the center of the scene object
* and ( 0 , 0 , 1 ) is it ' s positive Z axis . If not attached to an
* object , the ray is in the coordinate system of the scene ' s
* main camera with ( 0 , 0 , 0 ) at the viewer and ( 0 , 0 , - 1)
* where the viewer is looking .
* @ see # doPick ( )
* @ see # getPickRay ( )
* @ see # getWorldPickRay ( Vector3f , Vector3f ) */
public void setPickRay ( float ox , float oy , float oz , float dx , float dy , float dz ) { } } | synchronized ( this ) { mRayOrigin . x = ox ; mRayOrigin . y = oy ; mRayOrigin . z = oz ; mRayDirection . x = dx ; mRayDirection . y = dy ; mRayDirection . z = dz ; } |
public class AuthenticationAPIClient { /** * Start a passwordless flow with a < a href = " https : / / auth0 . com / docs / api / authentication # get - code - or - link " > SMS < / a >
* By default it will try to authenticate using the " sms " connection .
* Requires your Application to have the < b > Resource Owner < / b > Legacy Grant Type enabled . See < a href = " https : / / auth0 . com / docs / clients / client - grant - types " > Client Grant Types < / a > to learn how to enable it .
* Example usage :
* < pre >
* { @ code
* client . passwordlessWithSms ( " { phone number } " , PasswordlessType . CODE )
* . start ( new BaseCallback < Void > ( ) {
* { @ literal } Override
* public void onSuccess ( Void payload ) { }
* { @ literal } Override
* public void onFailure ( AuthenticationException error ) { }
* < / pre >
* @ param phoneNumber where an SMS with a verification code will be sent
* @ param passwordlessType indicate whether the SMS should contain a code , link or magic link ( android { @ literal & } iOS )
* @ return a request to configure and start */
@ SuppressWarnings ( "WeakerAccess" ) public ParameterizableRequest < Void , AuthenticationException > passwordlessWithSMS ( @ NonNull String phoneNumber , @ NonNull PasswordlessType passwordlessType ) { } } | return passwordlessWithSMS ( phoneNumber , passwordlessType , SMS_CONNECTION ) ; |
public class JavascriptArray { /** * pop ( ) Removes the last element of an array , and returns that element */
public Object pop ( ) { } } | // Object obj = jsObject . getSlot ( jsLen - 1 ) ;
Object obj = invokeJavascript ( "pop" ) ; if ( obj instanceof JSObject && content . containsKey ( ( JSObject ) obj ) ) { return ( JavascriptObject ) content . get ( ( JSObject ) obj ) ; } return obj ; |
public class ChangelogHandler { /** * Adds the specified Changelog file to the rpm
* @ param changelogFile the Changelog file to be added
* @ throws IOException if the specified file cannot be read
* @ throws ChangelogParseException if the file violates the requirements of a Changelog */
public void addChangeLog ( File changelogFile ) throws IOException , ChangelogParseException { } } | // parse the change log to a list of entries
InputStream changelog = new FileInputStream ( changelogFile ) ; ChangelogParser parser = new ChangelogParser ( ) ; List < ChangelogEntry > entries = parser . parse ( changelog ) ; for ( ChangelogEntry entry : entries ) { addChangeLogEntry ( entry ) ; } |
public class CmsSecure { /** * Returns true if the export user has read permission on a specified resource . < p >
* @ return true , if the export user has the permission to read the resource */
public boolean exportUserHasReadPermission ( ) { } } | String vfsName = getParamResource ( ) ; CmsObject cms = getCms ( ) ; try { // static export must always be checked with the export users permissions ,
// not the current users permissions
CmsObject exportCms = OpenCms . initCmsObject ( OpenCms . getDefaultUsers ( ) . getUserExport ( ) ) ; exportCms . getRequestContext ( ) . setSiteRoot ( getCms ( ) . getRequestContext ( ) . getSiteRoot ( ) ) ; // let ' s look up if the export user has the permission to read
return exportCms . hasPermissions ( cms . readResource ( vfsName , CmsResourceFilter . IGNORE_EXPIRATION ) , CmsPermissionSet . ACCESS_READ ) ; } catch ( CmsException e ) { // ignore this exception
} return false ; |
public class CreateChannelRequest { /** * List of input attachments for channel .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setInputAttachments ( java . util . Collection ) } or { @ link # withInputAttachments ( java . util . Collection ) } if you
* want to override the existing values .
* @ param inputAttachments
* List of input attachments for channel .
* @ return Returns a reference to this object so that method calls can be chained together . */
public CreateChannelRequest withInputAttachments ( InputAttachment ... inputAttachments ) { } } | if ( this . inputAttachments == null ) { setInputAttachments ( new java . util . ArrayList < InputAttachment > ( inputAttachments . length ) ) ; } for ( InputAttachment ele : inputAttachments ) { this . inputAttachments . add ( ele ) ; } return this ; |
public class AbstractSimpleThreadGroup { /** * JMeter 2.7 compatibility */
public void scheduleThread ( JMeterThread thread ) { } } | if ( System . currentTimeMillis ( ) - tgStartTime > TOLERANCE ) { tgStartTime = System . currentTimeMillis ( ) ; } scheduleThread ( thread , tgStartTime ) ; |
public class DefaultRecoveryPlugin { /** * { @ inheritDoc } */
@ Override public boolean isValid ( Object c ) throws ResourceException { } } | if ( c != null ) { try { Method method = SecurityActions . getMethod ( c . getClass ( ) , "isValid" , new Class [ ] { int . class } ) ; SecurityActions . setAccessible ( method , true ) ; Boolean b = ( Boolean ) method . invoke ( c , new Object [ ] { Integer . valueOf ( 5 ) } ) ; return b . booleanValue ( ) ; } catch ( Throwable t ) { log . debugf ( "No isValid(int) method defined on connection interface (%s)" , c . getClass ( ) . getName ( ) ) ; } } return false ; |
public class NettyUtils { /** * Creates a Netty { @ link EventLoopGroup } based on { @ link ChannelType } .
* @ param type Selector for which form of low - level IO we should use
* @ param numThreads target number of threads
* @ param threadPrefix name pattern for each thread . should contain ' % d ' to distinguish between
* threads .
* @ param isDaemon if true , the { @ link java . util . concurrent . ThreadFactory } will create daemon
* threads .
* @ return EventLoopGroup matching the ChannelType */
public static EventLoopGroup createEventLoop ( ChannelType type , int numThreads , String threadPrefix , boolean isDaemon ) { } } | ThreadFactory threadFactory = ThreadFactoryUtils . build ( threadPrefix , isDaemon ) ; switch ( type ) { case NIO : return new NioEventLoopGroup ( numThreads , threadFactory ) ; case EPOLL : return new EpollEventLoopGroup ( numThreads , threadFactory ) ; default : throw new IllegalArgumentException ( "Unknown io type: " + type ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.